diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 784eca9c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: c - -os: - - linux - - osx - -dist: xenial - -compiler: - - gcc - - clang - -env: - matrix: - - BUILD_SYSTEM="autotools" CONFIGURE_OPTS= - - BUILD_SYSTEM="autotools" CONFIGURE_OPTS=--enable-64-bit-words - - BUILD_SYSTEM="cmake" CONFIGURE_OPTS= - - BUILD_SYSTEM="cmake" CONFIGURE_OPTS=-DENABLE_64_BIT_WORDS=ON -install: - - if [ $TRAVIS_OS_NAME = linux ]; then sudo apt-get -y install libtool-bin libogg-dev doxygen libxml2-utils w3c-sgml-lib; fi - - if [ $TRAVIS_OS_NAME = osx ]; then brew update ; brew install libogg; fi - -script: - - if [[ "${BUILD_SYSTEM}" == "autotools" ]]; then ./autogen.sh && ./configure $CONFIGURE_OPTS && make && make check; fi - - if [[ "${BUILD_SYSTEM}" == "cmake" ]]; then mkdir cmake-build && cd cmake-build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON $CONFIGURE_OPTS && cmake --build . && ctest -V; fi - - if [ $TRAVIS_OS_NAME = linux ] && [ ${BUILD_SYSTEM} = "autotools" ]; then - xmllint --valid --noout doc/html/*.html; - xmllint --valid --noout doc/html/api/*.html; - fi diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index c83dd83e..00000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,153 +0,0 @@ -# 3.1 is OK for most parts. However: -# 3.3 is needed in src/libFLAC -# 3.5 is needed in src/libFLAC/ia32 -# 3.9 is needed in 'doc' because of doxygen_add_docs() -cmake_minimum_required(VERSION 3.5) - -if(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES OR DEFINED ENV{CFLAGS} OR DEFINED ENV{CXXFLAGS})) - set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo") -endif() - -project(FLAC VERSION 1.3.3) # HOMEPAGE_URL "https://www.xiph.org/flac/") - -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - -option(BUILD_CXXLIBS "Build libFLAC++" ON) -option(BUILD_PROGRAMS "Build and install programs" ON) -option(BUILD_EXAMPLES "Build and install examples" ON) -option(BUILD_DOCS "Build and install doxygen documents" ON) -option(WITH_STACK_PROTECTOR "Enable GNU GCC stack smash protection" ON) -option(INSTALL_MANPAGES "Install MAN pages" ON) -option(INSTALL_PKGCONFIG_MODULES "Install PkgConfig modules" ON) -option(INSTALL_CMAKE_CONFIG_MODULE "Install CMake package-config module" ON) -option(WITH_OGG "ogg support (default: test for libogg)" ON) - -if(WITH_OGG) - find_package(Ogg REQUIRED) -endif() - -find_package(Iconv) -set(HAVE_ICONV ${Iconv_FOUND}) - -if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -funroll-loops") -endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef") -endif() - -include(CMakePackageConfigHelpers) -include(CPack) -include(CTest) -include(CheckCCompilerFlag) -include(CheckCXXCompilerFlag) -include(CheckSymbolExists) -include(CheckFunctionExists) -include(CheckIncludeFile) -include(CheckCSourceCompiles) -include(CheckCXXSourceCompiles) -include(GNUInstallDirs) -include(UseSystemExtensions) -include(TestBigEndian) - -check_include_file("byteswap.h" HAVE_BYTESWAP_H) -check_include_file("inttypes.h" HAVE_INTTYPES_H) -check_include_file("stdint.h" HAVE_STDINT_H) -if(MSVC) - check_include_file("intrin.h" FLAC__HAS_X86INTRIN) -else() - check_include_file("x86intrin.h" FLAC__HAS_X86INTRIN) -endif() - -check_function_exists(fseeko HAVE_FSEEKO) - -check_c_source_compiles("int main() { return __builtin_bswap16 (0) ; }" HAVE_BSWAP16) -check_c_source_compiles("int main() { return __builtin_bswap32 (0) ; }" HAVE_BSWAP32) - -test_big_endian(CPU_IS_BIG_ENDIAN) - -check_c_compiler_flag(-Werror HAVE_WERROR_FLAG) -check_c_compiler_flag(-Wdeclaration-after-statement HAVE_DECL_AFTER_STMT_FLAG) -check_c_compiler_flag(-mstackrealign HAVE_STACKREALIGN_FLAG) -check_cxx_compiler_flag(-Weffc++ HAVE_WEFFCXX_FLAG) - -if(WITH_STACK_PROTECTOR) - if(NOT MSVC) - check_c_compiler_flag("-fstack-protector-strong" HAVE_STACK_PROTECTOR_FLAG) - endif() -endif() - -if(HAVE_WERROR_FLAG) - option(ENABLE_WERROR "Enable -Werror in all Makefiles" OFF) -endif() - -add_compile_options( - $<$:/wd4267> - $<$:/wd4996> - $<$:-Werror> - $<$,$>:-Weffc++> - $<$,$>:-Wdeclaration-after-statement>) - -if(HAVE_STACK_PROTECTOR_FLAG) - add_compile_options(-fstack-protector-strong) -endif() - -if(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND HAVE_STACKREALIGN_FLAG) - add_compile_options(-mstackrealign) -endif() - -include_directories("include") - -include_directories("${CMAKE_CURRENT_BINARY_DIR}") -add_definitions(-DHAVE_CONFIG_H) - -if(MSVC) - add_definitions( - -D_CRT_SECURE_NO_WARNINGS - -D_USE_MATH_DEFINES) -endif() -if(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) - add_definitions(-DFLAC__OVERFLOW_DETECT) -endif() - -add_subdirectory("src") -add_subdirectory("microbench") -if(BUILD_DOCS) - add_subdirectory("doc") -endif() -if(BUILD_EXAMPLES) - add_subdirectory("examples") -endif() -if(BUILD_TESTING) - add_subdirectory("test") -endif() - -configure_file(config.cmake.h.in config.h) - -if(INSTALL_CMAKE_CONFIG_MODULE) - install( - EXPORT targets - DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake" - NAMESPACE FLAC::) - - configure_package_config_file( - flac-config.cmake.in flac-config.cmake - INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake") - write_basic_package_version_file( - flac-config-version.cmake COMPATIBILITY AnyNewerVersion) - - install( - FILES - "${CMAKE_CURRENT_BINARY_DIR}/flac-config.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/flac-config-version.cmake" - DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake") -endif() - -file(GLOB FLAC_HEADERS "include/FLAC/*.h") -file(GLOB FLAC++_HEADERS "include/FLAC++/*.h") -install(FILES ${FLAC_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC") -install(FILES ${FLAC++_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/FLAC++") -if(INSTALL_MANPAGES) - install(FILES "man/flac.1" "man/metaflac.1" DESTINATION "${CMAKE_INSTALL_MANDIR}") -endif() diff --git a/COPYING.FDL b/COPYING.FDL deleted file mode 100644 index 4a0fe1c8..00000000 --- a/COPYING.FDL +++ /dev/null @@ -1,397 +0,0 @@ - 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. diff --git a/COPYING.GPL b/COPYING.GPL deleted file mode 100644 index d159169d..00000000 --- a/COPYING.GPL +++ /dev/null @@ -1,339 +0,0 @@ - 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. diff --git a/COPYING.LGPL b/COPYING.LGPL deleted file mode 100644 index 5ab7695a..00000000 --- a/COPYING.LGPL +++ /dev/null @@ -1,504 +0,0 @@ - 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! - - diff --git a/FLAC-vs2005.sln b/FLAC-vs2005.sln deleted file mode 100644 index c35b07c4..00000000 --- a/FLAC-vs2005.sln +++ /dev/null @@ -1,249 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual C++ Express 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_c_decode_file", "examples\c\decode\file\example_c_decode_file.vcproj", "{4CEFBD00-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_c_encode_file", "examples\c\encode\file\example_c_encode_file.vcproj", "{4CEFBD01-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_cpp_decode_file", "examples\cpp\decode\file\example_cpp_decode_file.vcproj", "{4CEFBE00-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBC86-C215-11DB-8314-0800200C9A66} = {4CEFBC86-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_cpp_encode_file", "examples\cpp\encode\file\example_cpp_encode_file.vcproj", "{4CEFBE01-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBC86-C215-11DB-8314-0800200C9A66} = {4CEFBC86-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flac", "src\flac\flac.vcproj", "{4CEFBC7D-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC81-C215-11DB-8314-0800200C9A66} = {4CEFBC81-C215-11DB-8314-0800200C9A66} - {4CEFBC89-C215-11DB-8314-0800200C9A66} = {4CEFBC89-C215-11DB-8314-0800200C9A66} - {4CEFBC92-C215-11DB-8314-0800200C9A66} = {4CEFBC92-C215-11DB-8314-0800200C9A66} - {4CEFBC80-C215-11DB-8314-0800200C9A66} = {4CEFBC80-C215-11DB-8314-0800200C9A66} - {4CEFBC8A-C215-11DB-8314-0800200C9A66} = {4CEFBC8A-C215-11DB-8314-0800200C9A66} - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBE02-C215-11DB-8314-0800200C9A66} = {4CEFBE02-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iffscan", "src\flac\iffscan.vcproj", "{4CEFBC94-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBE02-C215-11DB-8314-0800200C9A66} = {4CEFBE02-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flacdiff", "src\utils\flacdiff\flacdiff.vcproj", "{4CEFBC93-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBC86-C215-11DB-8314-0800200C9A66} = {4CEFBC86-C215-11DB-8314-0800200C9A66} - {4CEFBE02-C215-11DB-8314-0800200C9A66} = {4CEFBE02-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flactimer", "src\utils\flactimer\flactimer.vcproj", "{4CEFBC95-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "getopt_static", "src\share\getopt\getopt_static.vcproj", "{4CEFBC80-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grabbag_static", "src\share\grabbag\grabbag_static.vcproj", "{4CEFBC81-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBC89-C215-11DB-8314-0800200C9A66} = {4CEFBC89-C215-11DB-8314-0800200C9A66} - {4CEFBE02-C215-11DB-8314-0800200C9A66} = {4CEFBE02-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC_dynamic", "src\libFLAC\libFLAC_dynamic.vcproj", "{4CEFBC83-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC_static", "src\libFLAC\libFLAC_static.vcproj", "{4CEFBC84-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC++_dynamic", "src\libFLAC++\libFLAC++_dynamic.vcproj", "{4CEFBC85-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC83-C215-11DB-8314-0800200C9A66} = {4CEFBC83-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC++_static", "src\libFLAC++\libFLAC++_static.vcproj", "{4CEFBC86-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "metaflac", "src\metaflac\metaflac.vcproj", "{4CEFBC87-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBC80-C215-11DB-8314-0800200C9A66} = {4CEFBC80-C215-11DB-8314-0800200C9A66} - {4CEFBC92-C215-11DB-8314-0800200C9A66} = {4CEFBC92-C215-11DB-8314-0800200C9A66} - {4CEFBC89-C215-11DB-8314-0800200C9A66} = {4CEFBC89-C215-11DB-8314-0800200C9A66} - {4CEFBC81-C215-11DB-8314-0800200C9A66} = {4CEFBC81-C215-11DB-8314-0800200C9A66} - {4CEFBE02-C215-11DB-8314-0800200C9A66} = {4CEFBE02-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "replaygain_analysis_static", "src\share\replaygain_analysis\replaygain_analysis_static.vcproj", "{4CEFBC89-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "replaygain_synthesis_static", "src\share\replaygain_synthesis\replaygain_synthesis_static.vcproj", "{4CEFBC8A-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_cuesheet", "src\test_grabbag\cuesheet\test_cuesheet.vcproj", "{4CEFBC8B-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBC81-C215-11DB-8314-0800200C9A66} = {4CEFBC81-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_libFLAC", "src\test_libFLAC\test_libFLAC.vcproj", "{4CEFBC8C-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC8E-C215-11DB-8314-0800200C9A66} = {4CEFBC8E-C215-11DB-8314-0800200C9A66} - {4CEFBC81-C215-11DB-8314-0800200C9A66} = {4CEFBC81-C215-11DB-8314-0800200C9A66} - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_libFLAC++", "src\test_libFLAC++\test_libFLAC++.vcproj", "{4CEFBC8D-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBC86-C215-11DB-8314-0800200C9A66} = {4CEFBC86-C215-11DB-8314-0800200C9A66} - {4CEFBC81-C215-11DB-8314-0800200C9A66} = {4CEFBC81-C215-11DB-8314-0800200C9A66} - {4CEFBC8E-C215-11DB-8314-0800200C9A66} = {4CEFBC8E-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_libs_common_static", "src\test_libs_common\test_libs_common_static.vcproj", "{4CEFBC8E-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_picture", "src\test_grabbag\picture\test_picture.vcproj", "{4CEFBC8F-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - {4CEFBC81-C215-11DB-8314-0800200C9A66} = {4CEFBC81-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_seeking", "src\test_seeking\test_seeking.vcproj", "{4CEFBC90-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC84-C215-11DB-8314-0800200C9A66} = {4CEFBC84-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_streams", "src\test_streams\test_streams.vcproj", "{4CEFBC91-C215-11DB-8314-0800200C9A66}" - ProjectSection(ProjectDependencies) = postProject - {4CEFBC81-C215-11DB-8314-0800200C9A66} = {4CEFBC81-C215-11DB-8314-0800200C9A66} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "utf8_static", "src\share\utf8\utf8_static.vcproj", "{4CEFBC92-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win_utf8_io_static", "src\share\win_utf8_io\win_utf8_io_static.vcproj", "{4CEFBE02-C215-11DB-8314-0800200C9A66}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/FLAC.sln b/FLAC.sln deleted file mode 100644 index 1c175f80..00000000 --- a/FLAC.sln +++ /dev/null @@ -1,278 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2013 for Windows Desktop -VisualStudioVersion = 12.0.30501.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_c_decode_file", "examples\c\decode\file\example_c_decode_file.vcxproj", "{4CEFBD00-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_c_encode_file", "examples\c\encode\file\example_c_encode_file.vcxproj", "{4CEFBD01-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_cpp_decode_file", "examples\cpp\decode\file\example_cpp_decode_file.vcxproj", "{4CEFBE00-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example_cpp_encode_file", "examples\cpp\encode\file\example_cpp_encode_file.vcxproj", "{4CEFBE01-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flac", "src\flac\flac.vcxproj", "{4CEFBC7D-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iffscan", "src\flac\iffscan.vcxproj", "{4CEFBC94-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flacdiff", "src\utils\flacdiff\flacdiff.vcxproj", "{4CEFBC93-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flactimer", "src\utils\flactimer\flactimer.vcxproj", "{4CEFBC95-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "getopt_static", "src\share\getopt\getopt_static.vcxproj", "{4CEFBC80-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grabbag_static", "src\share\grabbag\grabbag_static.vcxproj", "{4CEFBC81-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC_dynamic", "src\libFLAC\libFLAC_dynamic.vcxproj", "{4CEFBC83-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC_static", "src\libFLAC\libFLAC_static.vcxproj", "{4CEFBC84-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC++_dynamic", "src\libFLAC++\libFLAC++_dynamic.vcxproj", "{4CEFBC85-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libFLAC++_static", "src\libFLAC++\libFLAC++_static.vcxproj", "{4CEFBC86-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "metaflac", "src\metaflac\metaflac.vcxproj", "{4CEFBC87-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "replaygain_analysis_static", "src\share\replaygain_analysis\replaygain_analysis_static.vcxproj", "{4CEFBC89-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "replaygain_synthesis_static", "src\share\replaygain_synthesis\replaygain_synthesis_static.vcxproj", "{4CEFBC8A-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_cuesheet", "src\test_grabbag\cuesheet\test_cuesheet.vcxproj", "{4CEFBC8B-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_libFLAC", "src\test_libFLAC\test_libFLAC.vcxproj", "{4CEFBC8C-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_libFLAC++", "src\test_libFLAC++\test_libFLAC++.vcxproj", "{4CEFBC8D-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_libs_common_static", "src\test_libs_common\test_libs_common_static.vcxproj", "{4CEFBC8E-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_picture", "src\test_grabbag\picture\test_picture.vcxproj", "{4CEFBC8F-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_seeking", "src\test_seeking\test_seeking.vcxproj", "{4CEFBC90-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_streams", "src\test_streams\test_streams.vcxproj", "{4CEFBC91-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "utf8_static", "src\share\utf8\utf8_static.vcxproj", "{4CEFBC92-C215-11DB-8314-0800200C9A66}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win_utf8_io_static", "src\share\win_utf8_io\win_utf8_io_static.vcxproj", "{4CEFBE02-C215-11DB-8314-0800200C9A66}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBD00-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBD01-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBE00-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBE01-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC7D-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC94-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC93-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC95-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC80-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC81-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC83-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC84-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC85-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC86-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC87-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC89-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC8A-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC8B-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC8C-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC8D-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC8E-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC8F-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC90-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC91-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBC92-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Debug|Win32.Build.0 = Debug|Win32 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Debug|x64.ActiveCfg = Debug|x64 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Debug|x64.Build.0 = Debug|x64 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Release|Win32.ActiveCfg = Release|Win32 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Release|Win32.Build.0 = Release|Win32 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Release|x64.ActiveCfg = Release|x64 - {4CEFBE02-C215-11DB-8314-0800200C9A66}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 7729c36f..00000000 --- a/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -# -# automake provides the following useful targets: -# -# all: build all programs and libraries using the current -# configuration (set by configure) -# -# check: build and run all self-tests -# -# clean: remove everything except what's required to build everything -# -# distclean: remove everything except what goes in the distribution -# - -ACLOCAL_AMFLAGS = -I m4 - -SUBDIRS = doc include m4 man src test build microbench oss-fuzz - -if EXAMPLES -SUBDIRS += examples -endif - -EXTRA_DIST = \ - CMakeLists.txt \ - config.cmake.h.in \ - flac-config.cmake.in \ - cmake/FindOgg.cmake \ - cmake/UseSystemExtensions.cmake \ - cmake/CheckCPUArch.cmake \ - cmake/CheckCPUArch.c.in \ - COPYING.FDL \ - COPYING.GPL \ - COPYING.LGPL \ - COPYING.Xiph \ - FLAC.sln \ - FLAC-vs2005.sln \ - Makefile.lite \ - Makefile.deps \ - autogen.sh \ - config.rpath \ - depcomp \ - ltmain.sh \ - strip_non_asm_libtool_args.sh - -CLEANFILES = *~ diff --git a/Makefile.deps b/Makefile.deps deleted file mode 100644 index a7a5ed7e..00000000 --- a/Makefile.deps +++ /dev/null @@ -1,39 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -ifeq ($(findstring Windows,$(OS)),Windows) # "Windows" is provided by GNU Make's internal $(OS) - WIN_DEPS = share/win_utf8_io -else - WIN_DEPS = -endif - -flac: libFLAC share $(WIN_DEPS) -libFLAC++: libFLAC -metaflac: libFLAC share $(WIN_DEPS) -plugin_common: libFLAC -plugin_xmms: libFLAC plugin_common -share: libFLAC -test_grabbag: share -test_libs_common: libFLAC -test_libFLAC++: libFLAC libFLAC++ test_libs_common -test_libFLAC: libFLAC test_libs_common -test_seeking: libFLAC -test_streams: share -flacdiff: libFLAC libFLAC++ $(WIN_DEPS) -flactimer: -utils: flacdiff flactimer diff --git a/Makefile.lite b/Makefile.lite deleted file mode 100644 index 2b394af8..00000000 --- a/Makefile.lite +++ /dev/null @@ -1,77 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU Makefile -# -# Useful targets -# -# all : build all libraries and programs in the default configuration (currently 'release') -# debug : build all libraries and programs in debug mode -# valgrind: build all libraries and programs in debug mode, dynamically linked and ready for valgrind -# release : build all libraries and programs in release mode -# test : run the unit and stream tests -# clean : remove all non-distro files -# - -topdir = . - -.PHONY: all doc src examples libFLAC libFLAC++ share plugin_common flac metaflac test_grabbag test_libFLAC test_libFLAC++ test_seeking test_streams flacdiff flactimer -all: src examples - -DEFAULT_CONFIG = release - -CONFIG = $(DEFAULT_CONFIG) - -debug : CONFIG = debug -valgrind: CONFIG = valgrind -release : CONFIG = release - -debug : all -valgrind: all -release : all - -doc: - (cd $@ && $(MAKE) -f Makefile.lite) - -src examples: - (cd $@ && $(MAKE) -f Makefile.lite $(CONFIG)) - -libFLAC libFLAC++ share flac metaflac plugin_common plugin_xmms test_libs_common test_seeking test_streams test_grabbag test_libFLAC test_libFLAC++: - (cd src/$@ && $(MAKE) -f Makefile.lite $(CONFIG)) - -flacdiff flactimer: - (cd src/utils/$@ && $(MAKE) -f Makefile.lite $(CONFIG)) - -test: debug - (cd test && $(MAKE) -f Makefile.lite debug) - -testv: valgrind - (cd test && $(MAKE) -f Makefile.lite valgrind) - -testr: release - (cd test && $(MAKE) -f Makefile.lite release) - -clean: - -(cd doc && $(MAKE) -f Makefile.lite clean) - -(cd src && $(MAKE) -f Makefile.lite clean) - -(cd examples && $(MAKE) -f Makefile.lite clean) - -(cd test && $(MAKE) -f Makefile.lite clean) - -examples: libFLAC libFLAC++ share -include $(topdir)/Makefile.deps diff --git a/Scripts/cross-build-win-binaries.mk b/Scripts/cross-build-win-binaries.mk deleted file mode 100755 index 9659655e..00000000 --- a/Scripts/cross-build-win-binaries.mk +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/make -f - -# Copyright (C) 2014-2016 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. - -ogg_version = 1.3.2 -ogg_sha256sum = e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 - -flac_version = $(shell grep ^AC_INIT configure.ac | sed 's/[^ ]* \[//;s/\].*//') - -win_build = $(shell pwd)/win-build - -win32_name = i686-w64-mingw32 -win64_name = x86_64-w64-mingw32 - -win32_target = --host=$(win32_name) --target=$(win32_name) -win64_target = --host=$(win64_name) --target=$(win64_name) - -flac-$(flac_version)-win.zip : flac-$(flac_version)-win//AUTHORS - zip -r $@ flac-$(flac_version)-win - rm -rf flac-$(flac_version)-win - - - -flac-$(flac_version)-win//AUTHORS : win-build/.stamp-flac-win32-install win-build/.stamp-flac-win64-install - mkdir -p flac-$(flac_version)-win/win32 flac-$(flac_version)-win/win64 - cp $(win_build)/flac32/bin/flac.exe flac-$(flac_version)-win/win32/ - cp $(win_build)/flac32/bin/metaflac.exe flac-$(flac_version)-win/win32/ - $(win32_name)-strip flac-$(flac_version)-win/win32/*.exe - cp $(win_build)/flac64/bin/flac.exe flac-$(flac_version)-win/win64/ - cp $(win_build)/flac64/bin/metaflac.exe flac-$(flac_version)-win/win64/ - $(win64_name)-strip flac-$(flac_version)-win/win64/*.exe - cp -r doc/html flac-$(flac_version)-win/ - rm -rf flac-$(flac_version)-win/html/api - find flac-$(flac_version)-win/ -name Makefile\* -exec rm -f {} \; - cp AUTHORS COPYING.* README flac-$(flac_version)-win/ - touch $@ - -#------------------------------------------------------------------------------- -# Build and install 32 and 64 bit versions of a statically linked flac and -# metaflac executable. - -win-build/.stamp-flac-win64-install : win-build/.stamp-flac-win64-config - make clean all install - touch $@ - -win-build/.stamp-flac-win64-config : win-build/.stamp-flac-prepare configure - mkdir -p $(win_build)/ogg64 - ./configure --disable-shared $(win64_target) --with-ogg=$(win_build)/ogg64 --prefix=$(win_build)/flac64 - touch $@ - -win-build/.stamp-flac-win32-install : win-build/.stamp-flac-win32-config - make clean all install - touch $@ - -win-build/.stamp-flac-win32-config : win-build/.stamp-flac-prepare configure - mkdir -p $(win_build)/ogg32 - ./configure --disable-shared $(win32_target) --with-ogg=$(win_build)/ogg32 --prefix=$(win_build)/flac32 - touch $@ - -win-build/.stamp-flac-prepare : win-build/.stamp-win32-install win-build/.stamp-win64-install - touch $@ - -#------------------------------------------------------------------------------- -# Build libogg for win32 and win64. - -win-build/.stamp-win64-install : win-build/.stamp-win64-configure - (cd win-build/libogg-$(ogg_version) && make clean all check install) - touch $@ - -win-build/.stamp-win64-configure : win-build/.stamp-source - mkdir -p $(win_build)/win64 - (cd win-build/libogg-$(ogg_version) && ./configure --prefix=$(win_build)/ogg64 $(win32_target) --disable-shared) - touch $@ - -win-build/.stamp-win32-install : win-build/.stamp-win32-configure - (cd win-build/libogg-$(ogg_version) && make clean all check install) - touch $@ - -win-build/.stamp-win32-configure : win-build/.stamp-source - mkdir -p $(win_build)/win32 - (cd win-build/libogg-$(ogg_version) && ./configure --prefix=$(win_build)/ogg32 $(win32_target) --disable-shared) - touch $@ - -win-build/.stamp-source : win-build/.stamp-sha256sum-checked - (cd win-build && tar xf libogg-$(ogg_version).tar.gz) - touch $@ - -#------------------------------------------------------------------------------- -# Retrieve and check libogg tarball. - -win-build/.stamp-sha256sum-checked : win-build/libogg-$(ogg_version).tar.gz - @if test $$(sha256sum $+ | sed 's/ .*//') != $(ogg_sha256sum) ; then exit 1 ; fi - @echo "sha256 sum : ok" - touch $@ - -win-build/libogg-$(ogg_version).tar.gz : - mkdir -p win-build - wget http://downloads.xiph.org/releases/ogg/$$(basename $@) -O $@ - -#------------------------------------------------------------------------------- -# Autotool stuff. - -configure : configure.ac autogen.sh - ./autogen.sh - -clean : - rm -rf $(win_build) flac-$(flac_version)-win diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 491d3557..00000000 --- a/autogen.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# Run this to set up the build system: configure, makefiles, etc. -# We trust that the user has a recent enough autoconf & automake setup -# (not older than a few years...) - -use_symlinks=" --symlink" - -case $1 in - --no-symlink*) - use_symlinks="" - echo "Copying autotool files instead of using symlinks." - ;; - *) - echo "Using symlinks to autotool files (use --no-symlinks to copy instead)." - ;; - esac - -test_program_errors=0 - -test_program () { - if ! command -v $1 >/dev/null 2>&1 ; then - echo "Missing program '$1'." - test_program_errors=1 - fi -} - -for prog in autoconf automake libtool pkg-config ; do - test_program $prog - done - -if test $(uname -s) != "Darwin" ; then - test_program gettext - fi - -test $test_program_errors -ne 1 || exit 1 - -#------------------------------------------------------------------------------- - -set -e - -if test $(uname -s) = "OpenBSD" ; then - # OpenBSD needs these environment variables set. - if test -z "$AUTOCONF_VERSION" ; then - AUTOCONF_VERSION=2.69 - export AUTOCONF_VERSION - echo "Defaulting to use AUTOCONF_VERSION version ${AUTOCONF_VERSION}." - else - echo "Using AUTOCONF_VERSION version ${AUTOCONF_VERSION}." - fi - if test -z "$AUTOMAKE_VERSION" ; then - AUTOMAKE_VERSION=1.15 - export AUTOMAKE_VERSION - echo "Defaulting to use AUTOMAKE_VERSION version ${AUTOMAKE_VERSION}." - else - echo "Using AUTOMAKE_VERSION version ${AUTOMAKE_VERSION}." - fi - fi - -srcdir=`dirname $0` -test -n "$srcdir" && cd "$srcdir" - -echo "Updating build configuration files for FLAC, please wait...." - -touch config.rpath -autoreconf --install $use_symlinks --force -#./configure "$@" && echo diff --git a/build/Makefile.am b/build/Makefile.am deleted file mode 100644 index 4d21ba9e..00000000 --- a/build/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -EXTRA_DIST = \ - compile.mk \ - config.mk \ - exe.mk \ - lib.mk diff --git a/build/compile.mk b/build/compile.mk deleted file mode 100644 index 121080a2..00000000 --- a/build/compile.mk +++ /dev/null @@ -1,49 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile fragment for building a library -# - -%.debug.o %.release.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ -%.debug.o %.release.o : %.cc - $(CCC) $(CXXFLAGS) -c $< -o $@ -%.debug.o %.release.o : %.cpp - $(CCC) $(CXXFLAGS) -c $< -o $@ -%.debug.pic.o %.release.pic.o : %.c - $(CC) $(CFLAGS) $(F_PIC) -DPIC -c $< -o $@ -%.debug.pic.o %.release.pic.o : %.cc - $(CCC) $(CXXFLAGS) $(F_PIC) -DPIC -c $< -o $@ -%.debug.pic.o %.release.pic.o : %.cpp - $(CCC) $(CXXFLAGS) $(F_PIC) -DPIC -c $< -o $@ -%.debug.i %.release.i : %.c - $(CC) $(CFLAGS) -E $< -o $@ -%.debug.i %.release.i : %.cc - $(CCC) $(CXXFLAGS) -E $< -o $@ -%.debug.i %.release.i : %.cpp - $(CCC) $(CXXFLAGS) -E $< -o $@ - -%.debug.o : %.nasm - $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ -g $< -o $@ -%.release.o : %.nasm - $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@ -%.debug.pic.o : %.nasm - $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ -g $< -o $@ -%.release.pic.o : %.nasm - $(NASM) -f elf -d OBJ_FORMAT_elf -i ia32/ $< -o $@ diff --git a/build/config.mk b/build/config.mk deleted file mode 100644 index 09abbbdd..00000000 --- a/build/config.mk +++ /dev/null @@ -1,159 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# customizable settings from the make invocation -# - -USE_OGG ?= 1 -USE_ICONV ?= 1 -USE_LROUND ?= 1 -USE_FSEEKO ?= 1 -USE_LANGINFO_CODESET ?= 1 - -# -# debug/release selection -# - -DEFAULT_BUILD = release - -F_PIC := -fPIC - -# returns Linux, Darwin, FreeBSD, etc. -ifndef OS - OS := $(shell uname -s) -endif -# returns i386, x86_64, powerpc, etc. -ifndef PROC - ifeq ($(findstring Windows,$(OS)),Windows) - PROC := i386 # failsafe - # ifeq ($(findstring i686,$(shell gcc -dumpmachine)),i686) # MinGW-w64: i686-w64-mingw32 - ifeq ($(findstring x86_64,$(shell gcc -dumpmachine)),x86_64) # MinGW-w64: x86_64-w64-mingw32 - PROC := x86_64 - endif - else - ifeq ($(shell uname -p),amd64) - PROC := x86_64 - else - PROC := $(shell uname -p) - endif - endif -endif -ifeq ($(PROC),powerpc) - PROC := ppc -endif -# x64_64 Mac OS outputs 'i386' in uname -p; use uname -m instead -ifeq ($(PROC),i386) - ifeq ($(OS),Darwin) - PROC := $(shell uname -m) - endif -endif - -ifeq ($(OS),Linux) - PROC := $(shell uname -m) - USE_ICONV := 0 -endif - -ifeq ($(findstring Windows,$(OS)),Windows) - F_PIC := - USE_ICONV := 0 - USE_LANGINFO_CODESET := 0 - ifeq (mingw32,$(shell gcc -dumpmachine)) # MinGW (mainline): mingw32 - USE_FSEEKO := 0 - endif -endif - -debug : BUILD = debug -valgrind : BUILD = debug -release : BUILD = release - -# override LINKAGE on OS X until we figure out how to get 'cc -static' to work -ifeq ($(OS),Darwin) -LINKAGE = -arch $(PROC) -else -debug : LINKAGE = -static -valgrind : LINKAGE = -dynamic -release : LINKAGE = -static -endif - -all default: $(DEFAULT_BUILD) - -# -# GNU makefile fragment for emulating stuff normally done by configure -# - -VERSION=\"1.3.3\" - -CONFIG_CFLAGS=$(CUSTOM_CFLAGS) -DHAVE_STDINT_H -DHAVE_INTTYPES_H -DHAVE_CXX_VARARRAYS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 - -ifeq ($(OS),Darwin) - CONFIG_CFLAGS += -DFLAC__SYS_DARWIN -DHAVE_SYS_PARAM_H -arch $(PROC) -else - CONFIG_CFLAGS += -DHAVE_SOCKLEN_T -endif - -ifeq ($(PROC),ppc) - CONFIG_CFLAGS += -DWORDS_BIGENDIAN=1 -DCPU_IS_LITTLE_ENDIAN=0 -else - CONFIG_CFLAGS += -DWORDS_BIGENDIAN=0 -DCPU_IS_LITTLE_ENDIAN=1 -endif - -ifeq ($(OS),Linux) - ifeq ($(PROC),x86_64) - CONFIG_CFLAGS += -fPIC - endif -endif -ifeq ($(OS),FreeBSD) - CONFIG_CFLAGS += -DHAVE_SYS_PARAM_H -endif - -ifneq (0,$(USE_ICONV)) - CONFIG_CFLAGS += -DHAVE_ICONV - ICONV_LIBS = -liconv -else - ICONV_LIBS = -endif - -ifneq (0,$(USE_OGG)) - CONFIG_CFLAGS += -DFLAC__HAS_OGG=1 - OGG_INCLUDES = -I$(OGG_INCLUDE_DIR) - OGG_EXPLICIT_LIBS = $(OGG_LIB_DIR)/libogg.a - OGG_LIBS = -L$(OGG_LIB_DIR) -logg - OGG_SRCS = $(OGG_SRCS_C) -else - CONFIG_CFLAGS += -DFLAC__HAS_OGG=0 - OGG_INCLUDES = - OGG_EXPLICIT_LIBS = - OGG_LIBS = - OGG_SRCS = -endif - -OGG_INCLUDE_DIR=$(HOME)/local/include -OGG_LIB_DIR=$(HOME)/local/lib - -ifneq (0,$(USE_LROUND)) - CONFIG_CFLAGS += -DHAVE_LROUND -endif - -ifneq (0,$(USE_FSEEKO)) - CONFIG_CFLAGS += -DHAVE_FSEEKO -endif - -ifneq (0,$(USE_LANGINFO_CODESET)) - CONFIG_CFLAGS += -DHAVE_LANGINFO_CODESET -endif diff --git a/build/exe.mk b/build/exe.mk deleted file mode 100644 index 1ff6d2d1..00000000 --- a/build/exe.mk +++ /dev/null @@ -1,107 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile fragment for building an executable -# - -include $(topdir)/build/config.mk - -ifeq ($(OS),Darwin) - CC = cc - CCC = c++ -else -ifeq ($(OS),FreeBSD) - CC = cc - CCC = c++ -else - CC = gcc - CCC = g++ -endif -endif -ifeq ($(CC),gcc) - GCC_INLINE = -finline-functions -endif -NASM = nasm -LINK = $(CC) $(LINKAGE) -OBJPATH = $(topdir)/objs -BINPATH = $(OBJPATH)/$(BUILD)/bin -LIBPATH = $(OBJPATH)/$(BUILD)/lib -DEBUG_BINPATH = $(OBJPATH)/debug/bin -DEBUG_LIBPATH = $(OBJPATH)/debug/lib -RELEASE_BINPATH = $(OBJPATH)/release/bin -RELEASE_LIBPATH = $(OBJPATH)/release/lib -PROGRAM = $(BINPATH)/$(PROGRAM_NAME) -DEBUG_PROGRAM = $(DEBUG_BINPATH)/$(PROGRAM_NAME) -RELEASE_PROGRAM = $(RELEASE_BINPATH)/$(PROGRAM_NAME) - -BASE_CFLAGS = -Wall -Wextra $(CONFIG_CFLAGS) -DVERSION=$(VERSION) $(DEFINES) $(INCLUDES) - -ifeq ($(DEFAULT_BUILD),debug) -CFLAGS := -g -O0 -DDEBUG $(CFLAGS) $(BASE_CFLAGS) -Wmissing-prototypes -Wstrict-prototypes -CXXFLAGS := -g -O0 -DDEBUG $(CXXFLAGS) $(BASE_CFLAGS) -endif - -ifeq ($(DEFAULT_BUILD),valgrind) -CFLAGS := -g -O0 -DDEBUG -DDEBUG -DFLAC__VALGRIND_TESTING $(CFLAGS) $(BASE_CFLAGS) -Wmissing-prototypes -Wstrict-prototypes -CXXFLAGS := -g -O0 -DDEBUG -DDEBUG -DFLAC__VALGRIND_TESTING $(CXXFLAGS) $(BASE_CFLAGS) -endif - -ifeq ($(DEFAULT_BUILD),release) -CFLAGS := -O3 -fomit-frame-pointer -funroll-loops $(GCC_INLINE) -DFLaC__INLINE=__inline__ -DNDEBUG $(CFLAGS) $(BASE_CFLAGS) -Wmissing-prototypes -Wstrict-prototypes -CXXFLAGS := -O3 -fomit-frame-pointer -funroll-loops $(GCC_INLINE) -DFLaC__INLINE=__inline__ -DNDEBUG $(CXXFLAGS) $(BASE_CFLAGS) -endif - -LFLAGS = -L$(LIBPATH) - -DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o) -RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o) -ifeq ($(PROC),x86_64) -DEBUG_PIC_OBJS = $(SRCS_C:%.c=%.debug.pic.o) $(SRCS_CC:%.cc=%.debug.pic.o) $(SRCS_CPP:%.cpp=%.debug.pic.o) $(SRCS_NASM:%.nasm=%.debug.pic.o) -RELEASE_PIC_OBJS = $(SRCS_C:%.c=%.release.pic.o) $(SRCS_CC:%.cc=%.release.pic.o) $(SRCS_CPP:%.cpp=%.release.pic.o) $(SRCS_NASM:%.nasm=%.release.pic.o) -endif - -debug : $(DEBUG_PROGRAM) -valgrind: $(DEBUG_PROGRAM) -release : $(RELEASE_PROGRAM) - -# by default on OS X we link with static libs as much as possible - -$(DEBUG_PROGRAM) : $(DEBUG_OBJS) $(DEBUG_PIC_OBJS) -ifeq ($(OS),Darwin) - $(LINK) -o $@ $(DEBUG_OBJS) $(EXPLICIT_LIBS) -else - $(LINK) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) -endif - -$(RELEASE_PROGRAM) : $(RELEASE_OBJS) $(RELEASE_PIC_OBJS) -ifeq ($(OS),Darwin) - $(LINK) -o $@ $(RELEASE_OBJS) $(EXPLICIT_LIBS) -else - $(LINK) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) -endif - -include $(topdir)/build/compile.mk - -.PHONY : clean -clean : - -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(DEBUG_PIC_OBJS) $(RELEASE_PIC_OBJS) $(OBJPATH)/*/bin/$(PROGRAM_NAME) - -.PHONY : depend -depend: - makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp diff --git a/build/lib.mk b/build/lib.mk deleted file mode 100644 index 12bcb410..00000000 --- a/build/lib.mk +++ /dev/null @@ -1,138 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile fragment for building a library -# - -include $(topdir)/build/config.mk - -ifeq ($(OS),Darwin) - CC = cc - CCC = c++ -else -ifeq ($(OS),FreeBSD) - CC = cc - CCC = c++ -else - CC = gcc - CCC = g++ -endif -endif -ifeq ($(CC),gcc) - GCC_INLINE = -finline-functions -endif -NASM = nasm -LINK = ar cr -OBJPATH = $(topdir)/objs -LIBPATH = $(OBJPATH)/$(BUILD)/lib -DEBUG_LIBPATH = $(OBJPATH)/debug/lib -RELEASE_LIBPATH = $(OBJPATH)/release/lib -ifeq ($(OS),Darwin) - STATIC_LIB_SUFFIX = a - DYNAMIC_LIB_SUFFIX = dylib -else -ifeq ($(findstring Windows,$(OS)),Windows) - STATIC_LIB_SUFFIX = a - DYNAMIC_LIB_SUFFIX = dll -else - STATIC_LIB_SUFFIX = a - DYNAMIC_LIB_SUFFIX = so -endif -endif -STATIC_LIB_NAME = $(LIB_NAME).$(STATIC_LIB_SUFFIX) -DYNAMIC_LIB_NAME = $(LIB_NAME).$(DYNAMIC_LIB_SUFFIX) -STATIC_LIB = $(LIBPATH)/$(STATIC_LIB_NAME) -DYNAMIC_LIB = $(LIBPATH)/$(DYNAMIC_LIB_NAME) -DEBUG_STATIC_LIB = $(DEBUG_LIBPATH)/$(STATIC_LIB_NAME) -DEBUG_DYNAMIC_LIB = $(DEBUG_LIBPATH)/$(DYNAMIC_LIB_NAME) -RELEASE_STATIC_LIB = $(RELEASE_LIBPATH)/$(STATIC_LIB_NAME) -RELEASE_DYNAMIC_LIB = $(RELEASE_LIBPATH)/$(DYNAMIC_LIB_NAME) -ifeq ($(OS),Darwin) - LINKD = $(CC) -dynamiclib -flat_namespace -undefined suppress -install_name $(DYNAMIC_LIB) -else - LINKD = $(CC) -shared -endif - -BASE_CFLAGS = -Wall -Wextra $(CONFIG_CFLAGS) -DVERSION=$(VERSION) -DPACKAGE_VERSION=$(VERSION) $(DEFINES) $(INCLUDES) - -ifeq ($(DEFAULT_BUILD),debug) -CFLAGS := -g -O0 -DDEBUG $(CFLAGS) $(BASE_CFLAGS) -Wmissing-prototypes -Wstrict-prototypes -CXXFLAGS := -g -O0 -DDEBUG $(CFLAGS) $(BASE_CFLAGS) -endif - -ifeq ($(DEFAULT_BUILD),valgrind) -CFLAGS := -g -O0 -DDEBUG -DDEBUG -DFLAC__VALGRIND_TESTING $(CFLAGS) $(BASE_CFLAGS) -Wmissing-prototypes -Wstrict-prototypes -CXXFLAGS := -g -O0 -DDEBUG -DDEBUG -DFLAC__VALGRIND_TESTING $(CFLAGS) $(BASE_CFLAGS) -endif - -ifeq ($(DEFAULT_BUILD),release) -CFLAGS := -O3 -fomit-frame-pointer -funroll-loops $(GCC_INLINE) -DFLaC__INLINE=__inline__ -DNDEBUG $(CFLAGS) $(BASE_CFLAGS) -Wmissing-prototypes -Wstrict-prototypes -CXXFLAGS := -O3 -fomit-frame-pointer -funroll-loops $(GCC_INLINE) -DFLaC__INLINE=__inline__ -DNDEBUG $(CFLAGS) $(BASE_CFLAGS) -endif - -LFLAGS = -L$(LIBPATH) - -DEBUG_OBJS = $(SRCS_C:%.c=%.debug.o) $(SRCS_CC:%.cc=%.debug.o) $(SRCS_CPP:%.cpp=%.debug.o) $(SRCS_NASM:%.nasm=%.debug.o) -RELEASE_OBJS = $(SRCS_C:%.c=%.release.o) $(SRCS_CC:%.cc=%.release.o) $(SRCS_CPP:%.cpp=%.release.o) $(SRCS_NASM:%.nasm=%.release.o) -ifeq ($(PROC),x86_64) -DEBUG_PIC_OBJS = $(SRCS_C:%.c=%.debug.pic.o) $(SRCS_CC:%.cc=%.debug.pic.o) $(SRCS_CPP:%.cpp=%.debug.pic.o) $(SRCS_NASM:%.nasm=%.debug.pic.o) -RELEASE_PIC_OBJS = $(SRCS_C:%.c=%.release.pic.o) $(SRCS_CC:%.cc=%.release.pic.o) $(SRCS_CPP:%.cpp=%.release.pic.o) $(SRCS_NASM:%.nasm=%.release.pic.o) -endif - -debug : $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB) -valgrind: $(DEBUG_STATIC_LIB) $(DEBUG_DYNAMIC_LIB) -release : $(RELEASE_STATIC_LIB) $(RELEASE_DYNAMIC_LIB) - -$(DEBUG_STATIC_LIB): $(DEBUG_OBJS) - $(LINK) $@ $(DEBUG_OBJS) && ranlib $@ - -$(RELEASE_STATIC_LIB): $(RELEASE_OBJS) - $(LINK) $@ $(RELEASE_OBJS) && ranlib $@ - -$(DEBUG_DYNAMIC_LIB) : $(DEBUG_OBJS) $(DEBUG_PIC_OBJS) -ifeq ($(OS),Darwin) - echo Not building dynamic lib, command is: $(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) -lc -else -ifeq ($(PROC),x86_64) - $(LINKD) -o $@ $(DEBUG_PIC_OBJS) $(LFLAGS) $(LIBS) -else - $(LINKD) -o $@ $(DEBUG_OBJS) $(LFLAGS) $(LIBS) -endif -endif - -$(RELEASE_DYNAMIC_LIB) : $(RELEASE_OBJS) $(RELEASE_PIC_OBJS) -ifeq ($(OS),Darwin) - echo Not building dynamic lib, command is: $(LINKD) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) -lc -else -ifeq ($(PROC),x86_64) - $(LINKD) -o $@ $(RELEASE_PIC_OBJS) $(LFLAGS) $(LIBS) -else - $(LINKD) -o $@ $(RELEASE_OBJS) $(LFLAGS) $(LIBS) -endif -endif - -include $(topdir)/build/compile.mk - -.PHONY : clean -clean : - -rm -f $(DEBUG_OBJS) $(RELEASE_OBJS) $(DEBUG_PIC_OBJS) $(RELEASE_PIC_OBJS) $(OBJPATH)/*/lib/$(STATIC_LIB_NAME) $(OBJPATH)/*/lib/$(DYNAMIC_LIB_NAME) - -.PHONY : depend -depend: - makedepend -fMakefile.lite -- $(CFLAGS) $(INCLUDES) -- *.c *.cc *.cpp diff --git a/ci/flac-autotool.sh b/ci/flac-autotool.sh deleted file mode 100755 index dafe29f7..00000000 --- a/ci/flac-autotool.sh +++ /dev/null @@ -1,17 +0,0 @@ -# Continuous integration build script for FLAC. -# This script is run by automated frameworks to verify commits -# see https://mf4.xiph.org/jenkins/job/flac/ - -# This is intended to be run from the top-level source directory. - -set -x - -./autogen.sh - -./configure - -# Should do 'distcheck' here instead of 'check', but 'distcheck' is currently busted. -V=1 make clean distcheck - -# Since we're doing 'make distcheck' we remove the generated source tarball. -rm -f flac-*.tar.xz diff --git a/cmake/CheckCPUArch.c.in b/cmake/CheckCPUArch.c.in deleted file mode 100644 index 54931394..00000000 --- a/cmake/CheckCPUArch.c.in +++ /dev/null @@ -1,7 +0,0 @@ -int main(void) { -#if @CHECK_CPU_ARCH_DEFINES@ - return 0; -#else - fail -#endif -} diff --git a/cmake/CheckCPUArch.cmake b/cmake/CheckCPUArch.cmake deleted file mode 100644 index 95330b4b..00000000 --- a/cmake/CheckCPUArch.cmake +++ /dev/null @@ -1,23 +0,0 @@ -macro(_CHECK_CPU_ARCH ARCH ARCH_DEFINES VARIABLE) - if(NOT DEFINED HAVE_${VARIABLE}) - message(STATUS "Check CPU architecture is ${ARCH}") - set(CHECK_CPU_ARCH_DEFINES ${ARCH_DEFINES}) - configure_file(${PROJECT_SOURCE_DIR}/cmake/CheckCPUArch.c.in ${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c @ONLY) - try_compile(HAVE_${VARIABLE} "${PROJECT_BINARY_DIR}" - "${PROJECT_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckCPUArch.c") - if(HAVE_${VARIABLE}) - message(STATUS "Check CPU architecture is ${ARCH} - yes") - set(${VARIABLE} 1 CACHE INTERNAL "Result of CHECK_CPU_ARCH_X64" FORCE) - else () - message(STATUS "Check CPU architecture is ${ARCH} - no") - endif() - endif () -endmacro(_CHECK_CPU_ARCH) - -macro(CHECK_CPU_ARCH_X64 VARIABLE) - _CHECK_CPU_ARCH(x64 "defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)" ${VARIABLE}) -endmacro(CHECK_CPU_ARCH_X64) - -macro(CHECK_CPU_ARCH_X86 VARIABLE) - _CHECK_CPU_ARCH(x86 "defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86)" ${VARIABLE}) -endmacro(CHECK_CPU_ARCH_X86) diff --git a/cmake/FindOgg.cmake b/cmake/FindOgg.cmake deleted file mode 100644 index b60c3526..00000000 --- a/cmake/FindOgg.cmake +++ /dev/null @@ -1,26 +0,0 @@ -find_package(PkgConfig) -pkg_check_modules(_OGG QUIET ogg) - -find_path(OGG_INCLUDE_DIR - NAMES "ogg/ogg.h" - PATHS ${_OGG_INCLUDE_DIRS}) - -find_library(OGG_LIBRARY - NAMES ogg libogg - HINTS ${_OGG_LIBRARY_DIRS}) - -mark_as_advanced( - OGG_INCLUDE_DIR - OGG_LIBRARY) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Ogg - REQUIRED_VARS OGG_INCLUDE_DIR OGG_LIBRARY - VERSION_VAR _OGG_VERSION) - -if(OGG_FOUND AND NOT TARGET Ogg::ogg) - add_library(Ogg::ogg UNKNOWN IMPORTED) - set_target_properties(Ogg::ogg PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OGG_INCLUDE_DIR}" - IMPORTED_LOCATION "${OGG_LIBRARY}") -endif() diff --git a/cmake/UseSystemExtensions.cmake b/cmake/UseSystemExtensions.cmake deleted file mode 100644 index f3c9490f..00000000 --- a/cmake/UseSystemExtensions.cmake +++ /dev/null @@ -1,73 +0,0 @@ -include(CheckCSourceCompiles) - -check_c_source_compiles(" - int main() - { - #ifndef _FORTIFY_SOURCE - return 0; - #else - this_is_an_error; - #endif - }" - DODEFINE_FORTIFY_SOURCE) -check_c_source_compiles(" - #include - mbstate_t x; - int main() { return 0; }" - HAVE_MBSTATE) -if(NOT HAVE_MBSTATE) - check_c_source_compiles(" - #define _XOPEN_SOURCE 500 - #include - mbstate_t x; - int main() { return 0; }" - DODEFINE_XOPEN_SOURCE) -endif() -check_c_source_compiles(" - #define __EXTENSIONS__ 1 - #include - #ifdef HAVE_SYS_TYPES_H - # include - #endif - #ifdef HAVE_SYS_STAT_H - # include - #endif - #ifdef STDC_HEADERS - # include - # include - #else - # ifdef HAVE_STDLIB_H - # include - # endif - #endif - #ifdef HAVE_STRING_H - # if !defined STDC_HEADERS && defined HAVE_MEMORY_H - # include - # endif - # include - #endif - #ifdef HAVE_STRINGS_H - # include - #endif - #ifdef HAVE_INTTYPES_H - # include - #endif - #ifdef HAVE_STDINT_H - # include - #endif - #ifdef HAVE_UNISTD_H - # include - #endif - int main() { return 0; }" - DODEFINE_EXTENSIONS) - -add_definitions( - -D_DARWIN_C_SOURCE - -D_POSIX_PTHREAD_SEMANTICS - -D__STDC_WANT_IEC_60559_BFP_EXT__ - -D__STDC_WANT_IEC_60559_DFP_EXT__ - -D__STDC_WANT_IEC_60559_FUNCS_EXT__ - -D__STDC_WANT_IEC_60559_TYPES_EXT__ - -D__STDC_WANT_LIB_EXT2__ - -D__STDC_WANT_MATH_SPEC_FUNCS__ - -D_TANDEM_SOURCE) diff --git a/config.cmake.h.in b/config.cmake.h.in deleted file mode 100644 index 1d96f426..00000000 --- a/config.cmake.h.in +++ /dev/null @@ -1,234 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#cmakedefine AC_APPLE_UNIVERSAL_BUILD - -/* Target processor is big endian. */ -#cmakedefine01 CPU_IS_BIG_ENDIAN - -/* Target processor is little endian. */ -#cmakedefine01 CPU_IS_LITTLE_ENDIAN - -/* Set FLAC__BYTES_PER_WORD to 8 (4 is the default) */ -#cmakedefine01 ENABLE_64_BIT_WORDS - -/* define to align allocated memory on 32-byte boundaries */ -#cmakedefine FLAC__ALIGN_MALLOC_DATA - -/* define if you have docbook-to-man or docbook2man */ -#cmakedefine FLAC__HAS_DOCBOOK_TO_MAN - -/* define if you are compiling for x86 and have the NASM assembler */ -#cmakedefine FLAC__HAS_NASM - -/* define if you have the ogg library */ -#cmakedefine01 OGG_FOUND -#define FLAC__HAS_OGG OGG_FOUND - -/* define if compiler has __attribute__((target("cpu=power8"))) support */ -#cmakedefine FLAC__HAS_TARGET_POWER8 - -/* define if compiler has __attribute__((target("cpu=power9"))) support */ -#cmakedefine FLAC__HAS_TARGET_POWER9 - -/* Set to 1 if is available. */ -#cmakedefine01 FLAC__HAS_X86INTRIN - -/* define if building for Darwin / MacOS X */ -#cmakedefine FLAC__SYS_DARWIN - -/* define if building for Linux */ -#cmakedefine FLAC__SYS_LINUX - -/* define to enable use of Altivec instructions */ -#cmakedefine FLAC__USE_ALTIVEC - -/* define to enable use of AVX instructions */ -#cmakedefine01 WITH_AVX -#define FLAC__USE_AVX WITH_AVX - -/* define to enable use of VSX instructions */ -#cmakedefine FLAC__USE_VSX - -/* Compiler has the __builtin_bswap16 intrinsic */ -#cmakedefine01 HAVE_BSWAP16 - -/* Compiler has the __builtin_bswap32 intrinsic */ -#cmakedefine01 HAVE_BSWAP32 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_BYTESWAP_H - -/* define if you have clock_gettime */ -#cmakedefine HAVE_CLOCK_GETTIME - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_CPUID_H - -/* Define to 1 if C++ supports variable-length arrays. */ -#cmakedefine HAVE_CXX_VARARRAYS - -/* Define to 1 if C supports variable-length arrays. */ -#cmakedefine HAVE_C_VARARRAYS - -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ -#cmakedefine HAVE_FSEEKO - -/* Define to 1 if you have the `getopt_long' function. */ -#cmakedefine HAVE_GETOPT_LONG - -/* Define if you have the iconv() function and it works. */ -#cmakedefine HAVE_ICONV - -/* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_INTTYPES_H - -/* Define if you have and nl_langinfo(CODESET). */ -#cmakedefine HAVE_LANGINFO_CODESET - -/* lround support */ -#cmakedefine01 HAVE_LROUND - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MEMORY_H - -/* Define to 1 if the system has the type `socklen_t'. */ -#cmakedefine HAVE_SOCKLEN_T - -/* Define to 1 if you have the header file. */ -#cmakedefine01 HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_IOCTL_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_TERMIOS_H - -/* Define to 1 if typeof works with your compiler. */ -#cmakedefine HAVE_TYPEOF - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_X86INTRIN_H - -/* Define as const if the declaration of iconv() needs const. */ -#cmakedefine ICONV_CONST - -/* Define if debugging is disabled */ -#cmakedefine NDEBUG - -/* Name of package */ -#cmakedefine PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#cmakedefine PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#cmakedefine PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#cmakedefine PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#cmakedefine PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#cmakedefine PACKAGE_URL - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PROJECT_VERSION@" - -/* The size of `off_t', as computed by sizeof. */ -#cmakedefine SIZEOF_OFF_T - -/* The size of `void*', as computed by sizeof. */ -#cmakedefine SIZEOF_VOIDP - -/* Define to 1 if you have the ANSI C header files. */ -#cmakedefine STDC_HEADERS - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -#define _ALL_SOURCE -#endif - -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#ifndef _FORTIFY_SOURCE -#cmakedefine DODEFINE_FORTIFY_SOURCE 2 -#define _FORTIFY_SOURCE DODEFINE_FORTIFY_SOURCE -#endif - -#ifndef _XOPEN_SOURCE -#cmakedefine DODEFINE_XOPEN_SOURCE 500 -#define _XOPEN_SOURCE DODEFINE_XOPEN_SOURCE -#endif - -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -#cmakedefine _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -#cmakedefine _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -#cmakedefine DODEFINE_EXTENSIONS -#define __EXTENSIONS__ DODEFINE_EXTENSIONS -#endif - - -/* Target processor is big endian. */ -#define WORDS_BIGENDIAN CPU_IS_BIG_ENDIAN - -/* Enable large inode numbers on Mac OS X 10.5. */ -#ifndef _DARWIN_USE_64_BIT_INODE -# define _DARWIN_USE_64_BIT_INODE 1 -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -#ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -#endif - -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ -#ifndef _LARGEFILE_SOURCE -# define _LARGEFILE_SOURCE -#endif - -/* Define for large files, on AIX-style hosts. */ -#cmakedefine _LARGE_FILES - -/* Define to 1 if on MINIX. */ -#cmakedefine _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#cmakedefine _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#cmakedefine _POSIX_SOURCE - -/* Define to __typeof__ if your compiler spells it that way. */ -#cmakedefine typeof diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 4a95cb8b..00000000 --- a/configure.ac +++ /dev/null @@ -1,634 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -# NOTE that for many of the AM_CONDITIONALs we use the prefix FLaC__ -# instead of FLAC__ since autoconf triggers off 'AC_' in strings - -AC_PREREQ(2.60) -AC_INIT([flac], [1.3.3], [flac-dev@xiph.org], [flac], [https://www.xiph.org/flac/]) -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_SRCDIR([src/flac/main.c]) -AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([foreign 1.10 -Wall tar-pax no-dist-gzip dist-xz subdir-objects]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -AC_MSG_CHECKING([whether configure should try to set CFLAGS/CXXFLAGS/CPPFLAGS/LDFLAGS]) -AS_IF([test "x${CFLAGS+set}" = "xset" || test "x${CXXFLAGS+set}" = "xset" || test "x${CPPFLAGS+set}" = "xset" || test "x${LDFLAGS+set}" = "xset"], - [enable_flags_setting=no], - [enable_flags_setting=yes] -) -AC_MSG_RESULT([${enable_flags_setting}]) -AX_CHECK_ENABLE_DEBUG -user_cflags=$CFLAGS - -#Prefer whatever the current ISO standard is. -AC_PROG_CC_STDC -AC_USE_SYSTEM_EXTENSIONS -m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) -LT_INIT([win32-dll disable-static pic-only]) -AM_PROG_AS -AC_PROG_CXX -XIPH_C_COMPILER_IS_CLANG -XIPH_GCC_REALLY_IS_GCC -AC_PROG_MAKE_SET -AC_PROG_MKDIR_P - -AC_SYS_LARGEFILE -AC_FUNC_FSEEKO - -AC_CHECK_SIZEOF(off_t,1) # Fake default value. -AC_CHECK_SIZEOF([void*]) -AC_SEARCH_LIBS([lround],[m], [AC_DEFINE(HAVE_LROUND,1,lround support)]) - -AC_LANG_PUSH([C++]) -# c++ flavor first -AC_C_VARARRAYS -if test $ac_cv_c_vararrays = yes; then - AC_DEFINE([HAVE_CXX_VARARRAYS], 1, [Define to 1 if C++ supports variable-length arrays.]) -fi -AC_LANG_POP([C++]) - -# c flavor -AC_HEADER_STDC -AM_PROG_CC_C_O -AC_C_INLINE -AC_C_VARARRAYS -AC_C_TYPEOF - -AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h sys/ioctl.h termios.h x86intrin.h cpuid.h]) - -XIPH_C_BSWAP32 -XIPH_C_BSWAP16 - -ac_cv_c_big_endian=0 -ac_cv_c_little_endian=0 -AC_C_BIGENDIAN([ac_cv_c_big_endian=1], [ac_cv_c_little_endian=1], [ - AC_MSG_WARN([[*****************************************************************]]) - AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]]) - AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]]) - AC_MSG_WARN([[*** config.h may need to be hand editied. ]]) - AC_MSG_WARN([[*****************************************************************]]) -]) -AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian}, - [Target processor is big endian.]) -AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian}, - [Target processor is little endian.]) -AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian}, - [Target processor is big endian.]) - -AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes) -dnl ' Terminate the damn single quote -AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno) -if test "x$asm_opt" = xno ; then -AC_DEFINE(FLAC__NO_ASM) -AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code]) -fi - -# For the XMMS plugin. -AC_CHECK_TYPES(socklen_t, [], []) - -dnl check for getopt in standard library -dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] ) -AC_CHECK_FUNCS(getopt_long, [], []) - -AC_CHECK_SIZEOF(void*,1) - -asm_optimisation=no -case "$host_cpu" in - amd64|x86_64) - case "$host" in - *gnux32) - # x32 user space and 64 bit kernel. - cpu_x86_64=true - AC_DEFINE(FLAC__CPU_X86_64) - AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64]) - asm_optimisation=$asm_opt - ;; - *) - if test $ac_cv_sizeof_voidp = 4 ; then - # This must be a 32 bit user space running on 64 bit kernel so treat - # this as ia32. - cpu_ia32=true - AC_DEFINE(FLAC__CPU_IA32) - AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386]) - else - # x86_64 user space and kernel. - cpu_x86_64=true - AC_DEFINE(FLAC__CPU_X86_64) - AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64]) - fi - asm_optimisation=$asm_opt - ;; - esac - ;; - i*86) - cpu_ia32=true - AC_DEFINE(FLAC__CPU_IA32) - AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386]) - asm_optimisation=$asm_opt - ;; - powerpc64|powerpc64le) - cpu_ppc64=true - cpu_ppc=true - AC_DEFINE(FLAC__CPU_PPC) - AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC]) - AC_DEFINE(FLAC__CPU_PPC64) - AH_TEMPLATE(FLAC__CPU_PPC64, [define if building for PowerPC64]) - asm_optimisation=$asm_opt - ;; - powerpc|powerpcle) - cpu_ppc=true - AC_DEFINE(FLAC__CPU_PPC) - AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC]) - asm_optimisation=$asm_opt - ;; - sparc) - cpu_sparc=true - AC_DEFINE(FLAC__CPU_SPARC) - AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC]) - asm_optimisation=$asm_opt - ;; -esac -AM_CONDITIONAL(FLAC__CPU_X86_64, test "x$cpu_x86_64" = xtrue) -AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue) -AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue) -AM_CONDITIONAL(FLaC__CPU_PPC64, test "x$cpu_ppc64" = xtrue) -AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue) - -if test "x$ac_cv_header_x86intrin_h" = xyes; then -AC_DEFINE([FLAC__HAS_X86INTRIN], 1, [Set to 1 if is available.]) -else -AC_DEFINE([FLAC__HAS_X86INTRIN], 0) -fi - -if test x"$cpu_ppc64" = xtrue ; then - -AC_C_ATTRIBUTE([target("cpu=power8")], - [have_cpu_power8=yes], - [have_cpu_power8=no]) -if test x"$have_cpu_power8" = xyes ; then - AC_DEFINE(FLAC__HAS_TARGET_POWER8) - AH_TEMPLATE(FLAC__HAS_TARGET_POWER8, [define if compiler has __attribute__((target("cpu=power8"))) support]) -fi - -AC_C_ATTRIBUTE([target("cpu=power9")], - [have_cpu_power9=yes], - [have_cpu_power9=no]) -if test x"$have_cpu_power9" = xyes ; then - AC_DEFINE(FLAC__HAS_TARGET_POWER9) - AH_TEMPLATE(FLAC__HAS_TARGET_POWER9, [define if compiler has __attribute__((target("cpu=power9"))) support]) -fi - -fi - -case "$host" in - i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;; - *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;; - *-*-darwin*) OBJ_FORMAT=macho ;; - *emx*) OBJ_FORMAT=aout ;; - *djgpp) OBJ_FORMAT=coff ;; - *) OBJ_FORMAT=elf ;; -esac -AC_SUBST(OBJ_FORMAT) - -os_is_windows=no -case "$host" in - *mingw*) - CPPFLAGS="-D__MSVCRT_VERSION__=0x0601 $CPPFLAGS" - os_is_windows=yes - ;; -esac - -AM_CONDITIONAL(OS_IS_WINDOWS, test "x$os_is_windows" = xyes) - -case "$host" in - *-linux-*) - sys_linux=true - AC_DEFINE(FLAC__SYS_LINUX) - AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux]) - ;; - *-*-darwin*) - sys_darwin=true - AC_DEFINE(FLAC__SYS_DARWIN) - AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X]) - ;; -esac -AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue) -AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue) - -if test "x$cpu_ia32" = xtrue || test "x$cpu_x86_64" = xtrue ; then -AC_DEFINE(FLAC__ALIGN_MALLOC_DATA) -AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries]) -fi - -AM_CONDITIONAL([DEBUG], [test "x${ax_enable_debug}" = "xyes" || test "x${ax_enable_debug}" = "xinfo"]) - -AC_ARG_ENABLE(sse, -AC_HELP_STRING([--disable-sse], [Disable passing of -msse2 to the compiler]), -[case "${enableval}" in - yes) sse_os=yes ;; - no) sse_os=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;; -esac],[sse_os=yes]) - -AC_ARG_ENABLE(altivec, -AC_HELP_STRING([--disable-altivec], [Disable Altivec optimizations]), -[case "${enableval}" in - yes) use_altivec=true ;; - no) use_altivec=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;; -esac],[use_altivec=true]) -AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue) -if test "x$use_altivec" = xtrue ; then -AC_DEFINE(FLAC__USE_ALTIVEC) -AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions]) -fi - -AC_ARG_ENABLE(vsx, -AC_HELP_STRING([--disable-vsx], [Disable VSX optimizations]), -[case "${enableval}" in - yes) use_vsx=true ;; - no) use_vsx=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-vsx) ;; -esac],[use_vsx=true]) -AM_CONDITIONAL(FLaC__USE_VSX, test "x$use_vsx" = xtrue) -if test "x$use_vsx" = xtrue ; then -AC_DEFINE(FLAC__USE_VSX) -AH_TEMPLATE(FLAC__USE_VSX, [define to enable use of VSX instructions]) -fi - -AC_ARG_ENABLE(avx, -AC_HELP_STRING([--disable-avx], [Disable AVX, AVX2 optimizations]), -[case "${enableval}" in - yes) use_avx=true ;; - no) use_avx=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-avx) ;; -esac],[use_avx=true]) -AM_CONDITIONAL(FLaC__USE_AVX, test "x$use_avx" = xtrue) -if test "x$use_avx" = xtrue ; then -AC_DEFINE(FLAC__USE_AVX) -AH_TEMPLATE(FLAC__USE_AVX, [define to enable use of AVX instructions]) -fi - -AC_ARG_ENABLE(thorough-tests, -AC_HELP_STRING([--disable-thorough-tests], [Disable thorough (long) testing, do only basic tests]), -[case "${enableval}" in - yes) thorough_tests=true ;; - no) thorough_tests=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;; -esac],[thorough_tests=true]) -AC_ARG_ENABLE(exhaustive-tests, -AC_HELP_STRING([--enable-exhaustive-tests], [Enable exhaustive testing (VERY long)]), -[case "${enableval}" in - yes) exhaustive_tests=true ;; - no) exhaustive_tests=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;; -esac],[exhaustive_tests=false]) -if test "x$thorough_tests" = xfalse ; then -FLAC__TEST_LEVEL=0 -elif test "x$exhaustive_tests" = xfalse ; then -FLAC__TEST_LEVEL=1 -else -FLAC__TEST_LEVEL=2 -fi -AC_SUBST(FLAC__TEST_LEVEL) - -AC_ARG_ENABLE(werror, - AC_HELP_STRING([--enable-werror], [Enable -Werror in all Makefiles])) - -AC_ARG_ENABLE([stack-smash-protection], - [AS_HELP_STRING([--disable-stack-smash-protection],[Disable GNU GCC stack smash protection])],, - [AS_IF([test "$ac_cv_c_compiler_gnu" = "yes" && test "$os_is_windows" = "no"], - [enable_stack_smash_protection=yes],[enable_stack_smash_protection=no])]) - -AC_ARG_ENABLE(64-bit-words, - AC_HELP_STRING([--enable-64-bit-words], [Set FLAC__BYTES_PER_WORD to 8 (4 is the default)])) -if test "x$enable_64_bit_words" = xyes ; then - AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],1,[Set FLAC__BYTES_PER_WORD to 8 (4 is the default)]) -else - AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],0) - fi -AC_SUBST(ENABLE_64_BIT_WORDS) - -AC_ARG_ENABLE(valgrind-testing, -AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]), -[case "${enableval}" in - yes) FLAC__TEST_WITH_VALGRIND=yes ;; - no) FLAC__TEST_WITH_VALGRIND=no ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;; -esac],[FLAC__TEST_WITH_VALGRIND=no]) -AC_SUBST(FLAC__TEST_WITH_VALGRIND) - -AC_ARG_ENABLE(doxygen-docs, -AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]), -[case "${enableval}" in - yes) enable_doxygen_docs=true ;; - no) enable_doxygen_docs=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;; -esac],[enable_doxygen_docs=true]) -if test "x$enable_doxygen_docs" != xfalse ; then - AC_CHECK_PROGS(DOXYGEN, doxygen) -fi -AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN") - -AC_ARG_ENABLE(local-xmms-plugin, -AC_HELP_STRING([--enable-local-xmms-plugin], [Install XMMS plugin to ~/.xmms/Plugins instead of system location]), -[case "${enableval}" in - yes) install_xmms_plugin_locally=true ;; - no) install_xmms_plugin_locally=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;; -esac],[install_xmms_plugin_locally=false]) -AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue) - -AC_ARG_ENABLE(xmms-plugin, -AC_HELP_STRING([--disable-xmms-plugin], [Do not build XMMS plugin]), -[case "${enableval}" in - yes) enable_xmms_plugin=true ;; - no) enable_xmms_plugin=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmms-plugin) ;; -esac],[enable_xmms_plugin=true]) -if test "x$enable_xmms_plugin" != xfalse ; then - AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - XMMS support will not be built])) -fi -AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR") - -dnl build FLAC++ or not -AC_ARG_ENABLE([cpplibs], -AC_HELP_STRING([--disable-cpplibs], [Do not build libFLAC++]), -[case "${enableval}" in - yes) disable_cpplibs=false ;; - no) disable_cpplibs=true ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;; -esac], [disable_cpplibs=false]) -AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue]) - -AC_ARG_ENABLE([oss-fuzzers], - [AS_HELP_STRING([--enable-oss-fuzzers], - [Whether to generate the fuzzers for OSS-Fuzz (Clang only)])], - [have_oss_fuzzers=yes], [have_oss_fuzzers=no]) - -if test "x$have_oss_fuzzers" = "xyes"; then - if test "x$xiph_cv_c_compiler_clang" = "xyes" ; then - AM_CONDITIONAL([USE_OSSFUZZERS], [test "x$have_oss_fuzzers" = "xyes"]) - if test "x$LIB_FUZZING_ENGINE" = "x" ; then - # Only set this if it is empty. - LIB_FUZZING_ENGINE=-fsanitize=fuzzer - fi - else - AM_CONDITIONAL([USE_OSSFUZZERS], [test "false" = "true"]) - # Disable fuzzer if the compiler is not Clang. - AC_MSG_WARN([*** Ozz-Fuzz is disabled because that requres the Clang compiler.]) - have_oss_fuzzers="no (compiler is GCC)" - fi -else - AM_CONDITIONAL([USE_OSSFUZZERS], [test "false" = "true"]) -fi - -AM_CONDITIONAL([USE_OSSFUZZ_FLAG], [test "x$LIB_FUZZING_ENGINE" = "x-fsanitize=fuzzer"]) -AM_CONDITIONAL([USE_OSSFUZZ_STATIC], [test -f "$LIB_FUZZING_ENGINE"]) -AC_SUBST([LIB_FUZZING_ENGINE]) - -dnl check for ogg library -AC_ARG_ENABLE([ogg], - AC_HELP_STRING([--disable-ogg], [Disable ogg support (default: test for libogg)]), - [ want_ogg=$enableval ], [ want_ogg=yes ] ) - -if test "x$want_ogg" != "xno"; then - XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development environment not installed - Ogg support will not be built])) -fi - -FLAC__HAS_OGG=0 -AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes]) -if test "x$have_ogg" = xyes ; then - FLAC__HAS_OGG=1 - OGG_PACKAGE="ogg" -else - have_ogg=no -fi -AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],$FLAC__HAS_OGG,[define if you have the ogg library]) -AC_SUBST(FLAC__HAS_OGG) -AC_SUBST(OGG_PACKAGE) - -dnl Build examples? -AC_ARG_ENABLE([examples], - AS_HELP_STRING([--disable-examples], [Don't build and install examples])) -AM_CONDITIONAL([EXAMPLES], [test "x$enable_examples" != "xno"]) - -dnl check for i18n(internationalization); these are from libiconv/gettext -AM_ICONV -AM_LANGINFO_CODESET - -AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man) -AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN") -if test -n "$DOCBOOK_TO_MAN" ; then -AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN) -AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man]) -fi - -AC_CHECK_LIB(rt, clock_gettime, - LIB_CLOCK_GETTIME=-lrt - AC_DEFINE(HAVE_CLOCK_GETTIME) - AH_TEMPLATE(HAVE_CLOCK_GETTIME, [define if you have clock_gettime])) -AC_SUBST(LIB_CLOCK_GETTIME) - -# only matters for x86 -AC_CHECK_PROGS(NASM, nasm) -AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM") -if test -n "$NASM" ; then -AC_DEFINE(FLAC__HAS_NASM) -AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler]) -fi - -dnl If debugging is disabled AND no CFLAGS/CXXFLAGS/CPPFLAGS/LDFLAGS -dnl are provided, we can set defaults to our liking -AS_IF([test "x${ax_enable_debug}" = "xno" && test "x${enable_flags_setting}" = "xyes"], [ - CFLAGS="-O3 -funroll-loops" - CXXFLAGS="-O3" -]) - -XIPH_GCC_VERSION dnl Sets a non-zero GCC_XXX_VERSION for gcc, not clang. checks below rely on that.. - -if test x$ac_cv_c_compiler_gnu = xyes -o x$xiph_cv_c_compiler_clang = xyes ; then - CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Wconversion - CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Woverloaded-virtual -Wmissing-declarations - - XIPH_ADD_CFLAGS([-Wdeclaration-after-statement]) - - dnl some distributions (such as Gentoo) have _FORTIFY_SOURCE always - dnl enabled. We test for this situation in order to prevent polluting - dnl the console with messages of macro redefinitions. - AX_ADD_FORTIFY_SOURCE - - AC_LANG_PUSH([C++]) - XIPH_ADD_CXXFLAGS([-Weffc++]) - AC_LANG_POP([C++]) - - if test x$xiph_cv_c_compiler_clang = xyes -a "$OBJ_FORMAT" = elf; then - CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR" - CFLAGS="$CFLAGS -fvisibility=hidden" - CXXFLAGS="$CXXFLAGS -fvisibility=hidden" - elif test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then - CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR" - CFLAGS="$CFLAGS -fvisibility=hidden" - CXXFLAGS="$CXXFLAGS -fvisibility=hidden" - fi - - - if test x$xiph_cv_c_compiler_clang = xyes -a "$OBJ_FORMAT" = macho; then - CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR" - CFLAGS="$CFLAGS -fvisibility=hidden" - CXXFLAGS="$CXXFLAGS -fvisibility=hidden" - elif test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = macho; then - CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR" - CFLAGS="$CFLAGS -fvisibility=hidden" - CXXFLAGS="$CXXFLAGS -fvisibility=hidden" - fi - - if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then - XIPH_ADD_CFLAGS([-fgnu89-inline]) - fi - - if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x47" ; then - XIPH_ADD_CFLAGS([-fno-inline-small-functions]) - fi - - if test "x$asm_optimisation$sse_os" = "xyesyes" ; then - XIPH_ADD_CFLAGS([-msse2]) - fi - - fi - -case "$host_os" in - "mingw32"|"os2") - if test "$host_cpu" = "i686"; then - XIPH_ADD_CFLAGS([-mstackrealign]) - fi - esac - -if test x$enable_werror = "xyes" ; then - XIPH_ADD_CFLAGS([-Werror]) - AC_LANG_PUSH([C++]) - XIPH_ADD_CXXFLAGS([-Werror]) - AC_LANG_POP([C++]) - fi - -if test x$enable_stack_smash_protection = "xyes" ; then - XIPH_GCC_STACK_PROTECTOR - XIPH_GXX_STACK_PROTECTOR - fi - -AH_VERBATIM([FLAC_API_EXPORTS], -[/* libtool defines DLL_EXPORT for windows dll builds, - but flac code relies on FLAC_API_EXPORTS instead. */ -#ifdef DLL_EXPORT -#ifdef __cplusplus -# define FLACPP_API_EXPORTS -#else -# define FLAC_API_EXPORTS -#endif -#endif]) - -if test x$enable_shared != "xyes" ; then -dnl for correct FLAC_API - CPPFLAGS="-DFLAC__NO_DLL $CPPFLAGS" - fi - -AC_CONFIG_FILES([ \ - Makefile \ - src/Makefile \ - src/libFLAC/Makefile \ - src/libFLAC/flac.pc \ - src/libFLAC/ia32/Makefile \ - src/libFLAC/include/Makefile \ - src/libFLAC/include/private/Makefile \ - src/libFLAC/include/protected/Makefile \ - src/libFLAC++/Makefile \ - src/libFLAC++/flac++.pc \ - src/flac/Makefile \ - src/metaflac/Makefile \ - src/plugin_common/Makefile \ - src/plugin_xmms/Makefile \ - src/share/Makefile \ - src/test_grabbag/Makefile \ - src/test_grabbag/cuesheet/Makefile \ - src/test_grabbag/picture/Makefile \ - src/test_libs_common/Makefile \ - src/test_libFLAC/Makefile \ - src/test_libFLAC++/Makefile \ - src/test_seeking/Makefile \ - src/test_streams/Makefile \ - src/utils/Makefile \ - src/utils/flacdiff/Makefile \ - src/utils/flactimer/Makefile \ - examples/Makefile \ - examples/c/Makefile \ - examples/c/decode/Makefile \ - examples/c/decode/file/Makefile \ - examples/c/encode/Makefile \ - examples/c/encode/file/Makefile \ - examples/cpp/Makefile \ - examples/cpp/decode/Makefile \ - examples/cpp/decode/file/Makefile \ - examples/cpp/encode/Makefile \ - examples/cpp/encode/file/Makefile \ - include/Makefile \ - include/FLAC/Makefile \ - include/FLAC++/Makefile \ - include/share/Makefile \ - include/share/grabbag/Makefile \ - include/test_libs_common/Makefile \ - doc/Doxyfile \ - doc/Makefile \ - doc/html/Makefile \ - doc/html/images/Makefile \ - m4/Makefile \ - man/Makefile \ - test/common.sh \ - test/Makefile \ - test/cuesheets/Makefile \ - test/flac-to-flac-metadata-test-files/Makefile \ - test/metaflac-test-files/Makefile \ - test/pictures/Makefile \ - build/Makefile \ - microbench/Makefile \ - oss-fuzz/Makefile -]) -AC_OUTPUT - -AC_MSG_RESULT([ --=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=- - - Configuration summary : - - FLAC version : ............................ ${VERSION} - - Host CPU : ................................ ${host_cpu} - Host Vendor : ............................. ${host_vendor} - Host OS : ................................. ${host_os} -]) - - echo " Compiler is GCC : ......................... ${ac_cv_c_compiler_gnu}" -if test x$ac_cv_c_compiler_gnu = xyes ; then - echo " GCC version : ............................. ${GCC_VERSION}" -fi - echo " Compiler is Clang : ....................... ${xiph_cv_c_compiler_clang}" - echo " SSE optimizations : ....................... ${sse_os}" - echo " Asm optimizations : ....................... ${asm_optimisation}" - echo " Ogg/FLAC support : ........................ ${have_ogg}" - echo " Stack protector : ........................ ${enable_stack_smash_protection}" - echo " Fuzzing support (Clang only) : ............ ${have_oss_fuzzers}" -echo diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt deleted file mode 100644 index e0e33913..00000000 --- a/doc/CMakeLists.txt +++ /dev/null @@ -1,54 +0,0 @@ -cmake_minimum_required(VERSION 3.9) - -find_package(Doxygen) - -if (NOT DOXYGEN_FOUND) - return() -endif() - -option(BUILD_DOXYGEN "Enable API documentation building via Doxygen" ON) - -if (NOT BUILD_DOXYGEN) - return() -endif() - -set(DOXYGEN_HTML_FOOTER doxygen.footer.html) -set(DOXYGEN_GENERATE_TAGFILE FLAC.tag) - -if(CMAKE_VERSION VERSION_LESS 3.12) - doxygen_add_docs(FLAC-doxygen - ALL - "${PROJECT_SOURCE_DIR}/include/FLAC" - "${PROJECT_SOURCE_DIR}/include/FLAC++") -else() - doxygen_add_docs(FLAC-doxygen - "${PROJECT_SOURCE_DIR}/include/FLAC" - "${PROJECT_SOURCE_DIR}/include/FLAC++") - - install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/" - DESTINATION "${CMAKE_INSTALL_DOCDIR}/html/api") - -endif() - -install(FILES - html/images/logo.svg - html/images/logo130.gif - html/changelog.html - html/developers.html - html/documentation.html - html/documentation_bugs.html - html/documentation_example_code.html - html/documentation_format_overview.html - html/documentation_tools.html - html/documentation_tools_flac.html - html/documentation_tools_metaflac.html - html/faq.html - html/favicon.ico - html/features.html - html/flac.css - html/format.html - html/id.html - html/index.html - html/license.html - html/ogg_mapping.html -DESTINATION "${CMAKE_INSTALL_DOCDIR}/html") diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in deleted file mode 100644 index cc20991a..00000000 --- a/doc/Doxyfile.in +++ /dev/null @@ -1,1784 +0,0 @@ -# Doxyfile 1.7.6.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" "). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or sequence of words) that should -# identify the project. Note that if you do not use Doxywizard you need -# to put quotes around the project name if it contains spaces. - -PROJECT_NAME = FLAC - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 1.3.3 - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = Free Lossless Audio Codec - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = doxytmp - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = NO - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = YES - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = .. - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = "assert=\par Assertions:\n" \ - "default=\par Default Value:\n" - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding -# "class=itcl::class" will allow you to use the command class in the -# itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = YES - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and -# unions with only public data fields will be shown inline in the documentation -# of the scope in which they are defined (i.e. file, namespace, or group -# documentation), provided this scope is documented. If set to NO (the default), -# structs, classes, and unions are shown on a separate page (for HTML and Man -# pages) or section (for LaTeX and RTF). - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -SYMBOL_CACHE_SIZE = 0 - -# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be -# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given -# their name and scope. Since this can be an expensive process and often the -# same symbol appear multiple times in the code, doxygen keeps a cache of -# pre-resolved symbols. If the cache is too small doxygen will become slower. -# If the cache is too large, memory is wasted. The cache size is given by this -# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = YES - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files -# containing the references data. This must be a list of .bib files. The -# .bib extension is automatically appended if omitted. Using this command -# requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = @top_srcdir@/include/FLAC \ - @top_srcdir@/include/FLAC++ - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is advised to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = @top_srcdir@/doc/doxygen.footer.html - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# style sheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the style sheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) -# at top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. Since the tabs have the same information as the -# navigation tree you can set this option to NO if you already set -# GENERATE_TREEVIEW to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. -# Since the tree basically has the same information as the tab index you -# could consider to set DISABLE_INDEX to NO when enabling this option. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the -# mathjax.org site, so you can quickly see the result without installing -# MathJax, but it is strongly recommended to install a local copy of MathJax -# before deployment. - -MATHJAX_RELPATH = http://www.mathjax.org/mathjax - -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension -# names that should be enabled during MathJax rendering. - -MATHJAX_EXTENSIONS = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = NO - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvantages are that it is more difficult to setup -# and does not have live searching capabilities. - -SERVER_BASED_SEARCH = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the -# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. - -LATEX_BIB_STYLE = plain - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load style sheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = FLAC__NO_DLL - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = FLAC_API \ - FLACPP_API - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = FLAC.tag - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will use the Helvetica font for all dot files that -# doxygen generates. When you want a differently looking font you can specify -# the font name using DOT_FONTNAME. You need to make sure dot is able to find -# the font, which can be done by putting it in a standard location or by setting -# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the -# directory containing the font. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the Helvetica font. -# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to -# set the path where dot can find it. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. If you choose svg you need to set -# HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible in IE 9+ (other browsers do not have this requirement). - -DOT_IMAGE_FORMAT = png - -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to -# enable generation of interactive SVG images that allow zooming and panning. -# Note that this requires a modern browser other than Internet Explorer. -# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you -# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible. Older versions of IE do not have SVG support. - -INTERACTIVE_SVG = NO - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/doc/Makefile.am b/doc/Makefile.am deleted file mode 100644 index 8e972594..00000000 --- a/doc/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -# flac - Command-line FLAC encoder/decoder -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -SUBDIRS = . html - -if FLaC__HAS_DOXYGEN -all-local: Doxyfile -FLAC.tag: Doxyfile - doxygen Doxyfile - rm -rf html/api - mv doxytmp/html html/api - rm -rf doxytmp -else -FLAC.tag: - touch $@ - mkdir -p html/api -endif - -doc_DATA = \ - FLAC.tag - -EXTRA_DIST = Doxyfile.in Makefile.lite doxygen.footer.html doxygen.header.html \ - isoflac.txt $(doc_DATA) CMakeLists.txt - -distclean-local: - rm -rf FLAC.tag html/api doxytmp diff --git a/doc/Makefile.lite b/doc/Makefile.lite deleted file mode 100644 index 423824f8..00000000 --- a/doc/Makefile.lite +++ /dev/null @@ -1,29 +0,0 @@ -# flac - Command-line FLAC encoder/decoder -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -topdir = .. - -FLAC.tag: Doxyfile - rm -rf doxytmp - doxygen Doxyfile - rm -rf html/api - mv doxytmp/html html/api - rm -rf doxytmp - -clean: - rm -rf FLAC.tag html/api doxytmp diff --git a/doc/doxygen.footer.html b/doc/doxygen.footer.html deleted file mode 100644 index cce041da..00000000 --- a/doc/doxygen.footer.html +++ /dev/null @@ -1,25 +0,0 @@ - -
- - - - - - - - - - diff --git a/doc/doxygen.header.html b/doc/doxygen.header.html deleted file mode 100644 index 97a03b9e..00000000 --- a/doc/doxygen.header.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/doc/html/Makefile.am b/doc/html/Makefile.am deleted file mode 100644 index 2c73fdbb..00000000 --- a/doc/html/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -SUBDIRS = images - -html_DATA = \ - changelog.html \ - developers.html \ - documentation.html \ - documentation_bugs.html \ - documentation_example_code.html \ - documentation_format_overview.html \ - documentation_tools.html \ - documentation_tools_flac.html \ - documentation_tools_metaflac.html \ - faq.html \ - favicon.ico \ - features.html \ - flac.css \ - format.html \ - id.html \ - index.html \ - license.html \ - ogg_mapping.html - -EXTRA_DIST = $(html_DATA) api - -if FLaC__HAS_DOXYGEN -# The install targets don't copy whole directories so we have to -# handle 'api/' specially: -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(htmldir)/api - (cd $(builddir)/api && $(INSTALL_DATA) * $(DESTDIR)$(htmldir)/api) -uninstall-local: - rm -rf $(DESTDIR)$(htmldir)/api -distclean-local: - -rm -rf api -endif diff --git a/doc/html/changelog.html b/doc/html/changelog.html deleted file mode 100644 index fc0dc4d7..00000000 --- a/doc/html/changelog.html +++ /dev/null @@ -1,1560 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - changelog - - - - - - -
- - - -
- -
-
- changelog -
-
-
- This is an informal changelog, a summary of changes in each release. (See also known bugs.) Particularly important for developers is the precise description of changes to the library interfaces. See also the porting guide for specific instructions on porting to newer versions of FLAC.
- - FLAC 1.3.3 (4-Augs-2019) - -
- -
    -
  • - General: -
      -
    • Fix CPU detection (Janne Hyvärinen).
    • -
    • Switch from unsigned types to uint32_t (erikd).
    • -
    • CppCheck fixes (erikd).
    • -
    • Improve SIMD decoding of 24 bit files (lvqcl).
    • -
    • POWER* amnd POWER9 improvements (Anton Blanchard).
    • -
    • More tests.
    • -
    -
  • -
  • - FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - flac: -
      -
    • When converting to WAV, use WAVEFORMATEXTENSIBLE when bits per second is not 8 or 16 (erikd).
    • -
    • Fix --output-prefix with input-files in sub-directories (orbea).
    • -
    -
  • -
  • - metaflac: -
      -
    • (none)
    • -
    -
  • -
  • - plugins: -
      -
    • (none)
    • -
    -
  • -
  • - build system: -
      -
    • Cmake support (Vitaliy Kirsanov, evpobr).
    • -
    • Visual Studio updates (Janne Hyvärinen).
    • -
    • Fix for MSVC when UNICODE is enabled (lvqcl).
    • -
    • Fix for OpenBSD/i386 (Christian Weisgerber).
    • -
    -
  • - -
  • - documentation: -
      -
    • (none)
    • -
    -
  • -
  • - libraries: -
      -
    • (none).
    • -
    -
  • -
  • - Interface changes: -
      -
    • - libFLAC: -
        -
      • (none)
      • -
      -
    • -
    • - libFLAC++: -
        -
      • (none)
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.3.2 (01-Jan-2017) - -
- -
    -
  • - General: -
      -
    • Fix undefined behaviour using GCC/Clang UBSAN (erikd).
    • -
    • General hardening via fuzz testing with AFL (erikd and others).
    • -
    • General code improvements (lvqcl, erikd and others).
    • -
    • Add FLAC in MP4 specification docs (Ralph Giles).
    • -
    • MSVS build cleanups (lvqcl).
    • -
    • Fix some cppcheck warnings (erikd).
    • -
    • Assume all currently used OSes support SSE2.
    • -
    -
  • -
  • - FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - flac: -
      -
    • Fix potential infinite loop on flac-to-flac conversion (erikd).
    • -
    • Add WAVEFORMATEXTENSIBLE to WAV (as needed) when decoding (lvqcl).
    • -
    • Only write vorbis-comments if they are non-empty.
    • -
    • Error out if decoding RAW with bits != (8|16|24).
    • -
    -
  • -
  • - metaflac: -
      -
    • Add --scan-replay-gain option.
    • -
    -
  • -
  • - plugins: -
      -
    • (none)
    • -
    -
  • -
  • - build system: -
      -
    • Fixes for MSVC and Makefile.lite build systems.
    • -
    -
  • - -
  • - documentation: -
      -
    • (none)
    • -
    -
  • -
  • - libraries: -
      -
    • CPU detection cleanup and fixes (Julian Calaby, erikd and lvqcl).
    • -
    • Fix two stream decoder bugs (Max Kellermann).
    • -
    • Fix a NULL dereference bug (on a malformed file).
    • -
    • Changed the LPC order guess for a slight compression improvement, particularly for classical music (Martijn van Beurden).
    • -
    • Improved encoding speed on older Intel CPUs.
    • -
    • Fixed a seeking bug when decoding certain files (Miroslav Lichvar).
    • -
    • Put an upper bound (32768) on the number of seek points.
    • -
    • Fix potential memory leaks.
    • -
    • Support 64bit brword/bwword allowing FLAC__BYTES_PER_WORD to be set to 8 (disabled by default).
    • -
    • Fix an out-of-bounds heap read.
    • -
    • Win32: Only use large buffers when writing to disk.
    • -
    -
  • -
  • - Interface changes: -
      -
    • - libFLAC: -
        -
      • (none)
      • -
      -
    • -
    • - libFLAC++: -
        -
      • (none)
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.3.1 (25-Nov-2014) - -
- -
    -
  • - General: -
      -
    • Improved decoding efficiency of all bit depths but especially so for 24 bits for IA32 architecture (lvqcl and Miroslav Lichvar).
    • -
    • Faster encoding using SSE and AVX (lvqcl).
    • -
    • Fixed bartlett, bartlett_hann and triangle functions.
    • -
    • New apodization functions partial_tukey and punchout_tukey for improved compression (Martijn van Beurden).
    • -
    • Retuned compression presets to incorporate new apodization functions (Martijn van Beurden).
    • -
    • Fix -Wcast-align warnings on armhf architecture (Erik de Castro Lopo).
    • -
    -
  • -
  • - FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - flac: -
      -
    • Help output documentation improvements.
    • -
    • I/O buffering improvements on Windows to reduce disk fragmentation when writing files.
    • -
    • Only write vorbis-comments if they are non-empty.
    • -
    -
  • -
  • - metaflac: -
      -
    • (none)
    • -
    -
  • -
  • - plugins: -
      -
    • Fix symbol visibility in XMMS plugin.
    • -
    -
  • -
  • - build system: -
      -
    • Many fixes and improvements across all the build systems.
    • -
    -
  • - -
  • - documentation: - -
  • -
  • - libraries: -
      -
    • Fix CVE-2014-9028 (heap write overflow) and CVE-2014-8962 (heap read overflow) (Erik de Castro Lopo).
    • -
    -
  • -
  • - Interface changes: -
      -
    • - libFLAC: -
        -
      • (none)
      • -
      -
    • -
    • - libFLAC++: -
        -
      • (none)
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.3.0 (26-May-2013) - -
- -
    -
  • - General: -
      -
    • Move development to Xiph.org git repository.
    • -
    • The --sector-align option of flac has been deprecated and may not exist in future versions. shntool provides similar functionality.
    • -
    • Support for the RF64 and Wave64 formats in flac (see below).
    • -
    • Better handling of cuesheets with non-CD-DA sample rates.
    • -
    • The --ignore-chunk-sizes option has been added to the flac command line tool.
    • -
    -
  • -
  • - FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - flac: -
      -
    • Added support for encoding from and decoding to the RF64 format, and a new corresponding option --force-rf64-format. (SF #1762502). --keep-foreign-metadata is also supported.
    • -
    • Added support for encoding from and decoding to the Sony Wave64 format, and a new corresponding option --force-wave64-format. (SF #1769582). --keep-foreign-metadata is also supported.
    • -
    • Added new options --preserve-modtime and --no-preserve-modtime to specify whether or not output files should copy the timestamp and permissions from their input files. The default is --preserve-modtime as in previous versions. (SF #1805428).
    • -
    • Allow MM:SS:FF and MM:SS.SS time formats in non-CD-DA cuesheets. (SF #1947353, SF #2182432)
    • -
    • The --sector-align option of flac has been deprecated and may not exist in future versions. shntool provides similar functionality. (SF #1805946)
    • -
    • Improved error message when user attempts to decode a non-FLAC file (SF #2222789).
    • -
    • Fix bug where flac was disallowing use of --replay-gain when encoding from stdin (SF #1840124).
    • -
    • Fix bug with fractional seconds on some locales (SF #1815517, SF #1858012).
    • -
    • Read and write appropriate channel masks for 6.1 and 7.1 surround input WAV files. Documentation was also updated.
    • -
    • Correct Wave64 GUIDs.
    • -
    • Support 56kHz to 192kHz gain analysis (patch from Earl Chew)
    • -
    • Add ability to handle unicode filenames on Windows (large set of patches from Janne Hyvärinen)
    • -
    -
  • -
  • - metaflac: - -
  • -
  • - plugins: -
      -
    • Minor updates for XMMS plugin.
    • -
    • Winamp2 plugin was dropped because Nullsoft has provided native FLAC support since 2006.
    • -
    -
  • -
  • - build system: - -
  • - -
  • - documentation: - -
  • -
  • - libraries: -
      -
    • libFLAC encoder was defaulting to level 0 compression instead of 5 (SF #1816825).
    • -
    • Fix bug in bitreader handling of read callback returning a short count (SF #2490454).
    • -
    • Improve decoder's ability to distinguish between a FLAC sync code and an MPEG one (SF #2491433).
    • -
    -
  • -
  • - Interface changes: -
      -
    • - libFLAC: -
        -
      • Added FLAC__format_blocksize_is_subset()
      • -
      -
    • -
    • - libFLAC++: -
        -
      • Add a number of convenience methods.
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.2.1 (17-Sep-2007) - -
- -
    -
  • - General: -
      -
    • With the new --keep-foreign-metadata in flac, non-audio RIFF and AIFF chunks can be stored in FLAC files and recreated when decoding. This allows, among other, things support for archiving BWF files and other WAVE files from editing tools that preserves all the metadata.
    • -
    -
  • -
  • - FLAC format: -
      -
    • Specified 2 new APPLICATION metadata blocks for storing WAVE and AIFF chunks (for use with --keep-foreign-metadata in flac).
    • -
    • The lead-out track number for non-CDDA cuesheets now must be 255.
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • This is not a format change, but changed default extension for Ogg FLAC from .ogg to .oga, according to new Xiph specification (SF #1762492).
    • -
    -
  • -
  • - flac: -
      -
    • Added a new option --no-utf8-convert which works like it does in metaflac (SF #973740).
    • -
    • Added a new option --keep-foreign-metadata which can save/restore RIFF and AIFF chunks to/from FLAC files (SF #363478).
    • -
    • Changed default extension for Ogg FLAC from .ogg to .oga, according to new Xiph specification (SF #1762492).
    • -
    • Fixed bug where using --replay-gain without any padding option caused only a small PADDING block to be created (SF #1760790).
    • -
    • Fixed bug where encoding from stdin on Windows could fail if WAVE/AIFF contained unknown chunks (SF #1776803).
    • -
    • Fixed bug where importing non-CDDA cuesheets would cause an invalid lead-out track number (SF #1764105).
    • -
    -
  • -
  • - metaflac: -
      -
    • Changed default extension for Ogg FLAC from .ogg to .oga, according to new Xiph specification (SF #1762492).
    • -
    • Fixed bug where importing non-CDDA cuesheets would cause an invalid lead-out track number (SF #1764105).
    • -
    -
  • -
  • - plugins: -
      -
    • (none)
    • -
    -
  • -
  • - build system: - -
  • -
  • - documentation: -
      -
    • Added new tutorial section for flac.
    • -
    • Added example code section for using libFLAC/libFLAC++.
    • -
    -
  • -
  • - libraries: -
      -
    • libFLAC: Fixed very rare seek bug (SF #1684049).
    • -
    • libFLAC: Fixed seek bug with Ogg FLAC and small streams (SF #1792172).
    • -
    • libFLAC: 64-bit fixes (SF #1790872).
    • -
    • libFLAC: Fix assembler code to be position independent.
    • -
    • libFLAC: Optimization of a number of inner loop functions.
    • -
    • Added support for encoding the residual coding method introduced in libFLAC 1.2.0 (RESIDUAL_CODING_METHOD_PARTITIONED_RICE2) which will encode 24-bit files more efficiently.
    • -
    -
  • -
  • - Interface changes: -
      -
    • - libFLAC: -
        -
      • Added FLAC__metadata_simple_iterator_is_last()
      • -
      • Added FLAC__metadata_simple_iterator_get_block_offset()
      • -
      • Added FLAC__metadata_simple_iterator_get_block_length()
      • -
      • Added FLAC__metadata_simple_iterator_get_application_id()
      • -
      -
    • -
    • - libFLAC++: -
        -
      • Added FLAC::Metadata::SimpleIterator::is_last()
      • -
      • Added FLAC::Metadata::SimpleIterator::get_block_offset()
      • -
      • Added FLAC::Metadata::SimpleIterator::get_block_length()
      • -
      • Added FLAC::Metadata::SimpleIterator::get_application_id()
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.2.0 (23-Jul-2007) - -
- -
    -
  • - General: -
      -
    • Small encoding speedups for all modes.
    • -
    -
  • -
  • - FLAC format: -
      -
    • One of the reserved bits in the FLAC frame header has been assigned for future use; make sure to refer to the porting guide if you parse FLAC streams manually.
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - flac: -
      -
    • Added runtime detection of SSE OS support for most operating systems.
    • -
    • Added a new undocumented option --ignore-chunk-sizes for ignoring the size of the 'data' chunk (WAVE) or 'SSND' chunk (AIFF). Can be used to encode files with bogus data sizes (e.g. with WAV files piped from foobar2000 to flac.exe as an external encoder). Use with caution: all subsequent data is treated as audio, so the data/SSND chunk must be the last or the following data/tags will be treated as audio and encoded.
    • -
    -
  • -
  • - metaflac: -
      -
    • (none)
    • -
    -
  • -
  • - plugins: -
      -
    • (none)
    • -
    -
  • -
  • - build system: -
      -
    • Added solution and project files for building with VC++ 2005.
    • -
    -
  • -
  • - libraries: -
      -
    • Added runtime detection of SSE OS support for most operating systems.
    • -
    • Fixed bug where invalid seek tables could cause some seeks to fail.
    • -
    • Added support for decoding the new residual coding method (RESIDUAL_CODING_METHOD_PARTITIONED_RICE2).
    • -
    -
  • -
  • - Interface changes (see also the porting guide for specific instructions on porting to FLAC 1.2.0): -
      -
    • - libFLAC: -
        -
      • Added FLAC__format_sample_rate_is_subset()
      • -
      -
    • -
    • - libFLAC++: -
        -
      • Added FLAC::Decoder::Stream::get_decode_position()
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.1.4 (13-Feb-2007) - -
- -
    -
  • - General: -
      -
    • Improved compression with no change to format or decrease in speed.
    • -
    • Encoding and decoding speedups for all modes. Encoding at -8 is twice as fast.
    • -
    -
  • -
  • - FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - flac: -
      -
    • Improved compression with no change to format or decrease in speed.
    • -
    • Encoding and decoding speedups for all modes. Encoding at -8 is twice as fast.
    • -
    • Added a new option -w,--warnings-as-errors for treating all warnings as errors.
    • -
    • Allow --picture option to take only a filename, and have all other attributes extracted from the file itself.
    • -
    • Fixed a bug that caused suboptimal default compression settings in some locales (SF #1608883).
    • -
    • Fixed a bug where FLAC-to-FLAC transcoding of a corrupted FLAC file would truncate the transcoded file at the first error (SF #1615019).
    • -
    • Fixed a bug where using -F with FLAC-to-FLAC transcoding of a corrupted FLAC would have no effect (SF #1615391).
    • -
    • Fixed a bug where new PICTURE metadata blocks specified with --picture would not be transferred during FLAC-to-FLAC transcoding (SF #1627993).
    • -
    -
  • -
  • - metaflac: -
      -
    • Allow --import-picture-from option to take only a filename, and have all other attributes extracted from the file itself.
    • -
    -
  • -
  • - plugins: -
      -
    • Fixed a bug in the XMMS plugin where Ctrl-3 (file info) would cause a crash if the file did not exist (SF #1634941).
    • -
    -
  • -
  • - build system: -
      -
    • Fixed a makefile linkage bug with libogg (SF #1611414).
    • -
    • Added pkg-config files for libFLAC and libFLAC++ (SF #1647881).
    • -
    • Added --disable-ogg option for building without Ogg support even if libogg is installed (SF #1196996).
    • -
    -
  • -
  • - libraries: -
      -
    • Completely rewritten bitbuffer which uses native machine word size instead of bytes for dramatic speed improvements. The speedup should be most dramatic on CPUs with slower byte manipulation capability and big-endian machines.
    • -
    • Much faster Rice partition size estimation which greatly speeds encoding in higher modes.
    • -
    • Increased compression for all modes.
    • -
    • Reduced memory requirements for encoder and decoder.
    • -
    • Fixed a bug with default apodization settings that were erroneous in some locales (SF #1608883).
    • -
    -
  • -
  • - Interface changes: -
      -
    • - libFLAC: -
        -
      • (behavior only) FLAC__stream_encoder_set_metadata() now makes a copy of the "metadata" array of pointers (but still not copies of the objects themselves) so the client does not need to maintain its copy of the array after the call.
      • -
      -
    • -
    • - libFLAC++: -
        -
      • (none)
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.1.3 (27-Nov-2006) - -
- -
    -
  • - General: -
      -
    • Improved compression with no impact on format or decoding speed.
    • -
    • Much better recovery for corrupted files
    • -
    • Better multichannel support
    • -
    • Large file (>2GB) support everywhere
    • -
    • flac now supports FLAC and Ogg FLAC as input to the encoder (e.g. can re-encode FLAC to FLAC) and preserve all the metadata like tags, etc.
    • -
    • New PICTURE metadata block for storing things like cover art, new --picture option to flac and --import-picture-from option to metaflac for importing pictures, new --export-picture-to option to metaflac for exporting pictures, and metadata API additions for searching for suitable pictures based on type, size and color constraints.
    • -
    • Support for new REPLAYGAIN_REFERENCE_LOUDNESS tag.
    • -
    • Fixed a bug in Ogg FLAC encoding where metadata was not being updated properly. Existing Ogg FLAC files should be recoded to fix up the metadata, e.g. flac -Vf -S 10s --ogg file.ogg
    • -
    • In the developer libraries, the interface has been simplfied by merging the three decoding layers into a single class; ditto for the encoders. Also, libOggFLAC has been merged into libFLAC and libOggFLAC++ has been merged into libFLAC++ so there is a single API supporting both native FLAC and Ogg FLAC.
    • -
    -
  • -
  • - FLAC format: -
      -
    • New PICTURE metadata block for storing things like cover art.
    • -
    • Speaker assignments and channel orders for 3-6 channels (see frame header).
    • -
    • Further restrictions on the FLAC subset when the sample rate is <=48kHz; in this case the maximum LPC order is now 12 and maximum blocksize is 4608. This is to further limit the processing and memory requirements for hardware implementations while not measurably affecting compression.
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - flac: -
      -
    • Improved the -F option to allow decoding of FLAC files whose metadata is corrupted, and other kinds of severe corruption.
    • -
    • Encoder can now take FLAC and Ogg FLAC as input. The output FLAC file will have all the same metadata as the original unless overridden with options on the command line.
    • -
    • Encoder can now take WAVEFORMATEXTENSIBLE WAVE files as input; decoder will output WAVEFORMATEXTENSIBLE WAVE files when necessary to conform to the latest Microsoft specifications.
    • -
    • Now properly supports AIFF and WAVEFORMATEXTENSIBLE multichannel input, performing necessary channel reordering both for encoding and decoding. WAVEFORMATEXTENSIBLE channel mask is also saved to a tag on encoding and restored on decoding for situations when there is no natural mapping to FLAC channel assignments.
    • -
    • Expanded support for "odd" sample resolutions to WAVE and AIFF input; all resolutions from 4 to 24 bits-per-sample now supported for all input types.
    • -
    • Added a new option --tag-from-file for setting a tag from file (e.g. for importing a cuesheet as a tag).
    • -
    • Added a new option --picture for adding pictures.
    • -
    • Added a new option --apodization for specifying the window function(s) to be used in LPC analysis.
    • -
    • Added support for encoding from non-compressed AIFF-C (SF #1090933).
    • -
    • Importing of non-CDDA-compliant cuesheets now only issues a warning, not an error (see here).
    • -
    • MD5 comparison failures on decoding are now an error instead of a warning and will also return a non-zero exit code (SF #1493725).
    • -
    • The default padding size is now 8K, or 64K if the input audio stream is more than 20 minutes long.
    • -
    • Fixed a bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline.
    • -
    • Fixed a bug that caused a crash when -a and -t were used together (SF #1229481).
    • -
    • Fixed a bug with --sector-align where appended samples were not always totally silent (SF #1237707).
    • -
    • Fixed bugs with --sector-align and raw input files.
    • -
    • Fixed a bug printing out unknown AIFF subchunk names (SF #1267476).
    • -
    • Fixed a bug where WAVE files with "data" subchunks of size 0 where accepted (SF #1293830).
    • -
    • Fixed a bug where sync error at end-of-stream of truncated files was not being caught (SF #1244071).
    • -
    • Fixed a problem with filename parsing if file does not have extension but also has a . in the path (SF #1161916).
    • -
    • Fixed a problem with fractional-second parsing for --skip/--until in some locales (SF #1031043).
    • -
    • Increase progress report rate when -p and -e are used together (SF #1580122).
    • -
    -
  • -
  • - metaflac: -
      -
    • Added support for read-only operations on Ogg FLAC files.
    • -
    • Added a new option --set-tag-from-file for setting a tag from file (e.g. for importing a cuesheet as a tag).
    • -
    • Added a new option --import-picture-from for importing pictures.
    • -
    • Added a new option --export-picture-to for exporting pictures.
    • -
    • Added shorthand operation --remove-replay-gain for removing ReplayGain tags.
    • -
    • --export-cuesheet-to now properly specifies the FLAC file name (SF #1272825).
    • -
    • Importing of non-CDDA-compliant cuesheets now issues a warning.
    • -
    • Removed the following deprecated tag editing options; you should use the new option names shown instead: -
        -
      • Removed --show-vc-vendor; use --show-vendor-tag
      • -
      • Removed --show-vc-field; use --show-tag
      • -
      • Removed --remove-vc-all; use --remove-all-tags
      • -
      • Removed --remove-vc-field; use --remove-tag
      • -
      • Removed --remove-vc-firstfield; use --remove-first-tag
      • -
      • Removed --set-vc-field; use --set-tag
      • -
      • Removed --import-vc-from; use --import-tags-from
      • -
      • Removed --export-vc-to; use --export-tags-to
      • -
      -
    • -
    • Disallow multiple input FLAC files when --import-tags-from=- is used (SF #1082577).
    • -
    -
  • -
  • - plugins: -
      -
    • When ReplayGain is on, if tags for the preferred kind of gain (album/track) are not in a stream, the other kind will be used.
    • -
    • Added ReplayGain info to file info box in XMMS plugin
    • -
    • Fixed UTF-8 decoder to disallow non-shortest-form and surrogate sequences (see here).
    • -
    -
  • -
  • - build system: -
      -
    • Added support for building on OS/2 with EMX (SF #1229495)
    • -
    • Added support for building with Borland C++ (SF #1599018)
    • -
    • Added a --disable-xmms-plugin option to configure to prevent building the XMMS plugin (SF #930494).
    • -
    • Added a --disable-doxygen-docs option to configure for disabling Doxygen-based API doc generation (SF #1365935).
    • -
    • Added a --disable-thorough-tests option to configure to do the basic library, stream, and tool tests in a reasonable time (SF #1077948).
    • -
    • Added large file support with AC_SYS_LARGEFILE; use --disable-largefile with configure to disable.
    • -
    -
  • -
  • - libraries: -
      -
    • Merged libOggFLAC into libFLAC; both formats are now supported through the same API.
    • -
    • Merged libOggFLAC++ into libFLAC++; both formats are now supported through the same API.
    • -
    • libFLAC and libFLAC++: Simplified encoder setup with new FLAC__stream_encoder_set_compression_level() function.
    • -
    • libFLAC: Improved compression with no impact on FLAC format or decoding time by adding a windowing stage before LPC analysis.
    • -
    • libFLAC: Fixed a bug where missing STREAMINFO fields (min/max framesize, total samples, MD5 sum) and seek point offsets were not getting rewritten back to Ogg FLAC file (SF #1338969).
    • -
    • libFLAC: Fixed a bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline.
    • -
    • libFLAC: Fixed UTF-8 decoder to disallow non-shortest-form and surrogate sequences (see here).
    • -
    • libFLAC: Fixed a bug in the return value for FLAC__stream_decoder_set_metadata_respond_application() and FLAC__stream_decoder_set_metadata_ignore_application() when there was a memory allocation error (SF #1235005).
    • -
    -
  • -
  • - Interface changes (see also the porting guide for specific instructions on porting to FLAC 1.1.3): -
      -
    • - all libraries; -
        -
      • Merged libOggFLAC into libFLAC; both formats are now supported through the same API.
      • -
      • Merged libOggFLAC++ into libFLAC++; both formats are now supported through the same API.
      • -
      • Merged seekable stream decoder and file decoder into the stream decoder.
      • -
      • Merged seekable stream encoder and file encoder into the stream encoder.
      • -
      • Added #defines for the API version number to make porting easier; see include/lib*FLAC*/export.h.
      • -
      -
    • -
    • - libFLAC: -
        -
      • Added FLAC__stream_encoder_set_apodization()
      • -
      • Added FLAC__stream_encoder_set_compression_level()
      • -
      • Added FLAC__metadata_object_cuesheet_calculate_cddb_id()
      • -
      • Added FLAC__metadata_get_cuesheet()
      • -
      • Added FLAC__metadata_get_picture()
      • -
      • Added FLAC__metadata_chain_read_ogg() and FLAC__metadata_chain_read_ogg_with_callbacks()
      • -
      • Changed FLAC__stream_encoder_finish() now returns a FLAC__bool to signal a verify failure, or error processing last frame or updating metadata.
      • -
      • Changed FLAC__StreamDecoderState: removed state FLAC__STREAM_DECODER_UNPARSEABLE_STREAM
      • -
      • Changed FLAC__StreamDecoderErrorStatus: new error code FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM
      • -
      • The above two changes mean that when the decoder encounters what it thinks are unparseable frames from a future decoder, instead of returning a fatal error with the FLAC__STREAM_DECODER_UNPARSEABLE_STREAM state, it just calls the error callback with FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM and leaves the behavior up to the application.
      • -
      -
    • -
    • - libFLAC++: -
        -
      • Added FLAC::Metadata::Picture
      • -
      • Added FLAC::Encoder::Stream::set_apodization()
      • -
      • Added FLAC::Encoder::Stream::set_compression_level()
      • -
      • Added FLAC::Metadata::CueSheet::calculate_cddb_id()
      • -
      • Added FLAC::Metadata::get_cuesheet()
      • -
      • Added FLAC::Metadata::get_picture()
      • -
      • Changed FLAC::Metadata::Chain::read() to accept a flag denoting Ogg FLAC input
      • -
      • Changed FLAC::Decoder::Stream::finish() now returns a bool to signal an MD5 failure like FLAC__stream_decoder_finish() does.
      • -
      • Changed FLAC::Encoder::Stream::finish() now returns a bool to signal a verify failure, or error processing last frame or updating metadata.
      • -
      -
    • -
    • - libOggFLAC: -
        -
      • Merged into libFLAC.
      • -
      -
    • -
    • - libOggFLAC++: -
        -
      • Merged into libFLAC++.
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.1.2 (05-Feb-2005) - -
- -
    -
  • - General: -
      -
    • Sped up decoding by a few percent overall.
    • -
    • Sped up encoding when not using LPC (i.e. when using flac options -0, -1, -2, or -l 0).
    • -
    • Fixed a decoding bug that could cause sync errors with some ID3v1-tagged FLAC files.
    • -
    • Added HTML documentation for metaflac.
    • -
    -
  • -
  • - FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • (none)
    • -
    -
  • -
  • - flac: -
      -
    • New option --input-size to manually specify the input size when encoding raw samples from stdin.
    • -
    -
  • -
  • - metaflac: -
      -
    • (none)
    • -
    -
  • -
  • - plugins: -
      -
    • Added support for HTTP streaming in XMMS plugin. NOTE: there is a bug in the XMMS mpg123 plugin that hijacks FLAC streams; to fix it you will need to add the '.flac' extension to the list of exceptions in Input/mpg123/mpg123.c:is_our_file() in the XMMS sources and recompile.
    • -
    -
  • -
  • - build system: -
      -
    • (none)
    • -
    -
  • -
  • - libraries: -
      -
    • libFLAC: Sped up Rice block decoding in the bitbuffer, resulting in decoding speed gains of a few percent.
    • -
    • libFLAC: Sped up encoding when not using LPC (i.e. max_lpc_order == 0).
    • -
    • libFLAC: Trailing NUL characters maintained on Vorbis comment entries so they can be treated like C strings.
    • -
    • libFLAC: More FLAC tag (i.e. Vorbis comment) validation.
    • -
    • libFLAC: Fixed a bug in the logic that determines the frame or sample number in a frame header; the bug could cause sync errors with some ID3v1-tagged FLAC files.
    • -
    • libFLAC, libOggFLAC: Can now be compiled to use only integer instructions, including encoding. The decoder is almost completely integer anyway but there were a couple places that needed a fixed-point replacement. There is no fixed-point version of LPC analysis yet, so if libFLAC is compiled integer-only, the encoder will behave as if the max LPC order is 0 (i.e. used fixed predictors only). LPC decoding is supported in all cases as it always was integer-only.
    • -
    -
  • -
  • - Interface changes: -
      -
    • - libFLAC: -
        -
      • Changed: Metadata object interface now maintains a trailing NUL on Vorbis comment entries for convenience.
      • -
      • Changed: Metadata object interface now validates all Vorbis comment entries on input and returns false if an entry does not conform to the Vorbis comment spec.
      • -
      • Added FLAC__format_vorbiscomment_entry_name_is_legal()
      • -
      • Added FLAC__format_vorbiscomment_entry_value_is_legal()
      • -
      • Added FLAC__format_vorbiscomment_entry_is_legal()
      • -
      • Added FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair()
      • -
      • Added FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair()
      • -
      • Changed the signature of FLAC__metadata_object_vorbiscomment_entry_matches(): the first argument is now FLAC__StreamMetadata_VorbisComment_Entry entry (was const FLAC__StreamMetadata_VorbisComment_Entry *entry), i.e. entry is now pass-by-value.
      • -
      -
    • -
    • - libFLAC++: -
        -
      • Changed: Metadata object interface now maintains a trailing NUL on Vorbis comment values for convenience.
      • -
      • Changed: Metadata object interface now validates all Vorbis comment entries on input and returns false if an entry does not conform to the Vorbis comment spec.
      • -
      • Changed: All Metadata objects' operator=() methods now return a reference to themselves.
      • -
      • Added methods to FLAC::Metadata::VorbisComment::Entry for setting comment values from null-terminated strings: -
          -
        • Entry(const char *field)
        • -
        • Entry(const char *field_name, const char *field_value)
        • -
        • bool set_field(const char *field)
        • -
        • bool set_field_value(const char *field_value)
        • -
        -
      • -
      • Changed the signature of FLAC::Metadata::VorbisComment::get_vendor_string() and FLAC::Metadata::VorbisComment::set_vendor_string() to use a UTF-8, NUL-terminated string const FLAC__byte * for the vendor string instead of FLAC::Metadata::VorbisComment::Entry.
      • -
      • Added FLAC::Metadata::*::assign() to all Metadata objects.
      • -
      • Added bool FLAC::Metadata::get_tags(const char *filename, VorbisComment &tags)
      • -
      -
    • -
    • - libOggFLAC: -
        -
      • (none)
      • -
      -
    • -
    • - libOggFLAC++: -
        -
      • (none)
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.1.1 (01-Oct-2004) - -
- -
    -
  • - General: -
      -
    • Ogg FLAC seeking now works
    • -
    • New optimizations almost double the decoding speed on PowerPC (e.g. Mac G4/G5)
    • -
    • A native OS X release thanks to updated Project Builder and autotools files
    • -
    -
  • -
  • - FLAC format: -
      -
    • Made invalid the metadata block type 127 so that audio frames can always be distinguished from metadata by seeing 0xff as the first byte. (This was also required for the Ogg FLAC mapping.)
    • -
    -
  • -
  • - Ogg FLAC format: -
      -
    • First official FLAC->Ogg bitstream mapping standardized (see new FLAC-to-Ogg mapping specification). See the documentation for the --ogg switch about having to re-encode older Ogg FLAC files.
    • -
    -
  • -
  • - flac: -
      -
    • Print an error when output file already exists instead of automatically overwriting.
    • -
    • New option -f (--force) to force overwriting if the output file already exists.
    • -
    • New option --cue to select a specific section to decode using cuesheet track/index points.
    • -
    • New option --totally-silent to suppress all output.
    • -
    • New (but undocumented) option --apply-replaygain-which-is-not-lossless which applies ReplayGain to the decoded output. See this thread for usage and caveats.
    • -
    • When encoding to Ogg FLAC, use a random serial number (instead of 0 as was done before) when a serial number is not specified.
    • -
    • When encoding multiple Ogg FLAC streams, --serial-number or random serial number sets the first number, which is then incremented for subsequent streams (before, the same serial number was used for all streams).
    • -
    • Decoder no longer exits with an error when writing to stdout and the pipe is broken.
    • -
    • Better explanation of common error messages.
    • -
    • Default extension when writing AIFF files is .aif (before, it was .aiff).
    • -
    • Write more common representation of SANE numbers in AIFF files.
    • -
    • Bug fix: calculating ReplayGain on 48kHz streams.
    • -
    • Bug fix: check for supported block alignments in WAVE files.
    • -
    • Bug fix: "offset" field in AIFF SSND chunk properly handled.
    • -
    • Bug fix: #679166: flac doesn't respect RIFF subchunk padding byte.
    • -
    • Bug fix: #828391: --add-replay-gain segfaults.
    • -
    • Bug fix: #851155: Can't seek to position in flac file.
    • -
    • Bug fix: #851756: flac --skip --until reads entire file.
    • -
    • Bug fix: #877122: problem parsing cuesheet with CATALOG entry.
    • -
    • Bug fix: #896057: parsing ISRC number from cuesheet.
    • -
    -
  • -
  • - metaflac: -
      -
    • Renamed the tag editing options as follows (the ...-vc-... options still work but are deprecated): -
        -
      • --show-vc-vendor becomes --show-vendor-tag
      • -
      • --show-vc-field becomes --show-tag
      • -
      • --remove-vc-all becomes --remove-all-tags
      • -
      • --remove-vc-field becomes --remove-tag
      • -
      • --remove-vc-firstfield becomes --remove-first-tag
      • -
      • --set-vc-field becomes --set-tag
      • -
      • --import-vc-from becomes --import-tags-from
      • -
      • --export-vc-to becomes --export-tags-to
      • -
      -
    • -
    • Better explanation of common error messages.
    • -
    • Bug fix: calculating ReplayGain on 48kHz streams.
    • -
    • Bug fix: incorrect numbers when printing seek points.
    • -
    -
  • -
  • - plugins: -
      -
    • Speed optimization in ReplayGain synthesis.
    • -
    • Speed optimization in XMMS playback.
    • -
    • Support for big-endian architectures in XMMS plugin.
    • -
    • Removed support for ID3 tags.
    • -
    • Bug fix: make hard limiter default to off in XMMS plugin.
    • -
    • Bug fix: stream length calculation bug in XMMS plugin, debian bug #200435
    • -
    • Bug fix: small memory leak in XMMS plugin.
    • -
    -
  • -
  • - build system: -
      -
    • ordinals.h is now static, not a build-generated file anymore.
    • -
    -
  • -
  • - libraries: -
      -
    • libFLAC: PPC+Altivec optimizations of some decoder routines.
    • -
    • libFLAC: Make stream encoder encode the blocksize and sample rate in the frame header if at all possible (not in STREAMINFO), even if subset encoding was not requested.
    • -
    • libFLAC: Bug fix: fixed seek routine where infinite loop could happen when seeking past end of stream.
    • -
    • libFLAC, libFLAC++: added methods to skip single frames, useful for quickly finding frame boundaries (see interface changes below).
    • -
    • libOggFLAC, libOggFLAC++: New seekable-stream and file encoder and decoder APIs to match native FLAC APIs (see interface changes below).
    • -
    -
  • -
  • - Interface changes: -
      -
    • - libFLAC: -
        -
      • Added FLAC__metadata_get_tags()
      • -
      • Added callback-based versions of metadata editing functions: -
          -
        • FLAC__metadata_chain_read_with_callbacks()
        • -
        • FLAC__metadata_chain_write_with_callbacks()
        • -
        • FLAC__metadata_chain_write_with_callbacks_and_tempfile()
        • -
        • FLAC__metadata_chain_check_if_tempfile_needed()
        • -
        -
      • -
      • Added decoder functions for skipping single frames, also useful for quickly finding frame boundaries: -
          -
        • FLAC__stream_decoder_skip_single_frame()
        • -
        • FLAC__seekable_stream_decoder_skip_single_frame()
        • -
        • FLAC__file_decoder_skip_single_frame()
        • -
        -
      • -
      • Added new required tell callback on seekable stream encoder: -
          -
        • FLAC__SeekableStreamEncoderTellStatus and FLAC__SeekableStreamEncoderTellStatusString[]
        • -
        • FLAC__SeekableStreamEncoderTellCallback
        • -
        • FLAC__seekable_stream_encoder_set_tell_callback()
        • -
        -
      • -
      • Changed FLAC__SeekableStreamEncoderState by adding FLAC__SEEKABLE_STREAM_ENCODER_TELL_ERROR
      • -
      • Changed Tell callback is now required to initialize seekable stream encoder
      • -
      • Deleted erroneous and unimplemented FLAC__file_decoder_process_remaining_frames()
      • -
      -
    • -
    • - libFLAC++: -
        -
      • Added FLAC::Metadata::get_tags()
      • -
      • Added decoder functions for skipping single frames, also useful for quickly finding frame boundaries: -
          -
        • FLAC::Decoder::Stream::skip_single_frame()
        • -
        • FLAC::Decoder::SeekableStream::skip_single_frame()
        • -
        • FLAC::Decoder::File::skip_single_frame()
        • -
        -
      • -
      • Added encoder functions for setting metadata: -
          -
        • FLAC::Encoder::Stream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
        • -
        • FLAC::Encoder::SeekableStream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
        • -
        • FLAC::Encoder::File::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks)
        • -
        -
      • -
      • Added new required tell callback on seekable stream encoder: -
          -
        • pure virtual FLAC::Encoder::SeekableStream::tell_callback()
        • -
        -
      • -
      • Changed Tell callback is now required to initialize seekable stream encoder
      • -
      • Deleted the following methods: -
          -
        • FLAC::Decoder::Stream::State::resolved_as_cstring()
        • -
        • FLAC::Encoder::Stream::State::resolved_as_cstring()
        • -
        -
      • -
      -
    • -
    • - libOggFLAC: -
        -
      • Added OggFLAC__SeekableStreamDecoder interface
      • -
      • Added OggFLAC__FileDecoder interface
      • -
      • Added OggFLAC__SeekableStreamEncoder interface
      • -
      • Added OggFLAC__FileEncoder interface
      • -
      • Added OggFLAC__stream_decoder_get_resolved_state_string()
      • -
      • Added OggFLAC__stream_encoder_get_resolved_state_string()
      • -
      • Added OggFLAC__stream_encoder_set_metadata_callback()
      • -
      • Changed OggFLAC__StreamDecoderState by adding OggFLAC__STREAM_DECODER_END_OF_STREAM
      • -
      -
    • -
    • - libOggFLAC++: -
        -
      • Added OggFLAC::Decoder::SeekableStream interface
      • -
      • Added OggFLAC::Decoder::File interface
      • -
      • Added OggFLAC::Encoder::SeekableStream interface
      • -
      • Added OggFLAC::Encoder::File interface
      • -
      • Added OggFLAC::Decoder::Stream::get_resolved_state_string()
      • -
      • Added OggFLAC::Encoder::Stream::get_resolved_state_string()
      • -
      • Added pure virtual OggFLAC::Encoder::Stream::metadata_callback()
      • -
      -
    • -
    -
  • -
- -
- - FLAC 1.1.0 (26-Jan-2003) - -
- -
    -
  • - General: -
      -
    • All code is now Valgrind-clean!
    • -
    • New CUESHEET metadata block for storing CD TOC and index point information. Now a CD can be completely backed up to a single FLAC file for archival.
    • -
    • ReplayGain support.
    • -
    • Better compression of 24-bit files.
    • -
    • More complete AIFF support.
    • -
    • 3DNow! optimizations enabled by default.
    • -
    • Complete MSVC build system with .dsp projects for everything, which can build both static libs and DLLs, and in debug or release mode, all in the same source tree.
    • -
    - flac: -
      -
    • Can now decode FLAC to AIFF; new --force-aiff-format option.
    • -
    • New --cuesheet option for reading and storing a cuesheet when encoding a whole CD. Automatically creates seek points for track and index points unless --no-cued-seekpoints is used.
    • -
    • New --replay-gain option for calculating ReplayGain values and storing them as tags.
    • -
    • New --until option complements --skip to stop decoding at a specified point in the stream.
    • -
    • --skip and --until now also accept mm:ss.ss format.
    • -
    • New -S #s flavor to specify seekpoints every '#' number of seconds.
    • -
    • flac now defaults to -S 10s instead of -S 100x for the seek table.
    • -
    • flac now adds a 4k PADDING block by default (turn off with --no-padding).
    • -
    • Fixed a bug with --skip and AIFF-to-FLAC encoding.
    • -
    • Fixed a bug where decoding a FLAC file whose total_samples==0 in the STREAMINFO would corrupt the WAVE header.
    • -
    - metaflac: -
      -
    • New --import-cuesheet-from option for reading and storing a cuesheet to a FLAC-encoded CD. Automatically creates seek points for track and index points unless --no-cued-seekpoints is used.
    • -
    • New --export-cuesheet-to option for writing a cuesheet from a FLAC file for use with CD authoring software.
    • -
    • New --add-replay-gain option for calculating ReplayGain values and storing them as tags.
    • -
    • New --add-seekpoint option to add seekpoints to an existing FLAC file. Includes new --add-seekpoint=#s flavor to add seekpoints every '#' number of seconds.
    • -
    - XMMS plugin: -
      -
    • Configurable sample resolution conversion with dither.
    • -
    • ReplayGain support with customizable noise shaping, pre-amp, and optional hard limiter.
    • -
    • New Vorbis comment editor.
    • -
    • File info now works.
    • -
    • Bitrate now shows the smoothed instantaneous bitrate.
    • -
    • Uses the ARTIST tag if there is no PERFORMER tag.
    • -
    - Winamp2 plugin: -
      -
    • Configurable sample resolution conversion with dither.
    • -
    • ReplayGain support with customizable noise shaping, pre-amp, and optional hard limiter.
    • -
    • File info now works.
    • -
    • Uses the ARTIST tag if there is no PERFORMER tag.
    • -
    - Libraries (developers take note!): -
      -
    • All code and tests are instrumented for Valgrind. All tests run Valgrind-clean, meaning no memory leaks or buffer over/under-runs.
    • -
    • Separate 64-bit datapath through the filter in libFLAC for better compression of >16 bps files.
    • -
    • FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT) now sets the vendor string.
    • -
    • The documentation on the usage of FLAC::Iterator::get_block() in libFLAC++ has an important correction. If you use this class make sure to read this.
    • -
    -
  • -
-
- - FLAC 1.0.4 (24-Sep-2002) - -
-
    -
  • - Plugins: -
      -
    • Support for Vorbis comments, ID3 v1 and v2 tags.
    • -
    • Configurable title formatting and charset conversion in XMMS plugin.
    • -
    • Support for 8- and 24-bit FLAC files. There is a compile-time option for raw 24-bit output or 24bps-to-16bps linear dithering (the default).
    • -
    - flac: -
      -
    • Improved option parser (now uses getopt).
    • -
    • AIFF input support (thanks to Brady Patterson).
    • -
    • Small decoder speedup.
    • -
    • --sector-align now supported for raw input files.
    • -
    • New -T, --tag options for adding Vorbis comments while encoding.
    • -
    • New --serial-number option for use with --ogg.
    • -
    • Automatically writes vendor string in Vorbis comments.
    • -
    • Drastically reduced memory requirements.
    • -
    • Fixed bug where extra fmt/data chunks that were supposed to be skipped were not getting skipped.
    • -
    • Fixed bug in granulepos setting for Ogg FLAC streams.
    • -
    • Fixed memory leak when encoding multiple files with -V.
    • -
    - metaflac: -
      -
    • UTF-8 support in Vorbis comments.
    • -
    • New --import-vc-from and --export-vc-to commands for importing/exporting Vorbis comments from/to a file. For example, the following can be used to copy tags back and forth:
      - - metaflac --export-vc-to=- --no-utf8-convert file.flac | vorbiscomment --raw -w file.ogg
      - vorbiscomment --raw -l file.ogg | metaflac --import-vc-from=- --no-utf8-convert file.flac
      -
      -
    • -
    • Fixed bug #606796 where metaflac was failing on read-only files.
    • -
    - Libraries: -
      -
    • All APIs now meticulously documented via Doxygen. See here.
    • -
    • New libOggFLAC and libOggFLAC++ libraries. These wrap around libFLAC to provide encoding and decoding of Ogg FLAC streams, providing interfaces similar to the ones of the native FLAC libraries. These are also documented via Doxygen.
    • -
    • New FLAC__SeekableStreamEncoder and FLAC__FileEncoder in libFLAC simplify common encoding tasks.
    • -
    • New verify mode in all encoders.
    • -
    • FLAC__stream_encoder_finish() now resets the defaults just like the stream decoders.
    • -
    • Drastically reduced memory requirements of encoders and decoders.
    • -
    • Encoder now automatically writes vendor string in VORBIS_COMMENT block.
    • -
    • Encoding speedup of fixed predictors and MD5 speedup for 16bps mono/stereo signals on x86 (thanks to Miroslav Lichvar).
    • -
    • Fixed bug in metadata interface where a bps in STREAMINFO > 16 was incorrectly parsed.
    • -
    • Fixed bug where aborting stream decoder could cause infinite loop.
    • -
    • Behavior change: simplified decoder *_process() commands.
    • -
    • Behavior change: calling FLAC__stream_encoder_init() calls write callback once for "fLaC" signature and once for each metadata block.
    • -
    • Behavior change: deprecated do_escape_coding and rice_parameter_search_distance in encoder.
    • -
    -
  • -
- -
- - FLAC 1.0.3 (03-Jul-2002) - -
- -
    -
  • - New features: -
      -
    • 24-bit input support restored in flac.
    • -
    • Decoder speedup in libFLAC, which is directly passed on to the command-line decoder and plugins.
    • -
    • New -F option to flac to continue decoding in spite of errors.
    • -
    • Correctly set granulepos in Ogg packets so seeking Ogg FLAC streams will be easier.
    • -
    • New VORBIS_COMMENT metadata block for tagging with Vorbis-style comments.
    • -
    • Vastly improved metaflac, now with many editing and tagging options.
    • -
    • Partial id3v1 support in Winamp plugins.
    • -
    • Updated Winamp 3 plugin.
    • -
    • Note: new semantics for -P option in flac.
    • -
    • Note: removed -R option in flac.
    • -
    - New library features: -
      -
    • Previously mentioned decoder speedup in libFLAC.
    • -
    • New metadata interface to libFLAC for manipulating metadata in FLAC files.
    • -
    • New libFLAC++ API, an object wrapper around libFLAC.
    • -
    • New VORBIS_COMMENT metadata block for tagging with Vorbis-style comments.
    • -
    • Customizable metadata filtering by type in decoders.
    • -
    • Stream encoder can take an arbitrary list of metadata blocks, instead of just one SEEKTABLE and/or PADDING block.
    • -
    - Bugs fixed: -
      -
    • Fixed bug with using pipes under Windows.
    • -
    • Fixed several bugs in the plugins and made them more robust in general.
    • -
    • Fixed bug in flac where decoding to WAVE of a FLAC file with 0 for total_samples in the STREAMINFO block yielded a WAVE chunk of 0 size.
    • -
    • Fixed bug in Ogg packet numbering.
    • -
    -
  • -
- -
- - FLAC 1.0.2 (03-Dec-2001) - -
-
    -
  • - This release is only to fix a bug that was causing some of the plugins to crash sporadically. It can also affect libFLAC users that reuse one file decoder instance for multiple files -
  • -
-
- - FLAC 1.0.1 (14-Nov-2001) - -
-
    -
  • - New features for users: -
      -
    • Support for Ogg-FLAC, i.e. flac can now read and write FLAC streams using Ogg as the transport layer.
    • -
    • New Winamp 3 plugin based on the Wasabi Beta 1 SDK.
    • -
    • New utilities for adding FLAC support to the Monkey's Audio GUI (see how).
    • -
    • Mac OS X support. The download area now contains an OS X binary release.
    • -
    • Mingw32 support.
    • -
    • Better handling of MS-specific 'fmt' chunks in WAVE files.
    • -
    - New features for developers: -
      -
    • Added a SeekableStreamDecoder layer between StreamDecoder and FileDecoder. This makes it easier to use libFLAC in situations where files have been abstracted away. See the latest documentation for more. The interface for the StreamDecoder and FileDecoder remain the same and are still binary-compatible with libFLAC 1.0.
    • -
    • Drastically reduced the stack requirements of the encoder.
    • -
    - Bug fixes: -
      -
    • Fixed a serious bug with flac and raw input where the encoder was trying to rewind when it shouldn't, which would add 12 junk samples to the encoded file. This was not present in WAVE encoding.
    • -
    • Fixed a minor bug in libFLAC with setting the file name to stdin on a file decoder.
    • -
    • Fixed a minor bug in libFLAC where multiple calls to setting the file name on a file decoder caused leaked memory.
    • -
    • Fixed a minor bug in metaflac, now correctly skips an id3v2 tag if present.
    • -
    • Fixed a minor bug in metaflac, now correctly skips long metadata blocks.
    • -
    -
  • -
- -
- - FLAC 1.0 (20-Jul-2001) - -
-
    -
  • - It's finally here. There are a few new features but mostly it is minor bug fixes since 0.10: -
      -
    • New '--sector-align' option to flac which aligns a group of encoded files on CD audio sector boundaries.
    • -
    • New '--output-prefix' option to flac to allow the user to prepend a prefix to all output filenames (useful, for example, for encoding/decoding to a different directory).
    • -
    • Better WAVE autodetection (doesn't rely on ungetc() anymore).
    • -
    • Cleaner one-line encoding/decoding stats.
    • -
    • Changes to the libFLAC interface and type names to make binary compatibility easier to maintain in the future.
    • -
    • New '--sse-os' option to 'configure' to enable faster SSE-based routines.
    • -
    • Another (hopefully last) fix to the Winamp 2 plugin.
    • -
    • Slightly improved Rice parameter estimation.
    • -
    • Bug fixes for some very rare corner cases when encoding.
    • -
    -
  • -
-
- - FLAC 0.10 (07-Jun-2001) - -
-
    -
  • - This is probably the final beta. There have been many improvements in the last two months: -
      -
    • Both the encoder and decoder have been significantly sped up. Aside from C improvements, the code base now has an assembly infrastructure that allows assembly routines for different architectures to be easily integrated. Many key routines have now have faster IA-32 implementations (thanks to Miroslav).
    • -
    • A new metadata block SEEKTABLE has been defined to hold an arbitrary number of seek points, which speeds up seeking within a stream.
    • -
    • flac now has a command-line usage similar to 'gzip'; make sure to see the latest documentation for the new usage. It also attempts to preserve the input file's timestamp and permissions.
    • -
    • The -# options in flac have been tweaked to yield the best compression-to-encode-time ratios. The new default is -5.
    • -
    • flac can now usually autodetect WAVE files when encoding so that -fw is usually not needed when encoding from stdin.
    • -
    • The WAVE reader in flac now just ignores (with a warning) unsupported sub-chunks instead of aborting with an error.
    • -
    • Added an option '--delete-input-file' to flac which automatically deletes the input after a successful encode/decode.
    • -
    • Added an option '-o' to flac to force the output file name (the old usage of "flac - outputfilename" is no longer supported).
    • -
    • Changed the XMMS plugin to send smaller chunks of samples (now 512) so that visualization is not slow.
    • -
    • Fixed a bug in the stream decoder where the decoded samples counter got corrupted after a seek.
    • -
    - -
  • -
-
- - FLAC 0.9 (31-Mar-2001) - -
-
    -
  • - Bug fixes and some new features: -
      -
    • FLAC's sync code has been lengthened to 14 bits from 9 bits. This should enable a faster and more robust synchronization mechanism.
    • -
    • Two reserved bits were added to the frame header.
    • -
    • A CRC-16 was added to the FLAC frame footer, and the decoder now does frame integrity checking based on the CRC.
    • -
    • The format now includes a new subframe field to indicate when a subblock has one or more 0 LSBs for all samples. This increases compression on some kinds of data.
    • -
    • Added two options to the analysis mode, one for including the residual signal in the analysis file, and one for generating gnuplot files of each subframe's residual distribution with some statistics. See the latest documentation.
    • -
    • XMMS plugin now supports 8-bit files.
    • -
    • Fixed a bug in the Winamp2 plugin where the audio sounded garbled.
    • -
    • Fixed a bug in the Winamp2 plugin where Winamp would hang sporadically at the end of a track (c.f. bug #231197).
    • -
    - -
  • -
- -
- - FLAC 0.8 (05-Mar-2001) - -
-
    -
  • - Changes since 0.7: -
      -
    • Created a new utility called metaflac. It is a metadata editor for .flac files. Right now it just lists the contents of the metadata blocks but eventually it will allow update/insertion/deletion.
    • -
    • Added two new metadata blocks: PADDING which has an obvious function, and APPLICATION, which is meant to be open to third party applications. See the latest format docs for more info, or the new id registration page.
    • -
    • Added a -P option to flac to reserve a PADDING block when encoding.
    • -
    • Added support for 24-bit files to flac (the FLAC format always supported it).
    • -
    • Started the Winamp3 plugin.
    • -
    • Greatly expanded the test suite, adding more streams (24-bit streams, noise streams, non-audio streams, more patterns) and more option combinations to the encoder. The test suite runs about 30 streams and over 5000 encodings now.
    • -
    • Fixed a bug in libFLAC that happened when using an exhaustive LPC coefficient quantization search with 8 bps input.
    • -
    • Fixed a bug in libFLAC where the error estimation in the fixed predictor could overflow.
    • -
    • Fixed a bug in libFLAC where LPC was attempted even when the autocorrelation coefficients implied it wouldn't help.
    • -
    • Reworked the LPC coefficient quantizer, which also fixed another bug that might occur in rare cases.
    • -
    • Really fixed the '-V overflow' bug (c.f. bug #231976).
    • -
    • Fixed a bug in flac related to the decode buffer sizing.
    • -
    - FLAC is very close to being ready for an official release. The only known problems left are with the Winamp plugins, which should be fixed soon, and pipes with MSVC. -
  • -
-
- - FLAC 0.7 (12-Feb-2001) - -
- -
    -
  • - Changes: -
      -
    • Fixed a bug that happened when both -fr and --seek were used at the same time.
    • -
    • Fixed a bug with -p (c.f. bug #230992).
    • -
    • Fixed a bug that happened when using large (>32K) blocksizes and -V (c.f. bug #231976).
    • -
    • Fixed a bug where encoder was double-closing a file.
    • -
    • Expanded the test suite.
    • -
    • Added more optimization flags for gcc, which should speed up flac.
    • -
    -
  • -
-
- - FLAC 0.6 (28-Jan-2001) - -
-
    -
  • - The encoder is now much faster. The -m option has been sped up by 4x and -r improved, meaning that in the default compression mode (-6), encoding should be at least 3 times faster. Other changes: -
      -
    • Some bugs related to flac and pipes were fixed
    • -
    • A "loose mid-side" (-M) option to the encoder has been added, which adaptively switches between independent and mid-side coding, instead of the exhaustive search that -m does.
    • -
    • An analyze mode (-a) has been added to flac. This is useful mainly for developers; currently it will dump info about each frame and subframe to a file. It's a text file in a format that can be easily processed by scripts; a separate analysis program is in the works.
    • -
    • The source now has an autoconf/libtool-based build system. This should allow the source to build "out-of-the-box" on many more platforms.
    • -
    -
  • -
-
- - FLAC 0.5 (15-Jan-2001) - -
-
    -
  • - This is the first beta version of FLAC. Being beta, there will be no changes to the format that will break older streams, unless a serious bug involving the format is found. What this means is that, barring such a bug, streams created with 0.5 will be decodable by future versions. This version also includes some new features: -
      -
    • An MD5 signature of the unencoded audio is computed during encoding, and stored in the Encoding metadata block in the stream header. When decoding, flac will now compute the MD5 signature of the decoded data and compare it against the signature in the stream header.
    • -
    • A test mode (-t) has been added to flac. It works like decode mode but doesn't write an output file.
    • -
    -
  • -
-
- - FLAC 0.4 (23-Dec-2000) - -
-
    -
  • This version fixes a bug in the constant subframe detection. More importantly, a verify option (-V) has been added to flac that verifies the encoding process. With this option turned on, flac will create a parallel decoder while encoding to make sure that the encoded output decodes to exactly match the original input. In this way, any unknown bug in the encoder will be caught and flac will abort with an error message.
  • -
- - - -
- -
- - - - - - diff --git a/doc/html/developers.html b/doc/html/developers.html deleted file mode 100644 index 06d31c0f..00000000 --- a/doc/html/developers.html +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - developers - - - - - - -
- - - -
- -
-
- developers -
-
-
- FLAC is an open source project and we are happy to enlist the help of anyone who wants to contribute, or to help with FLAC support in other programs and devices. The preferred method of communication is the developer mailing list (you must subscribe to post).
-
- FLAC is open to third-party developers who want to add support for FLAC into their programs. All the necessary functionality is contained in the libFLAC libraries which are licensed under Xiph.org's BSD license.
-
- Some pointers to developer documentation and code:
- -
- -
- -
- -
-
- goals -
-
-
- Since FLAC is an open-source project, it's important to have a set of goals that everyone works to. They may change slightly from time to time but they're a good guideline. Changes should be in line with the goals and should not attempt to embrace any of the anti-goals.
-
- Goals -
    -
  • - FLAC should be and stay an open format with an open-source reference implementation. -
  • -
  • - FLAC should be lossless. This seems obvious but lossy compression seems to creep into every audio codec. This goal also means that flac should stay archival quality and be truly lossless for all input. Testing of releases should be thorough. -
  • -
  • - FLAC should yield respectable compression, on par or better than other lossless codecs. -
  • -
  • - FLAC should allow at least realtime decoding on even modest hardware. -
  • -
  • - FLAC should support fast sample-accurate seeking. -
  • -
  • - FLAC should allow gapless playback of consecutive streams. This follows from the lossless goal. -
  • -
  • - The FLAC project owes a lot to the many people who have advanced the audio compression field so freely, and aims also to contribute through the open-source development of new ideas. -
  • -
- Anti-goals
-
    -
  • - Lossy compression. There are already many suitable lossy formats (Ogg Vorbis, MP3, etc.). -
  • -
  • - Copy prevention, DRM, etc. There is no intention to add any copy prevention methods. Of course, we can't stop someone from encrypting a FLAC stream in another container (e.g. the way Apple encrypts AAC in MP4 with FairPlay), that is the choice of the user. -
  • -
-
- -
- - - - - - diff --git a/doc/html/documentation.html b/doc/html/documentation.html deleted file mode 100644 index d245e848..00000000 --- a/doc/html/documentation.html +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - documentation - - - - - - -
- - - -
- -
-
- documentation -
-
-
- FLAC is a general purpose audio format supported by many programs. Most of the documentation here is about the FLAC format itself and the tools we provide, but there is also information on using other programs that support FLAC. -
    -
  • Introduction - What is FLAC?
  • -
  • Getting FLAC - How to download what you need to play or make FLAC files.
  • -
  • Using FLAC - If you have some FLAC files and want to do something with them, or want to create FLAC files, look here.
  • -
  • FAQ - Frequently Asked Questions
  • -
- In more detail: -
    -
  • About the FLAC Format - An overview of the FLAC format for power users.
  • -
  • Official Tools - How to use the flac and metaflac command-line tools.
  • -
  • Comparison - A comparison of FLAC with other lossless codecs.
  • -
  • Bugs - How to report bugs and request features, and a list of known bugs in the FLAC tools.
  • -
  • Request Support - Support for the official FLAC tools. For other programs, use hydrogenaud.io
  • -
  • FLAC Mailing List - General discussion about FLAC, tools, releases, etc. (You must subscribe to post.)
  • -
- For developers who want to add FLAC support to their programs: - - Keep in mind that the online version of the documentation will always apply to the latest release. For older releases, check the documentation included with the release package. -
- -
- - - - - - diff --git a/doc/html/documentation_bugs.html b/doc/html/documentation_bugs.html deleted file mode 100644 index ad8b211a..00000000 --- a/doc/html/documentation_bugs.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - documentation - - - - - - -
- - - -
- -
- -
-
- The following are major known bugs in the current (1.3.3) release: -
    -
  • - When encoding to Ogg FLAC, the number of seek points is limited to 240. -
  • -
-
- -
- -
- -
- -
-
- To report a bug, please go to the FLAC bug tracker (or appropriately the feature request tracker, patch page, or support page).
-
- First check that there is not already an existing request. If you do submit a new request, make sure and provide an email contact and use the Monitor feature. -
- -
- - - - - - diff --git a/doc/html/documentation_example_code.html b/doc/html/documentation_example_code.html deleted file mode 100644 index dea608a2..00000000 --- a/doc/html/documentation_example_code.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - developers - - - - - - -
- - - -
- -
-
- example code -
-
-
- The FLAC source code has several small example programs that demonstrate how to use the libraries. The source is available on the download page, or can be checked out from git. The examples complement the API documentation.
-
- Currently the examples show how to encode WAV files to FLAC and vice-versa using both libFLAC and libFLAC++. Over time we'll be adding more examples. -
- -
- - - - - - diff --git a/doc/html/documentation_format_overview.html b/doc/html/documentation_format_overview.html deleted file mode 100644 index 5710522b..00000000 --- a/doc/html/documentation_format_overview.html +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - documentation - - - - - - -
- - - -
- -
-
- format -
-
-
- The basic structure of a FLAC stream is: -
    -
  • The four byte string "fLaC"
  • -
  • The STREAMINFO metadata block
  • -
  • Zero or more other metadata blocks
  • -
  • One or more audio frames
  • -
- The first four bytes are to identify the FLAC stream. The metadata that follows contains all the information about the stream except for the audio data itself. After the metadata comes the encoded audio data.
-
- METADATA
-
- FLAC defines several types of metadata blocks (see the format page for the complete list). Metadata blocks can be any length and new ones can be defined. A decoder is allowed to skip any metadata types it does not understand. Only one is mandatory: the STREAMINFO block. This block has information like the sample rate, number of channels, etc., and data that can help the decoder manage its buffers, like the minimum and maximum data rate and minimum and maximum block size. Also included in the STREAMINFO block is the MD5 signature of the unencoded audio data. This is useful for checking an entire stream for transmission errors.
-
- Other blocks allow for padding, seek tables, tags, cuesheets, and application-specific data. There are flac options for adding PADDING blocks or specifying seek points. FLAC does not require seek points for seeking but they can speed up seeks, or be used for cueing in editing applications.
-
- Also, if you have a need of a custom metadata block, you can define your own and request an ID here. Then you can reserve a PADDING block of the correct size when encoding, and overwrite the padding block with your APPLICATION block after encoding. The resulting stream will be FLAC compatible; decoders that are aware of your metadata can use it and the rest will safely ignore it.
-
- AUDIO DATA
-
- After the metadata comes the encoded audio data. Audio data and metadata are not interleaved. Like most audio codecs, FLAC splits the unencoded audio data into blocks, and encodes each block separately. The encoded block is packed into a frame and appended to the stream. The reference encoder uses a single block size for the whole stream but the FLAC format does not require it.
-
- BLOCKING
-
- The block size is an important parameter to encoding. If it is too small, the frame overhead will lower the compression. If it is too large, the modeling stage of the compressor will not be able to generate an efficient model. Understanding FLAC's modeling will help you to improve compression for some kinds of input by varying the block size. In the most general case, using linear prediction on 44.1kHz audio, the optimal block size will be between 2-6 ksamples. flac defaults to a block size of 4096 in this case. Using the fast fixed predictors, a smaller block size is usually preferable because of the smaller frame header.
-
- INTER-CHANNEL DECORRELATION
-
- In the case of stereo input, once the data is blocked it is optionally passed through an inter-channel decorrelation stage. The left and right channels are converted to center and side channels through the following transformation: mid = (left + right) / 2, side = left - right. This is a lossless process, unlike joint stereo. For normal CD audio this can result in significant extra compression. flac has two options for this: -m always compresses both the left-right and mid-side versions of the block and takes the smallest frame, and -M, which adaptively switches between left-right and mid-side.
-
- MODELING
-
- In the next stage, the encoder tries to approximate the signal with a function in such a way that when the approximation is subtracted, the result (called the residual, residue, or error) requires fewer bits-per-sample to encode. The function's parameters also have to be transmitted so they should not be so complex as to eat up the savings. FLAC has two methods of forming approximations: 1) fitting a simple polynomial to the signal; and 2) general linear predictive coding (LPC). I will not go into the details here, only some generalities that involve the encoding options.
-
- First, fixed polynomial prediction (specified with -l 0) is much faster, but less accurate than LPC. The higher the maximum LPC order, the slower, but more accurate, the model will be. However, there are diminishing returns with increasing orders. Also, at some point (usually around order 9) the part of the encoder that guesses what is the best order to use will start to get it wrong and the compression will actually decrease slightly; at that point you will have to you will have to use the exhaustive search option -e to overcome this, which is significantly slower.
-
- Second, the parameters for the fixed predictors can be transmitted in 3 bits whereas the parameters for the LPC model depend on the bits-per-sample and LPC order. This means the frame header length varies depending on the method and order you choose and can affect the optimal block size.
-
- RESIDUAL CODING
-
- Once the model is generated, the encoder subracts the approximation from the original signal to get the residual (error) signal. The error signal is then losslessly coded. To do this, FLAC takes advantage of the fact that the error signal generally has a Laplacian (two-sided geometric) distribution, and that there are a set of special Huffman codes called Rice codes that can be used to efficiently encode these kind of signals quickly and without needing a dictionary.
-
- Rice coding involves finding a single parameter that matches a signal's distribution, then using that parameter to generate the codes. As the distribution changes, the optimal parameter changes, so FLAC supports a method that allows the parameter to change as needed. The residual can be broken into several contexts or partitions, each with it's own Rice parameter. flac allows you to specify how the partitioning is done with the -r option. The residual can be broken into 2^n partitions, by using the option -r n,n. The parameter n is called the partition order. Furthermore, the encoder can be made to search through m to n partition orders, taking the best one, by specifying -r m,n. Generally, the choice of n does not affect encoding speed but m,n does. The larger the difference between m and n, the more time it will take the encoder to search for the best order. The block size will also affect the optimal order.
-
- FRAMING
-
- An audio frame is preceded by a frame header and trailed by a frame footer. The header starts with a sync code, and contains the minimum information necessary for a decoder to play the stream, like sample rate, bits per sample, etc. It also contains the block or sample number and an 8-bit CRC of the frame header. The sync code, frame header CRC, and block/sample number allow resynchronization and seeking even in the absence of seek points. The frame footer contains a 16-bit CRC of the entire encoded frame for error detection. If the reference decoder detects a CRC error it will generate a silent block.
-
- MISCELLANEOUS
-
- As a convenience, the reference decoder knows how to skip ID3v1 and ID3v2 tags. Note however that the FLAC specification does not require compliant implementations to support ID3 in any form and their use is strongly discouraged.
-
- flac has a verify option -V that verifies the output while encoding. With this option, a decoder is run in parallel to the encoder and its output is compared against the original input. If a difference is found flac will stop with an error. -
- -
- - - - - - diff --git a/doc/html/documentation_tools.html b/doc/html/documentation_tools.html deleted file mode 100644 index 971dfeba..00000000 --- a/doc/html/documentation_tools.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - documentation - - - - - - -
- - - -
- -
-
- tools -
-
-
- FLAC is a general purpose audio format supported by many programs, but in this section we are concentrating on just the official tools provided by the FLAC project: -
    -
  • flac - The command-line encoder and decoder.
  • -
  • metaflac - The command-line metadata editor.
  • -
- Other resources: -
    -
  • Bugs - How to report bugs and request features, and a list of known bugs in the FLAC tools.
  • -
  • Request Support - Support for the official FLAC tools. For other programs, use hydrogenaud.io
  • -
  • FLAC Mailing List - General discussion about FLAC, tools, releases, etc. (You must subscribe to post.)
  • -
-
- See Getting FLAC for instructions on downloading and installing the official FLAC tools, or Using FLAC for instructions and guides on playing FLAC files, ripping CDs to FLAC, etc. -
- -
- - - - - - diff --git a/doc/html/documentation_tools_flac.html b/doc/html/documentation_tools_flac.html deleted file mode 100644 index 8496aca9..00000000 --- a/doc/html/documentation_tools_flac.html +++ /dev/null @@ -1,1189 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - documentation - - - - - - -
- - - -
- -
-
- flac -
-
-
- Table of Contents - - General Usage
-
- flac is the command-line file encoder/decoder. The encoder currently supports as input RIFF WAVE, Wave64, RF64, AIFF, FLAC or Ogg FLAC format, or raw interleaved samples. The decoder currently can output to RIFF WAVE, Wave64, RF64, or AIFF format, or raw interleaved samples. flac only supports linear PCM samples (in other words, no A-LAW, uLAW, etc.), and the input must be between 4 and 24 bits per sample. This is not a limitation of the FLAC format, just the reference encoder/decoder.
-
- flac assumes that files ending in ".wav" or that have the RIFF WAVE header present are WAVE files, files ending in ".w64" or have the Wave64 header present are Wave64 files, files ending in ".rf64" or have the RF64 header present are RF64 files, files ending in ".aif" or ".aiff" or have the AIFF header present are AIFF files, and files ending in ".flac" or have the FLAC header present are FLAC files. This assumption may be overridden with a command-line option. It also assumes that files ending in ".oga" or ".ogg" or have the Ogg FLAC header present are Ogg FLAC files. Other than this, flac makes no assumptions about file extensions, though the convention is that FLAC files have the extension ".flac" (or ".fla" on ancient "8.3" file systems like FAT-16).
-
- Before going into the full command-line description, a few other things help to sort it out: 1) flac encodes by default, so you must use -d to decode; 2) the options -0 .. -8 (or --fast and --best) that control the compression level actually are just synonyms for different groups of specific encoding options (described later) and you can get the same effect by using the same options; 3) flac behaves similarly to gzip in the way it handles input and output files.
-
- Skip to the tutorial below for examples of some common tasks.
-
- flac will be invoked one of four ways, depending on whether you are encoding, decoding, testing, or analyzing: - - In any case, if no inputfile is specified, stdin is assumed. If only one inputfile is specified, it may be "-" for stdin. When stdin is used as input, flac will write to stdout. Otherwise flac will perform the desired operation on each input file to similarly named output files (meaning for encoding, the extension will be replaced with ".flac", or appended with ".flac" if the input file has no extension, and for decoding, the extension will be ".wav" for WAVE output and ".raw" for raw output). The original file is not deleted unless --delete-input-file is specified.
-
- If you are encoding/decoding from stdin to a file, you should use the -o option like so: -
    -
  • - flac [options] -o outputfile -
  • -
  • - flac -d [options] -o outputfile -
  • -
- which are better than: -
    -
  • - flac [options] > outputfile -
  • -
  • - flac -d [options] > outputfile -
  • -
- since the former allows flac to seek backwards to write the STREAMINFO or RIFF WAVE header contents when necessary.
-
- Also, you can force output data to go to stdout using -c.
-
- To encode or decode files that start with a dash, use -- to signal the end of options, to keep the filenames themselves from being treated as options: -
    -
  • - flac -V -- -01-filename.wav -
  • -
- The encoding options affect the compression ratio and encoding speed. The format options are used to tell flac the arrangement of samples if the input file (or output file when decoding) is a raw file. If it is a RIFF WAVE, Wave64, RF64, or AIFF file the format options are not needed since they are read from the file's header.
-
- In test mode, flac acts just like in decode mode, except no output file is written. Both decode and test modes detect errors in the stream, but they also detect when the MD5 signature of the decoded audio does not match the stored MD5 signature, even when the bitstream is valid.
-
- flac can also re-encode FLAC files. In other words, you can specify a FLAC or Ogg FLAC file as an input to the encoder and it will decoder it and re-encode it according to the options you specify. It will also preserve all the metadata unless you override it with other options (e.g. specifying new tags, seekpoints, cuesheet, padding, etc.).
-
- flac has been tuned so that the default settings yield a good speed vs. compression tradeoff for many kinds of input. However, if you are looking to maximize the compression rate or speed, or want to use the full power of FLAC's metadata system, see About the FLAC Format.
-
- - Tutorial
-
- Some common encoding tasks using flac:
-
- flac abc.wav
- Encode abc.wav to abc.flac using the default compression setting. abc.wav is not deleted.
-
- flac --delete-input-file abc.wav
- Like above, except abc.wav is deleted if there were no errors.
-
- flac --delete-input-file -w abc.wav
- Like above, except abc.wav is deleted if there were no errors or warnings.
-
- flac --best abc.wav
- Encode abc.wav to abc.flac using the highest compression setting.
-
- flac --verify abc.wav
- Encode abc.wav to abc.flac and internally decode abc.flac to make sure it matches abc.wav.
-
- flac -o my.flac abc.wav
- Encode abc.wav to my.flac.
-
- flac -T "TITLE=Bohemian Rhapsody" -T "ARTIST=Queen" abc.wav
- Encode abc.wav and add some tags at the same time to abc.flac.
-
- flac *.wav
- Encode all .wav files in the current directory. NOTE: Wildcards on Windows
-
- flac abc.aiff
- Encode abc.aiff to abc.flac.
-
- flac abc.rf64
- Encode abc.rf64 to abc.flac.
-
- flac abc.w64
- Encode abc.w64 to abc.flac.
-
- flac abc.flac --force
- This one's a little tricky: notice that flac is in encode mode by default (you have to specify -d to decode) so this command actually recompresses abc.flac back to abc.flac. --force is needed to make sure you really want to overwrite abc.flac with a new version. Why would you want to do this? It allows you to recompress an existing FLAC file with (usually) higher compression options or a newer version of FLAC and preserve all the metadata like tags too.
-
- - Some common decoding tasks using flac:
-
- flac -d abc.flac
- Decode abc.flac to abc.wav. abc.flac is not deleted. NOTE: Without -d it means re-encode abc.flac to abc.flac (see above).
-
- flac -d --force-aiff-format abc.flac
- flac -d -o abc.aiff abc.flac
- Two different ways of decoding abc.flac to abc.aiff (AIFF format). abc.flac is not deleted.
-
- flac -d --force-rf64-format abc.flac
- flac -d -o abc.rf64 abc.flac
- Two different ways of decoding abc.flac to abc.rf64 (RF64 format). abc.flac is not deleted.
-
- flac -d --force-wave64-format abc.flac
- flac -d -o abc.w64 abc.flac
- Two different ways of decoding abc.flac to abc.w64 (Wave64 format). abc.flac is not deleted.
-
- flac -d -F abc.flac
- Decode abc.flac to abc.wav and don't abort if errors are found (useful for recovering as much as possible from corrupted files).
-
- flac has many other useful options, described below.
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- General Options -
- - -v, --version - - Show the flac version number. -
- - -h, --help - - Show basic usage and a list of all options. Running flac without arguments shows the short help screen by default. -
- - -H, --explain - - Show detailed explanation of usage and all options. Running flac without arguments shows the short help screen by default. -
- - -d, --decode - - Decode (flac encodes by default). flac will exit with an exit code of 1 (and print a message, even in silent mode) if there were any errors during decoding, including when the MD5 checksum does not match the decoded output. Otherwise the exit code will be 0. -
- - -t, --test - - Test (same as -d except no decoded file is written). The exit codes are the same as in decode mode. -
- - -a, --analyze - - Analyze (same as -d except an analysis file is written). The exit codes are the same as in decode mode. This option is mainly for developers; the output will be a text file that has data about each frame and subframe. -
- - -c, --stdout - - Write output to stdout. -
- - -s, --silent - - Silent: do not show encoding/decoding statistics. -
- - --totally-silent - - Do not print anything of any kind, including warnings or errors. The exit code will be the only way to determine successful completion. -
- - --no-utf8-convert - - Do not convert tags from local charset to UTF-8. This is useful for scripts, and setting tags in situations where the locale is wrong. This option must appear before any tag options! -
- - -w, --warnings-as-errors - - Treat all warnings as errors (which cause flac to terminate with a non-zero exit code). -
- - -f, --force - - Force overwriting of output files. By default, flac warns that the output file already exists and continues to the next file. -
- - -o filename,
--output-name=filename -
- Force the output file name (usually flac just changes the extension). May only be used when encoding a single file. May not be used in conjunction with --output-prefix. -
- - --output-prefix=string - - Prefix each output file name with the given string. This can be useful for encoding/decoding files to a different directory. Make sure if your string is a path name that it ends with a trailing '/' slash. -
- - --delete-input-file - - Automatically delete the input file after a successful encode or decode. If there was an error (including a verify error) the input file is left intact. -
- - --preserve-modtime - - Output files have their timestamps/permissions set to match those of their inputs (this is default). Use --no-preserve-modtime to make output files have the current time and default permissions. -
- - --keep-foreign-metadata - - If encoding, save WAVE, Wave64, RF64, or AIFF non-audio chunks in FLAC metadata. If decoding, restore any saved non-audio chunks from FLAC metadata when writing the decoded file. Foreign metadata cannot be transcoded, e.g. WAVE chunks saved in a FLAC file cannot be restored when decoding to AIFF. Input and output must be regular files (not stdin or stdout).
- -
- - --skip={#|mm:ss.ss}
--skip={#|mm:ss,ss}
-
- Skip over the first # of samples of the input. This works for both encoding and decoding, but not testing. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second.
-
- Note that the use of either a dot or a comma depends on the locale used for the system.
-
- Examples:
-
- --skip=123 : skip the first 123 samples of the input
- --skip=1:23.45 : skip the first 1 minute and 23.45 seconds of the input, with a locale using the point as decimal separator
- --skip=1:23,45 : skip the first 1 minute and 23.45 seconds of the input, with a locale using the comma as decimal separator -
- - --until={#|[+|-]mm:ss.ss}
--until={#|[+|-]mm:ss,ss}
-
- Stop at the given sample number for each input file. This works for both encoding and decoding, but not testing. The given sample number is not included in the decoded output. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second. If a + sign is at the beginning, the --until point is relative to the --skip point. If a - sign is at the beginning, the --until point is relative to end of the audio.
-
- Note that the use of either a dot or a comma depends on the locale used for the system.
-
- Examples:
-
- --until=123 : decode only the first 123 samples of the input (samples 0-122, stopping at 123)
- --until=1:23.45 : decode only the first 1 minute and 23.45 seconds of the input
- --until=1:23,45 : decode only the first 1 minute and 23.45 seconds of the input, if your locale setting uses a comma as decimal separator
- --skip=1:00 --until=+1:23.45 : decode 1:00.00 to 2:23.45
- --until=-1:23.45 : decode everything except the last 1 minute and 23.45 seconds
- --until=-0:00 : decode until the end of the input (the same as not specifying --until) -
- - --ogg - - When encoding, generate Ogg FLAC output instead of native FLAC. Ogg FLAC streams are FLAC streams wrapped in an Ogg transport layer. The resulting file should have an '.oga' extension and will still be decodable by flac.
-
- When decoding, force the input to be treated as Ogg FLAC. This is useful when piping input from stdin or when the filename does not end in '.oga' or '.ogg'.
-
- NOTE: Ogg FLAC files created prior to flac 1.1.1 used an ad-hoc mapping and do not support seeking. They should be decoded and re-encoded with flac 1.1.1 or later. -
- - --serial-number=# - - When used with --ogg, specifies the serial number to use for the first Ogg FLAC stream, which is then incremented for each additional stream. When encoding and no serial number is given, flac uses a random number for the first stream, then increments it for each additional stream. When decoding and no number is given, flac uses the serial number of the first page. -
-
- -
- -
- - - - - - - - - - - - -
- Analysis Options -
- - --residual-text - - Includes the residual signal in the analysis file. This will make the file very big, much larger than even the decoded file. -
- - --residual-gnuplot - - Generates a gnuplot file for every subframe; each file will contain the residual distribution of the subframe. This will create a lot of files. -
-
- -
- -
- - - - - - - - - - - - - - - - -
- Decoding Options -
- - --cue=[#.#][-[#.#]] - - Set the beginning and ending cuepoints to decode. The optional first #.# is the track and index point at which decoding will start; the default is the beginning of the stream. The optional second #.# is the track and index point at which decoding will end; the default is the end of the stream. If the cuepoint does not exist, the closest one before it (for the start point) or after it (for the end point) will be used. If those don't exist, the start of the stream (for the start point) or end of the stream (for the end point) will be used. The cuepoints are merely translated into sample numbers then used as --skip and --until.
-
- Examples:
-
- --cue=- : decode the entire stream
- --cue=4.1 : decode from track 4, index 1 to the end of the stream
- --cue=4.1- : decode from track 4, index 1 to the end of the stream
- --cue=-4.1 : decode from the beginning of the stream up to, but not including, track 4, index 1
- --cue=2.1-2.4 : decode from track 2, index 1, up to, but not including, track 2, index 4
- --cue=9.1-10.1 : decode from track 9 the way it would be played on a CD player; this works even if the CD has no 10th track. -
- - -F,
--decode-through-errors -
- By default flac stops decoding with an error and removes the partially decoded file if it encounters a bitstream error. With -F, errors are still printed but flac will continue decoding to completion. Note that errors may cause the decoded audio to be missing some samples or have silent sections. -
- - --apply-replaygain-which-is-not-lossless[=<specification>] - - Applies ReplayGain values while decoding.
-
- WARNING: THIS IS NOT LOSSLESS. DECODED AUDIO WILL NOT BE IDENTICAL TO THE ORIGINAL WITH THIS OPTION.
-
- The equals sign and <specification> is optional. If omitted, the default is 0aLn1.
-
- The <specification> is a shorthand notation for describing how to apply ReplayGain. All components are optional but order is important. '[]' means 'optional'. '|' means 'or'. '{}' means required. The format is:
-
-   [<preamp>][a|t][l|L][n{0|1|2|3}] -
    -
  • - <preamp>
    -   A floating point number in dB. This is added to the existing gain value. -
  • -
  • - a|t
    -   Specify 'a' to use the album gain, or 't' to use the track gain. If tags for the preferred kind (album/track) do not exist but tags for the other (track/album) do, those will be used instead. -
  • -
  • - l|L
    -   Specify 'l' to peak-limit the output, so that the ReplayGain peak value is full-scale. Specify 'L' to use a 6dB hard limiter that kicks in when the signal approaches full-scale. -
  • -
  • - n{0|1|2|3}
    -   Specify the amount of noise shaping. ReplayGain synthesis happens in floating point; the result is dithered before converting back to integer. This quantization adds noise. Noise shaping tries to move the noise where you won't hear it as much. 0 means no noise shaping, 1 means 'low', 2 means 'medium', 3 means 'high'. -
  • -
- For example, the default of 0aLn1 means 0dB preamp, use album gain, 6dB hard limit, low noise shaping.
-
- --apply-replaygain-which-is-not-lossless=3 means 3dB preamp, use album gain, no limiting, no noise shaping.
-
- flac uses the ReplayGain tags for the calculation. If a stream does not have the required tags or they can't be parsed, decoding will continue with a warning, and no ReplayGain is applied to that stream. -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Encoding Options -
- - -V, --verify - - Verify the encoding process. With this option, flac will create a parallel decoder that decodes the output of the encoder and compares the result against the original. It will abort immediately with an error if a mismatch occurs. -V increases the total encoding time but is guaranteed to catch any unforeseen bug in the encoding process. -
- - --lax - - Allow encoder to generate non-Subset files. The resulting FLAC file may not be streamable or might have trouble being played in all players (especially hardware devices), so you should only use this option in combination with custom encoding options meant for archival. -
- - --replay-gain - - Calculate ReplayGain values and store them as FLAC tags, similar to VorbisGain. Title gains/peaks will be computed for each input file, and an album gain/peak will be computed for all files. All input files must have the same resolution, sample rate, and number of channels. Only mono and stereo files are allowed, and the sample rate must be one of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, or 48 kHz. Also note that this option may leave a few extra bytes in a PADDING block as the exact size of the tags is not known until all files are processed.
-
- Note that this option cannot be used when encoding to standard output (stdout). -
- - --cuesheet=FILENAME - - Import the given cuesheet file and store it in a CUESHEET metadata block. This option may only be used when encoding a single file. A seekpoint will be added for each index point in the cuesheet to the SEEKTABLE unless --no-cued-seekpoints is specified.
-
- The cuesheet file must be of the sort written by CDRwin, CDRcue, EAC, etc. See also cuesheet syntax. -
- - --picture={FILENAME|SPECIFICATION} - - Import a picture and store it in a PICTURE metadata block. More than one --picture command can be specified. Either a filename for the picture file or a more complete specification form can be used. The SPECIFICATION is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. FILENAME is just shorthand for ||||FILENAME. The format of SPECIFICATION is
-
-   [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE
-
- TYPE is optional; it is a number from one of:
-
    -
  • 0: Other
  • -
  • 1: 32x32 pixels 'file icon' (PNG only)
  • -
  • 2: Other file icon
  • -
  • 3: Cover (front)
  • -
  • 4: Cover (back)
  • -
  • 5: Leaflet page
  • -
  • 6: Media (e.g. label side of CD)
  • -
  • 7: Lead artist/lead performer/soloist
  • -
  • 8: Artist/performer
  • -
  • 9: Conductor
  • -
  • 10: Band/Orchestra
  • -
  • 11: Composer
  • -
  • 12: Lyricist/text writer
  • -
  • 13: Recording Location
  • -
  • 14: During recording
  • -
  • 15: During performance
  • -
  • 16: Movie/video screen capture
  • -
  • 17: A bright coloured fish
  • -
  • 18: Illustration
  • -
  • 19: Band/artist logotype
  • -
  • 20: Publisher/Studio logotype
  • -
- The default is 3 (front cover). There may only be one picture each of type 1 and 2 in a file.
-
- MIME-TYPE is optional; if left blank, it will be detected from the file. For best compatibility with players, use pictures with MIME type image/jpeg or image/png. The MIME type can also be --> to mean that FILE is actually a URL to an image, though this use is discouraged.
-
- DESCRIPTION is optional; the default is an empty string.
-
- The next part specifies the resolution and color information. If the MIME-TYPE is image/jpeg, image/png, or image/gif, you can usually leave this empty and they can be detected from the file. Otherwise, you must specify the width in pixels, height in pixels, and color depth in bits-per-pixel. If the image has indexed colors you should also specify the number of colors used. When manually specified, it is not checked against the file for accuracy.
-
- FILE is the path to the picture file to be imported, or the URL if MIME type is -->
-
- For example, the specification |image/jpeg|||../cover.jpg will embed the JPEG file at ../cover.jpg, defaulting to type 3 (front cover) and an empty description. The resolution and color info will be retrieved from the file itself.
-
- The specification 4|-->|CD|320x300x24/173|http://blah.blah/backcover.tiff will embed the given URL, with type 4 (back cover), description "CD", and a manually specified resolution of 320x300, 24 bits-per-pixel, and 173 colors. The file at the URL will not be fetched; the URL itself is stored in the PICTURE metadata block. -
- - --sector-align - - Align encoding of multiple CD format files on sector boundaries. This option is only allowed when encoding files all of which have a 44.1kHz sample rate and 2 channels. With --sector-align, the encoder will align the resulting .flac streams so that their lengths are even multiples of a CD sector (1/75th of a second, or 588 samples). It does this by carrying over any partial sector at the end of each file to the next stream. The last stream will be padded to alignment with zeroes.
-
- This option will have no effect if the files are already aligned (as is the normally the case with WAVE files ripped from a CD). flac can only align a set of files given in one invocation of flac.
-
- WARNING: The ordering of files is important! If you give a command like 'flac --sector-align *.wav' the shell may not expand the wildcard to the order you expect. To be safe you should 'echo *.wav' first to confirm the order, or be explicit like 'flac --sector-align 8.wav 9.wav 10.wav'.
-
- NOTE:This option is DEPRECATED and may not exist in future version of flac. shntool provides similar functionality. -
- - --ignore-chunk-sizes - - When encoding to flac, ignore the file size headers in WAV and AIFF files to attempt to work around problems with over-sized or malformed files.
-
- WAV and AIFF files both have an unsigned 32 bit numbers in the file header which specifes the length of audio data. Since this number is unsigned 32 bits, that limits the size of a valid file to being just over 4 Gigabytes. Files larger than this are mal-formed, but should be read correctly using this option.
-
-
- - -S {#|X|#x|#s},
--seekpoint={#|X|#x|#s} -
- Include a point or points in a SEEKTABLE:
-
    -
  • - : a specific sample number for a seek point -
  • -
  • - : a placeholder point (always goes at the end of the SEEKTABLE) -
  • -
  • - #x : # evenly spaced seekpoints, the first being at sample 0 -
  • -
  • - #s : a seekpoint every # seconds; # does not have to be a whole number, it can be, for example, 9.5, meaning a seekpoint every 9.5 seconds -
  • -
- You may use many -S options; the resulting SEEKTABLE will be the unique-ified union of all such values.
- With no -S options, flac defaults to '-S 10s'. Use --no-seektable for no SEEKTABLE.
- NOTE: -S #x and -S #s will not work if the encoder can't determine the input size before starting.
- NOTE: if you use -S # and # is >= samples in the input, there will be either no seek point entered (if the input size is determinable before encoding starts) or a placeholder point (if input size is not determinable).
-
- - -P #, --padding=# - - Tell the encoder to write a PADDING metadata block of the given length (in bytes) after the STREAMINFO block. This is useful if you plan to tag the file later with an APPLICATION block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the PADDING block. Note that the total length of the PADDING block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no PADDING block at all to be written with --no-padding. The encoder writes a PADDING block of 8192 bytes by default (or 65536 bytes if the input audio stream is more than 20 minutes long). -
- - -T FIELD=VALUE,
--tag=FIELD=VALUE -
- Add a FLAC tag. The comment must adhere to the Vorbis comment spec (which FLAC tags implement), i.e. the FIELD must contain only legal characters, terminated by an 'equals' sign. Make sure to quote the comment if necessary. This option may appear more than once to add several comments. NOTE: all tags will be added to all encoded files. -
- - --tag-from-file=FIELD=FILENAME - - Like --tag, except FILENAME is a file whose contents will be read verbatim to set the tag value. The contents will be converted to UTF-8 from the local charset. This can be used to store a cuesheet in a tag (e.g. --tag-from-file="CUESHEET=image.cue"). Do not try to store binary data in tag fields! Use APPLICATION blocks for that. -
- - -b #, --blocksize=# - - Specify the block size in samples. Subset streams must use one of 192/576/1152/2304/4608/256/512/1024/2048/4096 (and 8192/16384 if the sample rate is >48kHz). The reference encoder uses the same block size for the entire stream. -
- - -m, --mid-side - - Enable mid-side coding (only for stereo streams). Tends to increase compression by a few percent on average. For each block both the stereo pair and mid-side versions of the block will be encoded, and smallest resulting frame will be stored. -
- - -M, --adaptive-mid-side - - Enable adaptive mid-side coding (only for stereo streams). Like -m but the encoder adaptively switches between independent and mid-side coding, which is faster but yields less compression than -m (which does an exhaustive search). -
- - -0 .. -8 - - Fastest compression .. highest compression. The default is -5. -
- - -0, --compression-level-0 - - Synonymous with -l 0 -b 1152 -r 3 -
- - -1, --compression-level-1 - - Synonymous with -l 0 -b 1152 -M -r 3 -
- - -2, --compression-level-2 - - Synonymous with -l 0 -b 1152 -m -r 3 -
- - -3, --compression-level-3 - - Synonymous with -l 6 -b 4096 -r 4 -
- - -4, --compression-level-4 - - Synonymous with -l 8 -b 4096 -M -r 4 -
- - -5, --compression-level-5 - - Synonymous with -l 8 -b 4096 -m -r 5 -
- - -6, --compression-level-6 - - Synonymous with -l 8 -b 4096 -m -r 6 -A tukey(0.5);partial_tukey(2) -
- - -7, --compression-level-7 - - Synonymous with -l 12 -b 4096 -m -r 6 -A tukey(0.5);partial_tukey(2) -
- - -8, --compression-level-8 - - Synonymous with -l 12 -b 4096 -m -r 6 -A tukey(0.5);partial_tukey(2);punchout_tukey(3) -
- - --fast - - Fastest compression. Currently synonymous with -0 -
- - --best - - Highest compression. Currently synonymous with -8 -
- - -e,
--exhaustive-model-search -
- Exhaustive model search (expensive!). Normally the encoder estimates the best model to use and encodes once based on the estimate. With an exhaustive model search, the encoder will generate subframes for every order and use the smallest. If the max LPC order is high this can significantly increase the encode time but can shave off another 0.5%. -
- - -A "function", --apodization="function" - - Window audio data with given the apodization function. The functions are: bartlett, bartlett_hann, blackman, blackman_harris_4term_92db, connes, flattop, gauss(STDDEV), hamming, hann, kaiser_bessel, nuttall, rectangle, triangle, tukey(P), partial_tukey(n[/ov[/P]]), punchout_tukey(n[/ov[/P]]), welch.
- For gauss(STDDEV), STDDEV is the standard deviation (0<STDDEV<=0.5).
- For tukey(P), P specifies the fraction of the window that is tapered (0<=P<=1; P=0 corresponds to "rectangle" and P=1 corresponds to "hann").
- For partial_tukey(n) and punchout_tukey(n), n apodization functions are added that span different parts of each block. Values of 2 to 6 seem to yield sane results. If necessary, an overlap can be specified, as can be the taper parameter, for example partial_tukey(2/0.2) or partial_tukey(2/0.2/0.5). ov should be smaller than 1 and can be negative.
- Please note that P, STDDEV and ov are locale specific, so a comma as decimal separator might be required instead of a dot.
- More than one -A option (up to 32) may be used. Any function that is specified erroneously is silently dropped. The encoder chooses suitable defaults in the absence of any -A options; any -A option specified replaces the default(s).
- When more than one function is specified, then for every subframe the encoder will try each of them separately and choose the window that results in the smallest compressed subframe. Multiple functions can greatly increase the encoding time.
-
- - -l #, --max-lpc-order=# - - Specifies the maximum LPC order. This number must be <= 32. For Subset streams, it must be <=12 if the sample rate is <=48kHz. If 0, the encoder will not attempt generic linear prediction, and use only fixed predictors. Using fixed predictors is faster but usually results in files being 5-10% larger. -
- - -q #,
--qlp-coeff-precision=# -
- Specifies the precision of the quantized LP coefficients, in bits. The default is -q 0, which means let the encoder decide based on the signal. Unless you really know your input file it's best to leave this up to the encoder. -
- - -p,
--qlp-coeff-precision-search -
- Do exhaustive LP coefficient quantization optimization. This option overrides any -q option. It is expensive and typically will only improve the compression a tiny fraction of a percent. -q has no effect when -l 0 is used. -
- - -r [#,]#,
--rice-partition-order=[#,]# -
- Set the [min,]max residual partition order. The min value defaults to 0 if unspecified.
-
- By default the encoder uses a single Rice parameter for the subframe's entire residual. With this option, the residual is iteratively partitioned into 2^min# .. 2^max# pieces, each with its own Rice parameter. Higher values of max# yield diminishing returns. The most bang for the buck is usually with -r 2,2 (more for higher block sizes). This usually shaves off about 1.5%. The technique tends to peak out about when blocksize/(2^n)=128. Use -r 0,15 to force the highest degree of optimization. -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Format Options -
- - --endian={big|little} - - Specify big-endian or little-endian byte order in the raw file. -
- - --channels=# - - Specify the number of channels in the raw file. -
- - --bps=# - - Specify the number of bits per sample in the raw file. -
- - --sample-rate=# - - Specify the sample rate of the raw file. -
- - --sign={signed|unsigned} - - Specify that the samples in the raw file are signed or unsigned (the default is signed). -
- - --input-size=# - - Specify the size of the raw input in bytes. If you are encoding raw samples from stdin, you must set this option in order to be able to use --skip, --until, --cuesheet, or other options that need to know the size of the input beforehand. If the size given is greater than what is found in the input stream, the encoder will complain about an unexpected end-of-file. If the size given is less, samples will be truncated. -
- - --force-raw-format - - Treat the input file (or output file if decoding) as a raw file, regardless of the extension. -
- - --force-aiff-format - - Force the decoder to output AIFF format. This option is not needed if the output filename (as set by -o) ends with .aif or .aiff. Also, this option has no effect when encoding since input AIFF is auto-detected. -
- - --force-rf64-format - - Force the decoder to output RF64 format. This option is not needed if the output filename (as set by -o) ends with .rf64. Also, this option has no effect when encoding since input RF64 is auto-detected. -
- - --force-wave64-format - - Force the decoder to output Wave64 format. This option is not needed if the output filename (as set by -o) ends with .w64. Also, this option has no effect when encoding since input Wave64 is auto-detected. -
-
- -
- -
- - - - - - - - -
- Negative Options -
- --no-adaptive-mid-side
- --no-cued-seekpoints
- --no-decode-through-errors
- --no-delete-input-file
- --no-escape-coding
- --no-exhaustive-model-search
- --no-ignore-chunk-sizes
- --no-lax
- --no-mid-side
- --no-ogg
- --no-padding
- --no-preserve-modtime
- --no-qlp-coeff-prec-search
- --no-residual-gnuplot
- --no-residual-text
- --no-sector-align
- --no-seektable
- --no-silent
- --no-verify - --no-warnings-as-errors -
- Can all be used to turn off a particular option. -
-
- -
- Option Index
-
- -0
- -1
- -2
- -3
- -4
- -5
- -6
- -7
- -8
- -A
- -a
- --adaptive-mid-side
- --analyze
- --apodization
- --apply-replaygain-which-is-not-lossless
- -b
- --best
- --blocksize
- --bps
- -c
- --channels
- --compression-level-0
- --compression-level-1
- --compression-level-2
- --compression-level-3
- --compression-level-4
- --compression-level-5
- --compression-level-6
- --compression-level-7
- --compression-level-8
- --cue
- --cuesheet
- -d
- --decode
- --decode-through-errors
- --delete-input-file
- -e
- --endian
- --exhaustive-model-search
- --explain
- -F
- -f
- --fast
- --force-raw-format
- --force-aiff-format
- --force-rf64-format
- --force-wave64-format
- --force
- -H
- -h
- --help
- --ignore-chunk-sizes
- --input-size
- --keep-foreign-metadata
- -l
- --lax
- -M
- -m
- --max-lpc-order
- --mid-side
- --no-adaptive-mid-side
- --no-cued-seekpoints
- --no-decode-through-errors
- --no-delete-input-file
- --no-escape-coding
- --no-exhaustive-model-search
- --no-keep-foreign-metadata
- --no-lax
- --no-mid-side
- --no-ogg
- --no-padding
- --no-preserve-modtime
- --no-qlp-coeff-prec-search
- --no-residual-gnuplot
- --no-residual-text
- --no-sector-align
- --no-seektable
- --no-silent
- --no-verify
- --no-warnings-as-errors
- --no-utf8-convert
- -o
- --ogg
- --output-name
- --output-prefix
- -P
- -p
- --padding
- --picture
- -q
- --qlp-coeff-precision
- --qlp-coeff-precision-search
- -r
- --replay-gain
- --residual-gnuplot
- --residual-text
- --rice-partition-order
- -S
- -s
- --sample-rate
- --sector-align
- --seekpoint
- --serial-number
- --sign
- --silent
- --skip
- --stdout
- -T
- -t
- --tag
- --tag-from-file
- --test
- --totally-silent
- --until
- -V
- -v
- --verify
- -w
- --warnings-as-errors
- --version
- -
- -
- - - - - - diff --git a/doc/html/documentation_tools_metaflac.html b/doc/html/documentation_tools_metaflac.html deleted file mode 100644 index 122d70b8..00000000 --- a/doc/html/documentation_tools_metaflac.html +++ /dev/null @@ -1,566 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - documentation - - - - - - -
- - - -
- -
-
- metaflac -
-
-
- Table of Contents - - General Usage
-
- metaflac is the command-line .flac file metadata editor. You can use it to list the contents of metadata blocks, edit, delete or insert blocks, and manage padding.
-
- metaflac takes a set of "options" (though some are not optional) and a set of FLAC files to operate on. There are three kinds of "options": -
    -
  • - Major operations, which specify a mode of operation like listing blocks, removing blocks, etc. These will have sub-operations describing exactly what is to be done. -
  • -
  • - Shorthand operations, which are convenient synonyms for major operations. For example, there is a shorthand operation --show-sample-rate that shows just the sample rate field from the STREAMINFO metadata block. -
  • -
  • - Global options, which affect all the operations. -
  • -
- All of these are described in the tables below. At least one shorthand or major operation must be supplied. You can use multiple shorthand operations to do more than one thing to a file or set of files. Most of the common things to do to metadata have shorthand operations. As an example, here is how to show the MD5 signatures for a set of three FLAC files:
-
- metaflac --show-md5sum file1.flac file2.flac file3.flac
-
- Another example; this removes all DESCRIPTION and COMMENT tags in a set of FLAC files, and uses the --preserve-modtime global option to keep the FLAC file modification times the same (usually when files are edited the modification time is set to the current time):
-
- metaflac --preserve-modtime --remove-tag=DESCRIPTION --remove-tag=COMMENT file1.flac file2.flac file3.flac
-
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
- Global Options -
- - --preserve-modtime - - Preserve the original modification time in spite of edits. -
- - --with-filename - - Prefix each output line with the FLAC file name (the default if more than one FLAC file is specified). -
- - --no-filename - - Do not prefix each output line with the FLAC file name (the default if only one FLAC file is specified) -
- - --no-utf8-convert - - Do not convert tags from UTF-8 to local charset, or vice versa. This is useful for scripts, and setting tags in situations where the locale is wrong. -
- - --dont-use-padding - - By default metaflac tries to use padding where possible to avoid rewriting the entire file if the metadata size changes. Use this option to tell metaflac to not take advantage of padding this way. -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Shorthand Operations -
- - --show-md5sum - - Show the MD5 signature from the STREAMINFO block. -
- - --show-min-blocksize - - Show the minimum block size from the STREAMINFO block. -
- - --show-max-blocksize - - Show the maximum block size from the STREAMINFO block. -
- - --show-min-framesize - - Show the minimum frame size from the STREAMINFO block. -
- - --show-max-framesize - - Show the maximum frame size from the STREAMINFO block. -
- - --show-sample-rate - - Show the sample rate from the STREAMINFO block. -
- - --show-channels - - Show the number of channels from the STREAMINFO block. -
- - --show-bps - - Show the # of bits per sample from the STREAMINFO block. -
- - --show-total-samples - - Show the total # of samples from the STREAMINFO block. -
- - --show-vendor-tag - - Show the vendor string from the VORBIS_COMMENT block. -
- - --show-tag=NAME - - Show all tags where the field name matches NAME. -
- - --remove-tag=NAME - - Remove all tags whose field name is NAME. -
- - --remove-first-tag=NAME - - Remove first tag whose field name is NAME. -
- - --remove-all-tags - - Remove all tags, leaving only the vendor string. -
- - --set-tag=FIELD - - Add a tag. The FIELD must comply with the Vorbis comment spec, of the form NAME=VALUE. If there is currently no tag block, one will be created. -
- - --set-tag-from-file=FIELD - - Like --set-tag, except the VALUE is a filename whose contents will be read verbatim to set the tag value. Unless --no-utf8-convert is specified, the contents will be converted to UTF-8 from the local charset. This can be used to store a cuesheet in a tag (e.g. --set-tag-from-file="CUESHEET=image.cue"). Do not try to store binary data in tag fields! Use APPLICATION blocks for that. -
- - --import-tags-from=FILE - - Import tags from a file. Use - for stdin. Each line should be of the form NAME=VALUE. Multi-line comments are currently not supported. Specify --remove-all-tags and/or --no-utf8-convert before --import-tags-from if necessary. If FILE is - (stdin), only one FLAC file may be specified. -
- - --export-tags-to=FILE - - Export tags to a file. Use - for stdin. Each line will be of the form NAME=VALUE. Specify --no-utf8-convert if necessary. -
- - --import-cuesheet-from=FILE - - Import a cuesheet from a file. Use - for stdin. Only one FLAC file may be specified. A seekpoint will be added for each index point in the cuesheet to the SEEKTABLE unless --no-cued-seekpoints is specified. -
- - --export-cuesheet-to=FILE - - Export CUESHEET block to a cuesheet file, suitable for use by CD authoring software. Use - for stdout. Only one FLAC file may be specified on the command line. -
- - --import-picture-from={FILENAME|SPECIFICATION} - - Import a picture and store it in a PICTURE metadata block. See the flac option --picture for an explanation of the SPECIFICATION syntax. -
- - --export-picture-to=FILE - - Export PICTURE block to a file. Use - for stdout. Only one FLAC file may be specified on the command line. The first PICTURE block will be exported unless --export-picture-to is preceded by a --block-number=# option to specify the exact metadata block to extract. Note that the block number is the one shown by --list. -
- - --add-replay-gain - - Calculates the title and album gains/peaks of the given FLAC files as if all the files were part of one album, then stores them as FLAC tags. The tags are the same as those used by vorbisgain. Existing ReplayGain tags will be replaced. If only one FLAC file is given, the album and title gains will be the same. Since this operation requires two passes, it is always executed last, after all other operations have been completed and written to disk. All FLAC files specified must have the same resolution, sample rate, and number of channels. The sample rate must be one of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, or 48 kHz. -
- - --scan-replay-gain - - Like --add-replay-gain, but only analyzes the files rather than writing them to the tags. -
- - --remove-replay-gain - - Removes the ReplayGain tags. -
- - --add-seekpoint={#|X|#x|#s} - - Add seek points to a SEEKTABLE block:
-
    -
  • - : a specific sample number for a seek point -
  • -
  • - : a placeholder point (always goes at the end of the SEEKTABLE) -
  • -
  • - #x : # evenly spaced seekpoints, the first being at sample 0 -
  • -
  • - #s : a seekpoint every # seconds; # does not have to be a whole number, it can be, for example, 9.5, meaning a seekpoint every 9.5 seconds -
  • -
- If no SEEKTABLE block exists, one will be created. If one already exists, points will be added to the existing table, and any duplicates will be turned into placeholder points.
- You may use many --add-seekpoint options; the resulting SEEKTABLE will be the unique-ified union of all such values. Example: --add-seekpoint=100x --add-seekpoint=3.5s will add 100 evenly spaced seekpoints and a seekpoint every 3.5 seconds.
-
- - --add-padding=# - - Add a padding block of the given length (in bytes). The overall length of the new block will be 4 + length; the extra 4 bytes is for the metadata block header. -
-
- -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Major Operations -
- - --version - - Show the metaflac version number. -
- - --list - - List the contents of one or more metadata blocks to stdout. By default, all metadata blocks are listed in text format. Use the following options to change this behavior:
-
- - --block-number=#[,#[...]]
- An optional comma-separated list of block numbers to display. The first block, the STREAMINFO block, is block 0.
-
- - --block-type=type[,type[...]]
- --except-block-type=type[,type[...]]
- An optional comma-separated list of block types to be included or ignored with this option. Use only one of --block-type or --except-block-type. The valid block types are: STREAMINFO, PADDING, APPLICATION, SEEKTABLE, VORBIS_COMMENT. You may narrow down the types of APPLICATION blocks displayed as follows:
- - - - - - - - - -
APPLICATION:abcdThe APPLICATION block(s) whose textual representation of the 4-byte ID is "abcd"
APPLICATION:0xXXXXXXXXThe APPLICATION block(s) whose hexadecimal big- endian representation of the 4-byte ID is "0xXXXXXXXX". For the example "abcd" above the hexadecimal equivalalent is 0x61626364
-
- - NOTE: if both --block-number and --[except-]block-type are specified, the result is the logical AND of both arguments.
-
- - --application-data-format=hexdump|text
- If the application block you are displaying contains binary data but your --data-format=text, you can display a hex dump of the application data contents instead using --application-data-format=hexdump. -
- - --remove - - Remove one or more metadata blocks from the metadata. Unless --dont-use-padding is specified, the blocks will be replaced with padding. You may not remove the STREAMINFO block.
-
- - --block-number=#[,#[...]]
- --block-type=type[,type[...]]
- --except-block-type=type[,type[...]]
- See --list above for usage.
-
- - NOTE: if both --block-number and --[except-]block-type are specified, the result is the logical AND of both arguments. -
- - --remove-all - - Remove all metadata blocks (except the STREAMINFO block) from the metadata. Unless --dont-use-padding is specified, the blocks will be replaced with padding. -
- - --merge-padding - - Merge adjacent PADDING blocks into single blocks. -
- - --sort-padding - - Move all PADDING blocks to the end of the metadata and merge them into a single block. -
-
- -
- Option Index
-
- --add-padding
- --add-replay-gain
- --add-seekpoint
- --dont-use-padding
- --export-cuesheet-to
- --export-picture-to
- --export-tags-to
- --import-cuesheet-from
- --import-picture-from
- --import-tags-from
- --list
- --merge-padding
- --no-filename
- --no-utf8-convert
- --preserve-modtime
- --remove-all-tags
- --remove-all
- --remove-first-tag
- --remove-replay-gain
- --remove-tag
- --remove
- --scan-replay-gain
- --set-tag-from-file
- --set-tag
- --show-bps
- --show-channels
- --show-max-blocksize
- --show-max-framesize
- --show-md5sum
- --show-min-blocksize
- --show-min-framesize
- --show-sample-rate
- --show-tag
- --show-total-samples
- --show-vendor-tag
- --sort-padding
- --version
- --with-filename
- -
- -
- - - - - - diff --git a/doc/html/faq.html b/doc/html/faq.html deleted file mode 100644 index 5612002b..00000000 --- a/doc/html/faq.html +++ /dev/null @@ -1,390 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - faq - - - - - - -
- - - -
- -
-
- faq -
-
-
- General - - Tools - - API - - Project - - -

- General -

- - What is FLAC?
-
- FLAC stands for Free Lossless Audio Codec, an audio format similar to MP3, but lossless, meaning that audio is compressed in FLAC without any loss in quality. This is similar to how Zip works, except with FLAC you will get much better compression because it is designed specifically for audio, and you can play back compressed FLAC files in your favorite player (or your car or home stereo, see supported devices) just like you would an MP3 file.
-
- For more details, see What is FLAC?
-
- I have a FLAC file, how do I play it?
- How can I create FLAC files?
-
- See Using FLAC or a list of hardware that supports FLAC.
-
- What licensing applies to the FLAC format and software?
-
- See the license page.
-
- What kinds of tags does FLAC support?
-
- FLAC has it's own native tagging system which is identical to that of Vorbis. They are called alternately "FLAC tags" and "Vorbis comments". It is the only tagging system required and guaranteed to be supported by FLAC implementations.
-
- Out of convenience, the reference decoder knows how to skip ID3 tags so that they don't interfere with decoding. But you should not expect any tags beside FLAC tags to be supported in applications; some implementations may not even be able to decode a FLAC file with ID3 tags.
-
- What software support FLAC?
-
- This list is so large now it is difficult to maintain and keep up-to-date. For a partial list of open-source software that supports FLAC, see the software section of the links page. For a partial list of the most popular software used to encode, decode, play, tag, and rip FLAC files, see the download page.
-
- How can I play FLAC in Windows Media Player?
-
- The easiest way is to use the Xiph.org Directshow Filters, download them here
-
- What hardware products support FLAC?
-
- See the hardware section of the links page.
-
- What is the difference between (native) FLAC and Ogg FLAC?
-
- You can think of an audio codec as having two layers. The inside layer is the raw compressed data, and the outside layer is the "container" or "transport layer" that splits and arranges the compressed data in pieces so it can be seeked through, edited, etc.
-
- "Native" FLAC is the compressed FLAC data stored in a very minimalist container, designed to be very efficient at storing single audio streams.
-
- Ogg FLAC is the compressed FLAC data stored in an Ogg container. Ogg is a much more powerful transport layer that enables mixing several kinds of different streams (audio, data, metadata, etc). The overhead is slightly higher than with native FLAC.
-
- In either case, the compressed FLAC data is the same and one can be converted to the other without re-encoding.
-
- Which should I use, (native) FLAC or Ogg FLAC?
-
- The short answer right now is probably "native FLAC". If all you are doing is compressing audio to be played back later, native FLAC will do everything you need, is more widely supported, and will yield smaller files. If you plan to edit the compressed audio, or want to multiplex the audio with video later in an Ogg container, Ogg FLAC is a better choice.
-
- Why aren't PERFORMER/TITLE/etc tags stored in the FLAC CUESHEET block?
-
- This has turned out to be a pretty polarizing issue and requires a long explanation.
-
- The original purpose of a cue sheet in CD authoring software was to lay out the disc, essentially specifying how the audio will be organized on the disc; some of the information ends up as the CD table of contents: the track numbers and locations, and the index points. Later CD-TEXT was added. But CD-TEXT is a very complex spec, and actually goes in the CD subcode data. It is internationalized, not through Unicode, but with several different character sets, some of them multi-byte. It even allows for graphics. In cue sheets, the TITLE/PERFORMER/etc tags are just a limited shorthand for authoring CD-TEXT, but when you rip, you almost never parse the CD-TEXT, you get it from another database, and it doesn't really belong in the FLAC CUESHEET block.
-
- For FLAC the intention is that applications can calculate the CDDB or CDindex ID from the CUESHEET block and look it up in an online or local database just like CD rippers and players do. But if you really want it in the file itself, the track metadata should be stored separate from the CUESHEET, and already can be because of FLAC's metadata system. There just isn't a method specified yet because as soon as it is, people will say that it's not flexible enough. From experience (and you can see this come up time and time again in many lists), anyone who is going to the trouble of keeping a lossless collection in the first place will already be picky about metadata, and it is hard to come up with a standard that will please even the majority. That is the big problem with metadata and is why Xiph has deferred on it, waiting for someone to come up with a good metadata spec that can be multiplexed together with data.
-
- Some players (for example Foobar2000) allow you to store the CDDB data as FLAC tags and can parse that.
-
- Why doesn't FLAC store all WAVE metadata?
- If flac compresses WAVE files, why isn't it technically a WAVE file compressor?
-
- (By default, flac does not store WAVE metadata, but it can with the --keep-foreign-metadata option described below.)
-
- FLAC is a general-purpose audio format, not just a compressed WAVE file format. There's a subtle difference. WAVE is a complicated standard; many kinds of data besides audio data can be put in it. FLAC's purpose is not to reproduce a WAVE file, including all the non-audio data that is in it, it is to losslessly compress the audio.
-
- However, if you really need to store the non-audio parts of a WAVE or AIFF file, you can use the --keep-foreign-metadata option to flac when encoding to store it in FLAC metadata, then use the option again when decoding to restore in to the decoded WAVE/AIFF file.
-
- Why do some lossless comparisons say FLAC does not support RIFF chunks?
-
- This is a limitation that no longer exists with FLAC (see above).
-
- Why do the encoder settings have a big effect on the encoding time but not the decoding time?
-
- It's hard to explain without going into the codec design, but to oversimplify, the encoder is looking for functions that approximate the signal. Higher settings make the encoder search more to find better approximations. The functions are themselves encoded in the FLAC file. Decoding only requires computing the one chosen function, and the complexity of the function is very stable. This is by design, to make decoding easier, and is one of the things that makes FLAC easy to implement in hardware.
-
- Why use FLAC instead of other codecs that compress more?
-
- For most users, a small difference in filesize is usually far outweighed by FLAC's advantages: open patent free codec, portable open source (BSD) reference implementation, documented API, multi-platform support, hardware support, multi-channel support, etc. Improving FLAC to get a little more compression is not worth making it more complex and more compute-intensive to decode, and hence, less likely to be supported in hardware.
-
- Why can't you make FLAC encode faster?
-
- FLAC already encodes pretty fast. It is faster than real-time even on weak systems and is not much slower than even the fastest codecs. And it is faster than the CD ripping process with which it is usually paired, meaning even if it went faster, it would not speed up the ripping-encoding process anyway.
-
- Part of the reason is that FLAC is asymmetric (see also). That means that it is optimized for decoding speed at the expense of encoding speed, because it makes it easier to decode on low-powered hardware, and because you only encode once but you decode many times.
-
- How can I be sure FLAC is lossless?
- How much testing has been done on FLAC?
-
- First, FLAC is probably the only lossless compressor that has a published and comprehensive test suite. With the others you rely on the author's personal testing or the longevity of the program. But with FLAC you can download the whole test suite and run it on any version you like, or alter it to test your own data. The test suite checks every function in the API, as well as running many thousands of streams through an encode-decode-verify process, to test every nook and cranny of the system. Even on a fast machine the full test suite takes hours. The full test suite must pass on several platforms before a release is made.
-
- Second, you can always use the -V option with flac (also supported by most GUI frontends) to verify while encoding. With this option, a decoder is run in parallel to the encoder and its output is compared against the original input. If a difference is found flac will stop with an error.
-
- Finally, FLAC is used by many people and has been judged stable enough by many software and hardware makers to be incorporated into their products.
-
- What is the lowest bitrate (or highest compression) achievable with FLAC?
-
- With FLAC you do not specify a bitrate like with some lossy codecs. It's more like specifying a quality with Vorbis or MPC, except with FLAC the quality is always "lossless" and the resulting bitrate is roughly proportional to the amount of information in the original signal. You cannot control the bitrate much and the result can be from around 100% of the input rate (if you are encoding noise), down to almost 0 (encoding silence).
-
- How many channels does FLAC support?
-
- FLAC supports from 1 to 8 channels per stream. Channels are only grouped in FLAC to take advantage of interchannel correlation and to define common channel assignments (like stereo L/R, 5.1 surround, et cetera). When encoding a large number of independent channels it is expected that they are coded separately and if required, multiplexed together in a suitable container like Ogg or Matroska.
-
- What kind of audio samples does FLAC support?
-
- FLAC supports linear PCM samples with a resolution between 4 and 32 bits per sample. FLAC does not support floating point samples. In some cases it is possible to losslessly transform samples from an incompatible range to a FLAC-compatible range before encoding.
-
- FLAC supports linear sample rates from 1Hz - 655350Hz in 1Hz increments.
-
- Will FLAC ever support floating-point samples?
-
- It's unlikely FLAC will ever support floating-point samples natively. The main application for floating-point is audio engineering, which demands easy editing and very high speed for both encoding and decoding above everything else.
-
- FLAC is designed as a consumer audio format. It trades ease of editing for a featureful, robust transport layer more suited for playback, and encoding speed for more compression and faster decompression. - -

- Tools -

- - How do I set up EAC to rip directly to FLAC?
-
- See Case's excellent EAC configuration page. Or use AutoFLAC or MAREO to rip to FLAC or multiple formats at once.
-
- Why am I getting "Run-time error '75': Path/File access error" with FLAC Frontend?
-
- You are probably using an old version of FLAC Frontend. Try downloading a new version from this sourceforge page
-
- How do I encode a file that starts with a dash?
-
- When using flac to encode on the command-line, a file that starts with a dash will be treated as an option, but there is a simple workaround. Use -- to signal the end of options and the beginning of filenames, like so:
-
- flac -V -- -01-name.wav
-
- Why does it take so long to edit some FLAC files with metaflac?
-
- Since metadata is stored at the beginning of a FLAC file, changing the length of it can sometimes cause the whole file to be rewritten. You can avoid this by adding padding with flac when you encode, or with metaflac after encoding. By default, flac adds 8k of padding; you can change this amount if you need more or less.
-
- Why don't wildcards for file names like *.flac or *.wav work with flac/metaflac on Windows?
-
- The Windows command shells (cmd.exe, command.com) implement wildcard handling differently than most other shells, leaving it up to the program to do everything including difficult and ambiguous cases. For an explanation of why wildcards on cmd.exe/command.com are dangerous, see here. Better command shells for Windows exist, e.g. from Cygwin. A workaround with the Windows shells is to do something like:
-
- for %F in (*.wav) do flac "%F"
-
- but care must still be taken that the command will execute as intended.
-
- I compressed a file to FLAC with verify on, and flac said "Verify FAILED!" Why?
-
- The only known cause of verify errors is faulty hardware. The dead giveaway is that if you repeat the exact same command, the error occurs in a different place or not at all. This can also happen when decoding or testing a FLAC file. If this is happening it is your hardware and not a FLAC bug.
-
- The problem is usually caused by overclocking/overheating the CPU or bad RAM. Try one of the many free programs available for testing hardware (e.g. Memtest).
-
- If you ever have a verify error that fails at the same place every time, please file a bug, uploading a sample according to the instructions found at the bottom of this bug report.
-
- I compressed a WAVE file to FLAC, then decompressed to WAVE, and the two weren't identical. Why?
- I compressed a WAVE file to FLAC and it said "warning: skipping unknown sub-chunk LIST". Why?
-
- WAVE is a complicated standard; many kinds of data besides audio data can be put in it. Most likely what has happened is that the application that created the original WAVE file also added some extra information for it's own use, which FLAC does not store or recreate by default (but can with the --keep-foreign-metadata option) (see also). The audio data in the two WAVE files will be identical. There are other tools to compare just the audio content of two WAVE files; ExactAudioCopy has such a feature.
-
- For the more technically inclined, by default FLAC only stores what is in the 'fmt ' and 'data' sub-chunks of a WAVE file. (see also)
-
- I decoded a FLAC file and the WAVE is 2 bytes shorter than the original. Why?
-
- The difference is probably that between an 18-byte 'fmt ' subchunk in the original WAVE vs. a 16-byte one in the decoded WAVE. With WAVE there is more than one way to write identical formatting information, but FLAC always writes the most common legal form. (see also)
-
- Why did I get "ERROR initializing encoder, state = FLAC__STREAM_ENCODER_NOT_STREAMABLE"?
-
- You specified encoding options that are outside the Streamable subset. If that is what you really wanted and you understand the consequences, you can use flac --lax to generate a non-Subset stream. The resulting file may not be streamable or play in all players.
-
- Why doesn't the same file compressed on different machines with the same options yield the same FLAC file?
-
- It's not supposed to, and neither does it mean either encoding was bad. There are many variations between different machines or even different builds of flac on the same machine that can lead to small differences in the FLAC file, even if they have the exact same final size. This is normal. - -

- API -

- - Why does your API change for point releases?
-
- The FLAC release numbering scheme of MAJOR.MINOR.MICRO reflects the state of the FLAC format, not the API. This is most intuitive for users, at the expense of flustering developers. The shared library number (derived from the libtool current:revision:age number) is the indicator of binary API compatibility. As of FLAC 1.1.3, the current, revision, and age numbers are also #defined in the library headers to make porting easier; see the porting guide.
-
- How can I determine the encoded frame length?
-
- With native FLAC, it is not possible to determine the frame length without decoding. Probably if I had it all to do again I would have constrained the possible block sizes, which would have made it more practical to put the frame length in the frame header. For an example of how to find the frame boundaries in a stream, see the source code to metaflac, in the functionality that adds seek points.
-
- With Ogg FLAC, it can be calculated from the Ogg page header. - -

- Project -

- - Where are the mailing lists, forums, discussion areas, etc.?
-
- There are a few places. The main discussions happen on the official FLAC mailing lists (you must subscribe to post). Also, there is a lot of discussion relating to FLAC on Hydrogen Audio.
-
- How do I submit a bug report?
-
- First, visit the bug tracking page and do a little searching of both open and closed bugs to see if yours is already there. If you have something truly new submit a new bug there. Make sure to monitor the bug or include your email address in the description. Include as much information as possible: the version of FLAC that you are running, the name and version of any frontend you are running, your operating system and version, your CPU type and speed, the amount of memory you have, where you downloaded FLAC from, the exact error message (if any) copied from the console, and anything else you may think will help. -
- -
- - - - - - diff --git a/doc/html/favicon.ico b/doc/html/favicon.ico deleted file mode 100644 index 594fe38a..00000000 Binary files a/doc/html/favicon.ico and /dev/null differ diff --git a/doc/html/features.html b/doc/html/features.html deleted file mode 100644 index 1e87287c..00000000 --- a/doc/html/features.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - features - - - - - - -
- - - -
- -
- -
-
- FLAC stands for Free Lossless Audio Codec, an audio format similar to MP3, but lossless, meaning that audio is compressed in FLAC without any loss in quality. This is similar to how Zip works, except with FLAC you will get much better compression because it is designed specifically for audio, and you can play back compressed FLAC files in your favorite player (or your car or home stereo, see supported devices) just like you would an MP3 file.
-
- FLAC stands out as the fastest and most widely supported lossless audio codec, and the only one that at once is non-proprietary, is unencumbered by patents, has an open-source reference implementation, has a well documented format and API, and has several other independent implementations.
-
- FLAC supports tagging, cover art, and fast seeking. FLAC is freely available and supported on most operating systems, including Windows, "unix" (Linux, *BSD, Solaris, OS X, IRIX), BeOS, OS/2, and Amiga.
-
- There are many programs and devices that support FLAC, but the core FLAC project here maintains the format and provides programs and libraries for working with FLAC files. See Getting FLAC for instructions on downloading and installing the official FLAC tools, or Using FLAC for instructions and guides on playing FLAC files, ripping CDs to FLAC, etc.
-
- When we say that FLAC is "Free" it means more than just that it is available at no cost. It means that the specification of the format is fully open to the public to be used for any purpose (the FLAC project reserves the right to set the FLAC specification and certify compliance), and that neither the FLAC format nor any of the implemented encoding/decoding methods are covered by any known patent. It also means that all the source code is available under open-source licenses. It is the first truly open and free lossless audio format. (For more information, see the license page.)
-
- Notable features of FLAC: -
    -
  • - Lossless: The encoding of audio (PCM) data incurs no loss of information, and the decoded audio is bit-for-bit identical to what went into the encoder. Each frame contains a 16-bit CRC of the frame data for detecting transmission errors. The integrity of the audio data is further insured by storing an MD5 signature of the original unencoded audio data in the file header, which can be compared against later during decoding or testing. -
  • -
  • - Fast: FLAC is asymmetric in favor of decode speed. Decoding requires only integer arithmetic, and is much less compute-intensive than for most perceptual codecs. Real-time decode performance is easily achievable on even modest hardware. -
  • -
  • - Hardware support: FLAC is supported by dozens of consumer electronic devices, from portable players, to home stereo equipment, to car stereo. -
  • -
  • - Flexible metadata: FLAC's metadata system supports tags, cover art, seek tables, and cue sheets. Applications can write their own APPLICATION metadata once they register an ID. New metadata blocks can be defined and implemented in future versions of FLAC without breaking older streams or decoders. -
  • -
  • - Seekable: FLAC supports fast sample-accurate seeking. Not only is this useful for playback, it makes FLAC files suitable for use in editing applications. -
  • -
  • - Streamable: Each FLAC frame contains enough data to decode that frame. FLAC does not even rely on previous or following frames. FLAC uses sync codes and CRCs (similar to MPEG and other formats), which, along with framing, allow decoders to pick up in the middle of a stream with a minimum of delay. -
  • -
  • - Suitable for archiving: FLAC is an open format, and there is no generation loss if you need to convert your data to another format in the future. In addition to the frame CRCs and MD5 signature, flac has a verify option that decodes the encoded stream in parallel with the encoding process and compares the result to the original, aborting with an error if there is a mismatch. -
  • -
  • - Convenient CD archiving: FLAC has a "cue sheet" metadata block for storing a CD table of contents and all track and index points. For instance, you can rip a CD to a single file, then import the CD's extracted cue sheet while encoding to yield a single file representation of the entire CD. If your original CD is damaged, the cue sheet can be exported later in order to burn an exact copy. -
  • -
  • - Error resistant: Because of FLAC's framing, stream errors limit the damage to the frame in which the error occurred, typically a small fraction of a second worth of data. Contrast this with some other lossless codecs, in which a single error destroys the remainder of the stream. -
  • -
- What FLAC is not: -
    -
  • - Lossy. FLAC is intended for lossless compression only, as there are many good lossy formats already, such as Vorbis, MPC, and MP3 (see LAME for an excellent open-source implementation). -
  • -
  • - DRM. There is no intention to add any copy prevention methods. Of course, we can't stop someone from encrypting a FLAC stream in another container (e.g. the way Apple encrypts AAC in MP4 with FairPlay), that is the choice of the user. -
  • -
-
- -
- - - - - - diff --git a/doc/html/flac.css b/doc/html/flac.css deleted file mode 100644 index a4e57926..00000000 --- a/doc/html/flac.css +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2005,2006,2007 Josh Coalson - * Permission is granted to copy, distribute and/or modify this document - * under the terms of the GNU Free Documentation License, Version 1.1 - * or any later version published by the Free Software Foundation; - * with no invariant sections. - * A copy of the license can be found at http://www.gnu.org/copyleft/fdl.html - */ - -body -{ - background-color: #9a9; - color: black; - margin: 0 auto; - padding: 0px; - max-width: 1200px; -} - -/*div -{ - background-color: #99CC99; - margin: 0px; - padding: 0px; -}*/ - -div.logo -{ - background-color: black; - padding: 1px; - text-align: center; -} - -div.navbar -{ - border-width: 2px 0px 2px 0px; - border-style: solid; - border-color: black; - background-color: #D3D4C5; - padding: 3px; - text-align: center; -} - - -div.above_nav -{ - height: 25px; -} - -div.below_nav -{ - height: 25px; -} - -div.body_with_sidebar -{ -/* text-align: left; */ -} - -div.box -{ - text-align: left; - margin: 0; - background-color: #EEEED4; -} - -div.box_title -{ - border-width: 1px 0px 0px 0px; - border-style: solid; - border-color: black; - background-color: #D3D4C5; - padding: 3px 6px; - font-family: lucida, verdana, helvetica, arial, sans-serif; - font-weight: bold; - font-size: 150%; -} - -div.box_header -{ - border-width: 1px 0px 0px 0px; - border-style: solid; - border-color: black; - background-color: #EEEED4; - padding: 3px; -} - -div.box_footer -{ - border-width: 0px 0px 1px 0px; - border-style: solid; - border-color: black; - background-color: #EEEED4; - padding: 3px; -} - -div.box_body -{ - background-color: #EEEED4; - padding: 0px 6px; - font-family: lucida, verdana, helvetica, arial, sans-serif; - font-weight: normal; - font-size: 100%; -} - -#newsbox h3 -{ - margin: 5px 0 0 0; - font-size: 0.9em; -} - -#newsbox p -{ - margin: 0; -} - -div.smallbox -{ - text-align: left; - margin: 0 0 0 8px; - background-color: #EEEED4; -} - -div.smallbox_title -{ - text-align: center; - border-width: 1px 0px 0px 0px; - border-style: solid; - border-color: black; - background-color: #D3D4C5; - padding: 3px; - font-family: lucida, verdana, helvetica, arial, sans-serif; - font-weight: bold; - font-size: 100%; -} - -div.smallbox_header -{ - border-width: 1px 0px 0px 0px; - border-style: solid; - border-color: black; - background-color: #EEEED4; - padding: 3px; -} - -div.smallbox_footer -{ - border-width: 0px 0px 1px 0px; - border-style: solid; - border-color: black; - background-color: #EEEED4; - padding: 3px; -} - -div.smallbox_body -{ - background-color: #EEEED4; - padding: 0px 3px 0px 3px; - font-family: lucida, verdana, helvetica, arial, sans-serif; - font-weight: normal; - font-size: 80%; -} - -div.copyright -{ - text-align: left; - margin: 10px; -} - -span.commandname -{ - font-family: monospace; - font-weight: bold; -} - -span.command -{ - font-family: monospace; - font-weight: bold; -} - -span.argument -{ - font-family: monospace; -} - -span.code -{ - font-family: monospace; -} - -a:link {color:#336699; background-color:transparent} -a:visited {color:#336699; background-color:transparent} -a:active {color:#336699; background-color:transparent} -a:hover {color:#336699; background-color:transparent} diff --git a/doc/html/format.html b/doc/html/format.html deleted file mode 100644 index ce1e483d..00000000 --- a/doc/html/format.html +++ /dev/null @@ -1,1849 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - format - - - - - - -
- - - -
- -
-
- format -
-
-
- This is a detailed description of the FLAC format. There is also a companion document that describes FLAC-to-Ogg mapping.
-
- For a user-oriented overview, see About the FLAC Format.
-
- Table of Contents - - Acknowledgments
-
- FLAC owes much to the many people who have advanced the audio compression field so freely. For instance: -
    -
  • - A. J. Robinson for his work on Shorten; his paper is a good starting point on some of the basic methods used by FLAC. FLAC trivially extends and improves the fixed predictors, LPC coefficient quantization, and Rice coding used in Shorten. -
  • -
  • - S. W. Golomb and Robert F. Rice; their universal codes are used by FLAC's entropy coder. -
  • -
  • - N. Levinson and J. Durbin; the reference encoder uses an algorithm developed and refined by them for determining the LPC coefficients from the autocorrelation coefficients. -
  • -
  • - And of course, Claude Shannon -
  • -
- Scope
-
- It is a known fact that no algorithm can losslessly compress all possible input, so most compressors restrict themselves to a useful domain and try to work as well as possible within that domain. FLAC's domain is audio data. Though it can losslessly code any input, only certain kinds of input will get smaller. FLAC exploits the fact that audio data typically has a high degree of sample-to-sample correlation.
-
- Within the audio domain, there are many possible subdomains. For example: low bitrate speech, high-bitrate multi-channel music, etc. FLAC itself does not target a specific subdomain but many of the default parameters of the reference encoder are tuned to CD-quality music data (i.e. 44.1kHz, 2 channel, 16 bits per sample). The effect of the encoding parameters on different kinds of audio data will be examined later.
-
- Architecture
-
- Similar to many audio coders, a FLAC encoder has the following stages: -
    -
  • - Blocking. The input is broken up into many contiguous blocks. With FLAC, the blocks may vary in size. The optimal size of the block is usually affected by many factors, including the sample rate, spectral characteristics over time, etc. Though FLAC allows the block size to vary within a stream, the reference encoder uses a fixed block size. -
  • -
  • - Interchannel Decorrelation. In the case of stereo streams, the encoder will create mid and side signals based on the average and difference (respectively) of the left and right channels. The encoder will then pass the best form of the signal to the next stage. -
  • -
  • - Prediction. The block is passed through a prediction stage where the encoder tries to find a mathematical description (usually an approximate one) of the signal. This description is typically much smaller than the raw signal itself. Since the methods of prediction are known to both the encoder and decoder, only the parameters of the predictor need be included in the compressed stream. FLAC currently uses four different classes of predictors (described in the prediction section), but the format has reserved space for additional methods. FLAC allows the class of predictor to change from block to block, or even within the channels of a block. -
  • -
  • - Residual coding. If the predictor does not describe the signal exactly, the difference between the original signal and the predicted signal (called the error or residual signal) must be coded losslessy. If the predictor is effective, the residual signal will require fewer bits per sample than the original signal. FLAC currently uses only one method for encoding the residual (see the Residual coding section), but the format has reserved space for additional methods. FLAC allows the residual coding method to change from block to block, or even within the channels of a block. -
  • -
- In addition, FLAC specifies a metadata system, which allows arbitrary information about the stream to be included at the beginning of the stream.
-
- Definitions
-
- Many terms like "block" and "frame" are used to mean different things in different encoding schemes. For example, a frame in MP3 corresponds to many samples across several channels, whereas an S/PDIF frame represents just one sample for each channel. The definitions we use for FLAC follow. Note that when we talk about blocks and subblocks we are referring to the raw unencoded audio data that is the input to the encoder, and when we talk about frames and subframes, we are referring to the FLAC-encoded data. -
    -
  • - Block: One or more audio samples that span several channels. -
  • -
  • - Subblock: One or more audio samples within a channel. So a block contains one subblock for each channel, and all subblocks contain the same number of samples. -
  • -
  • - Blocksize: The number of samples in any of a block's subblocks. For example, a one second block sampled at 44.1KHz has a blocksize of 44100, regardless of the number of channels. -
  • -
  • - Frame: A frame header plus one or more subframes. -
  • -
  • - Subframe: A subframe header plus one or more encoded samples from a given channel. All subframes within a frame will contain the same number of samples. -
  • -
- Blocking
-
- The size used for blocking the audio data has a direct effect on the compression ratio. If the block size is too small, the resulting large number of frames mean that excess bits will be wasted on frame headers. If the block size is too large, the characteristics of the signal may vary so much that the encoder will be unable to find a good predictor. In order to simplify encoder/decoder design, FLAC imposes a minimum block size of 16 samples, and a maximum block size of 65535 samples. This range covers the optimal size for all of the audio data FLAC supports.
-
- Currently the reference encoder uses a fixed block size, optimized on the sample rate of the input. Future versions may vary the block size depending on the characteristics of the signal.
-
- Blocked data is passed to the predictor stage one subblock (channel) at a time. Each subblock is independently coded into a subframe, and the subframes are concatenated into a frame. Because each channel is coded separately, it means that one channel of a stereo frame may be encoded as a constant subframe, and the other an LPC subframe.
-
- Interchannel Decorrelation
-
- In stereo streams, many times there is an exploitable amount of correlation between the left and right channels. FLAC allows the frames of stereo streams to have different channel assignments, and an encoder may choose to use the best representation on a frame-by-frame basis. -
    -
  • - Independent. The left and right channels are coded independently. -
  • -
  • - Mid-side. The left and right channels are transformed into mid and side channels. The mid channel is the midpoint (average) of the left and right signals, and the side is the difference signal (left minus right). -
  • -
  • - Left-side. The left channel and side channel are coded. -
  • -
  • - Right-side. The right channel and side channel are coded -
  • -
- Surprisingly, the left-side and right-side forms can be the most efficient in many frames, even though the raw number of bits per sample needed for the original signal is slightly more than that needed for independent or mid-side coding.
-
- Prediction
-
- FLAC uses four methods for modeling the input signal: -
    -
  • - Verbatim. This is essentially a zero-order predictor of the signal. The predicted signal is zero, meaning the residual is the signal itself, and the compression is zero. This is the baseline against which the other predictors are measured. If you feed random data to the encoder, the verbatim predictor will probably be used for every subblock. Since the raw signal is not actually passed through the residual coding stage (it is added to the stream 'verbatim'), the encoding results will not be the same as a zero-order linear predictor. -
  • -
  • - Constant. This predictor is used whenever the subblock is pure DC ("digital silence"), i.e. a constant value throughout. The signal is run-length encoded and added to the stream. -
  • -
  • - Fixed linear predictor. FLAC uses a class of computationally-efficient fixed linear predictors (for a good description, see audiopak and shorten). FLAC adds a fourth-order predictor to the zero-to-third-order predictors used by Shorten. Since the predictors are fixed, the predictor order is the only parameter that needs to be stored in the compressed stream. The error signal is then passed to the residual coder. -
  • -
  • - FIR Linear prediction. For more accurate modeling (at a cost of slower encoding), FLAC supports up to 32nd order FIR linear prediction (again, for information on linear prediction, see audiopak and shorten). The reference encoder uses the Levinson-Durbin method for calculating the LPC coefficients from the autocorrelation coefficients, and the coefficients are quantized before computing the residual. Whereas encoders such as Shorten used a fixed quantization for the entire input, FLAC allows the quantized coefficient precision to vary from subframe to subframe. The FLAC reference encoder estimates the optimal precision to use based on the block size and dynamic range of the original signal. -
  • -
- Residual Coding
-
- FLAC currently defines two similar methods for the coding of the error signal from the prediction stage. The error signal is coded using Rice codes in one of two ways: 1) the encoder estimates a single Rice parameter based on the variance of the residual and Rice codes the entire residual using this parameter; 2) the residual is partitioned into several equal-length regions of contiguous samples, and each region is coded with its own Rice parameter based on the region's mean. (Note that the first method is a special case of the second method with one partition, except the Rice parameter is based on the residual variance instead of the mean.)
-
- The FLAC format has reserved space for other coding methods. Some possibilities for volunteers would be to explore better context-modeling of the Rice parameter, or Huffman coding. See LOCO-I and pucrunch for descriptions of several universal codes.
-
- Format
-
- This section specifies the FLAC bitstream format. FLAC has no format version information, but it does contain reserved space in several places. Future versions of the format may use this reserved space safely without breaking the format of older streams. Older decoders may choose to abort decoding or skip data encoded with newer methods. Apart from reserved patterns, in places the format specifies invalid patterns, meaning that the patterns may never appear in any valid bitstream, in any prior, present, or future versions of the format. These invalid patterns are usually used to make the synchronization mechanism more robust.
-
- All numbers used in a FLAC bitstream are integers; there are no floating-point representations. All numbers are big-endian coded. All numbers are unsigned unless otherwise specified.
-
- Before the formal description of the stream, an overview might be helpful. -
    -
  • - A FLAC bitstream consists of the "fLaC" marker at the beginning of the stream, followed by a mandatory metadata block (called the STREAMINFO block), any number of other metadata blocks, then the audio frames. -
  • -
  • - FLAC supports up to 128 kinds of metadata blocks; currently the following are defined: -
      -
    • STREAMINFO: This block has information about the whole stream, like sample rate, number of channels, total number of samples, etc. It must be present as the first metadata block in the stream. Other metadata blocks may follow, and ones that the decoder doesn't understand, it will skip.
    • -
    • APPLICATION: This block is for use by third-party applications. The only mandatory field is a 32-bit identifier. This ID is granted upon request to an application by the FLAC maintainers. The remainder is of the block is defined by the registered application. Visit the registration page if you would like to register an ID for your application with FLAC.
    • -
    • PADDING: This block allows for an arbitrary amount of padding. The contents of a PADDING block have no meaning. This block is useful when it is known that metadata will be edited after encoding; the user can instruct the encoder to reserve a PADDING block of sufficient size so that when metadata is added, it will simply overwrite the padding (which is relatively quick) instead of having to insert it into the right place in the existing file (which would normally require rewriting the entire file).
    • -
    • SEEKTABLE: This is an optional block for storing seek points. It is possible to seek to any given sample in a FLAC stream without a seek table, but the delay can be unpredictable since the bitrate may vary widely within a stream. By adding seek points to a stream, this delay can be significantly reduced. Each seek point takes 18 bytes, so 1% resolution within a stream adds less than 2k. There can be only one SEEKTABLE in a stream, but the table can have any number of seek points. There is also a special 'placeholder' seekpoint which will be ignored by decoders but which can be used to reserve space for future seek point insertion.
    • -
    • VORBIS_COMMENT: This block is for storing a list of human-readable name/value pairs. Values are encoded using UTF-8. It is an implementation of the Vorbis comment specification (without the framing bit). This is the only officially supported tagging mechanism in FLAC. There may be only one VORBIS_COMMENT block in a stream. In some external documentation, Vorbis comments are called FLAC tags to lessen confusion.
    • -
    • CUESHEET: This block is for storing various information that can be used in a cue sheet. It supports track and index points, compatible with Red Book CD digital audio discs, as well as other CD-DA metadata such as media catalog number and track ISRCs. The CUESHEET block is especially useful for backing up CD-DA discs, but it can be used as a general purpose cueing mechanism for playback.
    • -
    • PICTURE: This block is for storing pictures associated with the file, most commonly cover art from CDs. There may be more than one PICTURE block in a file. The picture format is similar to the APIC frame in ID3v2. The PICTURE block has a type, MIME type, and UTF-8 description like ID3v2, and supports external linking via URL (though this is discouraged). The differences are that there is no uniqueness constraint on the description field, and the MIME type is mandatory. The FLAC PICTURE block also includes the resolution, color depth, and palette size so that the client can search for a suitable picture without having to scan them all.
    • -
    -
  • -
  • - The audio data is composed of one or more audio frames. Each frame consists of a frame header, which contains a sync code, information about the frame like the block size, sample rate, number of channels, et cetera, and an 8-bit CRC. The frame header also contains either the sample number of the first sample in the frame (for variable-blocksize streams), or the frame number (for fixed-blocksize streams). This allows for fast, sample-accurate seeking to be performed. Following the frame header are encoded subframes, one for each channel, and finally, the frame is zero-padded to a byte boundary. Each subframe has its own header that specifies how the subframe is encoded. -
  • -
  • - Since a decoder may start decoding in the middle of a stream, there must be a method to determine the start of a frame. A 14-bit sync code begins each frame. The sync code will not appear anywhere else in the frame header. However, since it may appear in the subframes, the decoder has two other ways of ensuring a correct sync. The first is to check that the rest of the frame header contains no invalid data. Even this is not foolproof since valid header patterns can still occur within the subframes. The decoder's final check is to generate an 8-bit CRC of the frame header and compare this to the CRC stored at the end of the frame header. -
  • -
  • - Again, since a decoder may start decoding at an arbitrary frame in the stream, each frame header must contain some basic information about the stream because the decoder may not have access to the STREAMINFO metadata block at the start of the stream. This information includes sample rate, bits per sample, number of channels, etc. Since the frame header is pure overhead, it has a direct effect on the compression ratio. To keep the frame header as small as possible, FLAC uses lookup tables for the most commonly used values for frame parameters. For instance, the sample rate part of the frame header is specified using 4 bits. Eight of the bit patterns correspond to the commonly used sample rates of 8/16/22.05/24/32/44.1/48/96 kHz. However, odd sample rates can be specified by using one of the 'hint' bit patterns, directing the decoder to find the exact sample rate at the end of the frame header. The same method is used for specifying the block size and bits per sample. In this way, the frame header size stays small for all of the most common forms of audio data. -
  • -
  • - Individual subframes (one for each channel) are coded separately within a frame, and appear serially in the stream. In other words, the encoded audio data is NOT channel-interleaved. This reduces decoder complexity at the cost of requiring larger decode buffers. Each subframe has its own header specifying the attributes of the subframe, like prediction method and order, residual coding parameters, etc. The header is followed by the encoded audio data for that channel. -
  • -
  • - FLAC specifies a subset of itself as the Subset format. The purpose of this is to ensure that any streams encoded according to the Subset are truly "streamable", meaning that a decoder that cannot seek within the stream can still pick up in the middle of the stream and start decoding. It also makes hardware decoder implementations more practical by limiting the encoding parameters such that decoder buffer sizes and other resource requirements can be easily determined. flac generates Subset streams by default unless the "--lax" command-line option is used. The Subset makes the following limitations on what may be used in the stream: -
      -
    • - The blocksize bits in the frame header must be 0001-1110. The blocksize must be <=16384; if the sample rate is <= 48000Hz, the blocksize must be <=4608. -
    • -
    • - The sample rate bits in the frame header must be 0001-1110. -
    • -
    • - The bits-per-sample bits in the frame header must be 001-111. -
    • -
    • - If the sample rate is <= 48000Hz, the filter order in LPC subframes must be less than or equal to 12, i.e. the subframe type bits in the subframe header may not be 101100-111111. -
    • -
    • - The Rice partition order in a Rice-coded residual section must be less than or equal to 8. -
    • -
    -
  • -
- - The following tables constitute a formal description of the FLAC format. Numbers in angle brackets indicate how many bits are used for a given field.
-
- -
- -
- -
-
- - - - - - - - - - - - - - - - - - - - -
- STREAM -
- <32> - - "fLaC", the FLAC stream marker in ASCII, meaning byte 0 of the stream is 0x66, followed by 0x4C 0x61 0x43 -
- METADATA_BLOCK - - This is the mandatory STREAMINFO metadata block that has the basic properties of the stream -
- METADATA_BLOCK* - - Zero or more metadata blocks -
- FRAME+ - - One or more audio frames -
-
-
- -
- -
-
- - - - - - - - - - - - -
- METADATA_BLOCK -
- METADATA_BLOCK_HEADER - - A block header that specifies the type and size of the metadata block data. -
- METADATA_BLOCK_DATA - -   -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - -
- METADATA_BLOCK_HEADER -
- <1> - - Last-metadata-block flag: '1' if this block is the last metadata block before the audio blocks, '0' otherwise. -
- <7> - - BLOCK_TYPE
-
    -
  • - 0 : STREAMINFO -
  • -
  • - 1 : PADDING -
  • -
  • - 2 : APPLICATION -
  • -
  • - 3 : SEEKTABLE -
  • -
  • - 4 : VORBIS_COMMENT -
  • -
  • - 5 : CUESHEET -
  • -
  • - 6 : PICTURE -
  • -
  • - 7-126 : reserved -
  • -
  • - 127 : invalid, to avoid confusion with a frame sync code -
  • -
-
- <24> - - Length (in bytes) of metadata to follow (does not include the size of the METADATA_BLOCK_HEADER) -
-
-
- -
- -
-
- - - - - - - - -
- METADATA_BLOCK_DATA -
- METADATA_BLOCK_STREAMINFO
- || METADATA_BLOCK_PADDING
- || METADATA_BLOCK_APPLICATION
- || METADATA_BLOCK_SEEKTABLE
- || METADATA_BLOCK_VORBIS_COMMENT
- || METADATA_BLOCK_CUESHEET
- || METADATA_BLOCK_PICTURE -
- The block data must match the block type in the block header. -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- METADATA_BLOCK_STREAMINFO -
- <16> - - The minimum block size (in samples) used in the stream. -
- <16> - - The maximum block size (in samples) used in the stream. (Minimum blocksize == maximum blocksize) implies a fixed-blocksize stream. -
- <24> - - The minimum frame size (in bytes) used in the stream. May be 0 to imply the value is not known. -
- <24> - - The maximum frame size (in bytes) used in the stream. May be 0 to imply the value is not known. -
- <20> - - Sample rate in Hz. Though 20 bits are available, the maximum sample rate is limited by the structure of frame headers to 655350Hz. Also, a value of 0 is invalid. -
- <3> - - (number of channels)-1. FLAC supports from 1 to 8 channels -
- <5> - - (bits per sample)-1. FLAC supports from 4 to 32 bits per sample. Currently the reference encoder and decoders only support up to 24 bits per sample. -
- <36> - - Total samples in stream. 'Samples' means inter-channel sample, i.e. one second of 44.1Khz audio will have 44100 samples regardless of the number of channels. A value of zero here means the number of total samples is unknown. -
- <128> - - MD5 signature of the unencoded audio data. This allows the decoder to determine if an error exists in the audio data even when the error does not result in an invalid bitstream. -
- - NOTES
-
    -
  • - FLAC specifies a minimum block size of 16 and a maximum block size of 65535, meaning the bit patterns corresponding to the numbers 0-15 in the minimum blocksize and maximum blocksize fields are invalid. -
  • -
-
-
-
- -
- -
-
- - - - - - - - -
- METADATA_BLOCK_PADDING -
- <n> - - n '0' bits (n must be a multiple of 8) -
-
-
- -
- -
-
- - - - - - - - - - - - -
- METADATA_BLOCK_APPLICATION -
- <32> - - Registered application ID. (Visit the registration page to register an ID with FLAC.) -
- <n> - - Application data (n must be a multiple of 8) -
-
-
- -
- -
-
- - - - - - - - - - - - -
- METADATA_BLOCK_SEEKTABLE -
- SEEKPOINT+ - - One or more seek points. -
- - NOTE
-
    -
  • - The number of seek points is implied by the metadata header 'length' field, i.e. equal to length / 18. -
  • -
-
-
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - -
- SEEKPOINT -
- <64> - - Sample number of first sample in the target frame, or 0xFFFFFFFFFFFFFFFF for a placeholder point. -
- <64> - - Offset (in bytes) from the first byte of the first frame header to the first byte of the target frame's header. -
- <16> - - Number of samples in the target frame. -
- - NOTES
-
    -
  • - For placeholder points, the second and third field values are undefined. -
  • -
  • - Seek points within a table must be sorted in ascending order by sample number. -
  • -
  • - Seek points within a table must be unique by sample number, with the exception of placeholder points. -
  • -
  • - The previous two notes imply that there may be any number of placeholder points, but they must all occur at the end of the table. -
  • -
-
-
-
- -
- -
-
- - - - - - - - -
- METADATA_BLOCK_VORBIS_COMMENT -
- <n> - - Also known as FLAC tags, the contents of a vorbis comment packet as specified here (without the framing bit). Note that the vorbis comment spec allows for on the order of 2 ^ 64 bytes of data where as the FLAC metadata block is limited to 2 ^ 24 bytes. Given the stated purpose of vorbis comments, i.e. human-readable textual information, this limit is unlikely to be restrictive. Also note that the 32-bit field lengths are little-endian coded according to the vorbis spec, as opposed to the usual big-endian coding of fixed-length integers in the rest of FLAC. -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- METADATA_BLOCK_CUESHEET -
- <128*8> - - Media catalog number, in ASCII printable characters 0x20-0x7e. In general, the media catalog number may be 0 to 128 bytes long; any unused characters should be right-padded with NUL characters. For CD-DA, this is a thirteen digit number, followed by 115 NUL bytes. -
- <64> - - The number of lead-in samples. This field has meaning only for CD-DA cuesheets; for other uses it should be 0. For CD-DA, the lead-in is the TRACK 00 area where the table of contents is stored; more precisely, it is the number of samples from the first sample of the media to the first sample of the first index point of the first track. According to the Red Book, the lead-in must be silence and CD grabbing software does not usually store it; additionally, the lead-in must be at least two seconds but may be longer. For these reasons the lead-in length is stored here so that the absolute position of the first track can be computed. Note that the lead-in stored here is the number of samples up to the first index point of the first track, not necessarily to INDEX 01 of the first track; even the first track may have INDEX 00 data. -
- <1> - - 1 if the CUESHEET corresponds to a Compact Disc, else 0. -
- <7+258*8> - - Reserved. All bits must be set to zero. -
- <8> - - The number of tracks. Must be at least 1 (because of the requisite lead-out track). For CD-DA, this number must be no more than 100 (99 regular tracks and one lead-out track). -
- CUESHEET_TRACK+ - - One or more tracks. A CUESHEET block is required to have a lead-out track; it is always the last track in the CUESHEET. For CD-DA, the lead-out track number must be 170 as specified by the Red Book, otherwise is must be 255. -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- CUESHEET_TRACK -
- <64> - - Track offset in samples, relative to the beginning of the FLAC audio stream. It is the offset to the first index point of the track. (Note how this differs from CD-DA, where the track's offset in the TOC is that of the track's INDEX 01 even if there is an INDEX 00.) For CD-DA, the offset must be evenly divisible by 588 samples (588 samples = 44100 samples/sec * 1/75th of a sec). -
- <8> - - Track number. A track number of 0 is not allowed to avoid conflicting with the CD-DA spec, which reserves this for the lead-in. For CD-DA the number must be 1-99, or 170 for the lead-out; for non-CD-DA, the track number must for 255 for the lead-out. It is not required but encouraged to start with track 1 and increase sequentially. Track numbers must be unique within a CUESHEET. -
- <12*8> - - Track ISRC. This is a 12-digit alphanumeric code; see here and here. A value of 12 ASCII NUL characters may be used to denote absence of an ISRC. -
- <1> - - The track type: 0 for audio, 1 for non-audio. This corresponds to the CD-DA Q-channel control bit 3. -
- <1> - - The pre-emphasis flag: 0 for no pre-emphasis, 1 for pre-emphasis. This corresponds to the CD-DA Q-channel control bit 5; see here. -
- <6+13*8> - - Reserved. All bits must be set to zero. -
- <8> - - The number of track index points. There must be at least one index in every track in a CUESHEET except for the lead-out track, which must have zero. For CD-DA, this number may be no more than 100. -
- CUESHEET_TRACK_INDEX+ - - For all tracks except the lead-out track, one or more track index points. -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - -
- CUESHEET_TRACK_INDEX -
- <64> - - Offset in samples, relative to the track offset, of the index point. For CD-DA, the offset must be evenly divisible by 588 samples (588 samples = 44100 samples/sec * 1/75th of a sec). Note that the offset is from the beginning of the track, not the beginning of the audio data. -
- <8> - - The index point number. For CD-DA, an index number of 0 corresponds to the track pre-gap. The first index in a track must have a number of 0 or 1, and subsequently, index numbers must increase by 1. Index numbers must be unique within a track. -
- <3*8> - - Reserved. All bits must be set to zero. -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- METADATA_BLOCK_PICTURE -
- <32> - - The picture type according to the ID3v2 APIC frame:
-
    -
  • 0 - Other
  • -
  • 1 - 32x32 pixels 'file icon' (PNG only)
  • -
  • 2 - Other file icon
  • -
  • 3 - Cover (front)
  • -
  • 4 - Cover (back)
  • -
  • 5 - Leaflet page
  • -
  • 6 - Media (e.g. label side of CD)
  • -
  • 7 - Lead artist/lead performer/soloist
  • -
  • 8 - Artist/performer
  • -
  • 9 - Conductor
  • -
  • 10 - Band/Orchestra
  • -
  • 11 - Composer
  • -
  • 12 - Lyricist/text writer
  • -
  • 13 - Recording Location
  • -
  • 14 - During recording
  • -
  • 15 - During performance
  • -
  • 16 - Movie/video screen capture
  • -
  • 17 - A bright coloured fish
  • -
  • 18 - Illustration
  • -
  • 19 - Band/artist logotype
  • -
  • 20 - Publisher/Studio logotype
  • -
- Others are reserved and should not be used. There may only be one each of picture type 1 and 2 in a file. -
- <32> - - The length of the MIME type string in bytes. -
- <n*8> - - The MIME type string, in printable ASCII characters 0x20-0x7e. The MIME type may also be --> to signify that the data part is a URL of the picture instead of the picture data itself. -
- <32> - - The length of the description string in bytes. -
- <n*8> - - The description of the picture, in UTF-8. -
- <32> - - The width of the picture in pixels. -
- <32> - - The height of the picture in pixels. -
- <32> - - The color depth of the picture in bits-per-pixel. -
- <32> - - For indexed-color pictures (e.g. GIF), the number of colors used, or 0 for non-indexed pictures. -
- <32> - - The length of the picture data in bytes. -
- <n*8> - - The binary picture data. -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - -
- FRAME -
- FRAME_HEADER - -   -
- SUBFRAME+ - - One SUBFRAME per channel. -
- <?> - - Zero-padding to byte alignment. -
- FRAME_FOOTER - -   -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- FRAME_HEADER -
- <14> - - Sync code '11111111111110' -
- <1> - - Reserved: [1]
-
    -
  • - 0 : mandatory value -
  • -
  • - 1 : reserved for future use -
  • -
-
- <1> - - Blocking strategy: [2] [3]
-
    -
  • - 0 : fixed-blocksize stream; frame header encodes the frame number -
  • -
  • - 1 : variable-blocksize stream; frame header encodes the sample number -
  • -
-
- <4> - - Block size in inter-channel samples:
-
    -
  • - 0000 : reserved -
  • -
  • - 0001 : 192 samples -
  • -
  • - 0010-0101 : 576 * (2^(n-2)) samples, i.e. 576/1152/2304/4608 -
  • -
  • - 0110 : get 8 bit (blocksize-1) from end of header -
  • -
  • - 0111 : get 16 bit (blocksize-1) from end of header -
  • -
  • - 1000-1111 : 256 * (2^(n-8)) samples, i.e. 256/512/1024/2048/4096/8192/16384/32768 -
  • -
-
- <4> - - Sample rate:
-
    -
  • - 0000 : get from STREAMINFO metadata block -
  • -
  • - 0001 : 88.2kHz -
  • -
  • - 0010 : 176.4kHz -
  • -
  • - 0011 : 192kHz -
  • -
  • - 0100 : 8kHz -
  • -
  • - 0101 : 16kHz -
  • -
  • - 0110 : 22.05kHz -
  • -
  • - 0111 : 24kHz -
  • -
  • - 1000 : 32kHz -
  • -
  • - 1001 : 44.1kHz -
  • -
  • - 1010 : 48kHz -
  • -
  • - 1011 : 96kHz -
  • -
  • - 1100 : get 8 bit sample rate (in kHz) from end of header -
  • -
  • - 1101 : get 16 bit sample rate (in Hz) from end of header -
  • -
  • - 1110 : get 16 bit sample rate (in tens of Hz) from end of header -
  • -
  • - 1111 : invalid, to prevent sync-fooling string of 1s -
  • -
-
- <4> - - Channel assignment -
    -
  • - 0000-0111 : (number of independent channels)-1. Where defined, the channel order follows SMPTE/ITU-R recommendations. The assignments are as follows: -
      -
    • 1 channel: mono
    • -
    • 2 channels: left, right
    • -
    • 3 channels: left, right, center
    • -
    • 4 channels: front left, front right, back left, back right
    • -
    • 5 channels: front left, front right, front center, back/surround left, back/surround right
    • -
    • 6 channels: front left, front right, front center, LFE, back/surround left, back/surround right
    • -
    • 7 channels: front left, front right, front center, LFE, back center, side left, side right
    • -
    • 8 channels: front left, front right, front center, LFE, back left, back right, side left, side right
    • -
    -
  • -
  • - 1000 : left/side stereo: channel 0 is the left channel, channel 1 is the side(difference) channel -
  • -
  • - 1001 : right/side stereo: channel 0 is the side(difference) channel, channel 1 is the right channel -
  • -
  • - 1010 : mid/side stereo: channel 0 is the mid(average) channel, channel 1 is the side(difference) channel -
  • -
  • - 1011-1111 : reserved -
  • -
-
- <3> - - Sample size in bits: [5]
-
    -
  • - 000 : get from STREAMINFO metadata block -
  • -
  • - 001 : 8 bits per sample -
  • -
  • - 010 : 12 bits per sample -
  • -
  • - 011 : reserved -
  • -
  • - 100 : 16 bits per sample -
  • -
  • - 101 : 20 bits per sample -
  • -
  • - 110 : 24 bits per sample -
  • -
  • - 111 : reserved -
  • -
-
- <1> - - Reserved:
-
    -
  • - 0 : mandatory value -
  • -
  • - 1 : reserved for future use -
  • -
-
- <?> - - if(variable blocksize)
-    <8-56>:"UTF-8" coded sample number (decoded number is 36 bits) [4]
- else
-    <8-48>:"UTF-8" coded frame number (decoded number is 31 bits) [4] -
- <?> - - if(blocksize bits == 011x)
-    8/16 bit (blocksize-1) -
- <?> - - if(sample rate bits == 11xx)
-    8/16 bit sample rate -
- <8> - - CRC-8 (polynomial = x^8 + x^2 + x^1 + x^0, initialized with 0) of everything before the crc, including the sync code -
- - NOTES
-
    -
  1. - This bit must remain reserved for 0 in order for a FLAC frame's initial 15 bits to be distinguishable from the start of an MPEG audio frame (see also). -
  2. -
  3. - The "blocking strategy" bit must be the same throughout the entire stream. -
  4. -
  5. - The "blocking strategy" bit determines how to calculate the sample number of the first sample in the frame. If the bit is 0 (fixed-blocksize), the frame header encodes the frame number as above, and the frame's starting sample number will be the frame number times the blocksize. If it is 1 (variable-blocksize), the frame header encodes the frame's starting sample number itself. (In the case of a fixed-blocksize stream, only the last block may be shorter than the stream blocksize; its starting sample number will be calculated as the frame number times the previous frame's blocksize, or zero if it is the first frame). -
  6. -
  7. - The "UTF-8" coding used for the sample/frame number is the same variable length code used to store compressed UCS-2, extended to handle larger input. -
  8. -
  9. - For subframes that encode a difference channel, - the sample size is one bit larger than the sample size of the frame, - in order to be able to encode the difference between extreme values. -
  10. -
-
-
-
- -
- -
-
- - - - - - - - -
- FRAME_FOOTER -
- <16> - - CRC-16 (polynomial = x^16 + x^15 + x^2 + x^0, initialized with 0) of everything before the crc, back to and including the frame header sync code -
-
-
- -
- -
-
- - - - - - - - - - - - -
- SUBFRAME -
- SUBFRAME_HEADER - -   -
- SUBFRAME_CONSTANT
|| SUBFRAME_FIXED
|| SUBFRAME_LPC
|| SUBFRAME_VERBATIM -
- The SUBFRAME_HEADER specifies which one. -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - -
- SUBFRAME_HEADER -
- <1> - - Zero bit padding, to prevent sync-fooling string of 1s -
- <6> - - Subframe type: - -
- <1+k> - - 'Wasted bits-per-sample' flag: -
    -
  • - 0 : no wasted bits-per-sample in source subblock, k=0 -
  • -
  • - 1 : k wasted bits-per-sample in source subblock, k-1 follows, unary coded; e.g. k=3 => 001 follows, k=7 => 0000001 follows. -
  • -
- The size of the samples stored in the subframe is the subframe sample size reduced by k bits. - Decoded samples must be shifted left by k bits. -
-
-
- -
- -
-
- - - - - - - - -
- SUBFRAME_CONSTANT -
- <n> - - Unencoded constant value of the subblock, n = frame's bits-per-sample. -
-
-
- -
- -
-
- - - - - - - - - - - - -
- SUBFRAME_FIXED -
- <n> - - Unencoded warm-up samples (n = frame's bits-per-sample * predictor order). -
- RESIDUAL - - Encoded residual -
-
-
- -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - -
- SUBFRAME_LPC -
- <n> - - Unencoded warm-up samples (n = frame's bits-per-sample * lpc order). -
- <4> - - (Quantized linear predictor coefficients' precision in bits)-1 (1111 = invalid). -
- <5> - - Quantized linear predictor coefficient shift needed in bits (NOTE: this number is signed two's-complement; - but, due to implementation details, must be non-negative). -
- <n> - - Unencoded predictor coefficients (n = qlp coeff precision * lpc order) (NOTE: the coefficients are signed two's-complement). -
- RESIDUAL - - Encoded residual -
-
-
- -
- -
-
- - - - - - - - -
- SUBFRAME_VERBATIM -
- <n*i> - - Unencoded subblock; n = frame's bits-per-sample, i = frame's blocksize. -
-
-
- -
- -
-
- - - - - - - - - - - - -
- RESIDUAL -
- <2> - - Residual coding method:
-
    -
  • - 00 : partitioned Rice coding with 4-bit Rice parameter; RESIDUAL_CODING_METHOD_PARTITIONED_RICE follows -
  • -
  • - 01 : partitioned Rice coding with 5-bit Rice parameter; RESIDUAL_CODING_METHOD_PARTITIONED_RICE2 follows -
  • -
  • - 10-11 : reserved -
  • -
-
- RESIDUAL_CODING_METHOD_PARTITIONED_RICE ||
- RESIDUAL_CODING_METHOD_PARTITIONED_RICE2 -
-   -
-
-
- -
- -
-
- - - - - - - - - - - - -
- RESIDUAL_CODING_METHOD_PARTITIONED_RICE -
- <4> - - Partition order. -
- RICE_PARTITION+ - - There will be 2^order partitions. -
-
-
- -
- -
-
- - - - - - - - - - - - -
- RICE_PARTITION -
- <4(+5)> - - Encoding parameter:
-
    -
  • - 0000-1110 : Rice parameter. -
  • -
  • - 1111 : Escape code, meaning the partition is in unencoded binary form using n bits per sample; n follows as a 5-bit number. -
  • -
-
- <?> - - Encoded residual. The number of samples (n) in the partition is determined as follows:
-
    -
  • - partition size = (frame's blocksize / (2^partition order)) -
  • -
  • - for first partition of the subframe, n = partition size - predictor -
  • -
  • - for remaining partitions, n = partition size -
  • -
-
-
-
- -
- -
-
- - - - - - - - - - - - -
- RESIDUAL_CODING_METHOD_PARTITIONED_RICE2 -
- <4> - - Partition order. -
- RICE2_PARTITION+ - - There will be 2^order partitions. -
-
-
- -
- -
-
- - - - - - - - - - - - -
- RICE2_PARTITION -
- <5(+5)> - - Encoding parameter:
-
    -
  • - 00000-11110 : Rice parameter. -
  • -
  • - 11111 : Escape code, meaning the partition is in unencoded binary form using n bits per sample; n follows as a 5-bit number. -
  • -
-
- <?> - - Encoded residual. The number of samples (n) in the partition is determined as follows:
-
    -
  • - partition size = (frame's blocksize / (2^partition order)) -
  • -
  • - for first partition of the subframe, n = partition size - predictor -
  • -
  • - for remaining partitions, n = partition size -
  • -
-
-
-
- - - - - - diff --git a/doc/html/id.html b/doc/html/id.html deleted file mode 100644 index ac054273..00000000 --- a/doc/html/id.html +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - id - - - - - - -
- - - -
- -
-
- register -
-
-
- FLAC allows third-party applications to register an ID for use with FLAC APPLICATION metadata blocks. Contact the FLAC-dev mailinglist to register an ID or to change an existing ID. Your request should at least contain the application ID, application name and a contact e-mail address. An application URL and specification URL should be mentioned too, if applicable.
-
- The ID request should be 8 hexadecimal digits and not conflict with any existing IDs (see the table below for all currently registered IDs). This 32-bit number will be stored big-endian in the block.
-
- Information about your application (but not your e-mail address) will show up on this page in the ID directory. You can also provide a URL to your application and a URL reference to the specification of your application's APPLICATION block.
-
- -
- -
- -
- -
-
- Here is a list of all registered IDs and their applications:
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ID - - Application -
- 41544348 - "ATCH" - - FlacFile -
- 42534F4C - "BSOL" - - beSolo -
- 42554753 - "BUGS" - - Bugs Player -
- 43756573 - "Cues" - - GoldWave cue points (specification) -
- 46696361 - "Fica" - - CUE Splitter -
- 46746F6C - "Ftol" - - flac-tools -
- 4D4F5442 - "MOTB" - - MOTB MetaCzar -
- 4D505345 - "MPSE" - - MP3 Stream Editor -
- 4D754D4C - "MuML" - - MusicML: Music Metadata Language -
- 52494646 - "RIFF" - - Sound Devices RIFF chunk storage -
- 5346464C - "SFFL" - - Sound Font FLAC -
- 534F4E59 - "SONY" - - Sony Creative Software -
- 5351455A - "SQEZ" - - flacsqueeze -
- 54745776 - "TtWv" - - TwistedWave -
- 55495453 - "UITS" - - UITS Embedding tools -
- 61696666 - "aiff" - - FLAC AIFF chunk storage -
- 696D6167 - "imag" - - flac-image application for storing arbitrary files in APPLICATION metadata blocks -
- 7065656D - "peem" - - Parseable Embedded Extensible Metadata (specification) -
- 71667374 - "qfst" - - QFLAC Studio -
- 72696666 - "riff" - - FLAC RIFF chunk storage -
- 74756E65 - "tune" - - TagTuner -
- 78626174 - "xbat" - - XBAT -
- 786D6364 - "xmcd" - - xmcd -
-
-
- -
- - - - - - diff --git a/doc/html/images/Makefile.am b/doc/html/images/Makefile.am deleted file mode 100644 index 467651cd..00000000 --- a/doc/html/images/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -logosdir = $(htmldir)/images - -logos_DATA = \ - logo.svg \ - logo130.gif - -EXTRA_DIST = $(logos_DATA) diff --git a/doc/html/images/logo.svg b/doc/html/images/logo.svg deleted file mode 100644 index 4ee2d418..00000000 --- a/doc/html/images/logo.svg +++ /dev/null @@ -1,431 +0,0 @@ - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/html/images/logo130.gif b/doc/html/images/logo130.gif deleted file mode 100644 index 3200df34..00000000 Binary files a/doc/html/images/logo130.gif and /dev/null differ diff --git a/doc/html/index.html b/doc/html/index.html deleted file mode 100644 index 3dabbd16..00000000 --- a/doc/html/index.html +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - Free Lossless Audio Codec - - - - - - -
- - - -
- - - - - - - - -
- -
- -
-
- Please note: This is the source-code documentation, for more general information on FLAC, please visit the on-line FLAC homepage
-
- FLAC stands for Free Lossless Audio Codec, an audio format similar to MP3, but lossless, meaning that audio is compressed in FLAC without any loss in quality. This is similar to how Zip works, except with FLAC you will get much better compression because it is designed specifically for audio, and you can play back compressed FLAC files in your favorite player (or your car or home stereo, see supported devices) just like you would an MP3 file.
-
- FLAC stands out as the fastest and most widely supported lossless audio codec, and the only one that at once is non-proprietary, is unencumbered by patents, has an open-source reference implementation, has a well documented format and API, and has several other independent implementations.
-
- See About FLAC for more, or Using FLAC for how to play FLAC files, rip CDs to FLAC, etc. -
- -
- -
- -
- -
-
- FLAC 1.3.2 released  :Changelog here
- last updated 2016-Dec-5 -
- -
- -
- - - - - - diff --git a/doc/html/license.html b/doc/html/license.html deleted file mode 100644 index 22733880..00000000 --- a/doc/html/license.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - license - - - - - - -
- - - -
- -
-
- license -
-
-
- FLAC is a free codec in the fullest sense. This page explicitly states all that you may do with the format and software.
-
- The FLAC and Ogg FLAC formats themselves, and their specifications, are fully open to the public to be used for any purpose (the FLAC project reserves the right to set the FLAC specification and certify compliance). They are free for commercial or noncommercial use. That means that commercial developers may independently write FLAC or Ogg FLAC software which is compatible with the specifications for no charge and without restrictions of any kind. There are no licensing fees or royalties of any kind for use of the formats or their specifications, or for distributing, selling, or streaming media in the FLAC or Ogg FLAC formats.
-
- The FLAC project also makes available software that implements the formats, which is distributed according to Open Source licenses as follows:
-
- The reference implementation libraries are licensed under the New BSD License. In simple terms, these libraries may be used by any application, Open or proprietary, linked or incorporated in whole, so long as acknowledgement is made to Xiph.org Foundation when using the source code in whole or in derived works. The Xiph License is free enough that the libraries have been used in commercial products to implement FLAC, including in the firmware of hardware devices where other Open Source licenses can be problematic. In the source code these libraries are called libFLAC and libFLAC++.
-
- The rest of the software that the FLAC project provides is licensed under the GNU General Public License (GPL). This software includes various utilities for converting files to and from FLAC format, plugins for audio players, et cetera. In general, the GPL allows redistribution as long as derived works are also made available in source code form according to compatible terms.
-
- Neither the FLAC nor Ogg FLAC formats nor any of the implemented encoding/decoding methods are covered by any known patent.
-
- FLAC is one of a family of codecs of the Xiph.org Foundation, all created according to the same free ideals. For some other codecs' descriptions of the Xiph License see the Speex and Vorbis license pages.
-
- If you would like to redistribute parts or all of FLAC under different terms, contact the FLAC-dev mailinglist. -
- -
- - - - - - diff --git a/doc/html/ogg_mapping.html b/doc/html/ogg_mapping.html deleted file mode 100644 index e28ca3d0..00000000 --- a/doc/html/ogg_mapping.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - FLAC - ogg mapping - - - - - - -
- - - -
- -
-
- ogg mapping -
-
-
- This page specifies the way in which compressed FLAC data is encapsulated in an Ogg transport layer. It assumes basic knowledge of the FLAC format and Ogg structure and framing.
-
- The original FLAC format includes a very thin transport system. This system of compressed FLAC audio data mixed with a thin transport has come to be known as 'native FLAC'. The transport consists of audio frame headers and footers which contain synchronization patterns, timecodes, and checksums (but notably not frame lengths), and a metadata system. It is very lightweight and does not support more elaborate transport mechanisms such as multiple logical streams, but it has served its purpose well.
-
- The native FLAC transport is not a transport "layer" in the way of standard codec design because it cannot be entirely separated from the payload. Though the metadata system can be separated, the frame header includes both data that belongs in the transport (sync pattern, timecode, checksum) and data that belongs in the compressed packets (audio parameters like channel assignments, sample rate, etc).
-
- This presents a problem when trying to encapsulate FLAC in other true transport layers; the choice has to be made between redundancy and complexity. In pursuit of correctness, a mapping could be created that removed from native FLAC the transport data, and merged the remaining frame header information into the audio packets. The disadvantage is that current native FLAC decoder software could not be used to decode because of the tight coupling with the transport. Either a separate decoding implementation would have to be created and maintained, or an Ogg FLAC decoder would have to synthesize native FLAC frames from Ogg FLAC packets and feed them to a native FLAC decoder.
-
- The alternative is to treat native FLAC frames as Ogg packets and accept the transport redundancy. It turns out that this is not much of a penalty; a maximum of 12 bytes per frame will be wasted. Given the common case of stereo CD audio encoded with a blocksize of 4096 samples, a compressed frame will be 4-16 Kbytes. The redundancy amounts to a fraction of a percent.
-
- In the interest of simplicity and expediency, the second method was chosen for the first official FLAC->Ogg mapping. A mapping version is included in the first packet so that a less redundant mapping can be defined in the future.
-
- It should also be noted that support for encapsulating FLAC in Ogg has been present in the FLAC tools since version 1.0.1. However, the mappings used were never formalized and have insurmountable problems. For that reason, Ogg FLAC streams created with flac versions before 1.1.1 should be decoded and re-encoded with flac 1.1.1 or later (flac 1.1.1 can decode all previous Ogg FLAC files, but files made prior to 1.1.0 don't support seeking). Since the support for Ogg FLAC before FLAC 1.1.1 was limited, we hope this will not result in too much inconvenience.
-
- Version 1.0 of the FLAC-to-Ogg mapping then is a simple identifying header followed by pure native FLAC data, as follows: -
    -
  • - The first packet of a stream consists of: -
      -
    • The one-byte packet type 0x7F
    • -
    • The four-byte ASCII signature "FLAC", i.e. 0x46, 0x4C, 0x41, 0x43
    • -
    • A one-byte binary major version number for the mapping, e.g. 0x01 for mapping version 1.0
    • -
    • A one-byte binary minor version number for the mapping, e.g. 0x00 for mapping version 1.0
    • -
    • A two-byte, big-endian binary number signifying the number of header (non-audio) packets, not including this one. This number may be zero (0x0000) to signify 'unknown' but be aware that some decoders may not be able to handle such streams.
    • -
    • The four-byte ASCII native FLAC signature "fLaC" according to the FLAC format specification
    • -
    • The STREAMINFO metadata block for the stream.
    • -
    - This first packet is the only packet in the first page of the stream. This results in a first Ogg page of exactly 79 bytes at the very beginning of the logical stream. -
  • -
  • - This first page is marked 'beginning of stream' in the page flags. -
  • -
  • - The first packet is followed by one or more header packets. Each such packet will contain a single native FLAC metadata block. The first of these must be a VORBIS_COMMENT block. These packets may span page boundaries but the last will finish the page on which it ends, so that the first audio packet begins a page. The first byte of these metadata packets serves also as the packet type, and has a legal range of (0x01-0x7E,0x81-0xFE). -
  • -
  • - The granule position of these first pages containing only headers is zero. -
  • -
  • - The first audio packet of the logical stream begins a fresh Ogg page. -
  • -
  • - Native FLAC audio frames appear as subsequent packets in the stream. Each packet corresponds to one FLAC audio frame. The first byte of each packet serves as the packet type. Since audio packets are native FLAC frames, this first byte will be always 0xFF according to the native FLAC format specification. -
  • -
  • - The last page is marked 'end of stream' in the page flags. -
  • -
  • - FLAC packets may span page boundaries. -
  • -
  • - The granule position of pages containing FLAC audio follows the same semantics as that for Ogg-encapsulated Vorbis as described here. -
  • -
  • - Redundant fields in the STREAMINFO packet may be set to zero (indicating "unknown" in native FLAC), which also facilitates single-pass encoding. These fields are: the minimum and maximum frame sizes, the total samples count, and the MD5 signature. "Unknown" values for these fields will not prevent a compliant native FLAC or Ogg FLAC decoder from decoding the stream. -
  • -
- It is intended that the first six bytes of any version of FLAC-to-Ogg mapping will share the same structure, namely, the four-byte signature and two-byte version number.
-
- There is an implicit hint to the decoder in the mapping version number; mapping versions which share the same major version number should be decodable by decoders of the same major version number, e.g. a 1.x Ogg FLAC decoder should be able to decode any 1.y Ogg FLAC stream, even when x<y. If a mapping breaks this forward compatibility the major version number will be incremented. -
- -
- - - - - - diff --git a/doc/isoflac.txt b/doc/isoflac.txt deleted file mode 100644 index 574df9f5..00000000 --- a/doc/isoflac.txt +++ /dev/null @@ -1,666 +0,0 @@ -Encapsulation of FLAC in ISO Base Media File Format -Version 0.0.4 (draft) - -Table of Contents -1 Scope -2 Supporting Normative References -3 Design Rules of Encapsulation - 3.1 File Type Identification - 3.2 Overview of Track Structure - 3.3 Definition of FLAC sample - 3.3.1 Sample entry format - 3.3.2 FLAC Specific Box - 3.3.3 Sample format - 3.3.4 Duration of FLAC sample - 3.3.5 Sub-sample - 3.3.6 Random Access - 3.3.6.1 Random Access Point - 3.4 Basic Structure (informative) - 3.4.1 Initial Movie - 3.5 Example of Encapsulation (informative) -4 Acknowledgements -5 Author's Address - -1 Scope - - This document specifies the normative mapping for encapsulation of - FLAC coded audio bitstreams in ISO Base Media file format and its - derivatives. The encapsulation of FLAC coded bitstreams in - QuickTime file format is outside the scope of this specification. - -2 Supporting Normative References - - [1] ISO/IEC 14496-12:2012 Corrected version - - Information technology — Coding of audio-visual objects — Part - 12: ISO base media file format - - [2] ISO/IEC 14496-12:2012/Amd.1:2013 - - Information technology — Coding of audio-visual objects — Part - 12: ISO base media file format AMENDMENT 1: Various - enhancements including support for large metadata - - [3] FLAC format specification - - https://xiph.org/flac/format.html - - Definition of the FLAC Audio Codec stream format - - [4] FLAC-in-Ogg mapping specification - - https://xiph.org/flac/ogg_mapping.html - - Ogg Encapsulation for the FLAC Audio Codec - - [5] Matroska specification - -3 Design Rules of Encapsulation - - 3.1 File Type Identification - - This specification does not define any brand to declare files - which conform to this specification. Files which conform to - this specification shall contain at least one brand which - supports the requirements and the requirements described in - this clause without contradiction in the compatible brands - list of the File Type Box. The minimal support of the - encapsulation of FLAC bitstreams in ISO Base Media file format - requires the 'isom' brand. - - 3.2 Overview of Track Structure - - FLAC coded audio shall be encapsulated into the ISO Base - Media File Format as media data within an audio track. - - + The handler_type field in the Handler Reference Box - shall be set to 'soun'. - - + The Media Information Box shall contain the Sound Media - Header Box. - - + The codingname of the sample entry is 'fLaC'. - - This specification does not define any encapsulation - using MP4AudioSampleEntry with objectTypeIndication - specified by the MPEG-4 Registration Authority - (http://www.mp4ra.org/). See section 'Sample entry - format' for the definition of the sample entry. - - + The 'dfLa' box is added to the sample entry to convey - initializing information for the decoder. - - See section 'FLAC Specific Box' for the definition of - the box contents. - - + A FLAC sample is exactly one FLAC frame as described - in the format specification[3]. See section - 'Sample format' for details of the frame contents. - - + Every FLAC sample is a sync sample. No pre-roll or - lapping is required. See section 'Random Access' for - further details. - - 3.3 Definition of a FLAC sample - - 3.3.1 Sample entry format - - For any track containing one or more FLAC bitstreams, a - sample entry describing the corresponding FLAC bitstream - shall be present inside the Sample Table Box. This version - of the specification defines only one sample entry format - named FLACSampleEntry whose codingname is 'fLaC'. This - sample entry includes exactly one FLAC Specific Box - defined in section 'FLAC specific box' as a mandatory box - and indicates that FLAC samples described by this sample - entry are stored by the sample format described in section - 'Sample format'. - - The syntax and semantics of the FLACSampleEntry is shown - as follows. The data fields of this box and native - FLAC[3] structures encoded within FLAC blocks are both - stored in big-endian format, though for purposes of the - ISO BMFF container, FLAC native metadata and data blocks - are treated as unstructured octet streams. - - class FLACSampleEntry() extends AudioSampleEntry ('fLaC'){ - FLACSpecificBox(); - } - - The fields of the AudioSampleEntry portion shall be set as - follows: - - + channelcount: - - The channelcount field shall be set equal to the - channel count specified by the FLAC bitstream's native - METADATA_BLOCK_STREAMINFO header as described in [3]. - Note that the FLAC FRAME_HEADER structure that begins - each FLAC sample redundantly encodes channel number; - the number of channels declared in each FRAME_HEADER - MUST match the number of channels declared here and in - the METADATA_BLOCK_STREAMINFO header. - - + samplesize: - - The samplesize field shall be set equal to the bits - per sample specified by the FLAC bitstream's native - METADATA_BLOCK_STREAMINFO header as described in [3]. - Note that the FLAC FRAME_HEADER structure that begins - each FLAC sample redundantly encodes the number of - bits per sample; the bits per sample declared in each - FRAME_HEADER MUST match the samplesize declared here - and the bits per sample field declared in the - METADATA_BLOCK_STREAMINFO header. - - + samplerate: - - When possible, the samplerate field shall be set - equal to the sample rate specified by the FLAC - bitstream's native METADATA_BLOCK_STREAMINFO header - as described in [3], left-shifted by 16 bits to - create the appropriate 16.16 fixed-point - representation. - - When the bitstream's native sample rate is greater - than the maximum expressible value of 65535 Hz, - the samplerate field shall hold the greatest - expressible regular division of that rate. I.e. - the samplerate field shall hold 48000.0 for - native sample rates of 96 and 192 kHz. In the - case of unusual sample rates which do not have - an expressible regular division, the maximum value - of 65535.0 Hz should be used. - - High-rate FLAC bitstreams are common, and the native - value from the METADATA_BLOCK_STREAMINFO header in - the FLACSpecificBox MUST be read to determine the - correct sample rate of the bitstream. - - Note that the FLAC FRAME_HEADER structure that begins - each FLAC sample redundantly encodes the sample rate; - the sample rate declared in each FRAME_HEADER MUST - match the sample rate declared in the - METADATA_BLOCK_STREAMINFO header, and here in the - AudioSampleEntry portion of the FLACSampleEntry - as much as is allowed by the encoding restrictions - described above. - - Finally, the FLACSpecificBox carries codec headers: - - + FLACSpecificBox - - This box contains initializing information for the - decoder as defined in section 'FLAC specific box'. - - 3.3.2 FLAC Specific Box - - Exactly one FLAC Specific Box shall be present in each - FLACSampleEntry. This specification defines version 0 - of this box. If incompatible changes occur in future - versions of this specification, another version number - will be defined. The data fields of this box and native - FLAC[3] structures encoded within FLAC blocks are both - stored in big-endian format, though for purposes of the - ISO BMFF container, FLAC native metadata and data blocks - are treated as unstructured octet streams. - - The syntax and semantics of the FLAC Specific Box is shown - as follows. - - class FLACMetadataBlock { - unsigned int(1) LastMetadataBlockFlag; - unsigned int(7) BlockType; - unsigned int(24) Length; - unsigned int(8) BlockData[Length]; - } - - aligned(8) class FLACSpecificBox - extends FullBox('dfLa', version=0, 0){ - for (i=0; ; i++) { // to end of box - FLACMetadataBlock(); - } - } - - + Version: - - The Version field shall be set to 0. - - In the future versions of this specification, this - field may be set to other values. And without support - of those values, the reader shall not read the fields - after this within the FLACSpecificBox. - - + Flags: - - The Flags field shall be set to 0. - - After the FullBox header, the box contains a sequence of - FLAC[3] native-metadata block structures that fill the - remainder of the box. - - Each FLACMetadataBlock structure consists of three fields - filling a total of four bytes that form a FLAC[3] native - METADATA_BLOCK_HEADER, followed by raw octet bytes that - comprise the FLAC[3] native METADATA_BLOCK_DATA. - - + LastMetadataBlockFlag: - - The LastMetadataBlockFlag field maps semantically to - the FLAC[3] native METADATA_BLOCK_HEADER - Last-metadata-block flag as defined in the FLAC[3] - file specification. - - The LastMetadataBlockFlag is set to 1 if this - MetadataBlock is the last metadata block in the - FLACSpecificBox. It is set to 0 otherwise. - - + BlockType: - - The BlockType field maps semantically to the FLAC[3] - native METADATA_BLOCK_HEADER BLOCK_TYPE field as - defined in the FLAC[3] file specification. - - The BlockType is set to a valid FLAC[3] BLOCK_TYPE - value that identifies the type of this native metadata - block. The BlockType of the first FLACMetadataBlock - must be set to 0, signifying this is a FLAC[3] native - METADATA_BLOCK_STREAMINFO block. - - + Length: - - The Length field maps semantically to the FLAC[3] - native METADATA_BLOCK_HEADER Length field as - defined in the FLAC[3] file specification. - - The length field specifies the number of bytes of - MetadataBlockData to follow. - - + BlockData - - The BlockData field maps semantically to the FLAC[3] - native METADATA_BLOCK_HEADER METADATA_BLOCK_DATA as - defined in the FLAC[3] file specification. - - Taken together, the bytes of the FLACMetadataBlock form a - complete FLAC[3] native METADATA_BLOCK structure. - - Note that a minimum of a single FLACMetadataBlock, - consisting of a FLAC[3] native METADATA_BLOCK_STREAMINFO - structure, is required. Should the FLACSpecificBox - contain more than a single FLACMetadataBlock structure, - the FLACMetadataBlock containing the FLAC[3] native - METADATA_BLOCK_STREAMINFO must occur first in the list. - - Other containers that package FLAC audio streams, such as - Ogg[4] and Matroska[5], wrap FLAC[3] native metadata without - modification similar to this specification. When - repackaging or remuxing FLAC[3] streams from another - format that contains FLAC[3] native metadata into an ISO - BMFF file, the complete FLAC[3] native metadata should be - preserved in the ISO BMFF stream as described above. It - is also allowed to parse this native metadata and include - contextually redundant ISO BMFF-native repackagings and/or - reparsings of FLAC[3] native metadata, so long as the - native metadata is also preserved. - - 3.3.3 Sample format - - A FLAC sample is exactly one FLAC audio FRAME (as defined - in the FLAC[3] file specification) belonging to a FLAC - bitstreams. The FLAC sample data begins with a complete - FLAC FRAME_HEADER, followed by one FLAC SUBFRAME per - channel, any necessary bit padding, and ends with the - usual FLAC FRAME_FOOTER. - - Note that the FLAC native FRAME_HEADER structure that - begins each FLAC sample redundantly encodes channel count, - sample rate, and sample size. The values of these fields - must agree both with the values declared in the FLAC - METADATA_BLOCK_STREAMINFO structure as well as the - FLACSampleEntry box. - - 3.3.4 Duration of a FLAC sample - - The duration of any given FLAC sample is determined by - dividing the decoded block size of a FLAC frame, as - encoded in the FLAC FRAME's FRAME_HEADER structure, by the - value of the timescale field in the Media Header Box. - FLAC samples are permitted to have variable durations - within a given audio stream. FLAC does not use padding - values. - - 3.3.5 Sub-sample - - Sub-samples are not defined for FLAC samples in this - specification. - - 3.3.6 Random Access - - This subclause describes the nature of the random access - of FLAC sample. - - 3.3.6.1 Random Access Point - - All FLAC samples can be independently decoded - i.e. every FLAC sample is a sync sample. The Sync - Sample Box shall not be present as long as there are - no samples other than FLAC samples in the same - track. The sample_is_non_sync_sample field for FLAC - samples shall be set to 0. - - 3.4 Basic Structure (informative) - - 3.4.1 Initial Movie - - This subclause shows a basic structure of the Movie Box as follows: - - +----+----+----+----+----+----+----+----+------------------------------+ - |moov| | | | | | | | Movie Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | |mvhd| | | | | | | Movie Header Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | |trak| | | | | | | Track Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | |tkhd| | | | | | Track Header Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | |edts|* | | | | | Edit Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | |elst|* | | | | Edit List Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | |mdia| | | | | | Media Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | |mdhd| | | | | Media Header Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | |hdlr| | | | | Handler Reference Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | |minf| | | | | Media Information Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | |smhd| | | | Sound Media Header Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | |dinf| | | | Data Information Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | | |dref| | | Data Reference Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | | | |url | | DataEntryUrlBox | - +----+----+----+----+----+----+ or +----+------------------------------+ - | | | | | | |urn | | DataEntryUrnBox | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | |stbl| | | | Sample Table | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | | |stsd| | | Sample Description Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | | | |fLaC| | FLACSampleEntry | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | | | | |dfLa| FLAC Specific Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | | |stts| | | Decoding Time to Sample Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | | |stsc| | | Sample To Chunk Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | | |stsz| | | Sample Size Box | - +----+----+----+----+----+ or +----+----+------------------------------+ - | | | | | |stz2| | | Compact Sample Size Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | | | | |stco| | | Chunk Offset Box | - +----+----+----+----+----+ or +----+----+------------------------------+ - | | | | | |co64| | | Chunk Large Offset Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | |mvex|* | | | | | | Movie Extends Box | - +----+----+----+----+----+----+----+----+------------------------------+ - | | |trex|* | | | | | Track Extends Box | - +----+----+----+----+----+----+----+----+------------------------------+ - - Figure 1 - Basic structure of Movie Box - - It is strongly recommended that the order of boxes should - follow the above structure. Boxes marked with an asterisk - (*) may or may not be present depending on context. For - most boxes listed above, the definition is as is defined - in ISO/IEC 14496-12 [1]. The additional boxes and the - additional requirements, restrictions and recommendations - to the other boxes are described in this specification. - - 3.5 Example of Encapsulation (informative) - [File] - size = 17790 - [ftyp: File Type Box] - position = 0 - size = 24 - major_brand = mp42 : MP4 version 2 - minor_version = 0 - compatible_brands - brand[0] = mp42 : MP4 version 2 - brand[1] = isom : ISO Base Media file format - [moov: Movie Box] - position = 24 - size = 757 - [mvhd: Movie Header Box] - position = 32 - size = 108 - version = 0 - flags = 0x000000 - creation_time = UTC 2014/12/12, 18:41:19 - modification_time = UTC 2014/12/12, 18:41:19 - timescale = 48000 - duration = 33600 (00:00:00.700) - rate = 1.000000 - volume = 1.000000 - reserved = 0x0000 - reserved = 0x00000000 - reserved = 0x00000000 - transformation matrix - | a, b, u | | 1.000000, 0.000000, 0.000000 | - | c, d, v | = | 0.000000, 1.000000, 0.000000 | - | x, y, w | | 0.000000, 0.000000, 1.000000 | - pre_defined = 0x00000000 - pre_defined = 0x00000000 - pre_defined = 0x00000000 - pre_defined = 0x00000000 - pre_defined = 0x00000000 - pre_defined = 0x00000000 - next_track_ID = 2 - [iods: Object Descriptor Box] - position = 140 - size = 33 - version = 0 - flags = 0x000000 - [tag = 0x10: MP4_IOD] - expandableClassSize = 16 - ObjectDescriptorID = 1 - URL_Flag = 0 - includeInlineProfileLevelFlag = 0 - reserved = 0xf - ODProfileLevelIndication = 0xff - sceneProfileLevelIndication = 0xff - audioProfileLevelIndication = 0xfe - visualProfileLevelIndication = 0xff - graphicsProfileLevelIndication = 0xff - [tag = 0x0e: ES_ID_Inc] - expandableClassSize = 4 - Track_ID = 1 - [trak: Track Box] - position = 173 - size = 608 - [tkhd: Track Header Box] - position = 181 - size = 92 - version = 0 - flags = 0x000007 - Track enabled - Track in movie - Track in preview - creation_time = UTC 2014/12/12, 18:41:19 - modification_time = UTC 2014/12/12, 18:41:19 - track_ID = 1 - reserved = 0x00000000 - duration = 33600 (00:00:00.700) - reserved = 0x00000000 - reserved = 0x00000000 - layer = 0 - alternate_group = 0 - volume = 1.000000 - reserved = 0x0000 - transformation matrix - | a, b, u | | 1.000000, 0.000000, 0.000000 | - | c, d, v | = | 0.000000, 1.000000, 0.000000 | - | x, y, w | | 0.000000, 0.000000, 1.000000 | - width = 0.000000 - height = 0.000000 - [mdia: Media Box] - position = 273 - size = 472 - [mdhd: Media Header Box] - position = 281 - size = 32 - version = 0 - flags = 0x000000 - creation_time = UTC 2014/12/12, 18:41:19 - modification_time = UTC 2014/12/12, 18:41:19 - timescale = 48000 - duration = 34560 (00:00:00.720) - language = und - pre_defined = 0x0000 - [hdlr: Handler Reference Box] - position = 313 - size = 51 - version = 0 - flags = 0x000000 - pre_defined = 0x00000000 - handler_type = soun - reserved = 0x00000000 - reserved = 0x00000000 - reserved = 0x00000000 - name = Xiph Audio Handler - [minf: Media Information Box] - position = 364 - size = 381 - [smhd: Sound Media Header Box] - position = 372 - size = 16 - version = 0 - flags = 0x000000 - balance = 0.000000 - reserved = 0x0000 - [dinf: Data Information Box] - position = 388 - size = 36 - [dref: Data Reference Box] - position = 396 - size = 28 - version = 0 - flags = 0x000000 - entry_count = 1 - [url : Data Entry Url Box] - position = 412 - size = 12 - version = 0 - flags = 0x000001 - location = in the same file - [stbl: Sample Table Box] - position = 424 - size = 321 - [stsd: Sample Description Box] - position = 432 - size = 79 - version = 0 - flags = 0x000000 - entry_count = 1 - [fLaC: Audio Description] - position = 448 - size = 63 - reserved = 0x000000000000 - data_reference_index = 1 - reserved = 0x0000 - reserved = 0x0000 - reserved = 0x00000000 - channelcount = 2 - samplesize = 16 - pre_defined = 0 - reserved = 0 - samplerate = 48000.000000 - [dfLa: FLAC Specific Box] - position = 484 - size = 50 - version = 0 - flags = 0x000000 - [FLACMetadataBlock] - LastMetadataBlockFlag = 1 - BlockType = 0 - Length = 34 - BlockData[34]; - [stts: Decoding Time to Sample Box] - position = 492 - size = 24 - version = 0 - flags = 0x000000 - entry_count = 1 - entry[0] - sample_count = 18 - sample_delta = 1920 - [stsc: Sample To Chunk Box] - position = 516 - size = 40 - version = 0 - flags = 0x000000 - entry_count = 2 - entry[0] - first_chunk = 1 - samples_per_chunk = 13 - sample_description_index = 1 - entry[1] - first_chunk = 2 - samples_per_chunk = 5 - sample_description_index = 1 - [stsz: Sample Size Box] - position = 556 - size = 92 - version = 0 - flags = 0x000000 - sample_size = 0 (variable) - sample_count = 18 - entry_size[0] = 977 - entry_size[1] = 938 - entry_size[2] = 939 - entry_size[3] = 938 - entry_size[4] = 934 - entry_size[5] = 945 - entry_size[6] = 948 - entry_size[7] = 956 - entry_size[8] = 955 - entry_size[9] = 930 - entry_size[10] = 933 - entry_size[11] = 934 - entry_size[12] = 972 - entry_size[13] = 977 - entry_size[14] = 958 - entry_size[15] = 949 - entry_size[16] = 962 - entry_size[17] = 848 - [stco: Chunk Offset Box] - position = 648 - size = 24 - version = 0 - flags = 0x000000 - entry_count = 2 - chunk_offset[0] = 686 - chunk_offset[1] = 12985 - [free: Free Space Box] - position = 672 - size = 8 - [mdat: Media Data Box] - position = 680 - size = 17001 - -4 Acknowledgements - - This spec draws heavily from the Opus-in-ISOBMFF specification - work done by Yusuke Nakamura - - Thank you to Tim Terriberry, David Evans, and Yusuke Nakamura - for valuable feedback. Thank you to Ralph Giles for editorial - help. - -5 Author Address - - Monty Montgomery diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt deleted file mode 100644 index ed18e3b1..00000000 --- a/examples/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -add_subdirectory("c/decode/file") -add_subdirectory("c/encode/file") - -if(BUILD_CXXLIBS) - add_subdirectory("cpp/decode/file") - add_subdirectory("cpp/encode/file") -endif() diff --git a/examples/Makefile.am b/examples/Makefile.am deleted file mode 100644 index 9ae4f156..00000000 --- a/examples/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -if FLaC__WITH_CPPLIBS -CPPLIBS_DIRS = cpp -endif - -SUBDIRS = c $(CPPLIBS_DIRS) - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - README diff --git a/examples/Makefile.lite b/examples/Makefile.lite deleted file mode 100644 index f805a3e1..00000000 --- a/examples/Makefile.lite +++ /dev/null @@ -1,50 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -.PHONY: all example_c_decode_file example_c_encode_file example_cpp_decode_file example_cpp_encode_file -all: example_c_decode_file example_c_encode_file example_cpp_decode_file example_cpp_encode_file - -DEFAULT_CONFIG = release - -CONFIG = $(DEFAULT_CONFIG) - -debug : CONFIG = debug -valgrind: CONFIG = valgrind -release : CONFIG = release - -debug : all -valgrind: all -release : all - -example_c_decode_file: - (cd c/decode/file && $(MAKE) -f Makefile.lite $(CONFIG)) - -example_c_encode_file: - (cd c/encode/file && $(MAKE) -f Makefile.lite $(CONFIG)) - -example_cpp_decode_file: - (cd cpp/decode/file && $(MAKE) -f Makefile.lite $(CONFIG)) - -example_cpp_encode_file: - (cd cpp/encode/file && $(MAKE) -f Makefile.lite $(CONFIG)) - -clean: - -(cd c/decode/file && $(MAKE) -f Makefile.lite clean) - -(cd c/encode/file && $(MAKE) -f Makefile.lite clean) - -(cd cpp/decode/file && $(MAKE) -f Makefile.lite clean) - -(cd cpp/encode/file && $(MAKE) -f Makefile.lite clean) diff --git a/examples/README b/examples/README deleted file mode 100644 index 2da7bd6d..00000000 --- a/examples/README +++ /dev/null @@ -1,12 +0,0 @@ -Here are several small example programs that use the libraries in different -ways. - -The "c" directory has programs that are all in C and use libFLAC. - -The "cpp" directory has analogous programs that are all in C++ and use libFLAC++. - -The programs are: -c/decode/file/ - example_c_decode_file - Simple FLAC file decoder using libFLAC -c/encode/file/ - example_c_encode_file - Simple FLAC file encoder using libFLAC -cpp/decode/file/ - example_cpp_decode_file - Simple FLAC file decoder using libFLAC++ -cpp/encode/file/ - example_cpp_encode_file - Simple FLAC file encoder using libFLAC++ diff --git a/examples/c/Makefile.am b/examples/c/Makefile.am deleted file mode 100644 index e44ad017..00000000 --- a/examples/c/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -SUBDIRS = decode encode diff --git a/examples/c/decode/Makefile.am b/examples/c/decode/Makefile.am deleted file mode 100644 index 2e103e43..00000000 --- a/examples/c/decode/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -SUBDIRS = file diff --git a/examples/c/decode/file/CMakeLists.txt b/examples/c/decode/file/CMakeLists.txt deleted file mode 100644 index 53a29918..00000000 --- a/examples/c/decode/file/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(decode_file main.c) -target_link_libraries(decode_file FLAC) diff --git a/examples/c/decode/file/Makefile.am b/examples/c/decode/file/Makefile.am deleted file mode 100644 index da1bae12..00000000 --- a/examples/c/decode/file/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# example_c_decode_file - Simple FLAC file decoder using libFLAC -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - example_c_decode_file.vcproj \ - example_c_decode_file.vcxproj \ - example_c_decode_file.vcxproj.filters - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -noinst_PROGRAMS = example_c_decode_file -example_c_decode_file_LDADD = \ - $(top_builddir)/src/libFLAC/libFLAC.la - -example_c_decode_file_SOURCES = main.c - -CLEANFILES = example_c_decode_file.exe diff --git a/examples/c/decode/file/Makefile.lite b/examples/c/decode/file/Makefile.lite deleted file mode 100644 index 16d5268b..00000000 --- a/examples/c/decode/file/Makefile.lite +++ /dev/null @@ -1,42 +0,0 @@ -# example_c_decode_file - Simple FLAC file decoder using libFLAC -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../../../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = example_c_decode_file - -INCLUDES = -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lFLAC $(OGG_LIBS) -lm -endif - -SRCS_C = main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/examples/c/decode/file/example_c_decode_file.vcproj b/examples/c/decode/file/example_c_decode_file.vcproj deleted file mode 100644 index ddd20bca..00000000 --- a/examples/c/decode/file/example_c_decode_file.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/c/decode/file/example_c_decode_file.vcxproj b/examples/c/decode/file/example_c_decode_file.vcxproj deleted file mode 100644 index db14265e..00000000 --- a/examples/c/decode/file/example_c_decode_file.vcxproj +++ /dev/null @@ -1,179 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbd00-c215-11db-8314-0800200c9a66} - example_c_decode_file - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/examples/c/decode/file/example_c_decode_file.vcxproj.filters b/examples/c/decode/file/example_c_decode_file.vcxproj.filters deleted file mode 100644 index a700a4f8..00000000 --- a/examples/c/decode/file/example_c_decode_file.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {39992580-89DB-4b41-8E8B-625F9E28BEBF} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC727F1-C7A5-1376-A061-2AF2D742A2F0} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/examples/c/decode/file/main.c b/examples/c/decode/file/main.c deleted file mode 100644 index 8b3710bd..00000000 --- a/examples/c/decode/file/main.c +++ /dev/null @@ -1,200 +0,0 @@ -/* example_c_decode_file - Simple FLAC file decoder using libFLAC - * Copyright (C) 2007-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* - * This example shows how to use libFLAC to decode a FLAC file to a WAVE - * file. It only supports 16-bit stereo files. - * - * Complete API documentation can be found at: - * http://xiph.org/flac/api/ - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include "share/compat.h" -#include "FLAC/stream_decoder.h" - -static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); -static void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); -static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); - -static FLAC__uint64 total_samples = 0; -static unsigned sample_rate = 0; -static unsigned channels = 0; -static unsigned bps = 0; - -static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 x) -{ - return - fputc(x, f) != EOF && - fputc(x >> 8, f) != EOF - ; -} - -static FLAC__bool write_little_endian_int16(FILE *f, FLAC__int16 x) -{ - return write_little_endian_uint16(f, (FLAC__uint16)x); -} - -static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 x) -{ - return - fputc(x, f) != EOF && - fputc(x >> 8, f) != EOF && - fputc(x >> 16, f) != EOF && - fputc(x >> 24, f) != EOF - ; -} - -int main(int argc, char *argv[]) -{ - FLAC__bool ok = true; - FLAC__StreamDecoder *decoder = 0; - FLAC__StreamDecoderInitStatus init_status; - FILE *fout; - - if(argc != 3) { - fprintf(stderr, "usage: %s infile.flac outfile.wav\n", argv[0]); - return 1; - } - - if((fout = fopen(argv[2], "wb")) == NULL) { - fprintf(stderr, "ERROR: opening %s for output\n", argv[2]); - return 1; - } - - if((decoder = FLAC__stream_decoder_new()) == NULL) { - fprintf(stderr, "ERROR: allocating decoder\n"); - fclose(fout); - return 1; - } - - (void)FLAC__stream_decoder_set_md5_checking(decoder, true); - - init_status = FLAC__stream_decoder_init_file(decoder, argv[1], write_callback, metadata_callback, error_callback, /*client_data=*/fout); - if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - fprintf(stderr, "ERROR: initializing decoder: %s\n", FLAC__StreamDecoderInitStatusString[init_status]); - ok = false; - } - - if(ok) { - ok = FLAC__stream_decoder_process_until_end_of_stream(decoder); - fprintf(stderr, "decoding: %s\n", ok? "succeeded" : "FAILED"); - fprintf(stderr, " state: %s\n", FLAC__StreamDecoderStateString[FLAC__stream_decoder_get_state(decoder)]); - } - - FLAC__stream_decoder_delete(decoder); - fclose(fout); - - return 0; -} - -FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - FILE *f = (FILE*)client_data; - const FLAC__uint32 total_size = (FLAC__uint32)(total_samples * channels * (bps/8)); - size_t i; - - (void)decoder; - - if(total_samples == 0) { - fprintf(stderr, "ERROR: this example only works for FLAC files that have a total_samples count in STREAMINFO\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - if(channels != 2 || bps != 16) { - fprintf(stderr, "ERROR: this example only supports 16bit stereo streams\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - if(frame->header.channels != 2) { - fprintf(stderr, "ERROR: This frame contains %u channels (should be 2)\n", frame->header.channels); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - if(buffer [0] == NULL) { - fprintf(stderr, "ERROR: buffer [0] is NULL\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - if(buffer [1] == NULL) { - fprintf(stderr, "ERROR: buffer [1] is NULL\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - - /* write WAVE header before we write the first frame */ - if(frame->header.number.sample_number == 0) { - if( - fwrite("RIFF", 1, 4, f) < 4 || - !write_little_endian_uint32(f, total_size + 36) || - fwrite("WAVEfmt ", 1, 8, f) < 8 || - !write_little_endian_uint32(f, 16) || - !write_little_endian_uint16(f, 1) || - !write_little_endian_uint16(f, (FLAC__uint16)channels) || - !write_little_endian_uint32(f, sample_rate) || - !write_little_endian_uint32(f, sample_rate * channels * (bps/8)) || - !write_little_endian_uint16(f, (FLAC__uint16)(channels * (bps/8))) || /* block align */ - !write_little_endian_uint16(f, (FLAC__uint16)bps) || - fwrite("data", 1, 4, f) < 4 || - !write_little_endian_uint32(f, total_size) - ) { - fprintf(stderr, "ERROR: write error\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - - /* write decoded PCM samples */ - for(i = 0; i < frame->header.blocksize; i++) { - if( - !write_little_endian_int16(f, (FLAC__int16)buffer[0][i]) || /* left channel */ - !write_little_endian_int16(f, (FLAC__int16)buffer[1][i]) /* right channel */ - ) { - fprintf(stderr, "ERROR: write error\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - (void)decoder, (void)client_data; - - /* print some stats */ - if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { - /* save for later */ - total_samples = metadata->data.stream_info.total_samples; - sample_rate = metadata->data.stream_info.sample_rate; - channels = metadata->data.stream_info.channels; - bps = metadata->data.stream_info.bits_per_sample; - - fprintf(stderr, "sample rate : %u Hz\n", sample_rate); - fprintf(stderr, "channels : %u\n", channels); - fprintf(stderr, "bits per sample: %u\n", bps); - fprintf(stderr, "total samples : %" PRIu64 "\n", total_samples); - } -} - -void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - (void)decoder, (void)client_data; - - fprintf(stderr, "Got error callback: %s\n", FLAC__StreamDecoderErrorStatusString[status]); -} diff --git a/examples/c/encode/Makefile.am b/examples/c/encode/Makefile.am deleted file mode 100644 index 2e103e43..00000000 --- a/examples/c/encode/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -SUBDIRS = file diff --git a/examples/c/encode/file/CMakeLists.txt b/examples/c/encode/file/CMakeLists.txt deleted file mode 100644 index 4b7d4c2c..00000000 --- a/examples/c/encode/file/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(encode_file main.c) -target_link_libraries(encode_file FLAC) diff --git a/examples/c/encode/file/Makefile.am b/examples/c/encode/file/Makefile.am deleted file mode 100644 index 17a4491c..00000000 --- a/examples/c/encode/file/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -# example_c_encode_file - Simple FLAC file encoder using libFLAC -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - example_c_encode_file.vcproj \ - example_c_encode_file.vcxproj \ - example_c_encode_file.vcxproj.filters - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -noinst_PROGRAMS = example_c_encode_file -example_c_encode_file_LDADD = \ - $(top_builddir)/src/libFLAC/libFLAC.la \ - @OGG_LIBS@ \ - -lm - -example_c_encode_file_SOURCES = main.c - -CLEANFILES = example_c_encode_file.exe diff --git a/examples/c/encode/file/Makefile.lite b/examples/c/encode/file/Makefile.lite deleted file mode 100644 index 1530af9f..00000000 --- a/examples/c/encode/file/Makefile.lite +++ /dev/null @@ -1,42 +0,0 @@ -# example_c_encode_file - Simple FLAC file encoder using libFLAC -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../../../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = example_c_encode_file - -INCLUDES = -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lFLAC $(OGG_LIBS) -lm -endif - -SRCS_C = main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/examples/c/encode/file/example_c_encode_file.vcproj b/examples/c/encode/file/example_c_encode_file.vcproj deleted file mode 100644 index 26f0e9e2..00000000 --- a/examples/c/encode/file/example_c_encode_file.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/c/encode/file/example_c_encode_file.vcxproj b/examples/c/encode/file/example_c_encode_file.vcxproj deleted file mode 100644 index edf464b7..00000000 --- a/examples/c/encode/file/example_c_encode_file.vcxproj +++ /dev/null @@ -1,179 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbd01-c215-11db-8314-0800200c9a66} - example_c_encode_file - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/examples/c/encode/file/example_c_encode_file.vcxproj.filters b/examples/c/encode/file/example_c_encode_file.vcxproj.filters deleted file mode 100644 index a700a4f8..00000000 --- a/examples/c/encode/file/example_c_encode_file.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {39992580-89DB-4b41-8E8B-625F9E28BEBF} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC727F1-C7A5-1376-A061-2AF2D742A2F0} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/examples/c/encode/file/main.c b/examples/c/encode/file/main.c deleted file mode 100644 index b12d32b1..00000000 --- a/examples/c/encode/file/main.c +++ /dev/null @@ -1,171 +0,0 @@ -/* example_c_encode_file - Simple FLAC file encoder using libFLAC - * Copyright (C) 2007-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* - * This example shows how to use libFLAC to encode a WAVE file to a FLAC - * file. It only supports 16-bit stereo files in canonical WAVE format. - * - * Complete API documentation can be found at: - * http://xiph.org/flac/api/ - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include "share/compat.h" -#include "FLAC/metadata.h" -#include "FLAC/stream_encoder.h" - -static void progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data); - -#define READSIZE 1024 - -static unsigned total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */ -static FLAC__byte buffer[READSIZE/*samples*/ * 2/*bytes_per_sample*/ * 2/*channels*/]; /* we read the WAVE data into here */ -static FLAC__int32 pcm[READSIZE/*samples*/ * 2/*channels*/]; - -int main(int argc, char *argv[]) -{ - FLAC__bool ok = true; - FLAC__StreamEncoder *encoder = 0; - FLAC__StreamEncoderInitStatus init_status; - FLAC__StreamMetadata *metadata[2]; - FLAC__StreamMetadata_VorbisComment_Entry entry; - FILE *fin; - unsigned sample_rate = 0; - unsigned channels = 0; - unsigned bps = 0; - - if(argc != 3) { - fprintf(stderr, "usage: %s infile.wav outfile.flac\n", argv[0]); - return 1; - } - - if((fin = fopen(argv[1], "rb")) == NULL) { - fprintf(stderr, "ERROR: opening %s for output\n", argv[1]); - return 1; - } - - /* read wav header and validate it */ - if( - fread(buffer, 1, 44, fin) != 44 || - memcmp(buffer, "RIFF", 4) || - memcmp(buffer+8, "WAVEfmt \020\000\000\000\001\000\002\000", 16) || - memcmp(buffer+32, "\004\000\020\000data", 8) - ) { - fprintf(stderr, "ERROR: invalid/unsupported WAVE file, only 16bps stereo WAVE in canonical form allowed\n"); - fclose(fin); - return 1; - } - sample_rate = ((((((unsigned)buffer[27] << 8) | buffer[26]) << 8) | buffer[25]) << 8) | buffer[24]; - channels = 2; - bps = 16; - total_samples = (((((((unsigned)buffer[43] << 8) | buffer[42]) << 8) | buffer[41]) << 8) | buffer[40]) / 4; - - /* allocate the encoder */ - if((encoder = FLAC__stream_encoder_new()) == NULL) { - fprintf(stderr, "ERROR: allocating encoder\n"); - fclose(fin); - return 1; - } - - ok &= FLAC__stream_encoder_set_verify(encoder, true); - ok &= FLAC__stream_encoder_set_compression_level(encoder, 5); - ok &= FLAC__stream_encoder_set_channels(encoder, channels); - ok &= FLAC__stream_encoder_set_bits_per_sample(encoder, bps); - ok &= FLAC__stream_encoder_set_sample_rate(encoder, sample_rate); - ok &= FLAC__stream_encoder_set_total_samples_estimate(encoder, total_samples); - - /* now add some metadata; we'll add some tags and a padding block */ - if(ok) { - if( - (metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT)) == NULL || - (metadata[1] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)) == NULL || - /* there are many tag (vorbiscomment) functions but these are convenient for this particular use: */ - !FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "ARTIST", "Some Artist") || - !FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy=*/false) || /* copy=false: let metadata object take control of entry's allocated string */ - !FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "YEAR", "1984") || - !FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy=*/false) - ) { - fprintf(stderr, "ERROR: out of memory or tag error\n"); - ok = false; - } - - metadata[1]->length = 1234; /* set the padding length */ - - ok = FLAC__stream_encoder_set_metadata(encoder, metadata, 2); - } - - /* initialize encoder */ - if(ok) { - init_status = FLAC__stream_encoder_init_file(encoder, argv[2], progress_callback, /*client_data=*/NULL); - if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) { - fprintf(stderr, "ERROR: initializing encoder: %s\n", FLAC__StreamEncoderInitStatusString[init_status]); - ok = false; - } - } - - /* read blocks of samples from WAVE file and feed to encoder */ - if(ok) { - size_t left = (size_t)total_samples; - while(ok && left) { - size_t need = (left>READSIZE? (size_t)READSIZE : (size_t)left); - if(fread(buffer, channels*(bps/8), need, fin) != need) { - fprintf(stderr, "ERROR: reading from WAVE file\n"); - ok = false; - } - else { - /* convert the packed little-endian 16-bit PCM samples from WAVE into an interleaved FLAC__int32 buffer for libFLAC */ - size_t i; - for(i = 0; i < need*channels; i++) { - /* inefficient but simple and works on big- or little-endian machines */ - pcm[i] = (FLAC__int32)(((FLAC__int16)(FLAC__int8)buffer[2*i+1] << 8) | (FLAC__int16)buffer[2*i]); - } - /* feed samples to encoder */ - ok = FLAC__stream_encoder_process_interleaved(encoder, pcm, need); - } - left -= need; - } - } - - ok &= FLAC__stream_encoder_finish(encoder); - - fprintf(stderr, "encoding: %s\n", ok? "succeeded" : "FAILED"); - fprintf(stderr, " state: %s\n", FLAC__StreamEncoderStateString[FLAC__stream_encoder_get_state(encoder)]); - - /* now that encoding is finished, the metadata can be freed */ - FLAC__metadata_object_delete(metadata[0]); - FLAC__metadata_object_delete(metadata[1]); - - FLAC__stream_encoder_delete(encoder); - fclose(fin); - - return 0; -} - -void progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data) -{ - (void)encoder, (void)client_data; - - fprintf(stderr, "wrote %" PRIu64 " bytes, %" PRIu64 "/%u samples, %u/%u frames\n", bytes_written, samples_written, total_samples, frames_written, total_frames_estimate); -} diff --git a/examples/cpp/Makefile.am b/examples/cpp/Makefile.am deleted file mode 100644 index e44ad017..00000000 --- a/examples/cpp/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -SUBDIRS = decode encode diff --git a/examples/cpp/decode/Makefile.am b/examples/cpp/decode/Makefile.am deleted file mode 100644 index 2e103e43..00000000 --- a/examples/cpp/decode/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -SUBDIRS = file diff --git a/examples/cpp/decode/file/CMakeLists.txt b/examples/cpp/decode/file/CMakeLists.txt deleted file mode 100644 index 2ce420d7..00000000 --- a/examples/cpp/decode/file/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(decode_file_cxx main.cpp) -target_link_libraries(decode_file_cxx FLAC++) diff --git a/examples/cpp/decode/file/Makefile.am b/examples/cpp/decode/file/Makefile.am deleted file mode 100644 index bde9cb2e..00000000 --- a/examples/cpp/decode/file/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -# example_cpp_decode_file - Simple FLAC file decoder using libFLAC -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - example_cpp_decode_file.vcproj \ - example_cpp_decode_file.vcxproj \ - example_cpp_decode_file.vcxproj.filters - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -noinst_PROGRAMS = example_cpp_decode_file -example_cpp_decode_file_LDADD = \ - $(top_builddir)/src/libFLAC++/libFLAC++.la \ - $(top_builddir)/src/libFLAC/libFLAC.la \ - @OGG_LIBS@ \ - -lm - -example_cpp_decode_file_SOURCES = main.cpp - -CLEANFILES = example_cpp_decode_file.exe diff --git a/examples/cpp/decode/file/Makefile.lite b/examples/cpp/decode/file/Makefile.lite deleted file mode 100644 index c835bb46..00000000 --- a/examples/cpp/decode/file/Makefile.lite +++ /dev/null @@ -1,44 +0,0 @@ -# example_cpp_decode_file - Simple FLAC file decoder using libFLAC -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../../../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = example_cpp_decode_file - -INCLUDES = -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lFLAC++ -lFLAC $(OGG_LIBS) -lm -endif - -SRCS_CPP = main.cpp - -include $(topdir)/build/exe.mk - -LINK = $(CCC) $(LINKAGE) - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/examples/cpp/decode/file/example_cpp_decode_file.vcproj b/examples/cpp/decode/file/example_cpp_decode_file.vcproj deleted file mode 100644 index 59e735da..00000000 --- a/examples/cpp/decode/file/example_cpp_decode_file.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cpp/decode/file/example_cpp_decode_file.vcxproj b/examples/cpp/decode/file/example_cpp_decode_file.vcxproj deleted file mode 100644 index 6dde67e2..00000000 --- a/examples/cpp/decode/file/example_cpp_decode_file.vcxproj +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbe00-c215-11db-8314-0800200c9a66} - example_cpp_decode_file - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - {4cefbc86-c215-11db-8314-0800200c9a66} - false - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/examples/cpp/decode/file/example_cpp_decode_file.vcxproj.filters b/examples/cpp/decode/file/example_cpp_decode_file.vcxproj.filters deleted file mode 100644 index 6ff808d0..00000000 --- a/examples/cpp/decode/file/example_cpp_decode_file.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93292580-829B-b441-E8B8-65A95828BEB0} - h;hpp;hxx;hm;inl;inc;xsd - - - {9C7247F1-CA27-1761-A016-0F27452AD2F0} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/examples/cpp/decode/file/main.cpp b/examples/cpp/decode/file/main.cpp deleted file mode 100644 index 02a6339d..00000000 --- a/examples/cpp/decode/file/main.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* example_cpp_decode_file - Simple FLAC file decoder using libFLAC - * Copyright (C) 2007-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* - * This example shows how to use libFLAC++ to decode a FLAC file to a WAVE - * file. It only supports 16-bit stereo files. - * - * Complete API documentation can be found at: - * http://xiph.org/flac/api/ - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include "FLAC++/decoder.h" -#include "share/compat.h" - -static FLAC__uint64 total_samples = 0; -static uint32_t sample_rate = 0; -static uint32_t channels = 0; -static uint32_t bps = 0; - -static bool write_little_endian_uint16(FILE *f, FLAC__uint16 x) -{ - return - fputc(x, f) != EOF && - fputc(x >> 8, f) != EOF - ; -} - -static bool write_little_endian_int16(FILE *f, FLAC__int16 x) -{ - return write_little_endian_uint16(f, (FLAC__uint16)x); -} - -static bool write_little_endian_uint32(FILE *f, FLAC__uint32 x) -{ - return - fputc(x, f) != EOF && - fputc(x >> 8, f) != EOF && - fputc(x >> 16, f) != EOF && - fputc(x >> 24, f) != EOF - ; -} - -class OurDecoder: public FLAC::Decoder::File { -public: - OurDecoder(FILE *f_): FLAC::Decoder::File(), f(f_) { } -protected: - FILE *f; - - virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]); - virtual void metadata_callback(const ::FLAC__StreamMetadata *metadata); - virtual void error_callback(::FLAC__StreamDecoderErrorStatus status); -private: - OurDecoder(const OurDecoder&); - OurDecoder&operator=(const OurDecoder&); -}; - -int main(int argc, char *argv[]) -{ - bool ok = true; - FILE *fout; - - if(argc != 3) { - fprintf(stderr, "usage: %s infile.flac outfile.wav\n", argv[0]); - return 1; - } - - if((fout = fopen(argv[2], "wb")) == NULL) { - fprintf(stderr, "ERROR: opening %s for output\n", argv[2]); - return 1; - } - - OurDecoder decoder(fout); - - if(!decoder) { - fprintf(stderr, "ERROR: allocating decoder\n"); - fclose(fout); - return 1; - } - - (void)decoder.set_md5_checking(true); - - FLAC__StreamDecoderInitStatus init_status = decoder.init(argv[1]); - if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - fprintf(stderr, "ERROR: initializing decoder: %s\n", FLAC__StreamDecoderInitStatusString[init_status]); - ok = false; - } - - if(ok) { - ok = decoder.process_until_end_of_stream(); - fprintf(stderr, "decoding: %s\n", ok? "succeeded" : "FAILED"); - fprintf(stderr, " state: %s\n", decoder.get_state().resolved_as_cstring(decoder)); - } - - fclose(fout); - - return 0; -} - -::FLAC__StreamDecoderWriteStatus OurDecoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) -{ - const FLAC__uint32 total_size = (FLAC__uint32)(total_samples * channels * (bps/8)); - size_t i; - - if(total_samples == 0) { - fprintf(stderr, "ERROR: this example only works for FLAC files that have a total_samples count in STREAMINFO\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - if(channels != 2 || bps != 16) { - fprintf(stderr, "ERROR: this example only supports 16bit stereo streams\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - - /* write WAVE header before we write the first frame */ - if(frame->header.number.sample_number == 0) { - if( - fwrite("RIFF", 1, 4, f) < 4 || - !write_little_endian_uint32(f, total_size + 36) || - fwrite("WAVEfmt ", 1, 8, f) < 8 || - !write_little_endian_uint32(f, 16) || - !write_little_endian_uint16(f, 1) || - !write_little_endian_uint16(f, (FLAC__uint16)channels) || - !write_little_endian_uint32(f, sample_rate) || - !write_little_endian_uint32(f, sample_rate * channels * (bps/8)) || - !write_little_endian_uint16(f, (FLAC__uint16)(channels * (bps/8))) || /* block align */ - !write_little_endian_uint16(f, (FLAC__uint16)bps) || - fwrite("data", 1, 4, f) < 4 || - !write_little_endian_uint32(f, total_size) - ) { - fprintf(stderr, "ERROR: write error\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - - /* write decoded PCM samples */ - for(i = 0; i < frame->header.blocksize; i++) { - if( - !write_little_endian_int16(f, (FLAC__int16)buffer[0][i]) || /* left channel */ - !write_little_endian_int16(f, (FLAC__int16)buffer[1][i]) /* right channel */ - ) { - fprintf(stderr, "ERROR: write error\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -void OurDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) -{ - /* print some stats */ - if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { - /* save for later */ - total_samples = metadata->data.stream_info.total_samples; - sample_rate = metadata->data.stream_info.sample_rate; - channels = metadata->data.stream_info.channels; - bps = metadata->data.stream_info.bits_per_sample; - - fprintf(stderr, "sample rate : %u Hz\n", sample_rate); - fprintf(stderr, "channels : %u\n", channels); - fprintf(stderr, "bits per sample: %u\n", bps); - fprintf(stderr, "total samples : %" PRIu64 "\n", total_samples); - } -} - -void OurDecoder::error_callback(::FLAC__StreamDecoderErrorStatus status) -{ - fprintf(stderr, "Got error callback: %s\n", FLAC__StreamDecoderErrorStatusString[status]); -} diff --git a/examples/cpp/encode/Makefile.am b/examples/cpp/encode/Makefile.am deleted file mode 100644 index 2e103e43..00000000 --- a/examples/cpp/encode/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -SUBDIRS = file diff --git a/examples/cpp/encode/file/CMakeLists.txt b/examples/cpp/encode/file/CMakeLists.txt deleted file mode 100644 index 26178763..00000000 --- a/examples/cpp/encode/file/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(encode_file_cxx main.cpp) -target_link_libraries(encode_file_cxx FLAC++) diff --git a/examples/cpp/encode/file/Makefile.am b/examples/cpp/encode/file/Makefile.am deleted file mode 100644 index 598c765c..00000000 --- a/examples/cpp/encode/file/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -# example_cpp_encode_file - Simple FLAC file encoder using libFLAC -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - example_cpp_encode_file.vcproj \ - example_cpp_encode_file.vcxproj \ - example_cpp_encode_file.vcxproj.filters - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -noinst_PROGRAMS = example_cpp_encode_file -example_cpp_encode_file_LDADD = \ - $(top_builddir)/src/libFLAC++/libFLAC++.la \ - $(top_builddir)/src/libFLAC/libFLAC.la \ - @OGG_LIBS@ \ - -lm - -example_cpp_encode_file_SOURCES = main.cpp - -CLEANFILES = example_cpp_encode_file.exe diff --git a/examples/cpp/encode/file/Makefile.lite b/examples/cpp/encode/file/Makefile.lite deleted file mode 100644 index 982a0334..00000000 --- a/examples/cpp/encode/file/Makefile.lite +++ /dev/null @@ -1,44 +0,0 @@ -# example_cpp_encode_file - Simple FLAC file encoder using libFLAC -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../../../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = example_cpp_encode_file - -INCLUDES = -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lFLAC++ -lFLAC $(OGG_LIBS) -lm -endif - -SRCS_CPP = main.cpp - -include $(topdir)/build/exe.mk - -LINK = $(CCC) $(LINKAGE) - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/examples/cpp/encode/file/example_cpp_encode_file.vcproj b/examples/cpp/encode/file/example_cpp_encode_file.vcproj deleted file mode 100644 index f81949f9..00000000 --- a/examples/cpp/encode/file/example_cpp_encode_file.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cpp/encode/file/example_cpp_encode_file.vcxproj b/examples/cpp/encode/file/example_cpp_encode_file.vcxproj deleted file mode 100644 index 271b50ac..00000000 --- a/examples/cpp/encode/file/example_cpp_encode_file.vcxproj +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbe01-c215-11db-8314-0800200c9a66} - example_cpp_encode_file - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - ..\..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - {4cefbc86-c215-11db-8314-0800200c9a66} - false - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/examples/cpp/encode/file/example_cpp_encode_file.vcxproj.filters b/examples/cpp/encode/file/example_cpp_encode_file.vcxproj.filters deleted file mode 100644 index 6ff808d0..00000000 --- a/examples/cpp/encode/file/example_cpp_encode_file.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93292580-829B-b441-E8B8-65A95828BEB0} - h;hpp;hxx;hm;inl;inc;xsd - - - {9C7247F1-CA27-1761-A016-0F27452AD2F0} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/examples/cpp/encode/file/main.cpp b/examples/cpp/encode/file/main.cpp deleted file mode 100644 index 7d44b873..00000000 --- a/examples/cpp/encode/file/main.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* example_cpp_encode_file - Simple FLAC file encoder using libFLAC - * Copyright (C) 2007-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/* - * This example shows how to use libFLAC++ to encode a WAVE file to a FLAC - * file. It only supports 16-bit stereo files in canonical WAVE format. - * - * Complete API documentation can be found at: - * http://xiph.org/flac/api/ - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#include "FLAC++/metadata.h" -#include "FLAC++/encoder.h" -#include "share/compat.h" - -#include - -class OurEncoder: public FLAC::Encoder::File { -public: - OurEncoder(): FLAC::Encoder::File() { } -protected: - virtual void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate); -}; - -#define READSIZE 1024 - -static uint32_t total_samples = 0; /* can use a 32-bit number due to WAVE size limitations */ -static FLAC__byte buffer[READSIZE/*samples*/ * 2/*bytes_per_sample*/ * 2/*channels*/]; /* we read the WAVE data into here */ -static FLAC__int32 pcm[READSIZE/*samples*/ * 2/*channels*/]; - -int main(int argc, char *argv[]) -{ - bool ok = true; - OurEncoder encoder; - FLAC__StreamEncoderInitStatus init_status; - FLAC__StreamMetadata *metadata[2]; - FLAC__StreamMetadata_VorbisComment_Entry entry; - FILE *fin; - uint32_t sample_rate = 0; - uint32_t channels = 0; - uint32_t bps = 0; - - if(argc != 3) { - fprintf(stderr, "usage: %s infile.wav outfile.flac\n", argv[0]); - return 1; - } - - if((fin = fopen(argv[1], "rb")) == NULL) { - fprintf(stderr, "ERROR: opening %s for output\n", argv[1]); - return 1; - } - - /* read wav header and validate it */ - if( - fread(buffer, 1, 44, fin) != 44 || - memcmp(buffer, "RIFF", 4) || - memcmp(buffer+8, "WAVEfmt \020\000\000\000\001\000\002\000", 16) || - memcmp(buffer+32, "\004\000\020\000data", 8) - ) { - fprintf(stderr, "ERROR: invalid/unsupported WAVE file, only 16bps stereo WAVE in canonical form allowed\n"); - fclose(fin); - return 1; - } - sample_rate = ((((((uint32_t)buffer[27] << 8) | buffer[26]) << 8) | buffer[25]) << 8) | buffer[24]; - channels = 2; - bps = 16; - total_samples = (((((((uint32_t)buffer[43] << 8) | buffer[42]) << 8) | buffer[41]) << 8) | buffer[40]) / 4; - - /* check the encoder */ - if(!encoder) { - fprintf(stderr, "ERROR: allocating encoder\n"); - fclose(fin); - return 1; - } - - ok &= encoder.set_verify(true); - ok &= encoder.set_compression_level(5); - ok &= encoder.set_channels(channels); - ok &= encoder.set_bits_per_sample(bps); - ok &= encoder.set_sample_rate(sample_rate); - ok &= encoder.set_total_samples_estimate(total_samples); - - /* now add some metadata; we'll add some tags and a padding block */ - if(ok) { - if( - (metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT)) == NULL || - (metadata[1] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)) == NULL || - /* there are many tag (vorbiscomment) functions but these are convenient for this particular use: */ - !FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "ARTIST", "Some Artist") || - !FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy=*/false) || /* copy=false: let metadata object take control of entry's allocated string */ - !FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, "YEAR", "1984") || - !FLAC__metadata_object_vorbiscomment_append_comment(metadata[0], entry, /*copy=*/false) - ) { - fprintf(stderr, "ERROR: out of memory or tag error\n"); - ok = false; - } - - metadata[1]->length = 1234; /* set the padding length */ - - ok = encoder.set_metadata(metadata, 2); - } - - /* initialize encoder */ - if(ok) { - init_status = encoder.init(argv[2]); - if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) { - fprintf(stderr, "ERROR: initializing encoder: %s\n", FLAC__StreamEncoderInitStatusString[init_status]); - ok = false; - } - } - - /* read blocks of samples from WAVE file and feed to encoder */ - if(ok) { - size_t left = (size_t)total_samples; - while(ok && left) { - size_t need = (left>READSIZE? (size_t)READSIZE : (size_t)left); - if(fread(buffer, channels*(bps/8), need, fin) != need) { - fprintf(stderr, "ERROR: reading from WAVE file\n"); - ok = false; - } - else { - /* convert the packed little-endian 16-bit PCM samples from WAVE into an interleaved FLAC__int32 buffer for libFLAC */ - size_t i; - for(i = 0; i < need*channels; i++) { - /* inefficient but simple and works on big- or little-endian machines */ - pcm[i] = (FLAC__int32)(((FLAC__int16)(FLAC__int8)buffer[2*i+1] << 8) | (FLAC__int16)buffer[2*i]); - } - /* feed samples to encoder */ - ok = encoder.process_interleaved(pcm, need); - } - left -= need; - } - } - - ok &= encoder.finish(); - - fprintf(stderr, "encoding: %s\n", ok? "succeeded" : "FAILED"); - fprintf(stderr, " state: %s\n", encoder.get_state().resolved_as_cstring(encoder)); - - /* now that encoding is finished, the metadata can be freed */ - FLAC__metadata_object_delete(metadata[0]); - FLAC__metadata_object_delete(metadata[1]); - - fclose(fin); - - return 0; -} - -void OurEncoder::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate) -{ - fprintf(stderr, "wrote %" PRIu64 " bytes, %" PRIu64 "/%u samples, %u/%u frames\n", bytes_written, samples_written, total_samples, frames_written, total_frames_estimate); -} diff --git a/flac-config.cmake.in b/flac-config.cmake.in deleted file mode 100644 index f44133c5..00000000 --- a/flac-config.cmake.in +++ /dev/null @@ -1,15 +0,0 @@ -@PACKAGE_INIT@ - -include(CMakeFindDependencyMacro) -find_dependency(Ogg) - -include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake") - -if(TARGET FLAC::FLAC) - set(FLAC_FLAC_FOUND 1) -endif() -if(TARGET FLAC::FLAC++) - set(FLAC_FLAC++_FOUND 1) -endif() - -check_required_components(FLAC) diff --git a/m4/Makefile.am b/m4/Makefile.am deleted file mode 100644 index b7952da1..00000000 --- a/m4/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2006-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -EXTRA_DIST = \ - add_cflags.m4 \ - add_cxxflags.m4 \ - bswap.m4 \ - endian.m4 \ - gcc_version.m4 \ - ogg.m4 \ - stack_protect.m4 \ - xmms.m4 diff --git a/m4/add_cflags.m4 b/m4/add_cflags.m4 deleted file mode 100644 index 08f4a409..00000000 --- a/m4/add_cflags.m4 +++ /dev/null @@ -1,18 +0,0 @@ -dnl @synopsis XIPH_ADD_CFLAGS -dnl -dnl Add the given option to CFLAGS, if it doesn't break the compiler - -AC_DEFUN([XIPH_ADD_CFLAGS], -[AC_MSG_CHECKING([if $CC accepts $1]) - ac_add_cflags__old_cflags="$CFLAGS" - CFLAGS="$1" - AC_TRY_LINK([ - #include - ], - [puts("Hello, World!"); return 0;], - AC_MSG_RESULT([yes]) - CFLAGS="$ac_add_cflags__old_cflags $1", - AC_MSG_RESULT([no]) - CFLAGS="$ac_add_cflags__old_cflags" - ) -])# XIPH_ADD_CFLAGS diff --git a/m4/add_cxxflags.m4 b/m4/add_cxxflags.m4 deleted file mode 100644 index 8197dc2d..00000000 --- a/m4/add_cxxflags.m4 +++ /dev/null @@ -1,19 +0,0 @@ -dnl @synopsis XIPH_ADD_CXXFLAGS -dnl -dnl Add the given option to CXXFLAGS, if it doesn't break the compiler - -AC_DEFUN([XIPH_ADD_CXXFLAGS], -[AC_MSG_CHECKING([if $CXX accepts $1]) - AC_LANG_ASSERT([C++]) - ac_add_cxxflags__old_cxxflags="$CXXFLAGS" - CXXFLAGS="$1" - AC_TRY_LINK([ - #include - ], - [puts("Hello, World!"); return 0;], - AC_MSG_RESULT([yes]) - CXXFLAGS="$ac_add_cxxflags__old_cxxflags $1", - AC_MSG_RESULT([no]) - CXXFLAGS="$ac_add_cxxflags__old_cxxflags" - ) -])# XIPH_ADD_CXXFLAGS diff --git a/m4/ax_add_fortify_source.m4 b/m4/ax_add_fortify_source.m4 deleted file mode 100644 index d443814b..00000000 --- a/m4/ax_add_fortify_source.m4 +++ /dev/null @@ -1,53 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_add_fortify_source.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_ADD_FORTIFY_SOURCE -# -# DESCRIPTION -# -# Check whether -D_FORTIFY_SOURCE=2 can be added to CPPFLAGS without macro -# redefinition warnings. Some distributions (such as Gentoo Linux) enable -# _FORTIFY_SOURCE globally in their compilers, leading to unnecessary -# warnings in the form of -# -# :0:0: error: "_FORTIFY_SOURCE" redefined [-Werror] -# : note: this is the location of the previous definition -# -# which is a problem if -Werror is enabled. This macro checks whether -# _FORTIFY_SOURCE is already defined, and if not, adds -D_FORTIFY_SOURCE=2 -# to CPPFLAGS. -# -# LICENSE -# -# Copyright (c) 2017 David Seifert -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 1 - -AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[ - AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=2 to CPPFLAGS]) - AC_LINK_IFELSE([ - AC_LANG_SOURCE( - [[ - int main() { - #ifndef _FORTIFY_SOURCE - return 0; - #else - this_is_an_error; - #endif - } - ]] - )], [ - AC_MSG_RESULT([yes]) - CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" - ], [ - AC_MSG_RESULT([no]) - ]) -]) diff --git a/m4/ax_check_enable_debug.m4 b/m4/ax_check_enable_debug.m4 deleted file mode 100644 index f99d75fe..00000000 --- a/m4/ax_check_enable_debug.m4 +++ /dev/null @@ -1,124 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_enable_debug.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_ENABLE_DEBUG([enable by default=yes/info/profile/no], [ENABLE DEBUG VARIABLES ...], [DISABLE DEBUG VARIABLES NDEBUG ...], [IS-RELEASE]) -# -# DESCRIPTION -# -# Check for the presence of an --enable-debug option to configure, with -# the specified default value used when the option is not present. Return -# the value in the variable $ax_enable_debug. -# -# Specifying 'yes' adds '-g -O0' to the compilation flags for all -# languages. Specifying 'info' adds '-g' to the compilation flags. -# Specifying 'profile' adds '-g -pg' to the compilation flags and '-pg' to -# the linking flags. Otherwise, nothing is added. -# -# Define the variables listed in the second argument if debug is enabled, -# defaulting to no variables. Defines the variables listed in the third -# argument if debug is disabled, defaulting to NDEBUG. All lists of -# variables should be space-separated. -# -# If debug is not enabled, ensure AC_PROG_* will not add debugging flags. -# Should be invoked prior to any AC_PROG_* compiler checks. -# -# IS-RELEASE can be used to change the default to 'no' when making a -# release. Set IS-RELEASE to 'yes' or 'no' as appropriate. By default, it -# uses the value of $ax_is_release, so if you are using the AX_IS_RELEASE -# macro, there is no need to pass this parameter. -# -# AX_IS_RELEASE([git-directory]) -# AX_CHECK_ENABLE_DEBUG() -# -# LICENSE -# -# Copyright (c) 2011 Rhys Ulerich -# Copyright (c) 2014, 2015 Philip Withnall -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. - -#serial 5 - -AC_DEFUN([AX_CHECK_ENABLE_DEBUG],[ - AC_BEFORE([$0],[AC_PROG_CC])dnl - AC_BEFORE([$0],[AC_PROG_CXX])dnl - AC_BEFORE([$0],[AC_PROG_F77])dnl - AC_BEFORE([$0],[AC_PROG_FC])dnl - - AC_MSG_CHECKING(whether to enable debugging) - - ax_enable_debug_default=m4_tolower(m4_normalize(ifelse([$1],,[no],[$1]))) - ax_enable_debug_is_release=m4_tolower(m4_normalize(ifelse([$4],, - [$ax_is_release], - [$4]))) - - # If this is a release, override the default. - AS_IF([test "$ax_enable_debug_is_release" = "yes"], - [ax_enable_debug_default="no"]) - - m4_define(ax_enable_debug_vars,[m4_normalize(ifelse([$2],,,[$2]))]) - m4_define(ax_disable_debug_vars,[m4_normalize(ifelse([$3],,[NDEBUG],[$3]))]) - - AC_ARG_ENABLE(debug, - [AS_HELP_STRING([--enable-debug=]@<:@yes/info/profile/no@:>@,[compile with debugging])], - [],enable_debug=$ax_enable_debug_default) - - # empty mean debug yes - AS_IF([test "x$enable_debug" = "x"], - [enable_debug="yes"]) - - # case of debug - AS_CASE([$enable_debug], - [yes],[ - AC_MSG_RESULT(yes) - CFLAGS="${CFLAGS} -g -O0" - CXXFLAGS="${CXXFLAGS} -g -O0" - FFLAGS="${FFLAGS} -g -O0" - FCFLAGS="${FCFLAGS} -g -O0" - OBJCFLAGS="${OBJCFLAGS} -g -O0" - ], - [info],[ - AC_MSG_RESULT(info) - CFLAGS="${CFLAGS} -g" - CXXFLAGS="${CXXFLAGS} -g" - FFLAGS="${FFLAGS} -g" - FCFLAGS="${FCFLAGS} -g" - OBJCFLAGS="${OBJCFLAGS} -g" - ], - [profile],[ - AC_MSG_RESULT(profile) - CFLAGS="${CFLAGS} -g -pg" - CXXFLAGS="${CXXFLAGS} -g -pg" - FFLAGS="${FFLAGS} -g -pg" - FCFLAGS="${FCFLAGS} -g -pg" - OBJCFLAGS="${OBJCFLAGS} -g -pg" - LDFLAGS="${LDFLAGS} -pg" - ], - [ - AC_MSG_RESULT(no) - dnl Ensure AC_PROG_CC/CXX/F77/FC/OBJC will not enable debug flags - dnl by setting any unset environment flag variables - AS_IF([test "x${CFLAGS+set}" != "xset"], - [CFLAGS=""]) - AS_IF([test "x${CXXFLAGS+set}" != "xset"], - [CXXFLAGS=""]) - AS_IF([test "x${FFLAGS+set}" != "xset"], - [FFLAGS=""]) - AS_IF([test "x${FCFLAGS+set}" != "xset"], - [FCFLAGS=""]) - AS_IF([test "x${OBJCFLAGS+set}" != "xset"], - [OBJCFLAGS=""]) - ]) - - dnl Define various variables if debugging is disabled. - dnl assert.h is a NOP if NDEBUG is defined, so define it by default. - AS_IF([test "x$enable_debug" = "xyes"], - [m4_map_args_w(ax_enable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is enabled])])], - [m4_map_args_w(ax_disable_debug_vars, [AC_DEFINE(], [,,[Define if debugging is disabled])])]) - ax_enable_debug=$enable_debug -]) diff --git a/m4/bswap.m4 b/m4/bswap.m4 deleted file mode 100644 index f504dcb7..00000000 --- a/m4/bswap.m4 +++ /dev/null @@ -1,82 +0,0 @@ -dnl Copyright (C) 2012-2014 Xiph.org Foundation -dnl -dnl Redistribution and use in source and binary forms, with or without -dnl modification, are permitted provided that the following conditions -dnl are met: -dnl -dnl - Redistributions of source code must retain the above copyright -dnl notice, this list of conditions and the following disclaimer. -dnl -dnl - Redistributions in binary form must reproduce the above copyright -dnl notice, this list of conditions and the following disclaimer in the -dnl documentation and/or other materials provided with the distribution. -dnl -dnl - Neither the name of the Xiph.org Foundation nor the names of its -dnl contributors may be used to endorse or promote products derived from -dnl this software without specific prior written permission. -dnl -dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -dnl ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR -dnl CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -dnl @synopsis XIPH_C_BSWAP32 -dnl -dnl @author Erik de Castro Lopo -dnl -dnl Dtermine whether the compiler has the __builtin_bswap32() intrinsic which -dnl is likely to be present for most versions of GCC as well as Clang. - -AC_DEFUN([XIPH_C_BSWAP32], -[AC_CACHE_CHECK(for bswap32 intrinsic, - ac_cv_c_bswap32, - - # Initialize to no - ac_cv_c_bswap32=no - HAVE_BSWAP32=0 - - [AC_TRY_LINK([], - return __builtin_bswap32 (0) ;, - ac_cv_c_bswap32=yes - HAVE_BSWAP32=1 - )] - AC_DEFINE_UNQUOTED(HAVE_BSWAP32, ${HAVE_BSWAP32}, - [Compiler has the __builtin_bswap32 intrinsic]) - - )] -)# XIPH_C_BSWAP32 - - -dnl @synopsis XIPH_C_BSWAP16 -dnl -dnl @author Erik de Castro Lopo -dnl -dnl Dtermine whether the compiler has the __builtin_bswap16() intrinsic which -dnl is likely to be present for most versions of GCC as well as Clang. - -AC_DEFUN([XIPH_C_BSWAP16], -[AC_CACHE_CHECK(for bswap16 intrinsic, - ac_cv_c_bswap16, - - # Initialize to no - ac_cv_c_bswap16=no - HAVE_BSWAP16=0 - - [AC_TRY_LINK([], - return __builtin_bswap16 (0) ;, - ac_cv_c_bswap16=yes - HAVE_BSWAP16=1 - )] - AC_DEFINE_UNQUOTED(HAVE_BSWAP16, ${HAVE_BSWAP16}, - [Compiler has the __builtin_bswap16 intrinsic]) - - )] -)# XIPH_C_BSWAP16 diff --git a/m4/c_attribute.m4 b/m4/c_attribute.m4 deleted file mode 100644 index 48aa6223..00000000 --- a/m4/c_attribute.m4 +++ /dev/null @@ -1,18 +0,0 @@ -# -# Check for supported __attribute__ features -# -# AC_C_ATTRIBUTE(FEATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -AC_DEFUN([AC_C_ATTRIBUTE], -[AS_VAR_PUSHDEF([CACHEVAR], [ax_cv_c_attribute_$1])dnl -AC_CACHE_CHECK([for __attribute__ (($1))], - CACHEVAR,[ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], - [[ void foo(void) __attribute__ (($1)); ]])], - [AS_VAR_SET(CACHEVAR, [yes])], - [AS_VAR_SET(CACHEVAR, [no])])]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl diff --git a/m4/clang.m4 b/m4/clang.m4 deleted file mode 100644 index 036f0e68..00000000 --- a/m4/clang.m4 +++ /dev/null @@ -1,31 +0,0 @@ -dnl @synopsis XIPH_C_COMPILER_IS_CLANG -dnl -dnl Find out if a compiler claiming to be gcc really is gcc (clang lies). -dnl @version 1.0 Oct 31 2013 -dnl @author Erik de Castro Lopo -dnl -dnl Permission to use, copy, modify, distribute, and sell this file for any -dnl purpose is hereby granted without fee, provided that the above copyright -dnl and this permission notice appear in all copies. No representations are -dnl made about the suitability of this software for any purpose. It is -dnl provided "as is" without express or implied warranty. -dnl - - -AC_DEFUN([XIPH_C_COMPILER_IS_CLANG], -[AC_CACHE_CHECK(whether we are using the CLANG C compiler, - xiph_cv_c_compiler_clang, - [ AC_LANG_ASSERT(C) - AC_TRY_LINK([ - #include - ], - [ - #ifndef __clang__ - This is not clang! - #endif - ], - xiph_cv_c_compiler_clang=yes, - xiph_cv_c_compiler_clang=no - ]) - )] -) diff --git a/m4/codeset.m4 b/m4/codeset.m4 deleted file mode 100644 index cf53d241..00000000 --- a/m4/codeset.m4 +++ /dev/null @@ -1,23 +0,0 @@ -# codeset.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2006, 2008-2012 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_DEFUN([AM_LANGINFO_CODESET], -[ - AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], - [AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[#include ]], - [[char* cs = nl_langinfo(CODESET); return !cs;]])], - [am_cv_langinfo_codeset=yes], - [am_cv_langinfo_codeset=no]) - ]) - if test $am_cv_langinfo_codeset = yes; then - AC_DEFINE([HAVE_LANGINFO_CODESET], [1], - [Define if you have and nl_langinfo(CODESET).]) - fi -]) diff --git a/m4/endian.m4 b/m4/endian.m4 deleted file mode 100644 index 330a17fc..00000000 --- a/m4/endian.m4 +++ /dev/null @@ -1,177 +0,0 @@ -dnl Copyright (C) 2012-2016 Xiph.org Foundation -dnl -dnl Redistribution and use in source and binary forms, with or without -dnl modification, are permitted provided that the following conditions -dnl are met: -dnl -dnl - Redistributions of source code must retain the above copyright -dnl notice, this list of conditions and the following disclaimer. -dnl -dnl - Redistributions in binary form must reproduce the above copyright -dnl notice, this list of conditions and the following disclaimer in the -dnl documentation and/or other materials provided with the distribution. -dnl -dnl - Neither the name of the Xiph.org Foundation nor the names of its -dnl contributors may be used to endorse or promote products derived from -dnl this software without specific prior written permission. -dnl -dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -dnl ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR -dnl CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -dnl @synopsis XIPH_C_FIND_ENDIAN -dnl -dnl Determine endian-ness of target processor. -dnl @version 1.1 Mar 03 2002 -dnl @author Erik de Castro Lopo -dnl -dnl Majority written from scratch to replace the standard autoconf macro -dnl AC_C_BIGENDIAN. Only part remaining from the original is the invocation -dnl of the AC_TRY_RUN macro. -dnl -dnl Find endian-ness in the following way: -dnl 1) Look in . -dnl 2) If 1) fails, look in and . -dnl 3) If 1) and 2) fails and not cross compiling run a test program. -dnl 4) If 1) and 2) fails and cross compiling then guess based on target. - -AC_DEFUN([XIPH_C_FIND_ENDIAN], -[AC_CACHE_CHECK(processor byte ordering, - ac_cv_c_byte_order, - -# Initialize to unknown -ac_cv_c_byte_order=unknown - -if test x$ac_cv_header_endian_h = xyes ; then - - # First try which should set BYTE_ORDER. - - [AC_TRY_LINK([ - #include - #if BYTE_ORDER != LITTLE_ENDIAN - not big endian - #endif - ], return 0 ;, - ac_cv_c_byte_order=little - )] - - [AC_TRY_LINK([ - #include - #if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - ], return 0 ;, - ac_cv_c_byte_order=big - )] - - fi - -if test $ac_cv_c_byte_order = unknown ; then - - [AC_TRY_LINK([ - #include - #include - #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros - #endif - ], return 0 ;, - - [AC_TRY_LINK([ - #include - #include - #if BYTE_ORDER != LITTLE_ENDIAN - not big endian - #endif - ], return 0 ;, - ac_cv_c_byte_order=little - )] - - [AC_TRY_LINK([ - #include - #include - #if BYTE_ORDER != LITTLE_ENDIAN - not big endian - #endif - ], return 0 ;, - ac_cv_c_byte_order=little - )] - - )] - - fi - -if test $ac_cv_c_byte_order = unknown ; then - if test $cross_compiling = yes ; then - # This is the last resort. Try to guess the target processor endian-ness - # by looking at the target CPU type. - [ - case "$target_cpu" in - alpha* | i?86* | mipsel* | ia64*) - ac_cv_c_byte_order=little - ;; - - m68* | mips* | powerpc* | hppa* | sparc*) - ac_cv_c_byte_order=big - ;; - - esac - ] - else - AC_TRY_RUN( - [[ - int main (void) - { /* Are we little or big endian? From Harbison&Steele. */ - union - { long l ; - char c [sizeof (long)] ; - } u ; - u.l = 1 ; - return (u.c [sizeof (long) - 1] == 1); - } - ]], , ac_cv_c_byte_order=big, - ) - - AC_TRY_RUN( - [[int main (void) - { /* Are we little or big endian? From Harbison&Steele. */ - union - { long l ; - char c [sizeof (long)] ; - } u ; - u.l = 1 ; - return (u.c [0] == 1); - }]], , ac_cv_c_byte_order=little, - ) - fi - fi - -) - -if test $ac_cv_c_byte_order = big ; then - ac_cv_c_big_endian=1 - ac_cv_c_little_endian=0 -elif test $ac_cv_c_byte_order = little ; then - ac_cv_c_big_endian=0 - ac_cv_c_little_endian=1 -else - ac_cv_c_big_endian=0 - ac_cv_c_little_endian=0 - - AC_MSG_WARN([[*****************************************************************]]) - AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]]) - AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]]) - AC_MSG_WARN([[*** config.h may need to be hand editied. ]]) - AC_MSG_WARN([[*****************************************************************]]) - fi - -] -)# XIPH_C_FIND_ENDIAN diff --git a/m4/gcc_version.m4 b/m4/gcc_version.m4 deleted file mode 100644 index e6aaa603..00000000 --- a/m4/gcc_version.m4 +++ /dev/null @@ -1,34 +0,0 @@ -dnl @synopsis XIPH_GCC_VERSION -dnl -dnl Find the version of gcc. -dnl @version 1.0 Nov 05 2007 -dnl @version 1.1 Mar 10 2013 -dnl @author Erik de Castro Lopo -dnl -dnl Permission to use, copy, modify, distribute, and sell this file for any -dnl purpose is hereby granted without fee, provided that the above copyright -dnl and this permission notice appear in all copies. No representations are -dnl made about the suitability of this software for any purpose. It is -dnl provided "as is" without express or implied warranty. -dnl - -AC_DEFUN([XIPH_GCC_VERSION], -[ -if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then - - AC_MSG_CHECKING([for version of $CC]) - GCC_VERSION=`$CC -dumpversion` - AC_MSG_RESULT($GCC_VERSION) - - GCC_MAJOR_VERSION=`echo $GCC_VERSION | cut -d. -f 1` - GCC_MINOR_VERSION=`echo $GCC_VERSION | cut -d. -f 2` -else - GCC_MAJOR_VERSION=0 - GCC_MINOR_VERSION=0 - fi - -AC_SUBST(GCC_VERSION) -AC_SUBST(GCC_MAJOR_VERSION) -AC_SUBST(GCC_MINOR_VERSION) - -])# XIPH_GCC_VERSION diff --git a/m4/iconv.m4 b/m4/iconv.m4 deleted file mode 100644 index 6a47236c..00000000 --- a/m4/iconv.m4 +++ /dev/null @@ -1,268 +0,0 @@ -# iconv.m4 serial 18 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2007-2012 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], -[ - dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([iconv]) -]) - -AC_DEFUN([AM_ICONV_LINK], -[ - dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and - dnl those with the standalone portable GNU libiconv installed). - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - - dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV - dnl accordingly. - AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) - - dnl Add $INCICONV to CPPFLAGS before performing the following checks, - dnl because if the user has installed libiconv and not disabled its use - dnl via --without-libiconv-prefix, he wants to use it. The first - dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. - am_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) - - AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ - am_cv_func_iconv="no, consider installing GNU libiconv" - am_cv_lib_iconv=no - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include - ]], - [[iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);]])], - [am_cv_func_iconv=yes]) - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include - ]], - [[iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);]])], - [am_cv_lib_iconv=yes] - [am_cv_func_iconv=yes]) - LIBS="$am_save_LIBS" - fi - ]) - if test "$am_cv_func_iconv" = yes; then - AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ - dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, - dnl Solaris 10. - am_save_LIBS="$LIBS" - if test $am_cv_lib_iconv = yes; then - LIBS="$LIBS $LIBICONV" - fi - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include -#include -int main () -{ - int result = 0; - /* Test against AIX 5.1 bug: Failures are not distinguishable from successful - returns. */ - { - iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); - if (cd_utf8_to_88591 != (iconv_t)(-1)) - { - static const char input[] = "\342\202\254"; /* EURO SIGN */ - char buf[10]; - const char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_utf8_to_88591, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res == 0) - result |= 1; - iconv_close (cd_utf8_to_88591); - } - } - /* Test against Solaris 10 bug: Failures are not distinguishable from - successful returns. */ - { - iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); - if (cd_ascii_to_88591 != (iconv_t)(-1)) - { - static const char input[] = "\263"; - char buf[10]; - const char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_ascii_to_88591, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res == 0) - result |= 2; - iconv_close (cd_ascii_to_88591); - } - } - /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ - { - iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); - if (cd_88591_to_utf8 != (iconv_t)(-1)) - { - static const char input[] = "\304"; - static char buf[2] = { (char)0xDE, (char)0xAD }; - const char *inptr = input; - size_t inbytesleft = 1; - char *outptr = buf; - size_t outbytesleft = 1; - size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) - result |= 4; - iconv_close (cd_88591_to_utf8); - } - } -#if 0 /* This bug could be worked around by the caller. */ - /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ - { - iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); - if (cd_88591_to_utf8 != (iconv_t)(-1)) - { - static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - char buf[50]; - const char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if ((int)res > 0) - result |= 8; - iconv_close (cd_88591_to_utf8); - } - } -#endif - /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is - provided. */ - if (/* Try standardized names. */ - iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) - /* Try IRIX, OSF/1 names. */ - && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) - /* Try AIX names. */ - && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) - /* Try HP-UX names. */ - && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) - result |= 16; - return result; -}]])], - [am_cv_func_iconv_works=yes], - [am_cv_func_iconv_works=no], - [ -changequote(,)dnl - case "$host_os" in - aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; - *) am_cv_func_iconv_works="guessing yes" ;; - esac -changequote([,])dnl - ]) - LIBS="$am_save_LIBS" - ]) - case "$am_cv_func_iconv_works" in - *no) am_func_iconv=no am_cv_lib_iconv=no ;; - *) am_func_iconv=yes ;; - esac - else - am_func_iconv=no am_cv_lib_iconv=no - fi - if test "$am_func_iconv" = yes; then - AC_DEFINE([HAVE_ICONV], [1], - [Define if you have the iconv() function and it works.]) - fi - if test "$am_cv_lib_iconv" = yes; then - AC_MSG_CHECKING([how to link with libiconv]) - AC_MSG_RESULT([$LIBICONV]) - else - dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV - dnl either. - CPPFLAGS="$am_save_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - AC_SUBST([LIBICONV]) - AC_SUBST([LTLIBICONV]) -]) - -dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to -dnl avoid warnings like -dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". -dnl This is tricky because of the way 'aclocal' is implemented: -dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. -dnl Otherwise aclocal's initial scan pass would miss the macro definition. -dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. -dnl Otherwise aclocal would emit many "Use of uninitialized value $1" -dnl warnings. -m4_define([gl_iconv_AC_DEFUN], - m4_version_prereq([2.64], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [m4_ifdef([gl_00GNULIB], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [[AC_DEFUN( - [$1], [$2])]])])) -gl_iconv_AC_DEFUN([AM_ICONV], -[ - AM_ICONV_LINK - if test "$am_cv_func_iconv" = yes; then - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL([am_cv_proto_iconv], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - ]], - [[]])], - [am_cv_proto_iconv_arg1=""], - [am_cv_proto_iconv_arg1="const"]) - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([ - $am_cv_proto_iconv]) - AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], - [Define as const if the declaration of iconv() needs const.]) - dnl Also substitute ICONV_CONST in the gnulib generated . - m4_ifdef([gl_ICONV_H_DEFAULTS], - [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) - if test -n "$am_cv_proto_iconv_arg1"; then - ICONV_CONST="const" - fi - ]) - fi -]) diff --git a/m4/lib-ld.m4 b/m4/lib-ld.m4 deleted file mode 100644 index e1feab54..00000000 --- a/m4/lib-ld.m4 +++ /dev/null @@ -1,119 +0,0 @@ -# lib-ld.m4 serial 6 -dnl Copyright (C) 1996-2003, 2009-2012 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Subroutines of libtool.m4, -dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid -dnl collision with libtool.m4. - -dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], -[# I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 /dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` - while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL([acl_cv_path_LD], -[if test -z "$LD"; then - acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$acl_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 = 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - acl_libext="$acl_cv_libext" - acl_shlibext="$acl_cv_shlibext" - acl_libname_spec="$acl_cv_libname_spec" - acl_library_names_spec="$acl_cv_library_names_spec" - acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - acl_hardcode_direct="$acl_cv_hardcode_direct" - acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE([rpath], - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_FROMPACKAGE(name, package) -dnl declares that libname comes from the given package. The configure file -dnl will then not have a --with-libname-prefix option but a -dnl --with-package-prefix option. Several libraries can come from the same -dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar -dnl macro call that searches for libname. -AC_DEFUN([AC_LIB_FROMPACKAGE], -[ - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_frompackage_]NAME, [$2]) - popdef([NAME]) - pushdef([PACK],[$2]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_libsinpackage_]PACKUP, - m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) - popdef([PACKUP]) - popdef([PACK]) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found -dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) - dnl Autoconf >= 2.61 supports dots in --with options. - pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_ARG_WITH(P_A_C_K[-prefix], -[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib - --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - LIB[]NAME[]_PREFIX= - dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been - dnl computed. So it has to be reset here. - HAVE_LIB[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - dnl The same code as in the loop below: - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$acl_hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi - popdef([P_A_C_K]) - popdef([PACKLIBS]) - popdef([PACKUP]) - popdef([PACK]) - popdef([NAME]) -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -dnl For those cases where a variable contains several -L and -l options -dnl referring to unknown libraries and directories, this macro determines the -dnl necessary additional linker options for the runtime path. -dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) -dnl sets LDADDVAR to linker options needed together with LIBSVALUE. -dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, -dnl otherwise linking without libtool is assumed. -AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -[ - AC_REQUIRE([AC_LIB_RPATH]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - $1= - if test "$enable_rpath" != no; then - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode directories into the resulting - dnl binary. - rpathdirs= - next= - for opt in $2; do - if test -n "$next"; then - dir="$next" - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= - else - case $opt in - -L) next=yes ;; - -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= ;; - *) next= ;; - esac - fi - done - if test "X$rpathdirs" != "X"; then - if test -n ""$3""; then - dnl libtool is used for linking. Use -R options. - for dir in $rpathdirs; do - $1="${$1}${$1:+ }-R$dir" - done - else - dnl The linker is used for linking directly. - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user - dnl must pass all path elements in one option. - alldirs= - for dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="$flag" - else - dnl The -rpath options are cumulative. - for dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="${$1}${$1:+ }$flag" - done - fi - fi - fi - fi - fi - AC_SUBST([$1]) -]) diff --git a/m4/lib-prefix.m4 b/m4/lib-prefix.m4 deleted file mode 100644 index 007aa053..00000000 --- a/m4/lib-prefix.m4 +++ /dev/null @@ -1,224 +0,0 @@ -# lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 2008-2012 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_PREPARE_MULTILIB creates -dnl - a variable acl_libdirstem, containing the basename of the libdir, either -dnl "lib" or "lib64" or "lib/64", -dnl - a variable acl_libdirstem2, as a secondary possible value for -dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or -dnl "lib/amd64". -AC_DEFUN([AC_LIB_PREPARE_MULTILIB], -[ - dnl There is no formal standard regarding lib and lib64. - dnl On glibc systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine - dnl the compiler's default mode by looking at the compiler's library search - dnl path. If at least one of its elements ends in /lib64 or points to a - dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. - dnl Otherwise we use the default, namely "lib". - dnl On Solaris systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or - dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. - AC_REQUIRE([AC_CANONICAL_HOST]) - acl_libdirstem=lib - acl_libdirstem2= - case "$host_os" in - solaris*) - dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment - dnl . - dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." - dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the - dnl symlink is missing, so we set acl_libdirstem2 too. - AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], - [AC_EGREP_CPP([sixtyfour bits], [ -#ifdef _LP64 -sixtyfour bits -#endif - ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) - ]) - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" -]) diff --git a/m4/ogg.m4 b/m4/ogg.m4 deleted file mode 100644 index 58416cef..00000000 --- a/m4/ogg.m4 +++ /dev/null @@ -1,116 +0,0 @@ -# Configure paths for libogg -# Jack Moffitt 10-21-2000 -# Shamelessly stolen from Owen Taylor and Manish Singh - -dnl XIPH_PATH_OGG([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -dnl Test for libogg, and define OGG_CFLAGS and OGG_LIBS -dnl -AC_DEFUN([XIPH_PATH_OGG], -[dnl -dnl Get the cflags and libraries -dnl -AC_ARG_WITH(ogg,AC_HELP_STRING([--with-ogg=PFX],[Prefix where libogg is installed (optional)]), ogg_prefix="$withval", ogg_prefix="") -AC_ARG_WITH(ogg-libraries,AC_HELP_STRING([--with-ogg-libraries=DIR],[Directory where libogg library is installed (optional)]), ogg_libraries="$withval", ogg_libraries="") -AC_ARG_WITH(ogg-includes,AC_HELP_STRING([--with-ogg-includes=DIR],[Directory where libogg header files are installed (optional)]), ogg_includes="$withval", ogg_includes="") -AC_ARG_ENABLE(oggtest,AC_HELP_STRING([--disable-oggtest],[Do not try to compile and run a test Ogg program]),, enable_oggtest=yes) - - if test "x$ogg_libraries" != "x" ; then - OGG_LIBS="-L$ogg_libraries" - elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then - OGG_LIBS="" - elif test "x$ogg_prefix" != "x" ; then - OGG_LIBS="-L$ogg_prefix/lib" - elif test "x$prefix" != "xNONE" ; then - OGG_LIBS="-L$prefix/lib" - fi - - if test "x$ogg_prefix" != "xno" ; then - OGG_LIBS="$OGG_LIBS -logg" - fi - - if test "x$ogg_includes" != "x" ; then - OGG_CFLAGS="-I$ogg_includes" - elif test "x$ogg_prefix" = "xno" || test "x$ogg_prefix" = "xyes" ; then - OGG_CFLAGS="" - elif test "x$ogg_prefix" != "x" ; then - OGG_CFLAGS="-I$ogg_prefix/include" - elif test "x$prefix" != "xNONE"; then - OGG_CFLAGS="-I$prefix/include" - fi - - AC_MSG_CHECKING(for Ogg) - if test "x$ogg_prefix" = "xno" ; then - no_ogg="disabled" - enable_oggtest="no" - else - no_ogg="" - fi - - - if test "x$enable_oggtest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_LIBS="$LIBS" - CFLAGS="$CFLAGS $OGG_CFLAGS" - LIBS="$LIBS $OGG_LIBS" -dnl -dnl Now check if the installed Ogg is sufficiently new. -dnl - rm -f conf.oggtest - AC_TRY_RUN([ -#include -#include -#include -#include - -int main () -{ - system("touch conf.oggtest"); - return 0; -} - -],, no_ogg=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - - if test "x$no_ogg" = "xdisabled" ; then - AC_MSG_RESULT(no) - ifelse([$2], , :, [$2]) - elif test "x$no_ogg" = "x" ; then - AC_MSG_RESULT(yes) - ifelse([$1], , :, [$1]) - else - AC_MSG_RESULT(no) - if test -f conf.oggtest ; then - : - else - echo "*** Could not run Ogg test program, checking why..." - CFLAGS="$CFLAGS $OGG_CFLAGS" - LIBS="$LIBS $OGG_LIBS" - AC_TRY_LINK([ -#include -#include -], [ return 0; ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding Ogg or finding the wrong" - echo "*** version of Ogg. If it is not finding Ogg, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occurred. This usually means Ogg was incorrectly installed" - echo "*** or that you have moved Ogg since it was installed." ]) - CFLAGS="$ac_save_CFLAGS" - LIBS="$ac_save_LIBS" - fi - OGG_CFLAGS="" - OGG_LIBS="" - ifelse([$2], , :, [$2]) - fi - AC_SUBST(OGG_CFLAGS) - AC_SUBST(OGG_LIBS) - rm -f conf.oggtest -]) diff --git a/m4/really_gcc.m4 b/m4/really_gcc.m4 deleted file mode 100644 index cba53ab3..00000000 --- a/m4/really_gcc.m4 +++ /dev/null @@ -1,32 +0,0 @@ -dnl @synopsis XIPH_GCC_REALLY_IS_GCC -dnl -dnl Find out if a compiler claiming to be gcc really is gcc (clang lies). -dnl @version 1.0 Oct 31 2013 -dnl @author Erik de Castro Lopo -dnl -dnl Permission to use, copy, modify, distribute, and sell this file for any -dnl purpose is hereby granted without fee, provided that the above copyright -dnl and this permission notice appear in all copies. No representations are -dnl made about the suitability of this software for any purpose. It is -dnl provided "as is" without express or implied warranty. -dnl - -# If the configure script has already detected GNU GCC, then make sure it -# isn't CLANG masquerading as GCC. - -AC_DEFUN([XIPH_GCC_REALLY_IS_GCC], -[ AC_LANG_ASSERT(C) - if test "x$ac_cv_c_compiler_gnu" = "xyes" ; then - AC_TRY_LINK([ - #include - ], - [ - #ifdef __clang__ - This is clang! - #endif - ], - ac_cv_c_compiler_gnu=yes, - ac_cv_c_compiler_gnu=no - ) - fi -]) diff --git a/m4/stack_protect.m4 b/m4/stack_protect.m4 deleted file mode 100644 index d39f4190..00000000 --- a/m4/stack_protect.m4 +++ /dev/null @@ -1,73 +0,0 @@ -dnl Copyright (C) 2013-2016 Xiph.org Foundation -dnl -dnl Redistribution and use in source and binary forms, with or without -dnl modification, are permitted provided that the following conditions -dnl are met: -dnl -dnl - Redistributions of source code must retain the above copyright -dnl notice, this list of conditions and the following disclaimer. -dnl -dnl - Redistributions in binary form must reproduce the above copyright -dnl notice, this list of conditions and the following disclaimer in the -dnl documentation and/or other materials provided with the distribution. -dnl -dnl - Neither the name of the Xiph.org Foundation nor the names of its -dnl contributors may be used to endorse or promote products derived from -dnl this software without specific prior written permission. -dnl -dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -dnl ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR -dnl CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -dnl We want to know if GCC stack protector works, for the C and for the C++ -dnl compiler. -dnl -dnl Just checking if the compiler accepts the required CFLAGSs is not enough -dnl because we have seen at least one instance where this check was -dnl in-sufficient. -dnl -dnl Instead, try to compile and link a test program with the stack protector -dnl flags. If that works, we use it. - -AC_DEFUN([XIPH_GCC_STACK_PROTECTOR], -[AC_LANG_ASSERT(C) - AC_MSG_CHECKING([if $CC supports stack smash protection]) - xiph_stack_check_old_cflags="$CFLAGS" - SSP_FLAGS="-fstack-protector-strong" - CFLAGS=$SSP_FLAGS - AC_TRY_LINK([ - #include - ], - [puts("Hello, World!"); return 0;], - AC_MSG_RESULT([yes]) - CFLAGS="$xiph_stack_check_old_cflags $SSP_FLAGS", - AC_MSG_RESULT([no]) - CFLAGS="$xiph_stack_check_old_cflags" - ) -])# XIPH_GCC_STACK_PROTECTOR - -AC_DEFUN([XIPH_GXX_STACK_PROTECTOR], -[AC_LANG_PUSH([C++]) - AC_MSG_CHECKING([if $CXX supports stack smash protection]) - xiph_stack_check_old_cflags="$CFLAGS" - SSP_FLAGS="-fstack-protector-strong" - CFLAGS=$SSP_FLAGS - AC_TRY_LINK([ - #include - ], - [puts("Hello, World!"); return 0;], - AC_MSG_RESULT([yes]) - CFLAGS="$xiph_stack_check_old_cflags $SSP_FLAGS", - AC_MSG_RESULT([no]) - CFLAGS="$xiph_stack_check_old_cflags" - ) - AC_LANG_POP([C++]) -])# XIPH_GXX_STACK_PROTECTOR diff --git a/m4/xmms.m4 b/m4/xmms.m4 deleted file mode 100644 index d1720959..00000000 --- a/m4/xmms.m4 +++ /dev/null @@ -1,148 +0,0 @@ -# CFLAGS and library paths for XMMS -# written 15 December 1999 by Ben Gertzfield - -dnl Usage: -dnl AM_PATH_XMMS([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl -dnl Example: -dnl AM_PATH_XMMS(0.9.5.1, , AC_MSG_ERROR([*** XMMS >= 0.9.5.1 not installed - please install first ***])) -dnl -dnl Defines XMMS_CFLAGS, XMMS_LIBS, XMMS_DATA_DIR, XMMS_PLUGIN_DIR, -dnl XMMS_VISUALIZATION_PLUGIN_DIR, XMMS_INPUT_PLUGIN_DIR, -dnl XMMS_OUTPUT_PLUGIN_DIR, XMMS_GENERAL_PLUGIN_DIR, XMMS_EFFECT_PLUGIN_DIR, -dnl and XMMS_VERSION for your plugin pleasure. -dnl - -dnl XMMS_TEST_VERSION(AVAILABLE-VERSION, NEEDED-VERSION [, ACTION-IF-OKAY [, ACTION-IF-NOT-OKAY]]) -AC_DEFUN([XMMS_TEST_VERSION], [ - -# Determine which version number is greater. Prints 2 to stdout if -# the second number is greater, 1 if the first number is greater, -# 0 if the numbers are equal. - -# Written 15 December 1999 by Ben Gertzfield -# Revised 15 December 1999 by Jim Monty - - AC_PROG_AWK - xmms_got_version=[` $AWK ' \ -BEGIN { \ - print vercmp(ARGV[1], ARGV[2]); \ -} \ - \ -function vercmp(ver1, ver2, ver1arr, ver2arr, \ - ver1len, ver2len, \ - ver1int, ver2int, len, i, p) { \ - \ - ver1len = split(ver1, ver1arr, /\./); \ - ver2len = split(ver2, ver2arr, /\./); \ - \ - len = ver1len > ver2len ? ver1len : ver2len; \ - \ - for (i = 1; i <= len; i++) { \ - p = 1000 ^ (len - i); \ - ver1int += ver1arr[i] * p; \ - ver2int += ver2arr[i] * p; \ - } \ - \ - if (ver1int < ver2int) \ - return 2; \ - else if (ver1int > ver2int) \ - return 1; \ - else \ - return 0; \ -}' $1 $2`] - - if test $xmms_got_version -eq 2; then # failure - ifelse([$4], , :, $4) - else # success! - ifelse([$3], , :, $3) - fi -]) - -AC_DEFUN([AM_PATH_XMMS], -[ -AC_ARG_WITH(xmms-prefix,[ --with-xmms-prefix=PFX Prefix where XMMS is installed (optional)], - xmms_config_prefix="$withval", xmms_config_prefix="") -AC_ARG_WITH(xmms-exec-prefix,[ --with-xmms-exec-prefix=PFX Exec prefix where XMMS is installed (optional)], - xmms_config_exec_prefix="$withval", xmms_config_exec_prefix="") - -if test x$xmms_config_exec_prefix != x; then - xmms_config_args="$xmms_config_args --exec-prefix=$xmms_config_exec_prefix" - if test x${XMMS_CONFIG+set} != xset; then - XMMS_CONFIG=$xmms_config_exec_prefix/bin/xmms-config - fi -fi - -if test x$xmms_config_prefix != x; then - xmms_config_args="$xmms_config_args --prefix=$xmms_config_prefix" - if test x${XMMS_CONFIG+set} != xset; then - XMMS_CONFIG=$xmms_config_prefix/bin/xmms-config - fi -fi - -AC_PATH_PROG(XMMS_CONFIG, xmms-config, no) -min_xmms_version=ifelse([$1], ,0.9.5.1, $1) - -if test "$XMMS_CONFIG" = "no"; then - no_xmms=yes -else - XMMS_CFLAGS=`$XMMS_CONFIG $xmms_config_args --cflags` - XMMS_LIBS=`$XMMS_CONFIG $xmms_config_args --libs` - XMMS_VERSION=`$XMMS_CONFIG $xmms_config_args --version` - XMMS_DATA_DIR=`$XMMS_CONFIG $xmms_config_args --data-dir` - XMMS_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --plugin-dir` - XMMS_VISUALIZATION_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args \ - --visualization-plugin-dir` - XMMS_INPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --input-plugin-dir` - XMMS_OUTPUT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --output-plugin-dir` - XMMS_EFFECT_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --effect-plugin-dir` - XMMS_GENERAL_PLUGIN_DIR=`$XMMS_CONFIG $xmms_config_args --general-plugin-dir` - - XMMS_TEST_VERSION($XMMS_VERSION, $min_xmms_version, ,no_xmms=version) -fi - -AC_MSG_CHECKING(for XMMS - version >= $min_xmms_version) - -if test "x$no_xmms" = x; then - AC_MSG_RESULT(yes) - ifelse([$2], , :, [$2]) -else - AC_MSG_RESULT(no) - - if test "$XMMS_CONFIG" = "no" ; then - echo "*** The xmms-config script installed by XMMS could not be found." - echo "*** If XMMS was installed in PREFIX, make sure PREFIX/bin is in" - echo "*** your path, or set the XMMS_CONFIG environment variable to the" - echo "*** full path to xmms-config." - else - if test "$no_xmms" = "version"; then - echo "*** An old version of XMMS, $XMMS_VERSION, was found." - echo "*** You need a version of XMMS newer than $min_xmms_version." - echo "*** The latest version of XMMS is always available from" - echo "*** http://www.xmms.org/" - echo "***" - - echo "*** If you have already installed a sufficiently new version, this error" - echo "*** probably means that the wrong copy of the xmms-config shell script is" - echo "*** being found. The easiest way to fix this is to remove the old version" - echo "*** of XMMS, but you can also set the XMMS_CONFIG environment to point to the" - echo "*** correct copy of xmms-config. (In this case, you will have to" - echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf" - echo "*** so that the correct libraries are found at run-time)" - fi - fi - XMMS_CFLAGS="" - XMMS_LIBS="" - ifelse([$3], , :, [$3]) -fi -AC_SUBST(XMMS_CFLAGS) -AC_SUBST(XMMS_LIBS) -AC_SUBST(XMMS_VERSION) -AC_SUBST(XMMS_DATA_DIR) -AC_SUBST(XMMS_PLUGIN_DIR) -AC_SUBST(XMMS_VISUALIZATION_PLUGIN_DIR) -AC_SUBST(XMMS_INPUT_PLUGIN_DIR) -AC_SUBST(XMMS_OUTPUT_PLUGIN_DIR) -AC_SUBST(XMMS_GENERAL_PLUGIN_DIR) -AC_SUBST(XMMS_EFFECT_PLUGIN_DIR) -]) diff --git a/man/Makefile.am b/man/Makefile.am deleted file mode 100644 index fe9f0bce..00000000 --- a/man/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -# flac - Command-line FLAC encoder/decoder -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 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 FLaC__HAS_DOCBOOK_TO_MAN -flac.1: flac.sgml - docbook-to-man $? > $@ - (docbook2man $? && mv FLAC.1 $@) - -metaflac.1: metaflac.sgml - docbook-to-man $? > $@ - (docbook2man $? && mv METAFLAC.1 $@) -else -flac.1: - echo "*** Warning: docbook-to-man not found; man pages will not be built." - touch $@ - -metaflac.1: - touch $@ -endif - -man_MANS = flac.1 metaflac.1 - -EXTRA_DIST = $(man_MANS) flac.sgml metaflac.sgml diff --git a/man/flac.1 b/man/flac.1 deleted file mode 100644 index 853b89cc..00000000 --- a/man/flac.1 +++ /dev/null @@ -1,390 +0,0 @@ -.\" This manpage has been automatically generated by docbook2man -.\" from a DocBook document. This tool can be found at: -.\" -.\" Please send any bug reports, improvements, comments, patches, -.\" etc. to Steve Cheng . -.TH "FLAC" "1" "2013/09/18" "" "" - -.SH NAME -flac \- Free Lossless Audio Codec -.SH SYNOPSIS - -\fBflac\fR [ \fB\fIOPTIONS\fB\fR ] [ \fB\fIinfile.wav\fB\fR | \fB\fIinfile.rf64\fB\fR | \fB\fIinfile.aiff\fB\fR | \fB\fIinfile.raw\fB\fR | \fB\fIinfile.flac\fB\fR | \fB\fIinfile.oga\fB\fR | \fB\fIinfile.ogg\fB\fR | \fB-\fR\fI ...\fR ] - - -\fBflac\fR [ \fB-d\fR | \fB--decode\fR | \fB-t\fR | \fB--test\fR | \fB-a\fR | \fB--analyze\fR ] [ \fB\fIOPTIONS\fB\fR ] [ \fB\fIinfile.flac\fB\fR | \fB\fIinfile.oga\fB\fR | \fB\fIinfile.ogg\fB\fR | \fB-\fR\fI ...\fR ] - -.SH "DESCRIPTION" -.PP -\fBflac\fR is a command-line tool for encoding, decoding, testing and analyzing FLAC streams. -.SH "OPTIONS" -.PP -A summary of options is included below. For a complete -description, see the HTML documentation. -.SS "GENERAL OPTIONS" -.TP -\fB-v, --version\fR -Show the flac version number -.TP -\fB-h, --help \fR -Show basic usage and a list of all options -.TP -\fB-H, --explain \fR -Show detailed explanation of usage and all options -.TP -\fB-d, --decode \fR -Decode (the default behavior is to encode) -.TP -\fB-t, --test \fR -Test a flac encoded file (same as -d except no decoded file is written) -.TP -\fB-a, --analyze \fR -Analyze a FLAC encoded file (same as -d except an analysis file is written) -.TP -\fB-c, --stdout \fR -Write output to stdout -.TP -\fB-s, --silent \fR -Silent mode (do not write runtime encode/decode statistics to stderr) -.TP -\fB--totally-silent \fR -Do not print anything of any kind, including warnings or errors. The exit code will be the only way to determine successful completion. -.TP -\fB--no-utf8-convert \fR -Do not convert tags from local charset to UTF-8. This is useful for scripts, and setting tags in situations where the locale is wrong. This option must appear before any tag options! -.TP -\fB-w, --warnings-as-errors \fR -Treat all warnings as errors (which cause flac to terminate with a non-zero exit code). -.TP -\fB-f, --force \fR -Force overwriting of output files. By default, flac warns that the output file already exists and continues to the next file. -.TP -\fB-o \fIfilename\fB, --output-name=\fIfilename\fB\fR -Force the output file name (usually flac just changes the extension). May only be used when encoding a single file. May not be used in conjunction with --output-prefix. -.TP -\fB--output-prefix=\fIstring\fB\fR -Prefix each output file name with the given string. This can be useful for encoding or decoding files to a different directory. Make sure if your string is a path name that it ends with a trailing `/' (slash). -.TP -\fB--delete-input-file \fR -Automatically delete the input file after a successful encode or decode. If there was an error (including a verify error) the input file is left intact. -.TP -\fB--preserve-modtime \fR -Output files have their timestamps/permissions set to match those of their inputs (this is default). Use --no-preserve-modtime to make output files have the current time and default permissions. -.TP -\fB--keep-foreign-metadata \fR -If encoding, save WAVE, RF64, or AIFF non-audio chunks in FLAC metadata. If decoding, restore any saved non-audio chunks from FLAC metadata when writing the decoded file. Foreign metadata cannot be transcoded, e.g. WAVE chunks saved in a FLAC file cannot be restored when decoding to AIFF. Input and output must be regular files (not stdin or stdout). -.TP -\fB--skip={\fI#\fB|\fImm:ss.ss\fB}\fR -Skip over the first number of samples of the input. This works for both encoding and decoding, but not testing. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second. -.TP -\fB--until={\fI#\fB|[\fI+\fB|\fI-\fB]\fImm:ss.ss\fB}\fR -Stop at the given sample number for each input file. This works for both encoding and decoding, but not testing. The given sample number is not included in the decoded output. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second. If a `+' (plus) sign is at the beginning, the --until point is relative to the --skip point. If a `-' (minus) sign is at the beginning, the --until point is relative to end of the audio. -.TP -\fB--ogg\fR -When encoding, generate Ogg FLAC output instead of native FLAC. Ogg FLAC streams are FLAC streams wrapped in an Ogg transport layer. The resulting file should have an '.oga' extension and will still be decodable by flac. - -When decoding, force the input to be treated as Ogg FLAC. This is useful when piping input from stdin or when the filename does not end in '.oga' or '.ogg'. -.TP -\fB--serial-number=\fI#\fB\fR -When used with --ogg, specifies the serial number to use for the first Ogg FLAC stream, which is then incremented for each additional stream. When encoding and no serial number is given, flac uses a random number for the first stream, then increments it for each additional stream. When decoding and no number is given, flac uses the serial number of the first page. -.SS "ANALYSIS OPTIONS" -.TP -\fB--residual-text \fR -Includes the residual signal in the analysis file. This will make the file very big, much larger than even the decoded file. -.TP -\fB--residual-gnuplot \fR -Generates a gnuplot file for every subframe; each file will contain the residual distribution of the subframe. This will create a lot of files. -.SS "DECODING OPTIONS" -.TP -\fB--cue=[\fI#.#\fB][-[\fI#.#\fB]]\fR -Set the beginning and ending cuepoints to decode. The optional first #.# is the track and index point at which decoding will start; the default is the beginning of the stream. The optional second #.# is the track and index point at which decoding will end; the default is the end of the stream. If the cuepoint does not exist, the closest one before it (for the start point) or after it (for the end point) will be used. If those don't exist, the start of the stream (for the start point) or end of the stream (for the end point) will be used. The cuepoints are merely translated into sample numbers then used as --skip and --until. A CD track can always be cued by, for example, --cue=9.1-10.1 for track 9, even if the CD has no 10th track. -.TP -\fB-F, --decode-through-errors \fR -By default flac stops decoding with an error and removes the partially decoded file if it encounters a bitstream error. With -F, errors are still printed but flac will continue decoding to completion. Note that errors may cause the decoded audio to be missing some samples or have silent sections. -.TP -\fB--apply-replaygain-which-is-not-lossless[=] \fR -Applies ReplayGain values while decoding. - -WARNING: THIS IS NOT LOSSLESS. DECODED AUDIO WILL NOT BE IDENTICAL TO THE ORIGINAL WITH THIS OPTION. - -The equals sign and is optional. If omitted, the default is 0aLn1. - -The is a shorthand notation for describing how to apply ReplayGain. All components are optional but order is important. '[]' means 'optional'. '|' means 'or'. '{}' means required. The format is: - -[][a|t][l|L][n{0|1|2|3}] -.RS -.TP -\fBpreamp\fR -A floating point number in dB. This is added to the existing gain value. -.TP -\fBa|t\fR -Specify 'a' to use the album gain, or 't' to use the track gain. If tags for the preferred kind (album/track) do not exist but tags for the other (track/album) do, those will be used instead. -.TP -\fBl|L\fR -Specify 'l' to peak-limit the output, so that the ReplayGain peak value is full-scale. Specify 'L' to use a 6dB hard limiter that kicks in when the signal approaches full-scale. -.TP -\fBn{0|1|2|3}\fR -Specify the amount of noise shaping. ReplayGain synthesis happens in floating point; the result is dithered before converting back to integer. This quantization adds noise. Noise shaping tries to move the noise where you won't hear it as much. 0 means no noise shaping, 1 means 'low', 2 means 'medium', 3 means 'high'. -.RE - -For example, the default of 0aLn1 means 0dB preamp, use album gain, 6dB hard limit, low noise shaping. - ---apply-replaygain-which-is-not-lossless=3 means 3dB preamp, use album gain, no limiting, no noise shaping. - -flac uses the ReplayGain tags for the calculation. If a stream does not have the required tags or they can't be parsed, decoding will continue with a warning, and no ReplayGain is applied to that stream. -.SS "ENCODING OPTIONS" -.TP -\fB-V, --verify\fR -Verify a correct encoding by decoding the output in parallel and comparing to the original -.TP -\fB--lax\fR -Allow encoder to generate non-Subset files. The resulting FLAC file may not be streamable or might have trouble being played in all players (especially hardware devices), so you should only use this option in combination with custom encoding options meant for archival. -.TP -\fB--replay-gain\fR -Calculate ReplayGain values and store them as FLAC tags, similar to vorbisgain. Title gains/peaks will be computed for each input file, and an album gain/peak will be computed for all files. All input files must have the same resolution, sample rate, and number of channels. Only mono and stereo files are allowed, and the sample rate must be one of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, or 48 kHz. Also note that this option may leave a few extra bytes in a PADDING block as the exact size of the tags is not known until all files are processed. Note that this option cannot be used when encoding to standard output (stdout). -.TP -\fB--cuesheet=\fIfilename\fB\fR -Import the given cuesheet file and store it in a CUESHEET metadata block. This option may only be used when encoding a single file. A seekpoint will be added for each index point in the cuesheet to the SEEKTABLE unless --no-cued-seekpoints is specified. -.TP -\fB--picture={\fIFILENAME\fB|\fISPECIFICATION\fB}\fR -Import a picture and store it in a PICTURE metadata block. More than one --picture command can be specified. Either a filename for the picture file or a more complete specification form can be used. The SPECIFICATION is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. FILENAME is just shorthand for "||||FILENAME". The format of SPECIFICATION is - -[TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE - -TYPE is optional; it is a number from one of: - -0: Other - -1: 32x32 pixels 'file icon' (PNG only) - -2: Other file icon - -3: Cover (front) - -4: Cover (back) - -5: Leaflet page - -6: Media (e.g. label side of CD) - -7: Lead artist/lead performer/soloist - -8: Artist/performer - -9: Conductor - -10: Band/Orchestra - -11: Composer - -12: Lyricist/text writer - -13: Recording Location - -14: During recording - -15: During performance - -16: Movie/video screen capture - -17: A bright coloured fish - -18: Illustration - -19: Band/artist logotype - -20: Publisher/Studio logotype - -The default is 3 (front cover). There may only be one picture each of type 1 and 2 in a file. - -MIME-TYPE is optional; if left blank, it will be detected from the file. For best compatibility with players, use pictures with MIME type image/jpeg or image/png. The MIME type can also be --> to mean that FILE is actually a URL to an image, though this use is discouraged. - -DESCRIPTION is optional; the default is an empty string. - -The next part specifies the resolution and color information. If the MIME-TYPE is image/jpeg, image/png, or image/gif, you can usually leave this empty and they can be detected from the file. Otherwise, you must specify the width in pixels, height in pixels, and color depth in bits-per-pixel. If the image has indexed colors you should also specify the number of colors used. When manually specified, it is not checked against the file for accuracy. - -FILE is the path to the picture file to be imported, or the URL if MIME type is --> - -For example, "|image/jpeg|||../cover.jpg" will embed the JPEG file at ../cover.jpg, defaulting to type 3 (front cover) and an empty description. The resolution and color info will be retrieved from the file itself. - -The specification "4|-->|CD|320x300x24/173|http://blah.blah/backcover.tiff" will embed the given URL, with type 4 (back cover), description "CD", and a manually specified resolution of 320x300, 24 bits-per-pixel, and 173 colors. The file at the URL will not be fetched; the URL itself is stored in the PICTURE metadata block. -.TP -\fB--sector-align\fR -Align encoding of multiple CD format files on sector boundaries. See the HTML documentation for more information. This option is DEPRECATED and may not exist in future versions of flac. -.TP -\fB--ignore-chunk-sizes\fR -When encoding to flac, ignore the file size headers in WAV and AIFF files to attempt to work around problems with over-sized or malformed files. - -WAV and AIFF files both have an unsigned 32 bit numbers in the file header which specifes the length of audio data. Since this number is unsigned 32 bits, that limits the size of a valid file to being just over 4 Gigabytes. Files larger than this are mal-formed, but should be read correctly using this option. -.TP -\fB-S {\fI#\fB|\fIX\fB|\fI#x\fB|\fI#s\fB}, --seekpoint={\fI#\fB|\fIX\fB|\fI#x\fB|\fI#s\fB}\fR -Include a point or points in a SEEKTABLE. Using #, a seek point at that sample number is added. Using X, a placeholder point is added at the end of a the table. Using #x, # evenly spaced seek points will be added, the first being at sample 0. Using #s, a seekpoint will be added every # seconds (# does not have to be a whole number; it can be, for example, 9.5, meaning a seekpoint every 9.5 seconds). You may use many -S options; the resulting SEEKTABLE will be the unique-ified union of all such values. With no -S options, flac defaults to '-S 10s'. Use --no-seektable for no SEEKTABLE. Note: '-S #x' and '-S #s' will not work if the encoder can't determine the input size before starting. Note: if you use '-S #' and # is >= samples in the input, there will be either no seek point entered (if the input size is determinable before encoding starts) or a placeholder point (if input size is not determinable). -.TP -\fB-P \fI#\fB, --padding=\fI#\fB\fR -Tell the encoder to write a PADDING metadata block of the given length (in bytes) after the STREAMINFO block. This is useful if you plan to tag the file later with an APPLICATION block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the PADDING block. Note that the total length of the PADDING block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no PADDING block at all to be written with --no-padding. The encoder writes a PADDING block of 8192 bytes by default (or 65536 bytes if the input audio stream is more that 20 minutes long). -.TP -\fB-T \fIFIELD=VALUE\fB, --tag=\fIFIELD=VALUE\fB\fR -Add a FLAC tag. The comment must adhere to the Vorbis comment spec; i.e. the FIELD must contain only legal characters, terminated by an 'equals' sign. Make sure to quote the comment if necessary. This option may appear more than once to add several comments. NOTE: all tags will be added to all encoded files. -.TP -\fB--tag-from-file=\fIFIELD=FILENAME\fB\fR -Like --tag, except FILENAME is a file whose contents will be read verbatim to set the tag value. The contents will be converted to UTF-8 from the local charset. This can be used to store a cuesheet in a tag (e.g. --tag-from-file="CUESHEET=image.cue"). Do not try to store binary data in tag fields! Use APPLICATION blocks for that. -.TP -\fB-b \fI#\fB, --blocksize=\fI#\fB\fR -Specify the block size in samples. Subset streams must use one of 192, 576, 1152, 2304, 4608, 256, 512, 1024, 2048, 4096 (and 8192 or 16384 if the sample rate is >48kHz). -.TP -\fB-m, --mid-side\fR -Try mid-side coding for each frame (stereo input only) -.TP -\fB-M, --adaptive-mid-side\fR -Adaptive mid-side coding for all frames (stereo input only) -.TP -\fB-0\&..-8, --compression-level-0\&..--compression-level-8\fR -Fastest compression..highest compression (default is -5). These are synonyms for other options: -.RS -.TP -\fB-0, --compression-level-0\fR -Synonymous with -l 0 -b 1152 -r 3 --no-mid-side -.TP -\fB-1, --compression-level-1\fR -Synonymous with -l 0 -b 1152 -M -r 3 -.TP -\fB-2, --compression-level-2\fR -Synonymous with -l 0 -b 1152 -m -r 3 -.TP -\fB-3, --compression-level-3\fR -Synonymous with -l 6 -b 4096 -r 4 --no-mid-side -.TP -\fB-4, --compression-level-4\fR -Synonymous with -l 8 -b 4096 -M -r 4 -.TP -\fB-5, --compression-level-5\fR -Synonymous with -l 8 -b 4096 -m -r 5 -.TP -\fB-6, --compression-level-6\fR -Synonymous with -l 8 -b 4096 -m -r 6 -A tukey(0.5) -A partial_tukey(2) -.TP -\fB-7, --compression-level-7\fR -Synonymous with -l 12 -b 4096 -m -r 6 -A tukey(0.5) -A partial_tukey(2) -.TP -\fB-8, --compression-level-8\fR -Synonymous with -l 12 -b 4096 -m -r 6 -A tukey(0.5) -A partial_tukey(2) -A punchout_tukey(3) -.RE -.TP -\fB--fast\fR -Fastest compression. Currently synonymous with -0. -.TP -\fB--best\fR -Highest compression. Currently synonymous with -8. -.TP -\fB-e, --exhaustive-model-search\fR -Do exhaustive model search (expensive!) -.TP -\fB-A \fIfunction\fB, --apodization=\fIfunction\fB\fR -Window audio data with given the apodization function. The functions are: bartlett, bartlett_hann, blackman, blackman_harris_4term_92db, connes, flattop, gauss(STDDEV), hamming, hann, kaiser_bessel, nuttall, rectangle, triangle, tukey(P), partial_tukey(n[/ov[/P]]), punchout_tukey(n[/ov[/P]]), welch. - -For gauss(STDDEV), STDDEV is the standard deviation (0 let encoder decide (min is 5, default is 0) -.TP -\fB-r [\fI#\fB,]\fI#\fB, --rice-partition-order=[\fI#\fB,]\fI#\fB\fR -Set the [min,]max residual partition order (0..15). min defaults to 0 if unspecified. Default is -r 5. -.SS "FORMAT OPTIONS" -.TP -\fB--endian={\fIbig\fB|\fIlittle\fB}\fR -Set the byte order for samples -.TP -\fB--channels=\fI#\fB\fR -Set number of channels. -.TP -\fB--bps=\fI#\fB\fR -Set bits per sample. -.TP -\fB--sample-rate=\fI#\fB\fR -Set sample rate (in Hz). -.TP -\fB--sign={\fIsigned\fB|\fIunsigned\fB}\fR -Set the sign of samples (the default is signed). -.TP -\fB--input-size=\fI#\fB\fR -Specify the size of the raw input in bytes. If you are encoding raw samples from stdin, you must set this option in order to be able to use --skip, --until, --cuesheet, or other options that need to know the size of the input beforehand. If the size given is greater than what is found in the input stream, the encoder will complain about an unexpected end-of-file. If the size given is less, samples will be truncated. -.TP -\fB--force-raw-format\fR -Force input (when encoding) or output (when decoding) to be treated as raw samples (even if filename ends in \fI\&.wav\fR). -.TP -\fB--force-aiff-format\fR -Force the decoder to output AIFF format. This option is not needed if the output filename (as set by -o) ends with \fI\&.aif\fR or \fI\&.aiff\fR\&. Also, this option has no effect when encoding since input AIFF is auto-detected. -.TP -\fB--force-rf64-format\fR -Force the decoder to output RF64 format. This option is not needed if the output filename (as set by -o) ends with \fI\&.rf64\fR\&. Also, this option has no effect when encoding since input RF64 is auto-detected. -.TP -\fB--force-wave64-format\fR -Force the decoder to output Wave64 format. This option is not needed if the output filename (as set by -o) ends with \fI\&.w64\fR\&. Also, this option has no effect when encoding since input Wave64 is auto-detected. -.SS "NEGATIVE OPTIONS" -.TP -\fB--no-adaptive-mid-side\fR -.TP -\fB--no-cued-seekpoints\fR -.TP -\fB--no-decode-through-errors\fR -.TP -\fB--no-delete-input-file\fR -.TP -\fB--no-preserve-modtime\fR -.TP -\fB--no-keep-foreign-metadata\fR -.TP -\fB--no-exhaustive-model-search\fR -.TP -\fB--no-force\fR -.TP -\fB--no-lax\fR -.TP -\fB--no-mid-side\fR -.TP -\fB--no-ogg\fR -.TP -\fB--no-padding\fR -.TP -\fB--no-qlp-coeff-prec-search\fR -.TP -\fB--no-replay-gain\fR -.TP -\fB--no-residual-gnuplot\fR -.TP -\fB--no-residual-text\fR -.TP -\fB--no-sector-align\fR -.TP -\fB--no-seektable\fR -.TP -\fB--no-silent\fR -.TP -\fB--no-verify\fR -.TP -\fB--no-warnings-as-errors\fR -These flags can be used to invert the sense of the corresponding normal option. -.SH "SEE ALSO" -.PP -metaflac(1) -.PP -The programs are documented fully by HTML format documentation, available in \fI/usr/share/doc/libflac-doc/html\fR on Debian GNU/Linux systems. -.SH "AUTHOR" -.PP -This manual page was initially written by Matt Zimmerman for the Debian GNU/Linux system (but may be used by others). It has been kept up-to-date by the Xiph.org Foundation. diff --git a/man/flac.sgml b/man/flac.sgml deleted file mode 100644 index 87a3f238..00000000 --- a/man/flac.sgml +++ /dev/null @@ -1,814 +0,0 @@ - - Matt"> - Zimmerman"> - - 2013/09/18"> - - 1"> - mdz@debian.org"> - - FLAC"> - - - Debian GNU/Linux"> - GNU"> -]> - - - -
- &dhemail; -
- - &dhfirstname; - &dhsurname; - - - 2002-2005, 2011-2013 - &dhusername; - - &dhdate; -
- - &dhucpackage; - - &dhsection; - - - &dhpackage; - - Free Lossless Audio Codec - - - - flac - OPTIONS - - infile.wav - infile.rf64 - infile.aiff - infile.raw - infile.flac - infile.oga - infile.ogg - - - - - - flac - - -d --decode - -t --test - -a --analyze - - OPTIONS - - infile.flac - infile.oga - infile.ogg - - - - - - - DESCRIPTION - - flac is a command-line tool for encoding, decoding, testing and analyzing FLAC streams. - - - - OPTIONS - - A summary of options is included below. For a complete - description, see the HTML documentation. - - - General Options - - - - , - - Show the flac version number - - - - - , - - - Show basic usage and a list of all options - - - - - , - - - Show detailed explanation of usage and all options - - - - - , - - - Decode (the default behavior is to encode) - - - - - , - - - Test a flac encoded file (same as -d except no decoded file is written) - - - - - , - - - Analyze a FLAC encoded file (same as -d except an analysis file is written) - - - - - , - - - Write output to stdout - - - - - , - - - Silent mode (do not write runtime encode/decode statistics to stderr) - - - - - - - - Do not print anything of any kind, including warnings or errors. The exit code will be the only way to determine successful completion. - - - - - - - - Do not convert tags from local charset to UTF-8. This is useful for scripts, and setting tags in situations where the locale is wrong. This option must appear before any tag options! - - - - - , - - - Treat all warnings as errors (which cause flac to terminate with a non-zero exit code). - - - - - , - - - Force overwriting of output files. By default, flac warns that the output file already exists and continues to the next file. - - - - - filename, =filename - - Force the output file name (usually flac just changes the extension). May only be used when encoding a single file. May not be used in conjunction with --output-prefix. - - - - - =string - - Prefix each output file name with the given string. This can be useful for encoding or decoding files to a different directory. Make sure if your string is a path name that it ends with a trailing `/' (slash). - - - - - - - - Automatically delete the input file after a successful encode or decode. If there was an error (including a verify error) the input file is left intact. - - - - - - - - Output files have their timestamps/permissions set to match those of their inputs (this is default). Use --no-preserve-modtime to make output files have the current time and default permissions. - - - - - - - - If encoding, save WAVE, RF64, or AIFF non-audio chunks in FLAC metadata. If decoding, restore any saved non-audio chunks from FLAC metadata when writing the decoded file. Foreign metadata cannot be transcoded, e.g. WAVE chunks saved in a FLAC file cannot be restored when decoding to AIFF. Input and output must be regular files (not stdin or stdout). - - - - - ={#|mm:ss.ss} - - Skip over the first number of samples of the input. This works for both encoding and decoding, but not testing. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second. - - - - - ={#|[+|-]mm:ss.ss} - - Stop at the given sample number for each input file. This works for both encoding and decoding, but not testing. The given sample number is not included in the decoded output. The alternative form mm:ss.ss can be used to specify minutes, seconds, and fractions of a second. If a `+' (plus) sign is at the beginning, the --until point is relative to the --skip point. If a `-' (minus) sign is at the beginning, the --until point is relative to end of the audio. - - - - - - - - When encoding, generate Ogg FLAC output instead of native FLAC. Ogg FLAC streams are FLAC streams wrapped in an Ogg transport layer. The resulting file should have an '.oga' extension and will still be decodable by flac. - When decoding, force the input to be treated as Ogg FLAC. This is useful when piping input from stdin or when the filename does not end in '.oga' or '.ogg'. - - - - - =# - - - When used with --ogg, specifies the serial number to use for the first Ogg FLAC stream, which is then incremented for each additional stream. When encoding and no serial number is given, flac uses a random number for the first stream, then increments it for each additional stream. When decoding and no number is given, flac uses the serial number of the first page. - - - - - - - - Analysis Options - - - - - - - Includes the residual signal in the analysis file. This will make the file very big, much larger than even the decoded file. - - - - - - - - Generates a gnuplot file for every subframe; each file will contain the residual distribution of the subframe. This will create a lot of files. - - - - - - - - Decoding Options - - - - - - Set the beginning and ending cuepoints to decode. The optional first #.# is the track and index point at which decoding will start; the default is the beginning of the stream. The optional second #.# is the track and index point at which decoding will end; the default is the end of the stream. If the cuepoint does not exist, the closest one before it (for the start point) or after it (for the end point) will be used. If those don't exist, the start of the stream (for the start point) or end of the stream (for the end point) will be used. The cuepoints are merely translated into sample numbers then used as --skip and --until. A CD track can always be cued by, for example, --cue=9.1-10.1 for track 9, even if the CD has no 10th track. - - - - - , - - - By default flac stops decoding with an error and removes the partially decoded file if it encounters a bitstream error. With -F, errors are still printed but flac will continue decoding to completion. Note that errors may cause the decoded audio to be missing some samples or have silent sections. - - - - - - - - Applies ReplayGain values while decoding. - WARNING: THIS IS NOT LOSSLESS. DECODED AUDIO WILL NOT BE IDENTICAL TO THE ORIGINAL WITH THIS OPTION. - The equals sign and <specification> is optional. If omitted, the default is 0aLn1. - The <specification> is a shorthand notation for describing how to apply ReplayGain. All components are optional but order is important. '[]' means 'optional'. '|' means 'or'. '{}' means required. The format is: - [<preamp>][a|t][l|L][n{0|1|2|3}] - - - - - - A floating point number in dB. This is added to the existing gain value. - - - - - - - Specify 'a' to use the album gain, or 't' to use the track gain. If tags for the preferred kind (album/track) do not exist but tags for the other (track/album) do, those will be used instead. - - - - - - - Specify 'l' to peak-limit the output, so that the ReplayGain peak value is full-scale. Specify 'L' to use a 6dB hard limiter that kicks in when the signal approaches full-scale. - - - - - - - Specify the amount of noise shaping. ReplayGain synthesis happens in floating point; the result is dithered before converting back to integer. This quantization adds noise. Noise shaping tries to move the noise where you won't hear it as much. 0 means no noise shaping, 1 means 'low', 2 means 'medium', 3 means 'high'. - - - - - - For example, the default of 0aLn1 means 0dB preamp, use album gain, 6dB hard limit, low noise shaping. - --apply-replaygain-which-is-not-lossless=3 means 3dB preamp, use album gain, no limiting, no noise shaping. - flac uses the ReplayGain tags for the calculation. If a stream does not have the required tags or they can't be parsed, decoding will continue with a warning, and no ReplayGain is applied to that stream. - - - - - - - Encoding Options - - - - , - - - Verify a correct encoding by decoding the output in parallel and comparing to the original - - - - - - - - Allow encoder to generate non-Subset files. The resulting FLAC file may not be streamable or might have trouble being played in all players (especially hardware devices), so you should only use this option in combination with custom encoding options meant for archival. - - - - - - - - Calculate ReplayGain values and store them as FLAC tags, similar to vorbisgain. Title gains/peaks will be computed for each input file, and an album gain/peak will be computed for all files. All input files must have the same resolution, sample rate, and number of channels. Only mono and stereo files are allowed, and the sample rate must be one of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, or 48 kHz. Also note that this option may leave a few extra bytes in a PADDING block as the exact size of the tags is not known until all files are processed. Note that this option cannot be used when encoding to standard output (stdout). - - - - - =filename - - - Import the given cuesheet file and store it in a CUESHEET metadata block. This option may only be used when encoding a single file. A seekpoint will be added for each index point in the cuesheet to the SEEKTABLE unless --no-cued-seekpoints is specified. - - - - - ={FILENAME|SPECIFICATION} - - - Import a picture and store it in a PICTURE metadata block. More than one --picture command can be specified. Either a filename for the picture file or a more complete specification form can be used. The SPECIFICATION is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. FILENAME is just shorthand for "||||FILENAME". The format of SPECIFICATION is - [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE - TYPE is optional; it is a number from one of: - 0: Other - 1: 32x32 pixels 'file icon' (PNG only) - 2: Other file icon - 3: Cover (front) - 4: Cover (back) - 5: Leaflet page - 6: Media (e.g. label side of CD) - 7: Lead artist/lead performer/soloist - 8: Artist/performer - 9: Conductor - 10: Band/Orchestra - 11: Composer - 12: Lyricist/text writer - 13: Recording Location - 14: During recording - 15: During performance - 16: Movie/video screen capture - 17: A bright coloured fish - 18: Illustration - 19: Band/artist logotype - 20: Publisher/Studio logotype - The default is 3 (front cover). There may only be one picture each of type 1 and 2 in a file. - - MIME-TYPE is optional; if left blank, it will be detected from the file. For best compatibility with players, use pictures with MIME type image/jpeg or image/png. The MIME type can also be --> to mean that FILE is actually a URL to an image, though this use is discouraged. - - DESCRIPTION is optional; the default is an empty string. - - The next part specifies the resolution and color information. If the MIME-TYPE is image/jpeg, image/png, or image/gif, you can usually leave this empty and they can be detected from the file. Otherwise, you must specify the width in pixels, height in pixels, and color depth in bits-per-pixel. If the image has indexed colors you should also specify the number of colors used. When manually specified, it is not checked against the file for accuracy. - - FILE is the path to the picture file to be imported, or the URL if MIME type is --> - - For example, "|image/jpeg|||../cover.jpg" will embed the JPEG file at ../cover.jpg, defaulting to type 3 (front cover) and an empty description. The resolution and color info will be retrieved from the file itself. - - The specification "4|-->|CD|320x300x24/173|http://blah.blah/backcover.tiff" will embed the given URL, with type 4 (back cover), description "CD", and a manually specified resolution of 320x300, 24 bits-per-pixel, and 173 colors. The file at the URL will not be fetched; the URL itself is stored in the PICTURE metadata block. - - - - - - - - Align encoding of multiple CD format files on sector boundaries. See the HTML documentation for more information. This option is DEPRECATED and may not exist in future versions of flac. - - - - - - - - When encoding to flac, ignore the file size headers in WAV and AIFF files to attempt to work around problems with over-sized or malformed files. - WAV and AIFF files both have an unsigned 32 bit numbers in the file header which specifes the length of audio data. Since this number is unsigned 32 bits, that limits the size of a valid file to being just over 4 Gigabytes. Files larger than this are mal-formed, but should be read correctly using this option. - - - - - {#|X|#x|#s}, ={#|X|#x|#s} - - - Include a point or points in a SEEKTABLE. Using #, a seek point at that sample number is added. Using X, a placeholder point is added at the end of a the table. Using #x, # evenly spaced seek points will be added, the first being at sample 0. Using #s, a seekpoint will be added every # seconds (# does not have to be a whole number; it can be, for example, 9.5, meaning a seekpoint every 9.5 seconds). You may use many -S options; the resulting SEEKTABLE will be the unique-ified union of all such values. With no -S options, flac defaults to '-S 10s'. Use --no-seektable for no SEEKTABLE. Note: '-S #x' and '-S #s' will not work if the encoder can't determine the input size before starting. Note: if you use '-S #' and # is >= samples in the input, there will be either no seek point entered (if the input size is determinable before encoding starts) or a placeholder point (if input size is not determinable). - - - - - #, =# - - - Tell the encoder to write a PADDING metadata block of the given length (in bytes) after the STREAMINFO block. This is useful if you plan to tag the file later with an APPLICATION block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the PADDING block. Note that the total length of the PADDING block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no PADDING block at all to be written with --no-padding. The encoder writes a PADDING block of 8192 bytes by default (or 65536 bytes if the input audio stream is more that 20 minutes long). - - - - - FIELD=VALUE, =FIELD=VALUE - - - Add a FLAC tag. The comment must adhere to the Vorbis comment spec; i.e. the FIELD must contain only legal characters, terminated by an 'equals' sign. Make sure to quote the comment if necessary. This option may appear more than once to add several comments. NOTE: all tags will be added to all encoded files. - - - - - =FIELD=FILENAME - - - Like --tag, except FILENAME is a file whose contents will be read verbatim to set the tag value. The contents will be converted to UTF-8 from the local charset. This can be used to store a cuesheet in a tag (e.g. --tag-from-file="CUESHEET=image.cue"). Do not try to store binary data in tag fields! Use APPLICATION blocks for that. - - - - - #, =# - - - Specify the block size in samples. Subset streams must use one of 192, 576, 1152, 2304, 4608, 256, 512, 1024, 2048, 4096 (and 8192 or 16384 if the sample rate is >48kHz). - - - - - , - - - Try mid-side coding for each frame (stereo input only) - - - - - , - - - Adaptive mid-side coding for all frames (stereo input only) - - - - - .., .. - - - Fastest compression..highest compression (default is -5). These are synonyms for other options: - - - - , - - - Synonymous with -l 0 -b 1152 -r 3 - - - - - , - - - Synonymous with -l 0 -b 1152 -M -r 3 - - - - - , - - - Synonymous with -l 0 -b 1152 -m -r 3 - - - - - , - - - Synonymous with -l 6 -b 4096 -r 4 - - - - - , - - - Synonymous with -l 8 -b 4096 -M -r 4 - - - - - , - - - Synonymous with -l 8 -b 4096 -m -r 5 - - - - - , - - - Synonymous with -l 8 -b 4096 -m -r 6 -A tukey(0.5) -A partial_tukey(2) - - - - - , - - - Synonymous with -l 8 -b 4096 -m -e -r 6 -A tukey(0.5) -A partial_tukey(2) - - - - - , - - - Synonymous with -l 12 -b 4096 -m -e -r 6 -A tukey(0.5) -A partial_tukey(2) -A punchout_tukey(3) - - - - - - - - - - - - - Fastest compression. Currently synonymous with -0. - - - - - - - - Highest compression. Currently synonymous with -8. - - - - - , - - - Do exhaustive model search (expensive!) - - - - - function, =function - - - Window audio data with given the apodization function. The functions are: bartlett, bartlett_hann, blackman, blackman_harris_4term_92db, connes, flattop, gauss(STDDEV), hamming, hann, kaiser_bessel, nuttall, rectangle, triangle, tukey(P), partial_tukey(n[/ov[/P]]), punchout_tukey(n[/ov[/P]]), welch. - For gauss(STDDEV), STDDEV is the standard deviation (0<STDDEV<=0.5). - For tukey(P), P specifies the fraction of the window that is tapered (0<=P<=1; P=0 corresponds to "rectangle" and P=1 corresponds to "hann"). - For partial_tukey(n) and punchout_tukey(n), n apodization functions are added that span different parts of each block. Values of 2 to 6 seem to yield sane results. If necessary, an overlap can be specified, as can be the taper parameter, for example partial_tukey(2/0.2) or partial_tukey(2/0.2/0.5). ov should be smaller than 1 and can be negative. - Please note that P, STDDEV and ov are locale specific, so a comma as decimal separator might be required instead of a dot. - More than one -A option (up to 32) may be used. Any function that is specified erroneously is silently dropped. The encoder chooses suitable defaults in the absence of any -A options; any -A option specified replaces the default(s). - When more than one function is specified, then for every subframe the encoder will try each of them separately and choose the window that results in the smallest compressed subframe. Multiple functions can greatly increase the encoding time. - - - - - #, =# - - - Specifies the maximum LPC order. This number must be <= 32. For Subset streams, it must be <=12 if the sample rate is <=48kHz. If 0, the encoder will not attempt generic linear prediction, and use only fixed predictors. Using fixed predictors is faster but usually results in files being 5-10% larger. - - - - - , - - - Do exhaustive search of LP coefficient quantization (expensive!). Overrides -q; does nothing if using -l 0 - - - - - #, =# - - - Precision of the quantized linear-predictor coefficients, 0 => let encoder decide (min is 5, default is 0) - - - - - [#,]#, =[#,]# - - - Set the [min,]max residual partition order (0..15). min defaults to 0 if unspecified. Default is -r 5. - - - - - - - - Format Options - - - - ={big|little} - - - Set the byte order for samples - - - - - =# - - - Set number of channels. - - - - - =# - - - Set bits per sample. - - - - - =# - - - Set sample rate (in Hz). - - - - - ={signed|unsigned} - - - Set the sign of samples (the default is signed). - - - - - =# - - - Specify the size of the raw input in bytes. If you are encoding raw samples from stdin, you must set this option in order to be able to use --skip, --until, --cuesheet, or other options that need to know the size of the input beforehand. If the size given is greater than what is found in the input stream, the encoder will complain about an unexpected end-of-file. If the size given is less, samples will be truncated. - - - - - - - - Force input (when encoding) or output (when decoding) to be treated as raw samples (even if filename ends in .wav). - - - - - - - - Force the decoder to output AIFF format. This option is not needed if the output filename (as set by -o) ends with .aif or .aiff. Also, this option has no effect when encoding since input AIFF is auto-detected. - - - - - - - - Force the decoder to output RF64 format. This option is not needed if the output filename (as set by -o) ends with .rf64. Also, this option has no effect when encoding since input RF64 is auto-detected. - - - - - - - - Force the decoder to output Wave64 format. This option is not needed if the output filename (as set by -o) ends with .w64. Also, this option has no effect when encoding since input Wave64 is auto-detected. - - - - - - - - Negative Options - - - - - - - - - - - - - - - - - - - - - - - - - - These flags can be used to invert the sense of the corresponding normal option. - - - - - - - - - SEE ALSO - - metaflac(1) - - The programs are documented fully by HTML format documentation, available in /usr/share/doc/libflac-doc/html on &debian; systems. - - - AUTHOR - - This manual page was initially written by &dhusername; &dhemail; for the &debian; system (but may be used by others). It has been kept up-to-date by the Xiph.org Foundation. - - - - -
- - diff --git a/man/metaflac.1 b/man/metaflac.1 deleted file mode 100644 index 0c1c66bc..00000000 --- a/man/metaflac.1 +++ /dev/null @@ -1,304 +0,0 @@ -.\" This manpage has been automatically generated by docbook2man -.\" from a DocBook document. This tool can be found at: -.\" -.\" Please send any bug reports, improvements, comments, patches, -.\" etc. to Steve Cheng . -.TH "METAFLAC" "1" "2013/04/30" "" "" - -.SH NAME -metaflac \- program to list, add, remove, or edit metadata in one or more FLAC files. -.SH SYNOPSIS - -\fBmetaflac\fR [ \fB\fIoptions\fB\fR ] [ \fB\fIoperations\fB\fR ] \fB\fIFLACfile\fB\fR\fI ...\fR - -.SH "DESCRIPTION" -.PP -Use \fBmetaflac\fR to list, add, remove, or edit -metadata in one or more FLAC files. You may perform one major operation, -or many shorthand operations at a time. -.SH "OPTIONS" -.TP -\fB--preserve-modtime\fR -Preserve the original modification time in spite of edits. -.TP -\fB--with-filename\fR -Prefix each output line with the FLAC file name (the default if -more than one FLAC file is specified). -.TP -\fB--no-filename\fR -Do not prefix each output line with the FLAC file name (the default -if only one FLAC file is specified). -.TP -\fB--no-utf8-convert\fR -Do not convert tags from UTF-8 to local charset, or vice versa. This is -useful for scripts, and setting tags in situations where the locale is wrong. -.TP -\fB--dont-use-padding\fR -By default metaflac tries to use padding where possible to avoid -rewriting the entire file if the metadata size changes. Use this -option to tell metaflac to not take advantage of padding this way. -.SH "SHORTHAND OPERATIONS" -.TP -\fB--show-md5sum\fR -Show the MD5 signature from the STREAMINFO block. -.TP -\fB--show-min-blocksize\fR -Show the minimum block size from the STREAMINFO block. -.TP -\fB--show-max-blocksize\fR -Show the maximum block size from the STREAMINFO block. -.TP -\fB--show-min-framesize\fR -Show the minimum frame size from the STREAMINFO block. -.TP -\fB--show-max-framesize\fR -Show the maximum frame size from the STREAMINFO block. -.TP -\fB--show-sample-rate\fR -Show the sample rate from the STREAMINFO block. -.TP -\fB--show-channels\fR -Show the number of channels from the STREAMINFO block. -.TP -\fB--show-bps\fR -Show the # of bits per sample from the STREAMINFO block. -.TP -\fB--show-total-samples\fR -Show the total # of samples from the STREAMINFO block. -.TP -\fB--show-vendor-tag\fR -Show the vendor string from the VORBIS_COMMENT block. -.TP -\fB--show-tag=name\fR -Show all tags where the field name matches 'name'. -.TP -\fB--remove-tag=name\fR -Remove all tags whose field name is 'name'. -.TP -\fB--remove-first-tag=name\fR -Remove first tag whose field name is 'name'. -.TP -\fB--remove-all-tags\fR -Remove all tags, leaving only the vendor string. -.TP -\fB--set-tag=field\fR -Add a tag. The field must comply with the -Vorbis comment spec, of the form "NAME=VALUE". If there is -currently no tag block, one will be created. -.TP -\fB--set-tag-from-file=field\fR -Like --set-tag, except the VALUE is a filename whose -contents will be read verbatim to set the tag value. -Unless --no-utf8-convert is specified, the contents will be -converted to UTF-8 from the local charset. This can be used -to store a cuesheet in a tag (e.g. ---set-tag-from-file="CUESHEET=image.cue"). Do not try to -store binary data in tag fields! Use APPLICATION blocks for -that. -.TP -\fB--import-tags-from=file\fR -Import tags from a file. Use '-' for stdin. Each -line should be of the form NAME=VALUE. Multi-line comments -are currently not supported. Specify --remove-all-tags and/or ---no-utf8-convert before --import-tags-from if necessary. If -FILE is '-' (stdin), only one FLAC file may be specified. -.TP -\fB--export-tags-to=file\fR -Export tags to a file. Use '-' for stdout. Each -line will be of the form NAME=VALUE. Specify ---no-utf8-convert if necessary. -.TP -\fB--import-cuesheet-from=file\fR -Import a cuesheet from a file. Use '-' for stdin. Only one -FLAC file may be specified. A seekpoint will be added for each -index point in the cuesheet to the SEEKTABLE unless ---no-cued-seekpoints is specified. -.TP -\fB--export-cuesheet-to=file\fR -Export CUESHEET block to a cuesheet file, suitable for use by -CD authoring software. Use '-' for stdout. Only one FLAC file -may be specified on the command line. -.TP -\fB--import-picture-from={\fIFILENAME\fB|\fISPECIFICATION\fB}\fR -Import a picture and store it in a PICTURE metadata block. More than one --import-picture-from command can be specified. Either a filename for the picture file or a more complete specification form can be used. The SPECIFICATION is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. FILENAME is just shorthand for "||||FILENAME". The format of SPECIFICATION is - -[TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE - -TYPE is optional; it is a number from one of: - -0: Other - -1: 32x32 pixels 'file icon' (PNG only) - -2: Other file icon - -3: Cover (front) - -4: Cover (back) - -5: Leaflet page - -6: Media (e.g. label side of CD) - -7: Lead artist/lead performer/soloist - -8: Artist/performer - -9: Conductor - -10: Band/Orchestra - -11: Composer - -12: Lyricist/text writer - -13: Recording Location - -14: During recording - -15: During performance - -16: Movie/video screen capture - -17: A bright coloured fish - -18: Illustration - -19: Band/artist logotype - -20: Publisher/Studio logotype - -The default is 3 (front cover). There may only be one picture each of type 1 and 2 in a file. - -MIME-TYPE is optional; if left blank, it will be detected from the file. For best compatibility with players, use pictures with MIME type image/jpeg or image/png. The MIME type can also be --> to mean that FILE is actually a URL to an image, though this use is discouraged. - -DESCRIPTION is optional; the default is an empty string. - -The next part specifies the resolution and color information. If the MIME-TYPE is image/jpeg, image/png, or image/gif, you can usually leave this empty and they can be detected from the file. Otherwise, you must specify the width in pixels, height in pixels, and color depth in bits-per-pixel. If the image has indexed colors you should also specify the number of colors used. When manually specified, it is not checked against the file for accuracy. - -FILE is the path to the picture file to be imported, or the URL if MIME type is --> - -For example, "|image/jpeg|||../cover.jpg" will embed the JPEG file at ../cover.jpg, defaulting to type 3 (front cover) and an empty description. The resolution and color info will be retrieved from the file itself. - -The specification "4|-->|CD|320x300x24/173|http://blah.blah/backcover.tiff" will embed the given URL, with type 4 (back cover), description "CD", and a manually specified resolution of 320x300, 24 bits-per-pixel, and 173 colors. The file at the URL will not be fetched; the URL itself is stored in the PICTURE metadata block. -.TP -\fB--export-picture-to=file\fR -Export PICTURE block to a file. Use '-' for stdout. Only one FLAC file may be specified on the command line. The first PICTURE block will be exported unless --export-picture-to is preceded by a --block-number=# option to specify the exact metadata block to extract. Note that the block number is the one shown by --list. -.TP -\fB--add-replay-gain\fR -Calculates the title and album gains/peaks of the given FLAC -files as if all the files were part of one album, then stores -them as FLAC tags. The tags are the same as -those used by vorbisgain. Existing ReplayGain tags will be -replaced. If only one FLAC file is given, the album and title -gains will be the same. Since this operation requires two -passes, it is always executed last, after all other operations -have been completed and written to disk. All FLAC files -specified must have the same resolution, sample rate, and -number of channels. The sample rate must be one of 8, 11.025, -12, 16, 18.9, 22.05, 24, 28, 32, 37.8, 44.1, 48, 56, 64, 88.2, -96, 112, 128, 144, 176.4, or 192kHz. -.TP -\fB--scan-replay-gain\fR -Like --add-replay-gain, but only analyzes the files rather than -writing them to the tags. -.TP -\fB--remove-replay-gain\fR -Removes the ReplayGain tags. -.TP -\fB--add-seekpoint={\fI#\fB|\fIX\fB|\fI#x\fB|\fI#s\fB}\fR -Add seek points to a SEEKTABLE block. Using #, a seek point at -that sample number is added. Using X, a placeholder point is -added at the end of a the table. Using #x, # evenly spaced seek -points will be added, the first being at sample 0. Using #s, a -seekpoint will be added every # seconds (# does not have to be a -whole number; it can be, for example, 9.5, meaning a seekpoint -every 9.5 seconds). If no SEEKTABLE block exists, one will be -created. If one already exists, points will be added to the -existing table, and any duplicates will be turned into placeholder -points. You may use many --add-seekpoint options; the resulting -SEEKTABLE will be the unique-ified union of all such values. -Example: --add-seekpoint=100x --add-seekpoint=3.5s will add 100 -evenly spaced seekpoints and a seekpoint every 3.5 seconds. -.TP -\fB--add-padding=length\fR -Add a padding block of the given length (in bytes). The overall -length of the new block will be 4 + length; the extra 4 bytes is -for the metadata block header. -.SH "MAJOR OPERATIONS" -.TP -\fB--list\fR -List the contents of one or more metadata blocks to stdout. By -default, all metadata blocks are listed in text format. Use the -following options to change this behavior: -.RS -.TP -\fB--block-number=#[,#[...]]\fR -An optional comma-separated list of block numbers to display. -The first block, the STREAMINFO block, is block 0. -.TP -\fB--block-type=type[,type[...]]\fR -.TP -\fB--except-block-type=type[,type[...]]\fR -An optional comma-separated list of block types to be included -or ignored with this option. Use only one of --block-type or ---except-block-type. The valid block types are: STREAMINFO, -PADDING, APPLICATION, SEEKTABLE, VORBIS_COMMENT, PICTURE. You -may narrow down the types of APPLICATION blocks displayed as -follows: - -APPLICATION:abcd The APPLICATION block(s) whose textual repre- -sentation of the 4-byte ID is "abcd" -APPLICATION:0xXXXXXXXX The APPLICATION block(s) whose hexadecimal big- -endian representation of the 4-byte ID is -"0xXXXXXXXX". For the example "abcd" above the -hexadecimal equivalalent is 0x61626364 -.sp -.RS -.B "Note:" -if both --block-number and --[except-]block-type are -specified, the result is the logical AND of both -arguments. -.RE -.TP -\fB--application-data-format=hexdump|text\fR -If the application block you are displaying contains binary -data but your --data-format=text, you can display a hex dump -of the application data contents instead using ---application-data-format=hexdump. -.RE -.TP -\fB--remove\fR -Remove one or more metadata blocks from the metadata. Unless ---dont-use-padding is specified, the blocks will be replaced with -padding. You may not remove the STREAMINFO block. -.RS -.TP -\fB--block-number=#[,#[...]]\fR -.TP -\fB--block-type=type[,type[...]]\fR -.TP -\fB--except-block-type=type[,type[...]]\fR -See --list above for usage. -.sp -.RS -.B "Note:" -if both --block-number and --[except-]block-type are -specified, the result is the logical AND of both arguments. -.RE -.RE -.TP -\fB--remove-all\fR -Remove all metadata blocks (except the STREAMINFO block) from the -metadata. Unless --dont-use-padding is specified, the blocks will -be replaced with padding. -.TP -\fB--merge-padding\fR -Merge adjacent PADDING blocks into single blocks. -.TP -\fB--sort-padding\fR -Move all PADDING blocks to the end of the metadata and merge them -into a single block. -.SH "SEE ALSO" -.PP -flac(1). diff --git a/man/metaflac.sgml b/man/metaflac.sgml deleted file mode 100644 index 219cca4a..00000000 --- a/man/metaflac.sgml +++ /dev/null @@ -1,581 +0,0 @@ - manpage.1'. You may view - the manual page with: `docbook-to-man manpage.sgml | nroff -man | - less'. A typical entry in a Makefile or Makefile.am is: - -manpage.1: manpage.sgml - docbook-to-man $< > $@ - --> - - - - - dann"> - frazier"> - - 2013/04/30"> - - 1"> - dannf@debian.org"> - - METAFLAC"> - -]> - - - -
- &manemail; -
- - &manfirstname; - &mansurname; - - - 2002-2005, 2011-2013 - &manusername; - - &mandate; -
- - &manucpackage; - - &mansection; - - - &manpackage; - - - program to list, add, remove, or edit metadata in one or more FLAC files. - - - - - &manpackage; - - options - - operations - FLACfile - - - - DESCRIPTION - - Use &manpackage; to list, add, remove, or edit - metadata in one or more FLAC files. You may perform one major operation, - or many shorthand operations at a time. - - - - OPTIONS - - - - - - - Preserve the original modification time in spite of edits. - - - - - - - - Prefix each output line with the FLAC file name (the default if - more than one FLAC file is specified). - - - - - - - - Do not prefix each output line with the FLAC file name (the default - if only one FLAC file is specified). - - - - - - - - Do not convert tags from UTF-8 to local charset, or vice versa. This is - useful for scripts, and setting tags in situations where the locale is wrong. - - - - - - - - By default metaflac tries to use padding where possible to avoid - rewriting the entire file if the metadata size changes. Use this - option to tell metaflac to not take advantage of padding this way. - - - - - - - SHORTHAND OPERATIONS - - - - - - - Show the MD5 signature from the STREAMINFO block. - - - - - - - - Show the minimum block size from the STREAMINFO block. - - - - - - - - Show the maximum block size from the STREAMINFO block. - - - - - - - - Show the minimum frame size from the STREAMINFO block. - - - - - - - - Show the maximum frame size from the STREAMINFO block. - - - - - - - - Show the sample rate from the STREAMINFO block. - - - - - - - - Show the number of channels from the STREAMINFO block. - - - - - - - - Show the # of bits per sample from the STREAMINFO block. - - - - - - - - Show the total # of samples from the STREAMINFO block. - - - - - - - - Show the vendor string from the VORBIS_COMMENT block. - - - - - - - - Show all tags where the field name matches 'name'. - - - - - - - - Remove all tags whose field name is 'name'. - - - - - - - - Remove first tag whose field name is 'name'. - - - - - - - - Remove all tags, leaving only the vendor string. - - - - - - - - Add a tag. The field must comply with the - Vorbis comment spec, of the form "NAME=VALUE". If there is - currently no tag block, one will be created. - - - - - - - - Like --set-tag, except the VALUE is a filename whose - contents will be read verbatim to set the tag value. - Unless --no-utf8-convert is specified, the contents will be - converted to UTF-8 from the local charset. This can be used - to store a cuesheet in a tag (e.g. - --set-tag-from-file="CUESHEET=image.cue"). Do not try to - store binary data in tag fields! Use APPLICATION blocks for - that. - - - - - - - - Import tags from a file. Use '-' for stdin. Each - line should be of the form NAME=VALUE. Multi-line comments - are currently not supported. Specify --remove-all-tags and/or - --no-utf8-convert before --import-tags-from if necessary. If - FILE is '-' (stdin), only one FLAC file may be specified. - - - - - - - - Export tags to a file. Use '-' for stdout. Each - line will be of the form NAME=VALUE. Specify - --no-utf8-convert if necessary. - - - - - - - - Import a cuesheet from a file. Use '-' for stdin. Only one - FLAC file may be specified. A seekpoint will be added for each - index point in the cuesheet to the SEEKTABLE unless - --no-cued-seekpoints is specified. - - - - - - - - Export CUESHEET block to a cuesheet file, suitable for use by - CD authoring software. Use '-' for stdout. Only one FLAC file - may be specified on the command line. - - - - - ={FILENAME|SPECIFICATION} - - Import a picture and store it in a PICTURE metadata block. More than one --import-picture-from command can be specified. Either a filename for the picture file or a more complete specification form can be used. The SPECIFICATION is a string whose parts are separated by | (pipe) characters. Some parts may be left empty to invoke default values. FILENAME is just shorthand for "||||FILENAME". The format of SPECIFICATION is - [TYPE]|[MIME-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILE - TYPE is optional; it is a number from one of: - 0: Other - 1: 32x32 pixels 'file icon' (PNG only) - 2: Other file icon - 3: Cover (front) - 4: Cover (back) - 5: Leaflet page - 6: Media (e.g. label side of CD) - 7: Lead artist/lead performer/soloist - 8: Artist/performer - 9: Conductor - 10: Band/Orchestra - 11: Composer - 12: Lyricist/text writer - 13: Recording Location - 14: During recording - 15: During performance - 16: Movie/video screen capture - 17: A bright coloured fish - 18: Illustration - 19: Band/artist logotype - 20: Publisher/Studio logotype - The default is 3 (front cover). There may only be one picture each of type 1 and 2 in a file. - - MIME-TYPE is optional; if left blank, it will be detected from the file. For best compatibility with players, use pictures with MIME type image/jpeg or image/png. The MIME type can also be --> to mean that FILE is actually a URL to an image, though this use is discouraged. - - DESCRIPTION is optional; the default is an empty string. - - The next part specifies the resolution and color information. If the MIME-TYPE is image/jpeg, image/png, or image/gif, you can usually leave this empty and they can be detected from the file. Otherwise, you must specify the width in pixels, height in pixels, and color depth in bits-per-pixel. If the image has indexed colors you should also specify the number of colors used. When manually specified, it is not checked against the file for accuracy. - - FILE is the path to the picture file to be imported, or the URL if MIME type is --> - - For example, "|image/jpeg|||../cover.jpg" will embed the JPEG file at ../cover.jpg, defaulting to type 3 (front cover) and an empty description. The resolution and color info will be retrieved from the file itself. - - The specification "4|-->|CD|320x300x24/173|http://blah.blah/backcover.tiff" will embed the given URL, with type 4 (back cover), description "CD", and a manually specified resolution of 320x300, 24 bits-per-pixel, and 173 colors. The file at the URL will not be fetched; the URL itself is stored in the PICTURE metadata block. - - - - - - - Export PICTURE block to a file. Use '-' for stdout. Only one FLAC file may be specified on the command line. The first PICTURE block will be exported unless --export-picture-to is preceded by a --block-number=# option to specify the exact metadata block to extract. Note that the block number is the one shown by --list. - - - - - - - - Calculates the title and album gains/peaks of the given FLAC - files as if all the files were part of one album, then stores - them as FLAC tags. The tags are the same as - those used by vorbisgain. Existing ReplayGain tags will be - replaced. If only one FLAC file is given, the album and title - gains will be the same. Since this operation requires two - passes, it is always executed last, after all other operations - have been completed and written to disk. All FLAC files - specified must have the same resolution, sample rate, and - number of channels. The sample rate must be one of 8, 11.025, - 12, 16, 18.9, 22.05, 24, 28, 32, 37.8, 44.1, 48, 56, 64, 88.2, - 96, 112, 128, 144, 176.4, or 192kHz. - - - - - - - - - Like --add-replay-gain, but only analyzes the files rather - than writing them to the tags. - - - - - - - - Removes the ReplayGain tags. - - - - - ={#|X|#x|#s} - - - Add seek points to a SEEKTABLE block. Using #, a seek point at - that sample number is added. Using X, a placeholder point is - added at the end of a the table. Using #x, # evenly spaced seek - points will be added, the first being at sample 0. Using #s, a - seekpoint will be added every # seconds (# does not have to be a - whole number; it can be, for example, 9.5, meaning a seekpoint - every 9.5 seconds). If no SEEKTABLE block exists, one will be - created. If one already exists, points will be added to the - existing table, and any duplicates will be turned into placeholder - points. You may use many --add-seekpoint options; the resulting - SEEKTABLE will be the unique-ified union of all such values. - Example: --add-seekpoint=100x --add-seekpoint=3.5s will add 100 - evenly spaced seekpoints and a seekpoint every 3.5 seconds. - - - - - - - - Add a padding block of the given length (in bytes). The overall - length of the new block will be 4 + length; the extra 4 bytes is - for the metadata block header. - - - - - - - MAJOR OPERATIONS - - - - - - - List the contents of one or more metadata blocks to stdout. By - default, all metadata blocks are listed in text format. Use the - following options to change this behavior: - - - - - - - An optional comma-separated list of block numbers to display. - The first block, the STREAMINFO block, is block 0. - - - - - - - - - - - - An optional comma-separated list of block types to be included - or ignored with this option. Use only one of --block-type or - --except-block-type. The valid block types are: STREAMINFO, - PADDING, APPLICATION, SEEKTABLE, VORBIS_COMMENT, PICTURE. You - may narrow down the types of APPLICATION blocks displayed as - follows: - - - APPLICATION:abcd The APPLICATION block(s) whose textual repre- - sentation of the 4-byte ID is "abcd" - APPLICATION:0xXXXXXXXX The APPLICATION block(s) whose hexadecimal big- - endian representation of the 4-byte ID is - "0xXXXXXXXX". For the example "abcd" above the - hexadecimal equivalalent is 0x61626364 - - - - if both --block-number and --[except-]block-type are - specified, the result is the logical AND of both - arguments. - - - - - - - If the application block you are displaying contains binary - data but your --data-format=text, you can display a hex dump - of the application data contents instead using - --application-data-format=hexdump. - - - - - - - - - - - Remove one or more metadata blocks from the metadata. Unless - --dont-use-padding is specified, the blocks will be replaced with - padding. You may not remove the STREAMINFO block. - - - - - - - - - - - - - - See --list above for usage. - - - if both --block-number and --[except-]block-type are - specified, the result is the logical AND of both arguments. - - - - - - - - - - - Remove all metadata blocks (except the STREAMINFO block) from the - metadata. Unless --dont-use-padding is specified, the blocks will - be replaced with padding. - - - - - - - - Merge adjacent PADDING blocks into single blocks. - - - - - - - - Move all PADDING blocks to the end of the metadata and merge them - into a single block. - - - - - - - - SEE ALSO - - flac(1). - -
- - diff --git a/microbench/CMakeLists.txt b/microbench/CMakeLists.txt deleted file mode 100644 index 639915b6..00000000 --- a/microbench/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -if(MSVC) - return() -endif() - -set(CMAKE_REQUIRED_LIBRARIES rt) -check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) - -if(APPLE) - add_definitions(-DFLAC__SYS_DARWIN) -endif() - -add_executable(benchmark_residual benchmark_residual.c util.c) -target_include_directories(benchmark_residual PRIVATE - "$/include") -target_link_libraries(benchmark_residual - FLAC - $<$:rt>) diff --git a/microbench/Makefile.am b/microbench/Makefile.am deleted file mode 100644 index 8bad781b..00000000 --- a/microbench/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2015-2016 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. - - -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/libFLAC/include - -noinst_HEADERS = util.h - -noinst_PROGRAMS = benchmark_residual - -benchmark_residual_SOURCES = benchmark_residual.c util.c - -benchmark_residual_LDADD = @LIB_CLOCK_GETTIME@ - -EXTRA_DIST = CMakeLists.txt diff --git a/microbench/benchmark_residual.c b/microbench/benchmark_residual.c deleted file mode 100644 index 588c05bb..00000000 --- a/microbench/benchmark_residual.c +++ /dev/null @@ -1,151 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of the Xiph.org Foundation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include "FLAC/ordinals.h" -#include "share/compat.h" -#include "private/bitmath.h" -#include "private/fixed.h" -#include "private/macros.h" -#include "FLAC/assert.h" - -#include "util.h" - -static void FLAC__fixed_compute_residual_shift(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]) -{ - const int idata_len = (int) data_len; - int i; - - switch(order) { - case 0: - FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0])); - memcpy(residual, data, sizeof(residual[0])*data_len); - break; - case 1: - for(i = 0; i < idata_len; i++) - residual[i] = data[i] - data[i-1]; - break; - case 2: - for(i = 0; i < idata_len; i++) - residual[i] = data[i] - (data[i-1] << 1) + data[i-2]; - break; - case 3: - for(i = 0; i < idata_len; i++) - residual[i] = data[i] - (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) - data[i-3]; - break; - case 4: - for(i = 0; i < idata_len; i++) - residual[i] = data[i] - ((data[i-1]+data[i-3])<<2) + ((data[i-2]<<2) + (data[i-2]<<1)) + data[i-4]; - break; - default: - FLAC__ASSERT(0); - } -} - -static void FLAC__fixed_compute_residual_mult(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]) -{ - const int idata_len = (int)data_len; - int i; - - switch(order) { - case 0: - FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0])); - memcpy(residual, data, sizeof(residual[0])*data_len); - break; - case 1: - for(i = 0; i < idata_len; i++) - residual[i] = data[i] - data[i-1]; - break; - case 2: - for(i = 0; i < idata_len; i++) - residual[i] = data[i] - 2*data[i-1] + data[i-2]; - break; - case 3: - for(i = 0; i < idata_len; i++) - residual[i] = data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3]; - break; - case 4: - for(i = 0; i < idata_len; i++) - residual[i] = data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4]; - break; - default: - FLAC__ASSERT(0); - } -} - -static FLAC__int32 data [200000] ; -static FLAC__int32 residual [200000] ; - -static unsigned bench_order = 0 ; - -static void -bench_shift (void) -{ FLAC__fixed_compute_residual_shift (data, ARRAY_LEN (data), bench_order, residual) ; -} - -static void -bench_mult (void) -{ FLAC__fixed_compute_residual_mult (data, ARRAY_LEN (data), bench_order, residual) ; -} - -int -main (void) -{ bench_stats stats ; - - puts ("") ; - - for (bench_order = 2 ; bench_order <= 4 ; bench_order ++) { - memset (&stats, 0, sizeof (stats)) ; - stats.testfunc = bench_shift ; - stats.run_count = 100 ; - stats.loop_count = 10 ; - - benchmark_stats (&stats) ; - printf ("shift order %u : %f %f %f %f\n", bench_order, stats.min_time, stats.median_time, stats.mean_time, stats.max_time) ; - - memset (&stats, 0, sizeof (stats)) ; - stats.testfunc = bench_mult ; - stats.run_count = 100 ; - stats.loop_count = 10 ; - - benchmark_stats (&stats) ; - printf ("mult order %u : %f %f %f %f\n\n", bench_order, stats.min_time, stats.median_time, stats.mean_time, stats.max_time) ; - } - - return 0 ; -} diff --git a/microbench/util.c b/microbench/util.c deleted file mode 100644 index 66003d79..00000000 --- a/microbench/util.c +++ /dev/null @@ -1,205 +0,0 @@ -/* FLAC - Free Lossless Audio Codec - * Copyright (C) 2015-2016 Xiph.Org Foundation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of the Xiph.org Foundation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "util.h" - -#if defined _WIN32 - -#include - -static double -counter_diff (const LARGE_INTEGER * start, const LARGE_INTEGER * end) -{ - LARGE_INTEGER diff, freq; - - QueryPerformanceFrequency(&freq); - diff.QuadPart = end->QuadPart - start->QuadPart; - - return (double)diff.QuadPart/(double)freq.QuadPart; -} - -double -benchmark_function (void (*testfunc) (void), unsigned count) -{ - LARGE_INTEGER start, end; - unsigned k; - - QueryPerformanceCounter (&start) ; - - for (k = 0 ; k < count ; k++) - testfunc(); - - QueryPerformanceCounter (&end) ; - - return counter_diff (&start, &end) / count ; -} /* benchmark_function */ - -#elif defined FLAC__SYS_DARWIN - -#include - -static double -counter_diff (const uint64_t * start, const uint64_t * end) -{ - mach_timebase_info_data_t t_info; - mach_timebase_info(&t_info); - uint64_t duration = *end - *start; - - return duration * ((double)t_info.numer/(double)t_info.denom); -} - -double -benchmark_function (void (*testfunc) (void), unsigned count) -{ - uint64_t start, end; - unsigned k; - - start = mach_absolute_time(); - - for (k = 0 ; k < count ; k++) - testfunc(); - - end = mach_absolute_time(); - - return counter_diff (&start, &end) / count ; -} /* benchmark_function */ - -#elif defined HAVE_CLOCK_GETTIME - -#include -#include - -static double -timespec_diff (const struct timespec * start, const struct timespec * end) -{ struct timespec diff; - - if (end->tv_nsec - start->tv_nsec < 0) - { diff.tv_sec = end->tv_sec - start->tv_sec - 1 ; - diff.tv_nsec = 1000000000 + end->tv_nsec - start->tv_nsec ; - } - else - { diff.tv_sec = end->tv_sec - start->tv_sec ; - diff.tv_nsec = end->tv_nsec-start->tv_nsec ; - } ; - - return diff.tv_sec + 1e-9 * diff.tv_nsec ; -} - -double -benchmark_function (void (*testfunc) (void), unsigned count) -{ struct timespec start, end; - unsigned k ; - - clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &start) ; - - for (k = 0 ; k < count ; k++) - testfunc () ; - - clock_gettime (CLOCK_PROCESS_CPUTIME_ID, &end) ; - - return timespec_diff (&start, &end) / count ; -} /* benchmark_function */ - -#else - -#include -#include - -static double -timeval_diff (const struct timeval * start, const struct timeval * end) -{ struct timeval diff; - - if (end->tv_usec - start->tv_usec < 0) - { diff.tv_sec = end->tv_sec - start->tv_sec - 1 ; - diff.tv_usec = 1000000 + end->tv_usec - start->tv_usec ; - } - else - { diff.tv_sec = end->tv_sec - start->tv_sec ; - diff.tv_usec = end->tv_usec-start->tv_usec ; - } ; - - return diff.tv_sec + 1e-6 * diff.tv_usec ; -} - -double -benchmark_function (void (*testfunc) (void), unsigned count) -{ struct timeval start, end; - unsigned k ; - - gettimeofday(&start, NULL); - - for (k = 0 ; k < count ; k++) - testfunc () ; - - gettimeofday(&end, NULL); - - return timeval_diff (&start, &end) / count ; -} /* benchmark_function */ - -#endif - -static int -double_cmp (const void * a, const void * b) -{ const double * pa = (double *) a ; - const double * pb = (double *) b ; - return pa [0] < pb [0] ; -} /* double_cmp */ - -void -benchmark_stats (bench_stats * stats) -{ double sum, times [stats->run_count] ; - unsigned k ; - - for (k = 0 ; k < stats->run_count ; k++) - times [k] = benchmark_function (stats->testfunc, stats->loop_count) ; - - qsort (times, stats->run_count, sizeof (times [0]), double_cmp) ; - - sum = 0.0 ; - stats->min_time = stats->max_time = times [0] ; - for (k = 0 ; k < stats->run_count ; k++) - { stats->min_time = stats->min_time < times [k] ? stats->min_time : times [k] ; - stats->max_time = stats->max_time > times [k] ? stats->max_time : times [k] ; - sum += times [k] ; - } - stats->mean_time = sum / stats->run_count ; - if (stats->run_count & 1) - stats->median_time = times [(stats->run_count + 1) / 2] ; - else - stats->median_time = 0.5 * (times [stats->run_count / 2] + times [(stats->run_count / 2) + 1]) ; - - return ; -} /* benchmark_stats */ diff --git a/microbench/util.h b/microbench/util.h deleted file mode 100644 index db0ee757..00000000 --- a/microbench/util.h +++ /dev/null @@ -1,43 +0,0 @@ -/* FLAC - Free Lossless Audio Codec - * Copyright (C) 2015-2016 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. - */ - -#define ARRAY_LEN(x) ((sizeof (x) / sizeof (x [0]))) - -typedef struct bench_stats -{ void (*testfunc) (void) ; - unsigned run_count ; - unsigned loop_count ; - double min_time, mean_time, median_time, max_time ; -} bench_stats ; - -double benchmark_function (void (*testfunc) (void), unsigned count) ; - -void benchmark_stats (bench_stats * stats) ; diff --git a/oss-fuzz/Makefile.am b/oss-fuzz/Makefile.am deleted file mode 100644 index 7c4e2f60..00000000 --- a/oss-fuzz/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2019 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. - -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/oss-fuzz - -AM_CXXFLAGS = -std=c++11 - -EXTRA_DIST = \ - fuzz-encoder.dict \ - fuzzing/Readme.md \ - fuzzing/datasource/datasource.hpp \ - fuzzing/datasource/id.hpp \ - fuzzing/exception.hpp \ - fuzzing/memory.hpp \ - fuzzing/types.hpp - -if USE_OSSFUZZ_FLAG -FUZZ_FLAG = $(LIB_FUZZING_ENGINE) -FUZZ_LDADD = -lFuzzer -else -if USE_OSSFUZZ_STATIC -FUZZ_LDADD = $(LIB_FUZZING_ENGINE) -FUZZ_FLAG = -lFuzzer -endif -endif - -noinst_PROGRAMS = - -if USE_OSSFUZZERS -noinst_PROGRAMS += fuzz-decoder fuzz-encoder -endif - -fuzz_decoder_SOURCES = fuzz-decoder.cc -fuzz_decoder_CXXFLAGS = $(AM_CXXFLAGS) $(FUZZ_FLAG) -fuzz_decoder_LDFLAGS = $(AM_LDFLAGS) -static -fuzz_decoder_LDADD = $(flac_libs) $(FUZZ_LDADD) - -fuzz_encoder_SOURCES = fuzz-encoder.cc -fuzz_encoder_CXXFLAGS = $(AM_CXXFLAGS) $(FUZZ_FLAG) -fuzz_encoder_LDFLAGS = $(AM_LDFLAGS) -static -fuzz_encoder_LDADD = $(flac_libs) $(FUZZ_LDADD) - -flac_libs = \ - $(top_builddir)/src/libFLAC/libFLAC-static.la \ - $(top_builddir)/src/libFLAC++/libFLAC++-static.la \ - @OGG_LIBS@ \ - -lm - diff --git a/oss-fuzz/fuzz-decoder.cc b/oss-fuzz/fuzz-decoder.cc deleted file mode 100644 index b2733874..00000000 --- a/oss-fuzz/fuzz-decoder.cc +++ /dev/null @@ -1,355 +0,0 @@ -#include -#include - -#include -#include - -#include "FLAC++/decoder.h" - -template <> FLAC__MetadataType fuzzing::datasource::Base::Get(const uint64_t id) { - (void)id; - switch ( Get() ) { - case 0: - return FLAC__METADATA_TYPE_STREAMINFO; - case 1: - return FLAC__METADATA_TYPE_PADDING; - case 2: - return FLAC__METADATA_TYPE_APPLICATION; - case 3: - return FLAC__METADATA_TYPE_SEEKTABLE; - case 4: - return FLAC__METADATA_TYPE_VORBIS_COMMENT; - case 5: - return FLAC__METADATA_TYPE_CUESHEET; - case 6: - return FLAC__METADATA_TYPE_PICTURE; - case 7: - return FLAC__METADATA_TYPE_UNDEFINED; - case 8: - return FLAC__MAX_METADATA_TYPE; - default: - return FLAC__METADATA_TYPE_STREAMINFO; - } -} - -namespace FLAC { - namespace Decoder { - class FuzzerStream : public Stream { - private: - fuzzing::datasource::Datasource& ds; - public: - FuzzerStream(fuzzing::datasource::Datasource& dsrc) : - Stream(), ds(dsrc) { } - - ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes) override { - try { - const size_t maxCopySize = *bytes; - - if ( maxCopySize > 0 ) { - /* memset just to test if this overwrites anything, and triggers ASAN */ - memset(buffer, 0, maxCopySize); - } - - const auto data = ds.GetData(0); - const auto dataSize = data.size(); - const auto copySize = std::min(maxCopySize, dataSize); - - if ( copySize > 0 ) { - memcpy(buffer, data.data(), copySize); - } - - *bytes = copySize; - - return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; - } catch ( ... ) { - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - } - } - - ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) override { - { - fuzzing::memory::memory_test(&(frame->header), sizeof(frame->header)); - fuzzing::memory::memory_test(&(frame->footer), sizeof(frame->footer)); - } - - { - const auto numChannels = get_channels(); - const size_t bytesPerChannel = frame->header.blocksize * sizeof(FLAC__int32); - for (size_t i = 0; i < numChannels; i++) { - fuzzing::memory::memory_test(buffer[i], bytesPerChannel); - } - } - - try { - if ( ds.Get() == true ) { - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } catch ( ... ) { } - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; - } - - void error_callback(::FLAC__StreamDecoderErrorStatus status) override { - fuzzing::memory::memory_test(status); - } - - void metadata_callback(const ::FLAC__StreamMetadata *metadata) override { - fuzzing::memory::memory_test(metadata->type); - fuzzing::memory::memory_test(metadata->is_last); - fuzzing::memory::memory_test(metadata->length); - fuzzing::memory::memory_test(metadata->data); - } - - ::FLAC__StreamDecoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset) override { - fuzzing::memory::memory_test(absolute_byte_offset); - - try { - if ( ds.Get() == true ) { - return FLAC__STREAM_DECODER_SEEK_STATUS_OK; - } else { - return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - } - } catch ( ... ) { - return FLAC__STREAM_DECODER_SEEK_STATUS_OK; - } - } -#if 0 - ::FLAC__StreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset) override { - fuzzing::memory::memory_test(*absolute_byte_offset); - - try { - if ( ds.Get() == true ) { - return FLAC__STREAM_DECODER_TELL_STATUS_OK; - } else { - return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - } - } catch ( ... ) { - return FLAC__STREAM_DECODER_TELL_STATUS_OK; - } - } - - ::FLAC__StreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length) override { - fuzzing::memory::memory_test(*stream_length); - - try { - if ( ds.Get() == true ) { - return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; - } else { - return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; - } - } catch ( ... ) { - return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; - } - } -#endif - }; - } -} - -extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - fuzzing::datasource::Datasource ds(data, size); - FLAC::Decoder::FuzzerStream decoder(ds); - - try { - { - ::FLAC__StreamDecoderInitStatus ret; - - if ( ds.Get() ) { - ret = decoder.init(); - } else { - ret = decoder.init_ogg(); - } - - if ( ret != FLAC__STREAM_DECODER_INIT_STATUS_OK ) { - goto end; - } - } - - if ( ds.Get() ) { -#ifdef FUZZER_DEBUG - printf("set_ogg_serial_number\n"); -#endif - decoder.set_ogg_serial_number(ds.Get()); - } - if ( ds.Get() ) { -#ifdef FUZZER_DEBUG - printf("set_md5_checking\n"); -#endif - decoder.set_md5_checking(ds.Get()); - } - if ( ds.Get() ) { -#ifdef FUZZER_DEBUG - printf("set_metadata_respond\n"); -#endif - decoder.set_metadata_respond(ds.Get<::FLAC__MetadataType>()); - } - if ( ds.Get() ) { - const auto idVector = ds.GetData(0); - unsigned char id[4]; - if ( idVector.size() >= sizeof(id) ) { - memcpy(id, idVector.data(), sizeof(id)); -#ifdef FUZZER_DEBUG - printf("set_metadata_respond_application\n"); -#endif - decoder.set_metadata_respond_application(id); - } - } - if ( ds.Get() ) { -#ifdef FUZZER_DEBUG - printf("set_metadata_respond_all\n"); -#endif - decoder.set_metadata_respond_all(); - } - if ( ds.Get() ) { -#ifdef FUZZER_DEBUG - printf("set_metadata_ignore\n"); -#endif - decoder.set_metadata_ignore(ds.Get<::FLAC__MetadataType>()); - } - if ( ds.Get() ) { - const auto idVector = ds.GetData(0); - unsigned char id[4]; - if ( idVector.size() >= sizeof(id) ) { - memcpy(id, idVector.data(), sizeof(id)); -#ifdef FUZZER_DEBUG - printf("set_metadata_ignore_application\n"); -#endif - decoder.set_metadata_ignore_application(id); - } - } - if ( ds.Get() ) { -#ifdef FUZZER_DEBUG - printf("set_metadata_ignore_all\n"); -#endif - decoder.set_metadata_ignore_all(); - } - - while ( ds.Get() ) { - switch ( ds.Get() ) { - case 0: - { -#ifdef FUZZER_DEBUG - printf("flush\n"); -#endif - const bool res = decoder.flush(); - fuzzing::memory::memory_test(res); - } - break; - case 1: - { -#ifdef FUZZER_DEBUG - printf("reset\n"); -#endif - const bool res = decoder.reset(); - fuzzing::memory::memory_test(res); - } - break; - case 2: - { -#ifdef FUZZER_DEBUG - printf("process_single\n"); -#endif - const bool res = decoder.process_single(); - fuzzing::memory::memory_test(res); - } - break; - case 3: - { -#ifdef FUZZER_DEBUG - printf("process_until_end_of_metadata\n"); -#endif - const bool res = decoder.process_until_end_of_metadata(); - fuzzing::memory::memory_test(res); - } - break; - case 4: - { -#ifdef FUZZER_DEBUG - printf("process_until_end_of_stream\n"); -#endif - const bool res = decoder.process_until_end_of_stream(); - fuzzing::memory::memory_test(res); - } - break; - case 5: - { -#ifdef FUZZER_DEBUG - printf("skip_single_frame\n"); -#endif - const bool res = decoder.skip_single_frame(); - fuzzing::memory::memory_test(res); - } - break; - case 6: - { -#ifdef FUZZER_DEBUG - printf("seek_absolute\n"); -#endif - const bool res = decoder.seek_absolute(ds.Get()); - fuzzing::memory::memory_test(res); - } - break; - case 7: - { -#ifdef FUZZER_DEBUG - printf("get_md5_checking\n"); -#endif - const bool res = decoder.get_md5_checking(); - fuzzing::memory::memory_test(res); - } - break; - case 8: - { -#ifdef FUZZER_DEBUG - printf("get_total_samples\n"); -#endif - const bool res = decoder.get_total_samples(); - fuzzing::memory::memory_test(res); - } - break; - case 9: - { -#ifdef FUZZER_DEBUG - printf("get_channels\n"); -#endif - const bool res = decoder.get_channels(); - fuzzing::memory::memory_test(res); - } - break; - case 10: - { -#ifdef FUZZER_DEBUG - printf("get_bits_per_sample\n"); -#endif - const bool res = decoder.get_bits_per_sample(); - fuzzing::memory::memory_test(res); - } - break; - case 11: - { -#ifdef FUZZER_DEBUG - printf("get_sample_rate\n"); -#endif - const bool res = decoder.get_sample_rate(); - fuzzing::memory::memory_test(res); - } - break; - case 12: - { -#ifdef FUZZER_DEBUG - printf("get_blocksize\n"); -#endif - const bool res = decoder.get_blocksize(); - fuzzing::memory::memory_test(res); - } - break; - } - } - } catch ( ... ) { } - -end: - { - const bool res = decoder.finish(); - fuzzing::memory::memory_test(res); - } - return 0; -} diff --git a/oss-fuzz/fuzz-encoder.cc b/oss-fuzz/fuzz-encoder.cc deleted file mode 100644 index 067af055..00000000 --- a/oss-fuzz/fuzz-encoder.cc +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include -#include - -#include -#include - -#include "FLAC++/encoder.h" - -#define SAMPLE_VALUE_LIMIT (1024*1024*10) - -static_assert(SAMPLE_VALUE_LIMIT <= std::numeric_limits::max(), "Invalid SAMPLE_VALUE_LIMIT"); -static_assert(-SAMPLE_VALUE_LIMIT >= std::numeric_limits::min(), "Invalid SAMPLE_VALUE_LIMIT"); - -namespace FLAC { - namespace Encoder { - class FuzzerStream : public Stream { - private: - // fuzzing::datasource::Datasource& ds; - public: - FuzzerStream(fuzzing::datasource::Datasource&) : - Stream() { } - - ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t /* samples */, uint32_t /* current_frame */) override { - fuzzing::memory::memory_test(buffer, bytes); -#if 0 - try { - if ( ds.Get() == true ) { - return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; - } - } catch ( ... ) { } -#endif - return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; - } - }; - } -} - -extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { - fuzzing::datasource::Datasource ds(data, size); - FLAC::Encoder::FuzzerStream encoder(ds); - - const int channels = 2; - encoder.set_channels(channels); - encoder.set_bits_per_sample(16); - - try { - ::FLAC__StreamEncoderInitStatus ret; - - if ( ds.Get() ) { - ret = encoder.init(); - } else { - ret = encoder.init_ogg(); - } - - if ( ret != FLAC__STREAM_ENCODER_INIT_STATUS_OK ) { - goto end; - } - - { - const bool res = encoder.set_streamable_subset(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_ogg_serial_number(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_verify(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_compression_level(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_do_exhaustive_model_search(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_do_mid_side_stereo(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_loose_mid_side_stereo(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const auto s = ds.Get(); - const bool res = encoder.set_apodization(s.data()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_max_lpc_order(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_qlp_coeff_precision(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_do_qlp_coeff_prec_search(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_do_escape_coding(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_min_residual_partition_order(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_max_residual_partition_order(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_rice_parameter_search_dist(ds.Get()); - fuzzing::memory::memory_test(res); - } - { - const bool res = encoder.set_total_samples_estimate(ds.Get()); - fuzzing::memory::memory_test(res); - } - - while ( ds.Get() ) { - { - auto dat = ds.GetVector(); - for (size_t i = 0; i < dat.size(); i++) { - if ( SAMPLE_VALUE_LIMIT != 0 ) { - if ( dat[i] < -SAMPLE_VALUE_LIMIT ) { - dat[i] = -SAMPLE_VALUE_LIMIT; - } else if ( dat[i] > SAMPLE_VALUE_LIMIT ) { - dat[i] = SAMPLE_VALUE_LIMIT; - } - } - } - const uint32_t samples = dat.size() / 2; - if ( samples > 0 ) { - const int32_t* ptr = dat.data(); - const bool res = encoder.process_interleaved(ptr, samples); - fuzzing::memory::memory_test(res); - } - } - } - } catch ( ... ) { } - -end: - { - const bool res = encoder.finish(); - fuzzing::memory::memory_test(res); - } - return 0; -} diff --git a/oss-fuzz/fuzz-encoder.dict b/oss-fuzz/fuzz-encoder.dict deleted file mode 100644 index fe5b77fc..00000000 --- a/oss-fuzz/fuzz-encoder.dict +++ /dev/null @@ -1,17 +0,0 @@ -"bartlett" -"bartlett_hann" -"blackman" -"blackman_harris_4term_92db" -"connes" -"flattop" -"gauss()" -"hamming" -"hann" -"kaiser_bessel" -"nuttall" -"rectangle" -"triangle" -"tukey(0)" -"partial_tukey(0)" -"punchout_tukey(0)" -"welch" diff --git a/oss-fuzz/fuzzing/Readme.md b/oss-fuzz/fuzzing/Readme.md deleted file mode 100644 index d2fbd687..00000000 --- a/oss-fuzz/fuzzing/Readme.md +++ /dev/null @@ -1,6 +0,0 @@ -The header files in this directory and below were taken from: - - https://github.com/guidovranken/fuzzing-headers.git - -Some minor modifications were made to make them build with the default C++ -warning flags. diff --git a/oss-fuzz/fuzzing/datasource/datasource.hpp b/oss-fuzz/fuzzing/datasource/datasource.hpp deleted file mode 100644 index e0699d3e..00000000 --- a/oss-fuzz/fuzzing/datasource/datasource.hpp +++ /dev/null @@ -1,167 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace fuzzing { -namespace datasource { - -class Base -{ - protected: - virtual std::vector get(const size_t min, const size_t max, const uint64_t id = 0) = 0; - public: - Base(void) = default; - virtual ~Base(void) = default; - - template T Get(const uint64_t id = 0); - uint16_t GetChoice(const uint64_t id = 0); - std::vector GetData(const uint64_t id, const size_t min = 0, const size_t max = 0); - template std::vector GetVector(const uint64_t id = 0); - - class OutOfData : public fuzzing::exception::FlowException { - public: - OutOfData() = default; - }; - - class DeserializationFailure : public fuzzing::exception::FlowException { - public: - DeserializationFailure() = default; - }; -}; - -#ifndef FUZZING_HEADERS_NO_IMPL -template T Base::Get(const uint64_t id) -{ - T ret; - const auto v = get(sizeof(ret), sizeof(ret), id); - memcpy(&ret, v.data(), sizeof(ret)); - return ret; -} - -template <> bool Base::Get(const uint64_t id) -{ - uint8_t ret; - const auto v = get(sizeof(ret), sizeof(ret), id); - memcpy(&ret, v.data(), sizeof(ret)); - return (ret % 2) ? true : false; -} - -template <> std::string Base::Get(const uint64_t id) -{ - auto data = GetData(id); - return std::string(data.data(), data.data() + data.size()); -} - -template <> std::vector Base::Get>(const uint64_t id) -{ - std::vector ret; - while ( true ) { - auto data = GetData(id); - ret.push_back( std::string(data.data(), data.data() + data.size()) ); - if ( Get(id) == false ) { - break; - } - } - return ret; -} - -uint16_t Base::GetChoice(const uint64_t id) -{ - return Get(id); -} - -std::vector Base::GetData(const uint64_t id, const size_t min, const size_t max) -{ - return get(min, max, id); -} - - -template <> types::String<> Base::Get>(const uint64_t id) { - const auto data = GetData(id); - types::String<> ret(data.data(), data.size()); - return ret; -} - -template <> types::Data<> Base::Get>(const uint64_t id) { - const auto data = GetData(id); - types::Data<> ret(data.data(), data.size()); - return ret; -} - -template -std::vector Base::GetVector(const uint64_t id) { - std::vector ret; - - while ( Get(id) == true ) { - ret.push_back( Get(id) ); - } - - return ret; -} -#endif - -class Datasource : public Base -{ - private: - const uint8_t* data; - const size_t size; - size_t idx; - size_t left; - std::vector get(const size_t min, const size_t max, const uint64_t id = 0) override; - - // Make copy constructor and assignment opertator private. - Datasource(const Datasource &) : data(0), size(0), idx(0), left(0) {} - Datasource& operator=(const Datasource &) { return *this; } - public: - Datasource(const uint8_t* _data, const size_t _size); -}; - -#ifndef FUZZING_HEADERS_NO_IMPL -Datasource::Datasource(const uint8_t* _data, const size_t _size) : - Base(), data(_data), size(_size), idx(0), left(size) -{ -} - -std::vector Datasource::get(const size_t min, const size_t max, const uint64_t id) { - (void)id; - - uint32_t getSize; - if ( left < sizeof(getSize) ) { - throw OutOfData(); - } - memcpy(&getSize, data + idx, sizeof(getSize)); - idx += sizeof(getSize); - left -= sizeof(getSize); - - if ( getSize < min ) { - getSize = min; - } - if ( max && getSize > max ) { - getSize = max; - } - - if ( left < getSize ) { - throw OutOfData(); - } - - std::vector ret(getSize); - - if ( getSize > 0 ) { - memcpy(ret.data(), data + idx, getSize); - } - idx += getSize; - left -= getSize; - - return ret; -} -#endif - -} /* namespace datasource */ -} /* namespace fuzzing */ diff --git a/oss-fuzz/fuzzing/datasource/id.hpp b/oss-fuzz/fuzzing/datasource/id.hpp deleted file mode 100644 index 3ba38d71..00000000 --- a/oss-fuzz/fuzzing/datasource/id.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace fuzzing { -namespace datasource { - -/* From: https://gist.github.com/underscorediscovery/81308642d0325fd386237cfa3b44785c */ -inline uint64_t hash_64_fnv1a(const void* key, const uint64_t len) { - - const char* data = (char*)key; - uint64_t hash = 0xcbf29ce484222325; - uint64_t prime = 0x100000001b3; - - for(uint64_t i = 0; i < len; ++i) { - uint8_t value = data[i]; - hash = hash ^ value; - hash *= prime; - } - - return hash; - -} //hash_64_fnv1a - -// FNV1a c++11 constexpr compile time hash functions, 32 and 64 bit -// str should be a null terminated string literal, value should be left out -// e.g hash_32_fnv1a_const("example") -// code license: public domain or equivalent -// post: https://notes.underscorediscovery.com/constexpr-fnv1a/ - -constexpr uint32_t val_32_const = 0x811c9dc5; -constexpr uint32_t prime_32_const = 0x1000193; -constexpr uint64_t val_64_const = 0xcbf29ce484222325; -constexpr uint64_t prime_64_const = 0x100000001b3; - - -inline constexpr uint64_t ID(const char* const str, const uint64_t value = val_64_const) noexcept { - auto ret = (str[0] == '\0') ? value : ID(&str[1], (value ^ uint64_t(str[0])) * prime_64_const); - return ret; -} - -inline constexpr std::pair IDPair(const char* const str, const uint64_t value = val_64_const) noexcept { - return {str, ID(str, value)}; -} - -using IDMap = std::map; - -} /* namespace datasource */ -} /* namespace fuzzing */ diff --git a/oss-fuzz/fuzzing/exception.hpp b/oss-fuzz/fuzzing/exception.hpp deleted file mode 100644 index 55c360de..00000000 --- a/oss-fuzz/fuzzing/exception.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include -#include - -namespace fuzzing { -namespace exception { - -class ExceptionBase : public std::exception { - public: - ExceptionBase(void) = default; - /* typeid(T).name */ -}; - -/* Recoverable exception */ -class FlowException : public ExceptionBase { - public: - FlowException(void) : ExceptionBase() { } -}; - -/* Error in this library, should never happen */ -class LogicException : public ExceptionBase { - private: - std::string reason; - public: - LogicException(const std::string r) : ExceptionBase(), reason(r) { } - virtual const char* what(void) const throw() { - return reason.c_str(); - } -}; - -/* Error in target application */ -class TargetException : public ExceptionBase { - private: - std::string reason; - public: - TargetException(const std::string r) : ExceptionBase(), reason(r) { } - virtual const char* what(void) const throw() { - return reason.c_str(); - } -}; - -} /* namespace exception */ -} /* namespace fuzzing */ diff --git a/oss-fuzz/fuzzing/memory.hpp b/oss-fuzz/fuzzing/memory.hpp deleted file mode 100644 index 804e23b4..00000000 --- a/oss-fuzz/fuzzing/memory.hpp +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -#include -#include - -#ifndef ASAN -#define ASAN 0 -#endif - -#ifndef MSAN -#define MSAN 0 -#endif - -namespace fuzzing { -namespace memory { - -#ifndef FUZZING_HEADERS_NO_IMPL -#if ASAN == 1 -extern "C" void *__asan_region_is_poisoned(const void *beg, size_t size); -#endif - -#if MSAN == 1 -extern "C" void __msan_check_mem_is_initialized(const volatile void *x, size_t size); -#endif - -void memory_test_asan(const void* data, const size_t size) -{ - (void)data; - (void)size; - -#if ASAN == 1 - if ( __asan_region_is_poisoned(data, size) != NULL ) { - abort(); - } -#endif -} - -void memory_test_msan(const void* data, const size_t size) -{ - (void)data; - (void)size; - -#if MSAN == 1 - __msan_check_mem_is_initialized(data, size); -#endif -} - -void memory_test(const void* data, const size_t size) -{ - memory_test_asan(data, size); - memory_test_msan(data, size); -} - -template -void memory_test(const T& t) -{ - (void)t; -} - -template <> -void memory_test(const std::string& s) -{ - (void)s; - -#if MSAN == 1 - memory_test(s.data(), s.size()); -#endif -} - -#endif - -} /* namespace memory */ -} /* namespace fuzzing */ diff --git a/oss-fuzz/fuzzing/types.hpp b/oss-fuzz/fuzzing/types.hpp deleted file mode 100644 index f2b56fc3..00000000 --- a/oss-fuzz/fuzzing/types.hpp +++ /dev/null @@ -1,135 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace fuzzing { -namespace types { - -template -class Container { - private: - CoreType* InvalidAddress = (CoreType*)0x12; - - CoreType* _data = InvalidAddress; - size_t _size = 0; - -#ifndef FUZZING_HEADERS_NO_IMPL - void copy(const void* data, size_t size) { - if ( size > 0 ) { - std::memcpy(_data, data, size); - } - } - - void allocate(size_t size) { - if ( size > 0 ) { - _data = static_cast(malloc(size * sizeof(CoreType))); - } else { - _data = InvalidAddress; - } - }; - - void allocate_and_copy(const void* data, size_t size) { - allocate(size); - copy(data, size); - } - - void allocate_plus_1_and_copy(const void* data, size_t size) { - allocate(size+1); - copy(data, size); - } - - void access_hook(void) const { - if ( UseMSAN == true ) { - memory::memory_test_msan(_data, _size); - } - } - - void free(void) { - access_hook(); - - if ( _data != InvalidAddress ) { - std::free(_data); - _data = InvalidAddress; - _size = 0; - } - } - -#endif - - public: -#ifndef FUZZING_HEADERS_NO_IMPL - CoreType* data(void) { - access_hook(); - return _data; - } - - size_t size(void) const { - access_hook(); - return _size; - } -#endif - - Container(void) -#ifndef FUZZING_HEADERS_NO_IMPL - = default -#endif - ; - - Container(const void* data, const size_t size) -#ifndef FUZZING_HEADERS_NO_IMPL - { - if ( NullTerminated == false ) { - allocate_and_copy(data, size); - } else { - allocate_plus_1_and_copy(data, size); - _data[size] = 0; - } - - access_hook(); - } -#endif - ; - - template - Container(const T& t) -#ifndef FUZZING_HEADERS_NO_IMPL - { - Container(t.data(), t.size()); - } -#endif - ; - - ~Container(void) -#ifndef FUZZING_HEADERS_NO_IMPL - { - this->free(); - } -#endif - ; - - - - // The copy constructor was not originally explicitly supplied - // so it must have been incorrectly just copying the pointers. - Container(const Container &c) { - InvalidAddress = c.InvalidAddress; - allocate_and_copy(c._data, c._size); - } - - Container& operator=(Container &c) { - InvalidAddress = c.InvalidAddress; - allocate_and_copy(c._data, c._size); - } - -}; - -template using String = Container; -template using Data = Container; - -} /* namespace types */ -} /* namespace fuzzing */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index bde3647b..00000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -cmake_minimum_required(VERSION 3.11) - -option(ENABLE_64_BIT_WORDS "Set FLAC__BYTES_PER_WORD to 8 (4 is the default)" OFF) -option(WITH_XMMS "Build XMMS plugin" OFF) -option(BUILD_UTILS "Build utils" OFF) - -add_subdirectory("libFLAC") -if(BUILD_CXXLIBS) - add_subdirectory("libFLAC++") -endif() -add_subdirectory("share/replaygain_analysis") -add_subdirectory("share/replaygain_synthesis") -add_subdirectory("share/getopt") -add_subdirectory("share/utf8") -add_subdirectory("share/grabbag") - -if(BUILD_PROGRAMS) - add_subdirectory("flac") - add_subdirectory("metaflac") -endif() -if(BUILD_UTILS) - add_subdirectory(utils/flacdiff) - if(WIN32) - add_subdirectory(utils/flactimer) - endif() -endif() - -if(WITH_XMMS) - add_subdirectory("plugin_common") - add_subdirectory("plugin_xmms") -endif() -if(BUILD_TESTING) - add_subdirectory("test_libs_common") - add_subdirectory("test_libFLAC") - if(BUILD_CXXLIBS) - add_subdirectory("test_libFLAC++") - endif() - add_subdirectory("test_grabbag") - add_subdirectory("test_seeking") - add_subdirectory("test_streams") -endif() diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index fcc3cfbf..00000000 --- a/src/Makefile.am +++ /dev/null @@ -1,43 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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 = \ - libFLAC \ - share \ - flac \ - metaflac \ - $(XMMS_DIRS) \ - test_grabbag \ - test_libs_common \ - test_libFLAC \ - test_seeking \ - test_streams \ - utils \ - $(CPPLIBS_DIRS) - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite diff --git a/src/Makefile.lite b/src/Makefile.lite deleted file mode 100644 index 7e297c31..00000000 --- a/src/Makefile.lite +++ /dev/null @@ -1,76 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -topdir = .. - -include $(topdir)/build/config.mk - -ifeq ($(OS),Darwin) - EXTRA_TARGETS = -else -ifeq ($(PROC),x86_64) - EXTRA_TARGETS = -else - # Can add plugin_xmms here if desired. - EXTRA_TARGETS = -endif -endif - -ifeq ($(findstring Windows,$(OS)),Windows) - EXTRA_TARGETS += share/win_utf8_io -endif - -.PHONY: all flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms share/win_utf8_io share test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking test_streams flacdiff flactimer -all: flac libFLAC libFLAC++ metaflac plugin_common $(EXTRA_TARGETS) share test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking test_streams - -DEFAULT_CONFIG = release - -CONFIG = $(DEFAULT_CONFIG) - -debug : CONFIG = debug -valgrind: CONFIG = valgrind -release : CONFIG = release - -debug : all -valgrind: all -release : all - -flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms share/win_utf8_io share test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking test_streams: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -flacdiff flactimer: - (cd utils/$@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -clean: - -(cd flac ; $(MAKE) -f Makefile.lite clean) - -(cd libFLAC ; $(MAKE) -f Makefile.lite clean) - -(cd libFLAC++ ; $(MAKE) -f Makefile.lite clean) - -(cd metaflac ; $(MAKE) -f Makefile.lite clean) - -(cd plugin_common ; $(MAKE) -f Makefile.lite clean) - -(cd plugin_xmms ; $(MAKE) -f Makefile.lite clean) - -(cd share ; $(MAKE) -f Makefile.lite clean) - -(cd test_grabbag ; $(MAKE) -f Makefile.lite clean) - -(cd test_libs_common ; $(MAKE) -f Makefile.lite clean) - -(cd test_libFLAC ; $(MAKE) -f Makefile.lite clean) - -(cd test_libFLAC++ ; $(MAKE) -f Makefile.lite clean) - -(cd test_seeking ; $(MAKE) -f Makefile.lite clean) - -(cd test_streams ; $(MAKE) -f Makefile.lite clean) - -(cd utils/flacdiff ; $(MAKE) -f Makefile.lite clean) - -(cd utils/flactimer ; $(MAKE) -f Makefile.lite clean) - -include $(topdir)/Makefile.deps diff --git a/src/flac/Makefile.am b/src/flac/Makefile.am deleted file mode 100644 index 679e2ee9..00000000 --- a/src/flac/Makefile.am +++ /dev/null @@ -1,67 +0,0 @@ -# flac - Command-line FLAC encoder/decoder -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -bin_PROGRAMS = flac - -AM_CFLAGS = @OGG_CFLAGS@ -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - Makefile.lite.iffscan \ - flac.vcproj \ - flac.vcxproj \ - flac.vcxproj.filters \ - iffscan.c \ - iffscan.vcproj \ - iffscan.vcxproj \ - iffscan.vcxproj.filters - -flac_SOURCES = \ - analyze.c \ - decode.c \ - encode.c \ - foreign_metadata.c \ - main.c \ - local_string_utils.c \ - utils.c \ - vorbiscomment.c \ - analyze.h \ - decode.h \ - encode.h \ - foreign_metadata.h \ - local_string_utils.h \ - utils.h \ - vorbiscomment.h - -if OS_IS_WINDOWS -win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la -endif - -flac_LDADD = \ - $(top_builddir)/src/share/utf8/libutf8.la \ - $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/getopt/libgetopt.la \ - $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \ - $(top_builddir)/src/libFLAC/libFLAC.la \ - $(win_utf8_lib) \ - @LTLIBICONV@ \ - -lm - -CLEANFILES = flac.exe diff --git a/src/flac/Makefile.lite b/src/flac/Makefile.lite deleted file mode 100644 index d6553cf9..00000000 --- a/src/flac/Makefile.lite +++ /dev/null @@ -1,54 +0,0 @@ -# flac - Command-line FLAC encoder/decoder -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = flac - -INCLUDES = -I./include -I$(topdir)/include $(OGG_INCLUDES) - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libFLAC.a $(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a $(libdir)/libgetopt.a $(libdir)/libutf8.a $(OGG_EXPLICIT_LIBS) $(ICONV_LIBS) -lm -else -ifeq ($(findstring Windows,$(OS)),Windows) - LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -lgrabbag -lwin_utf8_io $(OGG_LIBS) -lm -else - LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -lgrabbag $(OGG_LIBS) -lm -endif -endif - -SRCS_C = \ - analyze.c \ - decode.c \ - encode.c \ - foreign_metadata.c \ - local_string_utils.c \ - main.c \ - utils.c \ - vorbiscomment.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/flac/Makefile.lite.iffscan b/src/flac/Makefile.lite.iffscan deleted file mode 100644 index 65c6084d..00000000 --- a/src/flac/Makefile.lite.iffscan +++ /dev/null @@ -1,46 +0,0 @@ -# flac - Command-line FLAC encoder/decoder -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = iffscan - -INCLUDES = -I./include -I$(topdir)/include $(OGG_INCLUDES) - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) $(ICONV_LIBS) -lm -else -ifeq ($(findstring Windows,$(OS)),Windows) - LIBS = -lFLAC -lwin_utf8_io $(OGG_LIBS) -lm -else - LIBS = -lFLAC $(OGG_LIBS) -lm -endif -endif - -SRCS_C = \ - foreign_metadata.c \ - iffscan.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/flac/flac.vcproj b/src/flac/flac.vcproj deleted file mode 100644 index 0c962b1b..00000000 --- a/src/flac/flac.vcproj +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/flac/flac.vcxproj b/src/flac/flac.vcxproj deleted file mode 100644 index ac7f4ead..00000000 --- a/src/flac/flac.vcxproj +++ /dev/null @@ -1,219 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc7d-c215-11db-8314-0800200c9a66} - flac - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - {4cefbc80-c215-11db-8314-0800200c9a66} - false - - - {4cefbc81-c215-11db-8314-0800200c9a66} - false - - - {4cefbc89-c215-11db-8314-0800200c9a66} - false - - - {4cefbc8a-c215-11db-8314-0800200c9a66} - false - - - {4cefbc92-c215-11db-8314-0800200c9a66} - false - - - {4cefbe02-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/flac/flac.vcxproj.filters b/src/flac/flac.vcxproj.filters deleted file mode 100644 index c46ad4cb..00000000 --- a/src/flac/flac.vcxproj.filters +++ /dev/null @@ -1,62 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/src/flac/iffscan.vcproj b/src/flac/iffscan.vcproj deleted file mode 100644 index 8c267508..00000000 --- a/src/flac/iffscan.vcproj +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/flac/iffscan.vcxproj b/src/flac/iffscan.vcxproj deleted file mode 100644 index 98b5076f..00000000 --- a/src/flac/iffscan.vcxproj +++ /dev/null @@ -1,191 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc94-c215-11db-8314-0800200c9a66} - iffscan - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - $(Configuration)_iffscan\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - $(Platform)\$(Configuration)_iffscan\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - $(Configuration)_iffscan\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - $(Platform)\$(Configuration)_iffscan\ - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - {4cefbe02-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/flac/iffscan.vcxproj.filters b/src/flac/iffscan.vcxproj.filters deleted file mode 100644 index 0636239e..00000000 --- a/src/flac/iffscan.vcxproj.filters +++ /dev/null @@ -1,26 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-6E5FBE522BFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2D32A752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Header Files - - - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/src/libFLAC++/CMakeLists.txt b/src/libFLAC++/CMakeLists.txt deleted file mode 100644 index ec27835c..00000000 --- a/src/libFLAC++/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -check_cxx_source_compiles(" - #ifdef __STDC_NO_VLA__ - syntax error; - #else - int fvla (int m, int * c) - { - int D[m]; - return D[0] == c[0]; - } - - int main(int, char * []) { return 0; } - #endif" - HAVE_CXX_VARARRAYS) - -add_library(FLAC++ - metadata.cpp - stream_decoder.cpp - stream_encoder.cpp) -target_compile_definitions(FLAC++ - PRIVATE $<$:FLACPP_API_EXPORTS> - PUBLIC $<$>:FLAC__NO_DLL>) -if(NOT WIN32) - target_compile_definitions(FLAC++ PRIVATE $<$:FLAC__USE_VISIBILITY_ATTR>) -endif() -target_include_directories(FLAC++ INTERFACE - "$" - "$") -target_link_libraries(FLAC++ PUBLIC FLAC) -if(BUILD_SHARED_LIBS) - set_target_properties(FLAC++ PROPERTIES - VERSION 6.3.0 - SOVERSION 6) - if(NOT WIN32) - set_target_properties(FLAC++ PROPERTIES CXX_VISIBILITY_PRESET hidden) - endif() -endif() - -add_library(FLAC::FLAC++ ALIAS FLAC++) - -install(TARGETS FLAC++ EXPORT targets - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/" - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}/") - -if(INSTALL_PKGCONFIG_MODULES) - set(prefix "${CMAKE_INSTALL_PREFIX}") - set(exec_prefix "${CMAKE_INSTALL_PREFIX}") - set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") - set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") - configure_file(flac++.pc.in flac++.pc @ONLY) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/flac++.pc" - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") -endif() diff --git a/src/libFLAC++/Makefile.am b/src/libFLAC++/Makefile.am deleted file mode 100644 index 4a6919ef..00000000 --- a/src/libFLAC++/Makefile.am +++ /dev/null @@ -1,64 +0,0 @@ -# libFLAC++ - Free Lossless Audio Codec library -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -lib_LTLIBRARIES = libFLAC++.la -noinst_LTLIBRARIES = libFLAC++-static.la - -m4datadir = $(datadir)/aclocal -m4data_DATA = libFLAC++.m4 - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = flac++.pc -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - flac++.pc.in \ - libFLAC++_dynamic.vcproj \ - libFLAC++_dynamic.vcxproj \ - libFLAC++_dynamic.vcxproj.filters \ - libFLAC++_static.vcproj \ - libFLAC++_static.vcxproj \ - libFLAC++_static.vcxproj.filters \ - libFLAC++.m4 - -libFLAC___sources = \ - metadata.cpp \ - stream_decoder.cpp \ - stream_encoder.cpp - -# see 'http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning' for numbering convention -libFLAC___la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 9:0:3 -libFLAC___la_LIBADD = ../libFLAC/libFLAC.la -libFLAC___la_SOURCES = $(libFLAC___sources) - -libFLAC___static_la_SOURCES = $(libFLAC___sources) -libFLAC___static_la_LIBADD = ../libFLAC/libFLAC-static.la diff --git a/src/libFLAC++/Makefile.lite b/src/libFLAC++/Makefile.lite deleted file mode 100644 index 3853a01b..00000000 --- a/src/libFLAC++/Makefile.lite +++ /dev/null @@ -1,63 +0,0 @@ -# libFLAC++ - Free Lossless Audio Codec library -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/objs/$(BUILD)/lib - -ifndef OS - OS := $(shell uname -s) -endif - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -lstdc++ -else -ifeq ($(OS),FreeBSD) - LIBS = -lFLAC $(OGG_LIBS) -lm -lstdc++ -else - LIBS = -lFLAC $(OGG_LIBS) -lm -lsupc++ -endif -endif - -LIB_NAME = libFLAC++ -INCLUDES = -I$(topdir)/include - -SRCS_CPP = \ - metadata.cpp \ - stream_decoder.cpp \ - stream_encoder.cpp - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/libFLAC++/flac++.pc.in b/src/libFLAC++/flac++.pc.in deleted file mode 100644 index f09c251a..00000000 --- a/src/libFLAC++/flac++.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: FLAC++ -Description: Free Lossless Audio Codec Library (C++ API) -Version: @VERSION@ -Requires: flac -Libs: -L${libdir} -lFLAC++ -Cflags: -I${includedir} diff --git a/src/libFLAC++/libFLAC++.m4 b/src/libFLAC++/libFLAC++.m4 deleted file mode 100644 index d9e05f85..00000000 --- a/src/libFLAC++/libFLAC++.m4 +++ /dev/null @@ -1,117 +0,0 @@ -# Configure paths for libFLAC++ -# "Inspired" by ogg.m4 -# Caller must first run AM_PATH_LIBFLAC - -dnl AM_PATH_LIBFLACPP([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) -dnl Test for libFLAC++, and define LIBFLACPP_CFLAGS, LIBFLACPP_LIBS, LIBFLACPP_LIBDIR -dnl -AC_DEFUN([AM_PATH_LIBFLACPP], -[dnl -dnl Get the cflags and libraries -dnl -AC_ARG_WITH(libFLACPP,[ --with-libFLACPP=PFX Prefix where libFLAC++ is installed (optional)], libFLACPP_prefix="$withval", libFLACPP_prefix="") -AC_ARG_WITH(libFLACPP-libraries,[ --with-libFLACPP-libraries=DIR Directory where libFLAC++ library is installed (optional)], libFLACPP_libraries="$withval", libFLACPP_libraries="") -AC_ARG_WITH(libFLACPP-includes,[ --with-libFLACPP-includes=DIR Directory where libFLAC++ header files are installed (optional)], libFLACPP_includes="$withval", libFLACPP_includes="") -AC_ARG_ENABLE(libFLACPPtest, [ --disable-libFLACPPtest Do not try to compile and run a test libFLAC++ program],, enable_libFLACPPtest=yes) - - if test "x$libFLACPP_libraries" != "x" ; then - LIBFLACPP_LIBDIR="$libFLACPP_libraries" - elif test "x$libFLACPP_prefix" != "x" ; then - LIBFLACPP_LIBDIR="$libFLACPP_prefix/lib" - elif test "x$prefix" != "xNONE" ; then - LIBFLACPP_LIBDIR="$libdir" - fi - - LIBFLACPP_LIBS="-L$LIBFLACPP_LIBDIR -lFLAC++ $LIBFLAC_LIBS" - - if test "x$libFLACPP_includes" != "x" ; then - LIBFLACPP_CFLAGS="-I$libFLACPP_includes" - elif test "x$libFLACPP_prefix" != "x" ; then - LIBFLACPP_CFLAGS="-I$libFLACPP_prefix/include" - elif test "$prefix" != "xNONE"; then - LIBFLACPP_CFLAGS="" - fi - - LIBFLACPP_CFLAGS="$LIBFLACPP_CFLAGS $LIBFLAC_CFLAGS" - - AC_MSG_CHECKING(for libFLAC++) - no_libFLACPP="" - - - if test "x$enable_libFLACPPtest" = "xyes" ; then - ac_save_CFLAGS="$CFLAGS" - ac_save_CXXFLAGS="$CXXFLAGS" - ac_save_LIBS="$LIBS" - ac_save_LD_LIBRARY_PATH="$LD_LIBRARY_PATH" - CFLAGS="$CFLAGS $LIBFLACPP_CFLAGS" - CXXFLAGS="$CXXFLAGS $LIBFLACPP_CFLAGS" - LIBS="$LIBS $LIBFLACPP_LIBS" - LD_LIBRARY_PATH="$LIBFLACPP_LIBDIR:$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH" -dnl -dnl Now check if the installed libFLAC++ is sufficiently new. -dnl - rm -f conf.libFLAC++test - AC_TRY_RUN([ -#include -#include -#include -#include - -int main () -{ - system("touch conf.libFLAC++test"); - return 0; -} - -],, no_libFLACPP=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH" - fi - - if test "x$no_libFLACPP" = "x" ; then - AC_MSG_RESULT(yes) - ifelse([$1], , :, [$1]) - else - AC_MSG_RESULT(no) - if test -f conf.libFLAC++test ; then - : - else - echo "*** Could not run libFLAC++ test program, checking why..." - CFLAGS="$CFLAGS $LIBFLACPP_CFLAGS" - CXXFLAGS="$CXXFLAGS $LIBFLACPP_CFLAGS" - LIBS="$LIBS $LIBFLACPP_LIBS" - LD_LIBRARY_PATH="$LIBFLACPP_LIBDIR:$LIBFLAC_LIBDIR:$LD_LIBRARY_PATH" - AC_TRY_LINK([ -#include -#include -], [ return 0; ], - [ echo "*** The test program compiled, but did not run. This usually means" - echo "*** that the run-time linker is not finding libFLAC++ or finding the wrong" - echo "*** version of libFLAC++. If it is not finding libFLAC++, you'll need to set your" - echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" - echo "*** to the installed location Also, make sure you have run ldconfig if that" - echo "*** is required on your system" - echo "***" - echo "*** If you have an old version installed, it is best to remove it, although" - echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], - [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occurred. This usually means libFLAC++ was incorrectly installed" - echo "*** or that you have moved libFLAC++ since it was installed. In the latter case, you" - echo "*** may want to edit the libFLAC++-config script: $LIBFLACPP_CONFIG" ]) - CFLAGS="$ac_save_CFLAGS" - CXXFLAGS="$ac_save_CXXFLAGS" - LIBS="$ac_save_LIBS" - LD_LIBRARY_PATH="$ac_save_LD_LIBRARY_PATH" - fi - LIBFLACPP_CFLAGS="" - LIBFLACPP_LIBDIR="" - LIBFLACPP_LIBS="" - ifelse([$2], , :, [$2]) - fi - AC_SUBST(LIBFLACPP_CFLAGS) - AC_SUBST(LIBFLACPP_LIBDIR) - AC_SUBST(LIBFLACPP_LIBS) - rm -f conf.libFLAC++test -]) diff --git a/src/libFLAC++/libFLAC++_dynamic.vcproj b/src/libFLAC++/libFLAC++_dynamic.vcproj deleted file mode 100644 index e1ce90b6..00000000 --- a/src/libFLAC++/libFLAC++_dynamic.vcproj +++ /dev/null @@ -1,227 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/libFLAC++/libFLAC++_dynamic.vcxproj b/src/libFLAC++/libFLAC++_dynamic.vcxproj deleted file mode 100644 index 12b4fb0c..00000000 --- a/src/libFLAC++/libFLAC++_dynamic.vcxproj +++ /dev/null @@ -1,180 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc85-c215-11db-8314-0800200c9a66} - libFLAC++_dynamic - Win32Proj - - - - DynamicLibrary - true - - - DynamicLibrary - true - - - DynamicLibrary - - - DynamicLibrary - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\lib\ - $(Configuration)_dynamic\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - $(Platform)\$(Configuration)_dynamic\ - - - $(SolutionDir)objs\$(Configuration)\lib\ - $(Configuration)_dynamic\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - $(Platform)\$(Configuration)_dynamic\ - - - - Disabled - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - true - Windows - MachineX86 - - - - - Disabled - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - true - Windows - - - - - true - Speed - true - true - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - true - Windows - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - true - Windows - true - true - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - {4cefbc83-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/libFLAC++/libFLAC++_dynamic.vcxproj.filters b/src/libFLAC++/libFLAC++_dynamic.vcxproj.filters deleted file mode 100644 index 8e64893a..00000000 --- a/src/libFLAC++/libFLAC++_dynamic.vcxproj.filters +++ /dev/null @@ -1,44 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {a429b95c-ff8f-4d97-94ec-abfee2afd73c} - - - - - Source Files - - - Source Files - - - Source Files - - - - - Public Header Files - - - Public Header Files - - - Public Header Files - - - Public Header Files - - - Public Header Files - - - \ No newline at end of file diff --git a/src/libFLAC++/libFLAC++_static.vcproj b/src/libFLAC++/libFLAC++_static.vcproj deleted file mode 100644 index 20ee93b5..00000000 --- a/src/libFLAC++/libFLAC++_static.vcproj +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/libFLAC++/libFLAC++_static.vcxproj b/src/libFLAC++/libFLAC++_static.vcxproj deleted file mode 100644 index 21994bd4..00000000 --- a/src/libFLAC++/libFLAC++_static.vcxproj +++ /dev/null @@ -1,148 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc86-c215-11db-8314-0800200c9a66} - libFLAC++_static - Win32Proj - - - - StaticLibrary - true - - - StaticLibrary - true - - - StaticLibrary - - - StaticLibrary - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - - Disabled - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - - - Disabled - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - - - - - - - - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/libFLAC++/libFLAC++_static.vcxproj.filters b/src/libFLAC++/libFLAC++_static.vcxproj.filters deleted file mode 100644 index e34f01ec..00000000 --- a/src/libFLAC++/libFLAC++_static.vcxproj.filters +++ /dev/null @@ -1,44 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {8fde5773-b1ca-496d-872f-5697b89aa10a} - - - - - Source Files - - - Source Files - - - Source Files - - - - - Public Header Files - - - Public Header Files - - - Public Header Files - - - Public Header Files - - - Public Header Files - - - \ No newline at end of file diff --git a/src/libFLAC++/metadata.cpp b/src/libFLAC++/metadata.cpp deleted file mode 100644 index 374e5b31..00000000 --- a/src/libFLAC++/metadata.cpp +++ /dev/null @@ -1,1745 +0,0 @@ -/* libFLAC++ - Free Lossless Audio Codec library - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#define __STDC_LIMIT_MACROS 1 /* otherwise SIZE_MAX is not defined for c++ */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "share/alloc.h" -#include "FLAC++/metadata.h" -#include "FLAC/assert.h" -#include // for malloc(), free() -#include // for memcpy() etc. - -#ifdef _MSC_VER -// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning) -#pragma warning ( disable : 4800 ) -#endif - -namespace FLAC { - namespace Metadata { - - // local utility routines - - namespace local { - - Prototype *construct_block(::FLAC__StreamMetadata *object) - { - if (0 == object) - return 0; - - Prototype *ret = 0; - switch(object->type) { - case FLAC__METADATA_TYPE_STREAMINFO: - ret = new StreamInfo(object, /*copy=*/false); - break; - case FLAC__METADATA_TYPE_PADDING: - ret = new Padding(object, /*copy=*/false); - break; - case FLAC__METADATA_TYPE_APPLICATION: - ret = new Application(object, /*copy=*/false); - break; - case FLAC__METADATA_TYPE_SEEKTABLE: - ret = new SeekTable(object, /*copy=*/false); - break; - case FLAC__METADATA_TYPE_VORBIS_COMMENT: - ret = new VorbisComment(object, /*copy=*/false); - break; - case FLAC__METADATA_TYPE_CUESHEET: - ret = new CueSheet(object, /*copy=*/false); - break; - case FLAC__METADATA_TYPE_PICTURE: - ret = new Picture(object, /*copy=*/false); - break; - default: - ret = new Unknown(object, /*copy=*/false); - break; - } - return ret; - } - - } // namespace local - - FLACPP_API Prototype *clone(const Prototype *object) - { - FLAC__ASSERT(0 != object); - - const StreamInfo *streaminfo = dynamic_cast(object); - const Padding *padding = dynamic_cast(object); - const Application *application = dynamic_cast(object); - const SeekTable *seektable = dynamic_cast(object); - const VorbisComment *vorbiscomment = dynamic_cast(object); - const CueSheet *cuesheet = dynamic_cast(object); - const Picture *picture = dynamic_cast(object); - const Unknown *unknown = dynamic_cast(object); - - if(0 != streaminfo) - return new StreamInfo(*streaminfo); - if(0 != padding) - return new Padding(*padding); - if(0 != application) - return new Application(*application); - if(0 != seektable) - return new SeekTable(*seektable); - if(0 != vorbiscomment) - return new VorbisComment(*vorbiscomment); - if(0 != cuesheet) - return new CueSheet(*cuesheet); - if(0 != picture) - return new Picture(*picture); - if(0 != unknown) - return new Unknown(*unknown); - - FLAC__ASSERT(0); - return 0; - } - - // - // Prototype - // - - Prototype::Prototype(const Prototype &object): - object_(::FLAC__metadata_object_clone(object.object_)), - is_reference_(false) - { - FLAC__ASSERT(object.is_valid()); - } - - Prototype::Prototype(const ::FLAC__StreamMetadata &object): - object_(::FLAC__metadata_object_clone(&object)), - is_reference_(false) - { - } - - Prototype::Prototype(const ::FLAC__StreamMetadata *object): - object_(::FLAC__metadata_object_clone(object)), - is_reference_(false) - { - FLAC__ASSERT(0 != object); - } - - Prototype::Prototype(::FLAC__StreamMetadata *object, bool copy): - object_(copy? ::FLAC__metadata_object_clone(object) : object), - is_reference_(false) - { - FLAC__ASSERT(0 != object); - } - - Prototype::~Prototype() - { - clear(); - } - - void Prototype::clear() - { - if(0 != object_ && !is_reference_) - FLAC__metadata_object_delete(object_); - object_ = 0; - } - - Prototype &Prototype::operator=(const Prototype &object) - { - FLAC__ASSERT(object.is_valid()); - clear(); - is_reference_ = false; - object_ = ::FLAC__metadata_object_clone(object.object_); - return *this; - } - - Prototype &Prototype::operator=(const ::FLAC__StreamMetadata &object) - { - clear(); - is_reference_ = false; - object_ = ::FLAC__metadata_object_clone(&object); - return *this; - } - - Prototype &Prototype::operator=(const ::FLAC__StreamMetadata *object) - { - FLAC__ASSERT(0 != object); - clear(); - is_reference_ = false; - object_ = ::FLAC__metadata_object_clone(object); - return *this; - } - - Prototype &Prototype::assign_object(::FLAC__StreamMetadata *object, bool copy) - { - FLAC__ASSERT(0 != object); - clear(); - object_ = (copy? ::FLAC__metadata_object_clone(object) : object); - is_reference_ = false; - return *this; - } - - bool Prototype::get_is_last() const - { - FLAC__ASSERT(is_valid()); - return static_cast(object_->is_last); - } - - FLAC__MetadataType Prototype::get_type() const - { - FLAC__ASSERT(is_valid()); - return object_->type; - } - - uint32_t Prototype::get_length() const - { - FLAC__ASSERT(is_valid()); - return object_->length; - } - - void Prototype::set_is_last(bool value) - { - FLAC__ASSERT(is_valid()); - object_->is_last = value; - } - - - // - // StreamInfo - // - - StreamInfo::StreamInfo(): - Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_STREAMINFO), /*copy=*/false) - { } - - StreamInfo::~StreamInfo() - { } - - uint32_t StreamInfo::get_min_blocksize() const - { - FLAC__ASSERT(is_valid()); - return object_->data.stream_info.min_blocksize; - } - - uint32_t StreamInfo::get_max_blocksize() const - { - FLAC__ASSERT(is_valid()); - return object_->data.stream_info.max_blocksize; - } - - uint32_t StreamInfo::get_min_framesize() const - { - FLAC__ASSERT(is_valid()); - return object_->data.stream_info.min_framesize; - } - - uint32_t StreamInfo::get_max_framesize() const - { - FLAC__ASSERT(is_valid()); - return object_->data.stream_info.max_framesize; - } - - uint32_t StreamInfo::get_sample_rate() const - { - FLAC__ASSERT(is_valid()); - return object_->data.stream_info.sample_rate; - } - - uint32_t StreamInfo::get_channels() const - { - FLAC__ASSERT(is_valid()); - return object_->data.stream_info.channels; - } - - uint32_t StreamInfo::get_bits_per_sample() const - { - FLAC__ASSERT(is_valid()); - return object_->data.stream_info.bits_per_sample; - } - - FLAC__uint64 StreamInfo::get_total_samples() const - { - FLAC__ASSERT(is_valid()); - return object_->data.stream_info.total_samples; - } - - const FLAC__byte *StreamInfo::get_md5sum() const - { - FLAC__ASSERT(is_valid()); - return object_->data.stream_info.md5sum; - } - - void StreamInfo::set_min_blocksize(uint32_t value) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(value >= FLAC__MIN_BLOCK_SIZE); - FLAC__ASSERT(value <= FLAC__MAX_BLOCK_SIZE); - object_->data.stream_info.min_blocksize = value; - } - - void StreamInfo::set_max_blocksize(uint32_t value) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(value >= FLAC__MIN_BLOCK_SIZE); - FLAC__ASSERT(value <= FLAC__MAX_BLOCK_SIZE); - object_->data.stream_info.max_blocksize = value; - } - - void StreamInfo::set_min_framesize(uint32_t value) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(value < (1u << FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN)); - object_->data.stream_info.min_framesize = value; - } - - void StreamInfo::set_max_framesize(uint32_t value) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(value < (1u << FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN)); - object_->data.stream_info.max_framesize = value; - } - - void StreamInfo::set_sample_rate(uint32_t value) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(FLAC__format_sample_rate_is_valid(value)); - object_->data.stream_info.sample_rate = value; - } - - void StreamInfo::set_channels(uint32_t value) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(value > 0); - FLAC__ASSERT(value <= FLAC__MAX_CHANNELS); - object_->data.stream_info.channels = value; - } - - void StreamInfo::set_bits_per_sample(uint32_t value) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(value >= FLAC__MIN_BITS_PER_SAMPLE); - FLAC__ASSERT(value <= FLAC__MAX_BITS_PER_SAMPLE); - object_->data.stream_info.bits_per_sample = value; - } - - void StreamInfo::set_total_samples(FLAC__uint64 value) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(value < (((FLAC__uint64)1) << FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)); - object_->data.stream_info.total_samples = value; - } - - void StreamInfo::set_md5sum(const FLAC__byte value[16]) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(0 != value); - std::memcpy(object_->data.stream_info.md5sum, value, 16); - } - - - // - // Padding - // - - Padding::Padding(): - Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING), /*copy=*/false) - { } - - Padding::Padding(uint32_t length): - Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING), /*copy=*/false) - { - set_length(length); - } - - Padding::~Padding() - { } - - void Padding::set_length(uint32_t length) - { - FLAC__ASSERT(is_valid()); - object_->length = length; - } - - - // - // Application - // - - Application::Application(): - Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION), /*copy=*/false) - { } - - Application::~Application() - { } - - const FLAC__byte *Application::get_id() const - { - FLAC__ASSERT(is_valid()); - return object_->data.application.id; - } - - const FLAC__byte *Application::get_data() const - { - FLAC__ASSERT(is_valid()); - return object_->data.application.data; - } - - void Application::set_id(const FLAC__byte value[4]) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(0 != value); - std::memcpy(object_->data.application.id, value, 4); - } - - bool Application::set_data(const FLAC__byte *data, uint32_t length) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_application_set_data(object_, const_cast(data), length, true)); - } - - bool Application::set_data(FLAC__byte *data, uint32_t length, bool copy) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_application_set_data(object_, data, length, copy)); - } - - - // - // SeekTable - // - - SeekTable::SeekTable(): - Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE), /*copy=*/false) - { } - - SeekTable::~SeekTable() - { } - - uint32_t SeekTable::get_num_points() const - { - FLAC__ASSERT(is_valid()); - return object_->data.seek_table.num_points; - } - - ::FLAC__StreamMetadata_SeekPoint SeekTable::get_point(uint32_t indx) const - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(indx < object_->data.seek_table.num_points); - return object_->data.seek_table.points[indx]; - } - - bool SeekTable::resize_points(uint32_t new_num_points) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_seektable_resize_points(object_, new_num_points)); - } - - void SeekTable::set_point(uint32_t indx, const ::FLAC__StreamMetadata_SeekPoint &point) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(indx < object_->data.seek_table.num_points); - ::FLAC__metadata_object_seektable_set_point(object_, indx, point); - } - - bool SeekTable::insert_point(uint32_t indx, const ::FLAC__StreamMetadata_SeekPoint &point) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(indx <= object_->data.seek_table.num_points); - return static_cast(::FLAC__metadata_object_seektable_insert_point(object_, indx, point)); - } - - bool SeekTable::delete_point(uint32_t indx) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(indx < object_->data.seek_table.num_points); - return static_cast(::FLAC__metadata_object_seektable_delete_point(object_, indx)); - } - - bool SeekTable::is_legal() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_seektable_is_legal(object_)); - } - - bool SeekTable::template_append_placeholders(uint32_t num) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_seektable_template_append_placeholders(object_, num)); - } - - bool SeekTable::template_append_point(FLAC__uint64 sample_number) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_seektable_template_append_point(object_, sample_number)); - } - - bool SeekTable::template_append_points(FLAC__uint64 sample_numbers[], uint32_t num) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_seektable_template_append_points(object_, sample_numbers, num)); - } - - bool SeekTable::template_append_spaced_points(uint32_t num, FLAC__uint64 total_samples) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_seektable_template_append_spaced_points(object_, num, total_samples)); - } - - bool SeekTable::template_append_spaced_points_by_samples(uint32_t samples, FLAC__uint64 total_samples) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(object_, samples, total_samples)); - } - - bool SeekTable::template_sort(bool compact) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_seektable_template_sort(object_, compact)); - } - - - // - // VorbisComment::Entry - // - - VorbisComment::Entry::Entry() : - is_valid_(true), - entry_(), - field_name_(0), - field_name_length_(0), - field_value_(0), - field_value_length_(0) - { - zero(); - } - - VorbisComment::Entry::Entry(const char *field, uint32_t field_length) : - is_valid_(true), - entry_(), - field_name_(0), - field_name_length_(0), - field_value_(0), - field_value_length_(0) - { - zero(); - construct(field, field_length); - } - - VorbisComment::Entry::Entry(const char *field) : - is_valid_(true), - entry_(), - field_name_(0), - field_name_length_(0), - field_value_(0), - field_value_length_(0) - { - zero(); - construct(field); - } - - VorbisComment::Entry::Entry(const char *field_name, const char *field_value, uint32_t field_value_length) : - is_valid_(true), - entry_(), - field_name_(0), - field_name_length_(0), - field_value_(0), - field_value_length_(0) - { - zero(); - construct(field_name, field_value, field_value_length); - } - - VorbisComment::Entry::Entry(const char *field_name, const char *field_value) : - is_valid_(true), - entry_(), - field_name_(0), - field_name_length_(0), - field_value_(0), - field_value_length_(0) - { - zero(); - construct(field_name, field_value); - } - - VorbisComment::Entry::Entry(const Entry &entry) : - is_valid_(true), - entry_(), - field_name_(0), - field_name_length_(0), - field_value_(0), - field_value_length_(0) - { - FLAC__ASSERT(entry.is_valid()); - zero(); - construct(reinterpret_cast(entry.entry_.entry), entry.entry_.length); - } - - VorbisComment::Entry &VorbisComment::Entry::operator=(const Entry &entry) - { - FLAC__ASSERT(entry.is_valid()); - clear(); - construct(reinterpret_cast(entry.entry_.entry), entry.entry_.length); - return *this; - } - - VorbisComment::Entry::~Entry() - { - clear(); - } - - bool VorbisComment::Entry::is_valid() const - { - return is_valid_; - } - - uint32_t VorbisComment::Entry::get_field_length() const - { - FLAC__ASSERT(is_valid()); - return entry_.length; - } - - uint32_t VorbisComment::Entry::get_field_name_length() const - { - FLAC__ASSERT(is_valid()); - return field_name_length_; - } - - uint32_t VorbisComment::Entry::get_field_value_length() const - { - FLAC__ASSERT(is_valid()); - return field_value_length_; - } - - ::FLAC__StreamMetadata_VorbisComment_Entry VorbisComment::Entry::get_entry() const - { - FLAC__ASSERT(is_valid()); - return entry_; - } - - const char *VorbisComment::Entry::get_field() const - { - FLAC__ASSERT(is_valid()); - return reinterpret_cast(entry_.entry); - } - - const char *VorbisComment::Entry::get_field_name() const - { - FLAC__ASSERT(is_valid()); - return field_name_; - } - - const char *VorbisComment::Entry::get_field_value() const - { - FLAC__ASSERT(is_valid()); - return field_value_; - } - - bool VorbisComment::Entry::set_field(const char *field, uint32_t field_length) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(0 != field); - - if(!::FLAC__format_vorbiscomment_entry_is_legal(reinterpret_cast(field), field_length)) - return is_valid_ = false; - - clear_entry(); - - if(0 == (entry_.entry = static_cast(safe_malloc_add_2op_(field_length, /*+*/1)))) { - is_valid_ = false; - } - else { - entry_.length = field_length; - std::memcpy(entry_.entry, field, field_length); - entry_.entry[field_length] = '\0'; - (void) parse_field(); - } - - return is_valid_; - } - - bool VorbisComment::Entry::set_field(const char *field) - { - return set_field(field, std::strlen(field)); - } - - bool VorbisComment::Entry::set_field_name(const char *field_name) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(0 != field_name); - - if(!::FLAC__format_vorbiscomment_entry_name_is_legal(field_name)) - return is_valid_ = false; - - clear_field_name(); - - if(0 == (field_name_ = strdup(field_name))) { - is_valid_ = false; - } - else { - field_name_length_ = std::strlen(field_name_); - compose_field(); - } - - return is_valid_; - } - - bool VorbisComment::Entry::set_field_value(const char *field_value, uint32_t field_value_length) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(0 != field_value); - - if(!::FLAC__format_vorbiscomment_entry_value_is_legal(reinterpret_cast(field_value), field_value_length)) - return is_valid_ = false; - - clear_field_value(); - - if(0 == (field_value_ = static_cast(safe_malloc_add_2op_(field_value_length, /*+*/1)))) { - is_valid_ = false; - } - else { - field_value_length_ = field_value_length; - std::memcpy(field_value_, field_value, field_value_length); - field_value_[field_value_length] = '\0'; - compose_field(); - } - - return is_valid_; - } - - bool VorbisComment::Entry::set_field_value(const char *field_value) - { - return set_field_value(field_value, std::strlen(field_value)); - } - - void VorbisComment::Entry::zero() - { - is_valid_ = true; - entry_.length = 0; - entry_.entry = 0; - field_name_ = 0; - field_name_length_ = 0; - field_value_ = 0; - field_value_length_ = 0; - } - - void VorbisComment::Entry::clear() - { - clear_entry(); - clear_field_name(); - clear_field_value(); - is_valid_ = true; - } - - void VorbisComment::Entry::clear_entry() - { - if(0 != entry_.entry) { - std::free(entry_.entry); - entry_.entry = 0; - entry_.length = 0; - } - } - - void VorbisComment::Entry::clear_field_name() - { - if(0 != field_name_) { - std::free(field_name_); - field_name_ = 0; - field_name_length_ = 0; - } - } - - void VorbisComment::Entry::clear_field_value() - { - if(0 != field_value_) { - std::free(field_value_); - field_value_ = 0; - field_value_length_ = 0; - } - } - - void VorbisComment::Entry::construct(const char *field, uint32_t field_length) - { - if(set_field(field, field_length)) - parse_field(); - } - - void VorbisComment::Entry::construct(const char *field) - { - construct(field, std::strlen(field)); - } - - void VorbisComment::Entry::construct(const char *field_name, const char *field_value, uint32_t field_value_length) - { - if(set_field_name(field_name) && set_field_value(field_value, field_value_length)) - compose_field(); - } - - void VorbisComment::Entry::construct(const char *field_name, const char *field_value) - { - construct(field_name, field_value, std::strlen(field_value)); - } - - void VorbisComment::Entry::compose_field() - { - clear_entry(); - - if(0 == (entry_.entry = static_cast(safe_malloc_add_4op_(field_name_length_, /*+*/1, /*+*/field_value_length_, /*+*/1)))) { - is_valid_ = false; - } - else { - std::memcpy(entry_.entry, field_name_, field_name_length_); - entry_.length += field_name_length_; - std::memcpy(entry_.entry + entry_.length, "=", 1); - entry_.length += 1; - if (field_value_length_ > 0) - std::memcpy(entry_.entry + entry_.length, field_value_, field_value_length_); - entry_.length += field_value_length_; - entry_.entry[entry_.length] = '\0'; - is_valid_ = true; - } - } - - void VorbisComment::Entry::parse_field() - { - clear_field_name(); - clear_field_value(); - - const char *p = static_cast(std::memchr(entry_.entry, '=', entry_.length)); - - if(0 == p) - p = reinterpret_cast(entry_.entry) + entry_.length; - - field_name_length_ = static_cast(p - reinterpret_cast(entry_.entry)); - if(0 == (field_name_ = static_cast(safe_malloc_add_2op_(field_name_length_, /*+*/1)))) { // +1 for the trailing \0 - is_valid_ = false; - return; - } - std::memcpy(field_name_, entry_.entry, field_name_length_); - field_name_[field_name_length_] = '\0'; - - if(entry_.length - field_name_length_ == 0) { - field_value_length_ = 0; - if(0 == (field_value_ = static_cast(safe_malloc_(0)))) { - is_valid_ = false; - return; - } - } - else { - field_value_length_ = entry_.length - field_name_length_ - 1; - if(0 == (field_value_ = static_cast(safe_malloc_add_2op_(field_value_length_, /*+*/1)))) { // +1 for the trailing \0 - is_valid_ = false; - return; - } - std::memcpy(field_value_, ++p, field_value_length_); - field_value_[field_value_length_] = '\0'; - } - - is_valid_ = true; - } - - - // - // VorbisComment - // - - VorbisComment::VorbisComment(): - Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT), /*copy=*/false) - { } - - VorbisComment::~VorbisComment() - { } - - uint32_t VorbisComment::get_num_comments() const - { - FLAC__ASSERT(is_valid()); - return object_->data.vorbis_comment.num_comments; - } - - const FLAC__byte *VorbisComment::get_vendor_string() const - { - FLAC__ASSERT(is_valid()); - return object_->data.vorbis_comment.vendor_string.entry; - } - - VorbisComment::Entry VorbisComment::get_comment(uint32_t indx) const - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments); - return Entry(reinterpret_cast(object_->data.vorbis_comment.comments[indx].entry), object_->data.vorbis_comment.comments[indx].length); - } - - bool VorbisComment::set_vendor_string(const FLAC__byte *string) - { - FLAC__ASSERT(is_valid()); - // vendor_string is a special kind of entry - const ::FLAC__StreamMetadata_VorbisComment_Entry vendor_string = { static_cast(std::strlen(reinterpret_cast(string))), const_cast(string) }; // we can cheat on const-ness because we make a copy below: - return static_cast(::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, vendor_string, /*copy=*/true)); - } - - bool VorbisComment::resize_comments(uint32_t new_num_comments) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_vorbiscomment_resize_comments(object_, new_num_comments)); - } - - bool VorbisComment::set_comment(uint32_t indx, const VorbisComment::Entry &entry) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments); - return static_cast(::FLAC__metadata_object_vorbiscomment_set_comment(object_, indx, entry.get_entry(), /*copy=*/true)); - } - - bool VorbisComment::insert_comment(uint32_t indx, const VorbisComment::Entry &entry) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(indx <= object_->data.vorbis_comment.num_comments); - return static_cast(::FLAC__metadata_object_vorbiscomment_insert_comment(object_, indx, entry.get_entry(), /*copy=*/true)); - } - - bool VorbisComment::append_comment(const VorbisComment::Entry &entry) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_vorbiscomment_append_comment(object_, entry.get_entry(), /*copy=*/true)); - } - - bool VorbisComment::replace_comment(const VorbisComment::Entry &entry, bool all) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_vorbiscomment_replace_comment(object_, entry.get_entry(), static_cast(all), /*copy=*/true)); - } - - bool VorbisComment::delete_comment(uint32_t indx) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments); - return static_cast(::FLAC__metadata_object_vorbiscomment_delete_comment(object_, indx)); - } - - int VorbisComment::find_entry_from(uint32_t offset, const char *field_name) - { - FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_object_vorbiscomment_find_entry_from(object_, offset, field_name); - } - - int VorbisComment::remove_entry_matching(const char *field_name) - { - FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_object_vorbiscomment_remove_entry_matching(object_, field_name); - } - - int VorbisComment::remove_entries_matching(const char *field_name) - { - FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_object_vorbiscomment_remove_entries_matching(object_, field_name); - } - - - // - // CueSheet::Track - // - - CueSheet::Track::Track(): - object_(::FLAC__metadata_object_cuesheet_track_new()) - { } - - CueSheet::Track::Track(const ::FLAC__StreamMetadata_CueSheet_Track *track): - object_(::FLAC__metadata_object_cuesheet_track_clone(track)) - { } - - CueSheet::Track::Track(const Track &track): - object_(::FLAC__metadata_object_cuesheet_track_clone(track.object_)) - { } - - CueSheet::Track &CueSheet::Track::operator=(const Track &track) - { - if(0 != object_) - ::FLAC__metadata_object_cuesheet_track_delete(object_); - object_ = ::FLAC__metadata_object_cuesheet_track_clone(track.object_); - return *this; - } - - CueSheet::Track::~Track() - { - if(0 != object_) - ::FLAC__metadata_object_cuesheet_track_delete(object_); - } - - bool CueSheet::Track::is_valid() const - { - return(0 != object_); - } - - ::FLAC__StreamMetadata_CueSheet_Index CueSheet::Track::get_index(uint32_t i) const - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(i < object_->num_indices); - return object_->indices[i]; - } - - void CueSheet::Track::set_isrc(const char value[12]) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(0 != value); - std::memcpy(object_->isrc, value, 12); - object_->isrc[12] = '\0'; - } - - void CueSheet::Track::set_type(uint32_t value) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(value <= 1); - object_->type = value; - } - - void CueSheet::Track::set_index(uint32_t i, const ::FLAC__StreamMetadata_CueSheet_Index &indx) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(i < object_->num_indices); - object_->indices[i] = indx; - } - - - // - // CueSheet - // - - CueSheet::CueSheet(): - Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET), /*copy=*/false) - { } - - CueSheet::~CueSheet() - { } - - const char *CueSheet::get_media_catalog_number() const - { - FLAC__ASSERT(is_valid()); - return object_->data.cue_sheet.media_catalog_number; - } - - FLAC__uint64 CueSheet::get_lead_in() const - { - FLAC__ASSERT(is_valid()); - return object_->data.cue_sheet.lead_in; - } - - bool CueSheet::get_is_cd() const - { - FLAC__ASSERT(is_valid()); - return object_->data.cue_sheet.is_cd? true : false; - } - - uint32_t CueSheet::get_num_tracks() const - { - FLAC__ASSERT(is_valid()); - return object_->data.cue_sheet.num_tracks; - } - - CueSheet::Track CueSheet::get_track(uint32_t i) const - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(i < object_->data.cue_sheet.num_tracks); - return Track(object_->data.cue_sheet.tracks + i); - } - - void CueSheet::set_media_catalog_number(const char value[128]) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(0 != value); - std::memcpy(object_->data.cue_sheet.media_catalog_number, value, 128); - object_->data.cue_sheet.media_catalog_number[128] = '\0'; - } - - void CueSheet::set_lead_in(FLAC__uint64 value) - { - FLAC__ASSERT(is_valid()); - object_->data.cue_sheet.lead_in = value; - } - - void CueSheet::set_is_cd(bool value) - { - FLAC__ASSERT(is_valid()); - object_->data.cue_sheet.is_cd = value; - } - - void CueSheet::set_index(uint32_t track_num, uint32_t index_num, const ::FLAC__StreamMetadata_CueSheet_Index &indx) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks); - FLAC__ASSERT(index_num < object_->data.cue_sheet.tracks[track_num].num_indices); - object_->data.cue_sheet.tracks[track_num].indices[index_num] = indx; - } - - bool CueSheet::resize_indices(uint32_t track_num, uint32_t new_num_indices) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks); - return static_cast(::FLAC__metadata_object_cuesheet_track_resize_indices(object_, track_num, new_num_indices)); - } - - bool CueSheet::insert_index(uint32_t track_num, uint32_t index_num, const ::FLAC__StreamMetadata_CueSheet_Index &indx) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks); - FLAC__ASSERT(index_num <= object_->data.cue_sheet.tracks[track_num].num_indices); - return static_cast(::FLAC__metadata_object_cuesheet_track_insert_index(object_, track_num, index_num, indx)); - } - - bool CueSheet::insert_blank_index(uint32_t track_num, uint32_t index_num) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks); - FLAC__ASSERT(index_num <= object_->data.cue_sheet.tracks[track_num].num_indices); - return static_cast(::FLAC__metadata_object_cuesheet_track_insert_blank_index(object_, track_num, index_num)); - } - - bool CueSheet::delete_index(uint32_t track_num, uint32_t index_num) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(track_num < object_->data.cue_sheet.num_tracks); - FLAC__ASSERT(index_num < object_->data.cue_sheet.tracks[track_num].num_indices); - return static_cast(::FLAC__metadata_object_cuesheet_track_delete_index(object_, track_num, index_num)); - } - - bool CueSheet::resize_tracks(uint32_t new_num_tracks) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_cuesheet_resize_tracks(object_, new_num_tracks)); - } - - bool CueSheet::set_track(uint32_t i, const CueSheet::Track &track) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(i < object_->data.cue_sheet.num_tracks); - // We can safely const_cast since copy=true - return static_cast(::FLAC__metadata_object_cuesheet_set_track(object_, i, const_cast< ::FLAC__StreamMetadata_CueSheet_Track*>(track.get_track()), /*copy=*/true)); - } - - bool CueSheet::insert_track(uint32_t i, const CueSheet::Track &track) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(i <= object_->data.cue_sheet.num_tracks); - // We can safely const_cast since copy=true - return static_cast(::FLAC__metadata_object_cuesheet_insert_track(object_, i, const_cast< ::FLAC__StreamMetadata_CueSheet_Track*>(track.get_track()), /*copy=*/true)); - } - - bool CueSheet::insert_blank_track(uint32_t i) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(i <= object_->data.cue_sheet.num_tracks); - return static_cast(::FLAC__metadata_object_cuesheet_insert_blank_track(object_, i)); - } - - bool CueSheet::delete_track(uint32_t i) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(i < object_->data.cue_sheet.num_tracks); - return static_cast(::FLAC__metadata_object_cuesheet_delete_track(object_, i)); - } - - bool CueSheet::is_legal(bool check_cd_da_subset, const char **violation) const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_cuesheet_is_legal(object_, check_cd_da_subset, violation)); - } - - FLAC__uint32 CueSheet::calculate_cddb_id() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_object_cuesheet_calculate_cddb_id(object_); - } - - - // - // Picture - // - - Picture::Picture(): - Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_PICTURE), /*copy=*/false) - { } - - Picture::~Picture() - { } - - ::FLAC__StreamMetadata_Picture_Type Picture::get_type() const - { - FLAC__ASSERT(is_valid()); - return object_->data.picture.type; - } - - const char *Picture::get_mime_type() const - { - FLAC__ASSERT(is_valid()); - return object_->data.picture.mime_type; - } - - const FLAC__byte *Picture::get_description() const - { - FLAC__ASSERT(is_valid()); - return object_->data.picture.description; - } - - FLAC__uint32 Picture::get_width() const - { - FLAC__ASSERT(is_valid()); - return object_->data.picture.width; - } - - FLAC__uint32 Picture::get_height() const - { - FLAC__ASSERT(is_valid()); - return object_->data.picture.height; - } - - FLAC__uint32 Picture::get_depth() const - { - FLAC__ASSERT(is_valid()); - return object_->data.picture.depth; - } - - FLAC__uint32 Picture::get_colors() const - { - FLAC__ASSERT(is_valid()); - return object_->data.picture.colors; - } - - FLAC__uint32 Picture::get_data_length() const - { - FLAC__ASSERT(is_valid()); - return object_->data.picture.data_length; - } - - const FLAC__byte *Picture::get_data() const - { - FLAC__ASSERT(is_valid()); - return object_->data.picture.data; - } - - void Picture::set_type(::FLAC__StreamMetadata_Picture_Type type) - { - FLAC__ASSERT(is_valid()); - object_->data.picture.type = type; - } - - bool Picture::set_mime_type(const char *string) - { - FLAC__ASSERT(is_valid()); - // We can safely const_cast since copy=true - return static_cast(::FLAC__metadata_object_picture_set_mime_type(object_, const_cast(string), /*copy=*/true)); - } - - bool Picture::set_description(const FLAC__byte *string) - { - FLAC__ASSERT(is_valid()); - // We can safely const_cast since copy=true - return static_cast(::FLAC__metadata_object_picture_set_description(object_, const_cast(string), /*copy=*/true)); - } - - void Picture::set_width(FLAC__uint32 value) const - { - FLAC__ASSERT(is_valid()); - object_->data.picture.width = value; - } - - void Picture::set_height(FLAC__uint32 value) const - { - FLAC__ASSERT(is_valid()); - object_->data.picture.height = value; - } - - void Picture::set_depth(FLAC__uint32 value) const - { - FLAC__ASSERT(is_valid()); - object_->data.picture.depth = value; - } - - void Picture::set_colors(FLAC__uint32 value) const - { - FLAC__ASSERT(is_valid()); - object_->data.picture.colors = value; - } - - bool Picture::set_data(const FLAC__byte *data, FLAC__uint32 data_length) - { - FLAC__ASSERT(is_valid()); - // We can safely const_cast since copy=true - return static_cast(::FLAC__metadata_object_picture_set_data(object_, const_cast(data), data_length, /*copy=*/true)); - } - - bool Picture::is_legal(const char **violation) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_picture_is_legal(object_, violation)); - } - - - // - // Unknown - // - - Unknown::Unknown(): - Prototype(FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION), /*copy=*/false) - { } - - Unknown::~Unknown() - { } - - const FLAC__byte *Unknown::get_data() const - { - FLAC__ASSERT(is_valid()); - return object_->data.application.data; - } - - bool Unknown::set_data(const FLAC__byte *data, uint32_t length) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_application_set_data(object_, const_cast(data), length, true)); - } - - bool Unknown::set_data(FLAC__byte *data, uint32_t length, bool copy) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_object_application_set_data(object_, data, length, copy)); - } - - - // ============================================================ - // - // Level 0 - // - // ============================================================ - - FLACPP_API bool get_streaminfo(const char *filename, StreamInfo &streaminfo) - { - FLAC__ASSERT(0 != filename); - - ::FLAC__StreamMetadata object; - - if(::FLAC__metadata_get_streaminfo(filename, &object)) { - streaminfo = object; - return true; - } - else - return false; - } - - FLACPP_API bool get_tags(const char *filename, VorbisComment *&tags) - { - FLAC__ASSERT(0 != filename); - - ::FLAC__StreamMetadata *object; - - tags = 0; - - if(::FLAC__metadata_get_tags(filename, &object)) { - tags = new VorbisComment(object, /*copy=*/false); - return true; - } - else - return false; - } - - FLACPP_API bool get_tags(const char *filename, VorbisComment &tags) - { - FLAC__ASSERT(0 != filename); - - ::FLAC__StreamMetadata *object; - - if(::FLAC__metadata_get_tags(filename, &object)) { - tags.assign(object, /*copy=*/false); - return true; - } - else - return false; - } - - FLACPP_API bool get_cuesheet(const char *filename, CueSheet *&cuesheet) - { - FLAC__ASSERT(0 != filename); - - ::FLAC__StreamMetadata *object; - - cuesheet = 0; - - if(::FLAC__metadata_get_cuesheet(filename, &object)) { - cuesheet = new CueSheet(object, /*copy=*/false); - return true; - } - else - return false; - } - - FLACPP_API bool get_cuesheet(const char *filename, CueSheet &cuesheet) - { - FLAC__ASSERT(0 != filename); - - ::FLAC__StreamMetadata *object; - - if(::FLAC__metadata_get_cuesheet(filename, &object)) { - cuesheet.assign(object, /*copy=*/false); - return true; - } - else - return false; - } - - FLACPP_API bool get_picture(const char *filename, Picture *&picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, uint32_t max_width, uint32_t max_height, uint32_t max_depth, uint32_t max_colors) - { - FLAC__ASSERT(0 != filename); - - ::FLAC__StreamMetadata *object; - - picture = 0; - - if(::FLAC__metadata_get_picture(filename, &object, type, mime_type, description, max_width, max_height, max_depth, max_colors)) { - picture = new Picture(object, /*copy=*/false); - return true; - } - else - return false; - } - - FLACPP_API bool get_picture(const char *filename, Picture &picture, ::FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, uint32_t max_width, uint32_t max_height, uint32_t max_depth, uint32_t max_colors) - { - FLAC__ASSERT(0 != filename); - - ::FLAC__StreamMetadata *object; - - if(::FLAC__metadata_get_picture(filename, &object, type, mime_type, description, max_width, max_height, max_depth, max_colors)) { - picture.assign(object, /*copy=*/false); - return true; - } - else - return false; - } - - - // ============================================================ - // - // Level 1 - // - // ============================================================ - - SimpleIterator::SimpleIterator(): - iterator_(::FLAC__metadata_simple_iterator_new()) - { } - - SimpleIterator::~SimpleIterator() - { - clear(); - } - - void SimpleIterator::clear() - { - if(0 != iterator_) - FLAC__metadata_simple_iterator_delete(iterator_); - iterator_ = 0; - } - - bool SimpleIterator::init(const char *filename, bool read_only, bool preserve_file_stats) - { - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_simple_iterator_init(iterator_, filename, read_only, preserve_file_stats)); - } - - bool SimpleIterator::is_valid() const - { - return 0 != iterator_; - } - - SimpleIterator::Status SimpleIterator::status() - { - FLAC__ASSERT(is_valid()); - return Status(::FLAC__metadata_simple_iterator_status(iterator_)); - } - - bool SimpleIterator::is_writable() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_simple_iterator_is_writable(iterator_)); - } - - bool SimpleIterator::next() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_simple_iterator_next(iterator_)); - } - - bool SimpleIterator::prev() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_simple_iterator_prev(iterator_)); - } - - //@@@@ add to tests - bool SimpleIterator::is_last() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_simple_iterator_is_last(iterator_)); - } - - //@@@@ add to tests - off_t SimpleIterator::get_block_offset() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_get_block_offset(iterator_); - } - - ::FLAC__MetadataType SimpleIterator::get_block_type() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_get_block_type(iterator_); - } - - //@@@@ add to tests - uint32_t SimpleIterator::get_block_length() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_simple_iterator_get_block_length(iterator_); - } - - //@@@@ add to tests - bool SimpleIterator::get_application_id(FLAC__byte *id) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_simple_iterator_get_application_id(iterator_, id)); - } - - Prototype *SimpleIterator::get_block() - { - FLAC__ASSERT(is_valid()); - return local::construct_block(::FLAC__metadata_simple_iterator_get_block(iterator_)); - } - - bool SimpleIterator::set_block(Prototype *block, bool use_padding) - { - FLAC__ASSERT(0 != block); - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_simple_iterator_set_block(iterator_, block->object_, use_padding)); - } - - bool SimpleIterator::insert_block_after(Prototype *block, bool use_padding) - { - FLAC__ASSERT(0 != block); - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_simple_iterator_insert_block_after(iterator_, block->object_, use_padding)); - } - - bool SimpleIterator::delete_block(bool use_padding) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_simple_iterator_delete_block(iterator_, use_padding)); - } - - - // ============================================================ - // - // Level 2 - // - // ============================================================ - - Chain::Chain(): - chain_(::FLAC__metadata_chain_new()) - { } - - Chain::~Chain() - { - clear(); - } - - void Chain::clear() - { - if(0 != chain_) - FLAC__metadata_chain_delete(chain_); - chain_ = 0; - } - - bool Chain::is_valid() const - { - return 0 != chain_; - } - - Chain::Status Chain::status() - { - FLAC__ASSERT(is_valid()); - return Status(::FLAC__metadata_chain_status(chain_)); - } - - bool Chain::read(const char *filename, bool is_ogg) - { - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(is_valid()); - return is_ogg? - static_cast(::FLAC__metadata_chain_read_ogg(chain_, filename)) : - static_cast(::FLAC__metadata_chain_read(chain_, filename)) - ; - } - - bool Chain::read(FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks, bool is_ogg) - { - FLAC__ASSERT(is_valid()); - return is_ogg? - static_cast(::FLAC__metadata_chain_read_ogg_with_callbacks(chain_, handle, callbacks)) : - static_cast(::FLAC__metadata_chain_read_with_callbacks(chain_, handle, callbacks)) - ; - } - - bool Chain::check_if_tempfile_needed(bool use_padding) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_chain_check_if_tempfile_needed(chain_, use_padding)); - } - - bool Chain::write(bool use_padding, bool preserve_file_stats) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_chain_write(chain_, use_padding, preserve_file_stats)); - } - - bool Chain::write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_chain_write_with_callbacks(chain_, use_padding, handle, callbacks)); - } - - bool Chain::write(bool use_padding, ::FLAC__IOHandle handle, ::FLAC__IOCallbacks callbacks, ::FLAC__IOHandle temp_handle, ::FLAC__IOCallbacks temp_callbacks) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_chain_write_with_callbacks_and_tempfile(chain_, use_padding, handle, callbacks, temp_handle, temp_callbacks)); - } - - void Chain::merge_padding() - { - FLAC__ASSERT(is_valid()); - ::FLAC__metadata_chain_merge_padding(chain_); - } - - void Chain::sort_padding() - { - FLAC__ASSERT(is_valid()); - ::FLAC__metadata_chain_sort_padding(chain_); - } - - - Iterator::Iterator(): - iterator_(::FLAC__metadata_iterator_new()) - { } - - Iterator::~Iterator() - { - clear(); - } - - void Iterator::clear() - { - if(0 != iterator_) - FLAC__metadata_iterator_delete(iterator_); - iterator_ = 0; - } - - bool Iterator::is_valid() const - { - return 0 != iterator_; - } - - void Iterator::init(Chain &chain) - { - FLAC__ASSERT(is_valid()); - FLAC__ASSERT(chain.is_valid()); - ::FLAC__metadata_iterator_init(iterator_, chain.chain_); - } - - bool Iterator::next() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_iterator_next(iterator_)); - } - - bool Iterator::prev() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_iterator_prev(iterator_)); - } - - ::FLAC__MetadataType Iterator::get_block_type() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__metadata_iterator_get_block_type(iterator_); - } - - Prototype *Iterator::get_block() - { - FLAC__ASSERT(is_valid()); - Prototype *block = local::construct_block(::FLAC__metadata_iterator_get_block(iterator_)); - if(0 != block) - block->set_reference(true); - return block; - } - - bool Iterator::set_block(Prototype *block) - { - FLAC__ASSERT(0 != block); - FLAC__ASSERT(is_valid()); - bool ret = static_cast(::FLAC__metadata_iterator_set_block(iterator_, block->object_)); - if(ret) { - block->set_reference(true); - delete block; - } - return ret; - } - - bool Iterator::delete_block(bool replace_with_padding) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__metadata_iterator_delete_block(iterator_, replace_with_padding)); - } - - bool Iterator::insert_block_before(Prototype *block) - { - FLAC__ASSERT(0 != block); - FLAC__ASSERT(is_valid()); - bool ret = static_cast(::FLAC__metadata_iterator_insert_block_before(iterator_, block->object_)); - if(ret) { - block->set_reference(true); - delete block; - } - return ret; - } - - bool Iterator::insert_block_after(Prototype *block) - { - FLAC__ASSERT(0 != block); - FLAC__ASSERT(is_valid()); - bool ret = static_cast(::FLAC__metadata_iterator_insert_block_after(iterator_, block->object_)); - if(ret) { - block->set_reference(true); - delete block; - } - return ret; - } - - } // namespace Metadata -} // namespace FLAC diff --git a/src/libFLAC++/stream_decoder.cpp b/src/libFLAC++/stream_decoder.cpp deleted file mode 100644 index b3750256..00000000 --- a/src/libFLAC++/stream_decoder.cpp +++ /dev/null @@ -1,394 +0,0 @@ -/* libFLAC++ - Free Lossless Audio Codec library - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of the Xiph.org Foundation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "FLAC++/decoder.h" -#include "FLAC/assert.h" - -#ifdef _MSC_VER -// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning) -#pragma warning ( disable : 4800 ) -#endif - -namespace FLAC { - namespace Decoder { - - // ------------------------------------------------------------ - // - // Stream - // - // ------------------------------------------------------------ - - Stream::Stream(): - decoder_(::FLAC__stream_decoder_new()) - { } - - Stream::~Stream() - { - if(0 != decoder_) { - (void)::FLAC__stream_decoder_finish(decoder_); - ::FLAC__stream_decoder_delete(decoder_); - } - } - - bool Stream::is_valid() const - { - return 0 != decoder_; - } - - bool Stream::set_ogg_serial_number(long value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_set_ogg_serial_number(decoder_, value)); - } - - bool Stream::set_md5_checking(bool value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_set_md5_checking(decoder_, value)); - } - - bool Stream::set_metadata_respond(::FLAC__MetadataType type) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_set_metadata_respond(decoder_, type)); - } - - bool Stream::set_metadata_respond_application(const FLAC__byte id[4]) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_set_metadata_respond_application(decoder_, id)); - } - - bool Stream::set_metadata_respond_all() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_set_metadata_respond_all(decoder_)); - } - - bool Stream::set_metadata_ignore(::FLAC__MetadataType type) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_set_metadata_ignore(decoder_, type)); - } - - bool Stream::set_metadata_ignore_application(const FLAC__byte id[4]) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_set_metadata_ignore_application(decoder_, id)); - } - - bool Stream::set_metadata_ignore_all() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_set_metadata_ignore_all(decoder_)); - } - - Stream::State Stream::get_state() const - { - FLAC__ASSERT(is_valid()); - return State(::FLAC__stream_decoder_get_state(decoder_)); - } - - bool Stream::get_md5_checking() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_get_md5_checking(decoder_)); - } - - FLAC__uint64 Stream::get_total_samples() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_get_total_samples(decoder_); - } - - uint32_t Stream::get_channels() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_get_channels(decoder_); - } - - ::FLAC__ChannelAssignment Stream::get_channel_assignment() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_get_channel_assignment(decoder_); - } - - uint32_t Stream::get_bits_per_sample() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_get_bits_per_sample(decoder_); - } - - uint32_t Stream::get_sample_rate() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_get_sample_rate(decoder_); - } - - uint32_t Stream::get_blocksize() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_get_blocksize(decoder_); - } - - bool Stream::get_decode_position(FLAC__uint64 *position) const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_get_decode_position(decoder_, position); - } - - ::FLAC__StreamDecoderInitStatus Stream::init() - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_init_stream(decoder_, read_callback_, seek_callback_, tell_callback_, length_callback_, eof_callback_, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamDecoderInitStatus Stream::init_ogg() - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_decoder_init_ogg_stream(decoder_, read_callback_, seek_callback_, tell_callback_, length_callback_, eof_callback_, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this); - } - - bool Stream::finish() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_finish(decoder_)); - } - - bool Stream::flush() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_flush(decoder_)); - } - - bool Stream::reset() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_reset(decoder_)); - } - - bool Stream::process_single() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_process_single(decoder_)); - } - - bool Stream::process_until_end_of_metadata() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_process_until_end_of_metadata(decoder_)); - } - - bool Stream::process_until_end_of_stream() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_process_until_end_of_stream(decoder_)); - } - - bool Stream::skip_single_frame() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_skip_single_frame(decoder_)); - } - - bool Stream::seek_absolute(FLAC__uint64 sample) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_decoder_seek_absolute(decoder_, sample)); - } - - ::FLAC__StreamDecoderSeekStatus Stream::seek_callback(FLAC__uint64 absolute_byte_offset) - { - (void)absolute_byte_offset; - return ::FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; - } - - ::FLAC__StreamDecoderTellStatus Stream::tell_callback(FLAC__uint64 *absolute_byte_offset) - { - (void)absolute_byte_offset; - return ::FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED; - } - - ::FLAC__StreamDecoderLengthStatus Stream::length_callback(FLAC__uint64 *stream_length) - { - (void)stream_length; - return ::FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED; - } - - bool Stream::eof_callback() - { - return false; - } - - void Stream::metadata_callback(const ::FLAC__StreamMetadata *metadata) - { - (void)metadata; - } - - ::FLAC__StreamDecoderReadStatus Stream::read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) - { - (void)decoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->read_callback(buffer, bytes); - } - - ::FLAC__StreamDecoderSeekStatus Stream::seek_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) - { - (void) decoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->seek_callback(absolute_byte_offset); - } - - ::FLAC__StreamDecoderTellStatus Stream::tell_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) - { - (void) decoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->tell_callback(absolute_byte_offset); - } - - ::FLAC__StreamDecoderLengthStatus Stream::length_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) - { - (void) decoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->length_callback(stream_length); - } - - FLAC__bool Stream::eof_callback_(const ::FLAC__StreamDecoder *decoder, void *client_data) - { - (void) decoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->eof_callback(); - } - - ::FLAC__StreamDecoderWriteStatus Stream::write_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) - { - (void)decoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->write_callback(frame, buffer); - } - - void Stream::metadata_callback_(const ::FLAC__StreamDecoder *decoder, const ::FLAC__StreamMetadata *metadata, void *client_data) - { - (void)decoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - instance->metadata_callback(metadata); - } - - void Stream::error_callback_(const ::FLAC__StreamDecoder *decoder, ::FLAC__StreamDecoderErrorStatus status, void *client_data) - { - (void)decoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - instance->error_callback(status); - } - - // ------------------------------------------------------------ - // - // File - // - // ------------------------------------------------------------ - - File::File(): - Stream() - { } - - File::~File() - { - } - - ::FLAC__StreamDecoderInitStatus File::init(FILE *file) - { - FLAC__ASSERT(0 != decoder_); - return ::FLAC__stream_decoder_init_FILE(decoder_, file, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamDecoderInitStatus File::init(const char *filename) - { - FLAC__ASSERT(0 != decoder_); - return ::FLAC__stream_decoder_init_file(decoder_, filename, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamDecoderInitStatus File::init(const std::string &filename) - { - return init(filename.c_str()); - } - - ::FLAC__StreamDecoderInitStatus File::init_ogg(FILE *file) - { - FLAC__ASSERT(0 != decoder_); - return ::FLAC__stream_decoder_init_ogg_FILE(decoder_, file, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamDecoderInitStatus File::init_ogg(const char *filename) - { - FLAC__ASSERT(0 != decoder_); - return ::FLAC__stream_decoder_init_ogg_file(decoder_, filename, write_callback_, metadata_callback_, error_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamDecoderInitStatus File::init_ogg(const std::string &filename) - { - return init_ogg(filename.c_str()); - } - - // This is a dummy to satisfy the pure virtual from Stream; the - // read callback will never be called since we are initializing - // with FLAC__stream_decoder_init_FILE() or - // FLAC__stream_decoder_init_file() and those supply the read - // callback internally. - ::FLAC__StreamDecoderReadStatus File::read_callback(FLAC__byte buffer[], size_t *bytes) - { - (void)buffer, (void)bytes; - FLAC__ASSERT(false); - return ::FLAC__STREAM_DECODER_READ_STATUS_ABORT; // double protection - } - - } // namespace Decoder -} // namespace FLAC diff --git a/src/libFLAC++/stream_encoder.cpp b/src/libFLAC++/stream_encoder.cpp deleted file mode 100644 index 1e047849..00000000 --- a/src/libFLAC++/stream_encoder.cpp +++ /dev/null @@ -1,516 +0,0 @@ -/* libFLAC++ - Free Lossless Audio Codec library - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of the Xiph.org Foundation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "FLAC++/encoder.h" -#include "FLAC++/metadata.h" -#include "FLAC/assert.h" - -#ifdef _MSC_VER -// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning) -#pragma warning ( disable : 4800 ) -#endif - -namespace FLAC { - namespace Encoder { - - // ------------------------------------------------------------ - // - // Stream - // - // ------------------------------------------------------------ - - Stream::Stream(): - encoder_(::FLAC__stream_encoder_new()) - { } - - Stream::~Stream() - { - if(0 != encoder_) { - (void)::FLAC__stream_encoder_finish(encoder_); - ::FLAC__stream_encoder_delete(encoder_); - } - } - - bool Stream::is_valid() const - { - return 0 != encoder_; - } - - bool Stream::set_ogg_serial_number(long value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_ogg_serial_number(encoder_, value)); - } - - bool Stream::set_verify(bool value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_verify(encoder_, value)); - } - - bool Stream::set_streamable_subset(bool value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_streamable_subset(encoder_, value)); - } - - bool Stream::set_channels(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_channels(encoder_, value)); - } - - bool Stream::set_bits_per_sample(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_bits_per_sample(encoder_, value)); - } - - bool Stream::set_sample_rate(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_sample_rate(encoder_, value)); - } - - bool Stream::set_compression_level(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_compression_level(encoder_, value)); - } - - bool Stream::set_blocksize(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_blocksize(encoder_, value)); - } - - bool Stream::set_do_mid_side_stereo(bool value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_do_mid_side_stereo(encoder_, value)); - } - - bool Stream::set_loose_mid_side_stereo(bool value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_loose_mid_side_stereo(encoder_, value)); - } - - bool Stream::set_apodization(const char *specification) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_apodization(encoder_, specification)); - } - - bool Stream::set_max_lpc_order(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_max_lpc_order(encoder_, value)); - } - - bool Stream::set_qlp_coeff_precision(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_qlp_coeff_precision(encoder_, value)); - } - - bool Stream::set_do_qlp_coeff_prec_search(bool value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder_, value)); - } - - bool Stream::set_do_escape_coding(bool value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_do_escape_coding(encoder_, value)); - } - - bool Stream::set_do_exhaustive_model_search(bool value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_do_exhaustive_model_search(encoder_, value)); - } - - bool Stream::set_min_residual_partition_order(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_min_residual_partition_order(encoder_, value)); - } - - bool Stream::set_max_residual_partition_order(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_max_residual_partition_order(encoder_, value)); - } - - bool Stream::set_rice_parameter_search_dist(uint32_t value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_rice_parameter_search_dist(encoder_, value)); - } - - bool Stream::set_total_samples_estimate(FLAC__uint64 value) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value)); - } - - bool Stream::set_metadata(::FLAC__StreamMetadata **metadata, uint32_t num_blocks) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks)); - } - - bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, uint32_t num_blocks) - { - FLAC__ASSERT(is_valid()); -#ifndef HAVE_CXX_VARARRAYS - // some compilers (MSVC++, Borland C, SunPro, some GCCs w/ -pedantic) can't handle: - // ::FLAC__StreamMetadata *m[num_blocks]; - // so we do this ugly workaround - ::FLAC__StreamMetadata **m = new ::FLAC__StreamMetadata*[num_blocks]; -#else - ::FLAC__StreamMetadata *m[num_blocks]; -#endif - for(uint32_t i = 0; i < num_blocks; i++) { - // we can get away with the const_cast since we know the encoder will only correct the is_last flags - m[i] = const_cast< ::FLAC__StreamMetadata*>(static_cast(*metadata[i])); - } -#ifndef HAVE_CXX_VARARRAYS - // complete the hack - const bool ok = static_cast(::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks)); - delete [] m; - return ok; -#else - return static_cast(::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks)); -#endif - } - - Stream::State Stream::get_state() const - { - FLAC__ASSERT(is_valid()); - return State(::FLAC__stream_encoder_get_state(encoder_)); - } - - Decoder::Stream::State Stream::get_verify_decoder_state() const - { - FLAC__ASSERT(is_valid()); - return Decoder::Stream::State(::FLAC__stream_encoder_get_verify_decoder_state(encoder_)); - } - - void Stream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got) - { - FLAC__ASSERT(is_valid()); - ::FLAC__stream_encoder_get_verify_decoder_error_stats(encoder_, absolute_sample, frame_number, channel, sample, expected, got); - } - - bool Stream::get_verify() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_get_verify(encoder_)); - } - - bool Stream::get_streamable_subset() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_get_streamable_subset(encoder_)); - } - - bool Stream::get_do_mid_side_stereo() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_get_do_mid_side_stereo(encoder_)); - } - - bool Stream::get_loose_mid_side_stereo() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_get_loose_mid_side_stereo(encoder_)); - } - - uint32_t Stream::get_channels() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_channels(encoder_); - } - - uint32_t Stream::get_bits_per_sample() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_bits_per_sample(encoder_); - } - - uint32_t Stream::get_sample_rate() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_sample_rate(encoder_); - } - - uint32_t Stream::get_blocksize() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_blocksize(encoder_); - } - - uint32_t Stream::get_max_lpc_order() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_max_lpc_order(encoder_); - } - - uint32_t Stream::get_qlp_coeff_precision() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_qlp_coeff_precision(encoder_); - } - - bool Stream::get_do_qlp_coeff_prec_search() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder_)); - } - - bool Stream::get_do_escape_coding() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_get_do_escape_coding(encoder_)); - } - - bool Stream::get_do_exhaustive_model_search() const - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_get_do_exhaustive_model_search(encoder_)); - } - - uint32_t Stream::get_min_residual_partition_order() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_min_residual_partition_order(encoder_); - } - - uint32_t Stream::get_max_residual_partition_order() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_max_residual_partition_order(encoder_); - } - - uint32_t Stream::get_rice_parameter_search_dist() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_rice_parameter_search_dist(encoder_); - } - - FLAC__uint64 Stream::get_total_samples_estimate() const - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_get_total_samples_estimate(encoder_); - } - - ::FLAC__StreamEncoderInitStatus Stream::init() - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_init_stream(encoder_, write_callback_, seek_callback_, tell_callback_, metadata_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamEncoderInitStatus Stream::init_ogg() - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_init_ogg_stream(encoder_, read_callback_, write_callback_, seek_callback_, tell_callback_, metadata_callback_, /*client_data=*/(void*)this); - } - - bool Stream::finish() - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_finish(encoder_)); - } - - bool Stream::process(const FLAC__int32 * const buffer[], uint32_t samples) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_process(encoder_, buffer, samples)); - } - - bool Stream::process_interleaved(const FLAC__int32 buffer[], uint32_t samples) - { - FLAC__ASSERT(is_valid()); - return static_cast(::FLAC__stream_encoder_process_interleaved(encoder_, buffer, samples)); - } - - ::FLAC__StreamEncoderReadStatus Stream::read_callback(FLAC__byte buffer[], size_t *bytes) - { - (void)buffer, (void)bytes; - return ::FLAC__STREAM_ENCODER_READ_STATUS_UNSUPPORTED; - } - - ::FLAC__StreamEncoderSeekStatus Stream::seek_callback(FLAC__uint64 absolute_byte_offset) - { - (void)absolute_byte_offset; - return ::FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED; - } - - ::FLAC__StreamEncoderTellStatus Stream::tell_callback(FLAC__uint64 *absolute_byte_offset) - { - (void)absolute_byte_offset; - return ::FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED; - } - - void Stream::metadata_callback(const ::FLAC__StreamMetadata *metadata) - { - (void)metadata; - } - - ::FLAC__StreamEncoderReadStatus Stream::read_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data) - { - (void)encoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->read_callback(buffer, bytes); - } - - ::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data) - { - (void)encoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->write_callback(buffer, bytes, samples, current_frame); - } - - ::FLAC__StreamEncoderSeekStatus Stream::seek_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) - { - (void)encoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->seek_callback(absolute_byte_offset); - } - - ::FLAC__StreamEncoderTellStatus Stream::tell_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) - { - (void)encoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - return instance->tell_callback(absolute_byte_offset); - } - - void Stream::metadata_callback_(const ::FLAC__StreamEncoder *encoder, const ::FLAC__StreamMetadata *metadata, void *client_data) - { - (void)encoder; - FLAC__ASSERT(0 != client_data); - Stream *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - instance->metadata_callback(metadata); - } - - // ------------------------------------------------------------ - // - // File - // - // ------------------------------------------------------------ - - File::File(): - Stream() - { } - - File::~File() - { - } - - ::FLAC__StreamEncoderInitStatus File::init(FILE *file) - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_init_FILE(encoder_, file, progress_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamEncoderInitStatus File::init(const char *filename) - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_init_file(encoder_, filename, progress_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamEncoderInitStatus File::init(const std::string &filename) - { - return init(filename.c_str()); - } - - ::FLAC__StreamEncoderInitStatus File::init_ogg(FILE *file) - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_init_ogg_FILE(encoder_, file, progress_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamEncoderInitStatus File::init_ogg(const char *filename) - { - FLAC__ASSERT(is_valid()); - return ::FLAC__stream_encoder_init_ogg_file(encoder_, filename, progress_callback_, /*client_data=*/(void*)this); - } - - ::FLAC__StreamEncoderInitStatus File::init_ogg(const std::string &filename) - { - return init_ogg(filename.c_str()); - } - - // This is a dummy to satisfy the pure virtual from Stream; the - // read callback will never be called since we are initializing - // with FLAC__stream_decoder_init_FILE() or - // FLAC__stream_decoder_init_file() and those supply the read - // callback internally. - ::FLAC__StreamEncoderWriteStatus File::write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame) - { - (void)buffer, (void)bytes, (void)samples, (void)current_frame; - FLAC__ASSERT(false); - return ::FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; // double protection - } - - void File::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate) - { - (void)bytes_written, (void)samples_written, (void)frames_written, (void)total_frames_estimate; - } - - void File::progress_callback_(const ::FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data) - { - (void)encoder; - FLAC__ASSERT(0 != client_data); - File *instance = reinterpret_cast(client_data); - FLAC__ASSERT(0 != instance); - instance->progress_callback(bytes_written, samples_written, frames_written, total_frames_estimate); - } - - } // namespace Encoder -} // namespace FLAC diff --git a/src/plugin_common/CMakeLists.txt b/src/plugin_common/CMakeLists.txt deleted file mode 100644 index e5e6d849..00000000 --- a/src/plugin_common/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.12) - -add_library(plugin_common STATIC - charset.c - dither.c - replaygain.c - tags.c) -target_link_libraries(plugin_common PUBLIC $) diff --git a/src/plugin_common/Makefile.am b/src/plugin_common/Makefile.am deleted file mode 100644 index 2c41f5bc..00000000 --- a/src/plugin_common/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -# plugin_common - Routines common to several plugins -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include - -noinst_LTLIBRARIES = libplugin_common.la - -noinst_HEADERS = \ - all.h \ - charset.h \ - defs.h \ - dither.h \ - replaygain.h \ - tags.h - -libplugin_common_la_SOURCES = \ - charset.c \ - dither.c \ - replaygain.c \ - tags.c - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - README diff --git a/src/plugin_common/Makefile.lite b/src/plugin_common/Makefile.lite deleted file mode 100644 index dc494a7e..00000000 --- a/src/plugin_common/Makefile.lite +++ /dev/null @@ -1,42 +0,0 @@ -# plugin_common - Routines common to several plugins -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# -# GNU makefile -# - -topdir = ../.. - -LIB_NAME = libplugin_common -INCLUDES = -I$(topdir)/include -I$(HOME)/local/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lgrabbag -lreplaygain_analysis -lFLAC $(OGG_LIBS) -lm -endif - -SRCS_C = \ - charset.c \ - dither.c \ - replaygain.c \ - tags.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/plugin_common/README b/src/plugin_common/README deleted file mode 100644 index 5a335261..00000000 --- a/src/plugin_common/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains a convenience library of routines that are -common to the plugins. diff --git a/src/plugin_common/all.h b/src/plugin_common/all.h deleted file mode 100644 index 1639ac9d..00000000 --- a/src/plugin_common/all.h +++ /dev/null @@ -1,27 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef FLAC__PLUGIN_COMMON__ALL_H -#define FLAC__PLUGIN_COMMON__ALL_H - -#include "charset.h" -#include "dither.h" -#include "tags.h" - -#endif diff --git a/src/plugin_common/charset.c b/src/plugin_common/charset.c deleted file mode 100644 index 85e574bc..00000000 --- a/src/plugin_common/charset.c +++ /dev/null @@ -1,158 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * Only slightly modified charset.c from: - * EasyTAG - Tag editor for MP3 and OGG files - * Copyright (C) 1999-2001 Håvard Kvålen - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include - -#ifdef HAVE_ICONV -#include -#endif - -#ifdef HAVE_LANGINFO_CODESET -#include -#endif - -#include "charset.h" - - -/************* - * Functions * - *************/ - -char* FLAC_plugin__charset_get_current (void) -{ - char *charset = getenv("CHARSET"); - -#ifdef HAVE_LANGINFO_CODESET - if (!charset) - charset = nl_langinfo(CODESET); -#endif - if (!charset) - charset = "ISO-8859-1"; - - return charset; -} - - -#ifdef HAVE_ICONV -char* FLAC_plugin__charset_convert_string (const char *string, char *from, char *to) -{ - size_t outleft, outsize, length; - iconv_t cd; - char *out, *outptr; - const char *input = string; - - if (!string) - return NULL; - - length = strlen(string); - - if ((cd = iconv_open(to, from)) == (iconv_t)-1) - { -#ifndef NDEBUG - fprintf(stderr, "convert_string(): Conversion not supported. Charsets: %s -> %s", from, to); -#endif - return strdup(string); - } - - /* Due to a GLIBC bug, round outbuf_size up to a multiple of 4 */ - /* + 1 for nul in case len == 1 */ - outsize = ((length + 3) & ~3) + 1; - if(outsize < length) /* overflow check */ - return NULL; - out = malloc(outsize); - outleft = outsize - 1; - outptr = out; - -retry: - if (iconv(cd, (char**)&input, &length, &outptr, &outleft) == (size_t)(-1)) - { - int used; - switch (errno) - { - case E2BIG: - used = outptr - out; - if((outsize - 1) * 2 + 1 <= outsize) { /* overflow check */ - free(out); - return NULL; - } - outsize = (outsize - 1) * 2 + 1; - out = realloc(out, outsize); - outptr = out + used; - outleft = outsize - 1 - used; - goto retry; - case EINVAL: - break; - case EILSEQ: - /* Invalid sequence, try to get the rest of the string */ - input++; - length = strlen(input); - goto retry; - default: -#ifndef NDEBUG - fprintf(stderr, "convert_string(): Conversion failed. Inputstring: %s; Error: %s", string, strerror(errno)); -#endif - break; - } - } - *outptr = '\0'; - - iconv_close(cd); - return out; -} -#else -char* FLAC_plugin__charset_convert_string (const char *string, char *from, char *to) -{ - (void)from, (void)to; - if (!string) - return NULL; - return strdup(string); -} -#endif - -#ifdef HAVE_ICONV -int FLAC_plugin__charset_test_conversion (char *from, char *to) -{ - iconv_t cd; - - if ((cd=iconv_open(to,from)) == (iconv_t)-1) - { - /* Conversion not supported */ - return 0; - } - iconv_close(cd); - return 1; -} -#else -int FLAC_plugin__charset_test_conversion (char *from, char *to) -{ - (void)from, (void)to; - return 1; -} -#endif diff --git a/src/plugin_common/charset.h b/src/plugin_common/charset.h deleted file mode 100644 index d4a62cec..00000000 --- a/src/plugin_common/charset.h +++ /dev/null @@ -1,40 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * Only slightly modified charset.h from: - * charset.h - 2001/12/04 - * EasyTAG - Tag editor for MP3 and OGG files - * Copyright (C) 1999-2001 H蛆ard Kvè™±en - * - * 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., - * with this program; if not, write to the Free Software Foundation, Inc., - */ - - -#ifndef FLAC__PLUGIN_COMMON__CHARSET_H -#define FLAC__PLUGIN_COMMON__CHARSET_H - - -/************** - * Prototypes * - **************/ - -char *FLAC_plugin__charset_get_current(void); -char *FLAC_plugin__charset_convert_string(const char *string, char *from, char *to); - -/* returns 1 for success, 0 for failure or no iconv */ -int FLAC_plugin__charset_test_conversion(char *from, char *to); - -#endif diff --git a/src/plugin_common/defs.h b/src/plugin_common/defs.h deleted file mode 100644 index 61896aed..00000000 --- a/src/plugin_common/defs.h +++ /dev/null @@ -1,25 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef FLAC__PLUGIN_COMMON__DEFS_H -#define FLAC__PLUGIN_COMMON__DEFS_H - -#define FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS 2 - -#endif diff --git a/src/plugin_common/dither.c b/src/plugin_common/dither.c deleted file mode 100644 index b4c9b672..00000000 --- a/src/plugin_common/dither.c +++ /dev/null @@ -1,263 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * dithering routine derived from (other GPLed source): - * mad - MPEG audio decoder - * Copyright (C) 2000-2001 Robert Leslie - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "dither.h" -#include "FLAC/assert.h" - -#ifdef max -#undef max -#endif -#define max(a,b) ((a)>(b)?(a):(b)) - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif - - -/* 32-bit pseudo-random number generator - * - * @@@ According to Miroslav, this one is poor quality, the one from the - * @@@ original replaygain code is much better - */ -static FLaC__INLINE FLAC__uint32 prng(FLAC__uint32 state) -{ - return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL; -} - -/* dither routine derived from MAD winamp plugin */ - -typedef struct { - FLAC__int32 error[3]; - FLAC__int32 random; -} dither_state; - -static FLAC__int32 linear_dither(uint32_t source_bps, uint32_t target_bps, FLAC__int32 sample, dither_state *dither, const FLAC__int32 MIN, const FLAC__int32 MAX) -{ - uint32_t scalebits; - FLAC__int32 output, mask, random; - - FLAC__ASSERT(source_bps < 32); - FLAC__ASSERT(target_bps <= 24); - FLAC__ASSERT(target_bps <= source_bps); - - /* noise shape */ - sample += dither->error[0] - dither->error[1] + dither->error[2]; - - dither->error[2] = dither->error[1]; - dither->error[1] = dither->error[0] / 2; - - /* bias */ - output = sample + (1L << (source_bps - target_bps - 1)); - - scalebits = source_bps - target_bps; - mask = (1L << scalebits) - 1; - - /* dither */ - random = (FLAC__int32)prng(dither->random); - output += (random & mask) - (dither->random & mask); - - dither->random = random; - - /* clip */ - if(output > MAX) { - output = MAX; - - if(sample > MAX) - sample = MAX; - } - else if(output < MIN) { - output = MIN; - - if(sample < MIN) - sample = MIN; - } - - /* quantize */ - output &= ~mask; - - /* error feedback */ - dither->error[0] = sample - output; - - /* scale */ - return output >> scalebits; -} - -size_t FLAC__plugin_common__pack_pcm_signed_big_endian(FLAC__byte *data, const FLAC__int32 * const input[], uint32_t wide_samples, uint32_t channels, uint32_t source_bps, uint32_t target_bps) -{ - static dither_state dither[FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS]; - FLAC__byte * const start = data; - FLAC__int32 sample; - const FLAC__int32 *input_; - uint32_t samples, channel; - const uint32_t bytes_per_sample = target_bps / 8; - const uint32_t incr = bytes_per_sample * channels; - - FLAC__ASSERT(channels > 0 && channels <= FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS); - FLAC__ASSERT(source_bps < 32); - FLAC__ASSERT(target_bps <= 24); - FLAC__ASSERT(target_bps <= source_bps); - FLAC__ASSERT((source_bps & 7) == 0); - FLAC__ASSERT((target_bps & 7) == 0); - - if(source_bps != target_bps) { - const FLAC__int32 MIN = -(1L << (source_bps - 1)); - const FLAC__int32 MAX = ~MIN; /*(1L << (source_bps-1)) - 1 */ - - for(channel = 0; channel < channels; channel++) { - - samples = wide_samples; - data = start + bytes_per_sample * channel; - input_ = input[channel]; - - while(samples--) { - sample = linear_dither(source_bps, target_bps, *input_++, &dither[channel], MIN, MAX); - - switch(target_bps) { - case 8: - data[0] = sample ^ 0x80; - break; - case 16: - data[0] = (FLAC__byte)(sample >> 8); - data[1] = (FLAC__byte)sample; - break; - case 24: - data[0] = (FLAC__byte)(sample >> 16); - data[1] = (FLAC__byte)(sample >> 8); - data[2] = (FLAC__byte)sample; - break; - } - - data += incr; - } - } - } - else { - for(channel = 0; channel < channels; channel++) { - samples = wide_samples; - data = start + bytes_per_sample * channel; - input_ = input[channel]; - - while(samples--) { - sample = *input_++; - - switch(target_bps) { - case 8: - data[0] = sample ^ 0x80; - break; - case 16: - data[0] = (FLAC__byte)(sample >> 8); - data[1] = (FLAC__byte)sample; - break; - case 24: - data[0] = (FLAC__byte)(sample >> 16); - data[1] = (FLAC__byte)(sample >> 8); - data[2] = (FLAC__byte)sample; - break; - } - - data += incr; - } - } - } - - return wide_samples * channels * (target_bps/8); -} - -size_t FLAC__plugin_common__pack_pcm_signed_little_endian(FLAC__byte *data, const FLAC__int32 * const input[], uint32_t wide_samples, uint32_t channels, uint32_t source_bps, uint32_t target_bps) -{ - static dither_state dither[FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS]; - FLAC__byte * const start = data; - FLAC__int32 sample; - const FLAC__int32 *input_; - uint32_t samples, channel; - const uint32_t bytes_per_sample = target_bps / 8; - const uint32_t incr = bytes_per_sample * channels; - - FLAC__ASSERT(channels > 0 && channels <= FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS); - FLAC__ASSERT(source_bps < 32); - FLAC__ASSERT(target_bps <= 24); - FLAC__ASSERT(target_bps <= source_bps); - FLAC__ASSERT((source_bps & 7) == 0); - FLAC__ASSERT((target_bps & 7) == 0); - - if(source_bps != target_bps) { - const FLAC__int32 MIN = -(1L << (source_bps - 1)); - const FLAC__int32 MAX = ~MIN; /*(1L << (source_bps-1)) - 1 */ - - for(channel = 0; channel < channels; channel++) { - - samples = wide_samples; - data = start + bytes_per_sample * channel; - input_ = input[channel]; - - while(samples--) { - sample = linear_dither(source_bps, target_bps, *input_++, &dither[channel], MIN, MAX); - - switch(target_bps) { - case 8: - data[0] = sample ^ 0x80; - break; - case 24: - data[2] = (FLAC__byte)(sample >> 16); - /* fall through */ - case 16: - data[1] = (FLAC__byte)(sample >> 8); - data[0] = (FLAC__byte)sample; - } - - data += incr; - } - } - } - else { - for(channel = 0; channel < channels; channel++) { - samples = wide_samples; - data = start + bytes_per_sample * channel; - input_ = input[channel]; - - while(samples--) { - sample = *input_++; - - switch(target_bps) { - case 8: - data[0] = sample ^ 0x80; - break; - case 24: - data[2] = (FLAC__byte)(sample >> 16); - /* fall through */ - case 16: - data[1] = (FLAC__byte)(sample >> 8); - data[0] = (FLAC__byte)sample; - } - - data += incr; - } - } - } - - return wide_samples * channels * (target_bps/8); -} diff --git a/src/plugin_common/dither.h b/src/plugin_common/dither.h deleted file mode 100644 index e7c1301b..00000000 --- a/src/plugin_common/dither.h +++ /dev/null @@ -1,30 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef FLAC__PLUGIN_COMMON__DITHER_H -#define FLAC__PLUGIN_COMMON__DITHER_H - -#include /* for size_t */ -#include "defs.h" /* buy FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS for the caller */ -#include "FLAC/ordinals.h" - -size_t FLAC__plugin_common__pack_pcm_signed_big_endian(FLAC__byte *data, const FLAC__int32 * const input[], uint32_t wide_samples, uint32_t channels, uint32_t source_bps, uint32_t target_bps); -size_t FLAC__plugin_common__pack_pcm_signed_little_endian(FLAC__byte *data, const FLAC__int32 * const input[], uint32_t wide_samples, uint32_t channels, uint32_t source_bps, uint32_t target_bps); - -#endif diff --git a/src/plugin_common/replaygain.c b/src/plugin_common/replaygain.c deleted file mode 100644 index 40fb0fc2..00000000 --- a/src/plugin_common/replaygain.c +++ /dev/null @@ -1,65 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * Copyright (C) 2003 Philip Jägenstedt - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "replaygain.h" -#include "FLAC/ordinals.h" -#include "FLAC/metadata.h" -#include "share/grabbag.h" - -FLAC__bool FLAC_plugin__replaygain_get_from_file(const char *filename, - double *reference, FLAC__bool *reference_set, - double *track_gain, FLAC__bool *track_gain_set, - double *album_gain, FLAC__bool *album_gain_set, - double *track_peak, FLAC__bool *track_peak_set, - double *album_peak, FLAC__bool *album_peak_set) -{ - FLAC__Metadata_SimpleIterator *iterator = FLAC__metadata_simple_iterator_new(); - FLAC__bool ret = false; - - *track_gain_set = *album_gain_set = *track_peak_set = *album_peak_set = false; - - if(0 != iterator) { - if(FLAC__metadata_simple_iterator_init(iterator, filename, /*read_only=*/true, /*preserve_file_stats=*/true)) { - FLAC__bool got_vorbis_comments = false; - ret = true; - do { - if(FLAC__metadata_simple_iterator_get_block_type(iterator) == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - FLAC__StreamMetadata *block = FLAC__metadata_simple_iterator_get_block(iterator); - if(0 != block) { - if(grabbag__replaygain_load_from_vorbiscomment(block, /*album_mode=*/false, /*strict=*/true, reference, track_gain, track_peak)) { - *reference_set = *track_gain_set = *track_peak_set = true; - } - if(grabbag__replaygain_load_from_vorbiscomment(block, /*album_mode=*/true, /*strict=*/true, reference, album_gain, album_peak)) { - *reference_set = *album_gain_set = *album_peak_set = true; - } - FLAC__metadata_object_delete(block); - got_vorbis_comments = true; - } - } - } while (!got_vorbis_comments && FLAC__metadata_simple_iterator_next(iterator)); - } - FLAC__metadata_simple_iterator_delete(iterator); - } - return ret; -} diff --git a/src/plugin_common/replaygain.h b/src/plugin_common/replaygain.h deleted file mode 100644 index dcb2aa92..00000000 --- a/src/plugin_common/replaygain.h +++ /dev/null @@ -1,33 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * Copyright (C) 2003 Philip Jägenstedt - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__PLUGIN_COMMON__REPLAYGAIN_H -#define FLAC__PLUGIN_COMMON__REPLAYGAIN_H - -#include "FLAC/ordinals.h" - -FLAC__bool FLAC_plugin__replaygain_get_from_file(const char *filename, - double *reference, FLAC__bool *reference_set, - double *track_gain, FLAC__bool *track_gain_set, - double *album_gain, FLAC__bool *album_gain_set, - double *track_peak, FLAC__bool *track_peak_set, - double *album_peak, FLAC__bool *album_peak_set); - -#endif diff --git a/src/plugin_common/tags.c b/src/plugin_common/tags.c deleted file mode 100644 index ae440c5d..00000000 --- a/src/plugin_common/tags.c +++ /dev/null @@ -1,359 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#include "tags.h" -#include "FLAC/assert.h" -#include "FLAC/metadata.h" -#include "share/alloc.h" - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif - - -static FLaC__INLINE size_t local__wide_strlen(const FLAC__uint16 *s) -{ - size_t n = 0; - while(*s++) - n++; - return n; -} - -/* - * also disallows non-shortest-form encodings, c.f. - * http://www.unicode.org/versions/corrigendum1.html - * and a more clear explanation at the end of this section: - * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 - */ -static size_t local__utf8len(const FLAC__byte *utf8) -{ - FLAC__ASSERT(0 != utf8); - if ((utf8[0] & 0x80) == 0) { - return 1; - } - else if ((utf8[0] & 0xE0) == 0xC0 && (utf8[1] & 0xC0) == 0x80) { - if ((utf8[0] & 0xFE) == 0xC0) /* overlong sequence check */ - return 0; - return 2; - } - else if ((utf8[0] & 0xF0) == 0xE0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80) { - if (utf8[0] == 0xE0 && (utf8[1] & 0xE0) == 0x80) /* overlong sequence check */ - return 0; - /* illegal surrogates check (U+D800...U+DFFF and U+FFFE...U+FFFF) */ - if (utf8[0] == 0xED && (utf8[1] & 0xE0) == 0xA0) /* D800-DFFF */ - return 0; - if (utf8[0] == 0xEF && utf8[1] == 0xBF && (utf8[2] & 0xFE) == 0xBE) /* FFFE-FFFF */ - return 0; - return 3; - } - else if ((utf8[0] & 0xF8) == 0xF0 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80) { - if (utf8[0] == 0xF0 && (utf8[1] & 0xF0) == 0x80) /* overlong sequence check */ - return 0; - return 4; - } - else if ((utf8[0] & 0xFC) == 0xF8 && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80) { - if (utf8[0] == 0xF8 && (utf8[1] & 0xF8) == 0x80) /* overlong sequence check */ - return 0; - return 5; - } - else if ((utf8[0] & 0xFE) == 0xFC && (utf8[1] & 0xC0) == 0x80 && (utf8[2] & 0xC0) == 0x80 && (utf8[3] & 0xC0) == 0x80 && (utf8[4] & 0xC0) == 0x80 && (utf8[5] & 0xC0) == 0x80) { - if (utf8[0] == 0xFC && (utf8[1] & 0xFC) == 0x80) /* overlong sequence check */ - return 0; - return 6; - } - else { - return 0; - } -} - - -static size_t local__utf8_to_ucs2(const FLAC__byte *utf8, FLAC__uint16 *ucs2) -{ - const size_t len = local__utf8len(utf8); - - FLAC__ASSERT(0 != ucs2); - - if (len == 1) - *ucs2 = *utf8; - else if (len == 2) - *ucs2 = (*utf8 & 0x3F)<<6 | (*(utf8+1) & 0x3F); - else if (len == 3) - *ucs2 = (*utf8 & 0x1F)<<12 | (*(utf8+1) & 0x3F)<<6 | (*(utf8+2) & 0x3F); - else - *ucs2 = '?'; - - return len; -} - -static FLAC__uint16 *local__convert_utf8_to_ucs2(const char *src, uint32_t length) -{ - FLAC__uint16 *out; - size_t chars = 0; - - FLAC__ASSERT(0 != src); - - /* calculate length */ - { - const uint8_t *s, *end; - for (s=(const uint8_t *)src, end=s+length; s> 6); - utf8[1] = 0x80 | (ucs2 & 0x3f); - return 2; - } - else { - utf8[0] = 0xe0 | (ucs2 >> 12); - utf8[1] = 0x80 | ((ucs2 >> 6) & 0x3f); - utf8[2] = 0x80 | (ucs2 & 0x3f); - return 3; - } -} - -static char *local__convert_ucs2_to_utf8(const FLAC__uint16 *src, uint32_t length) -{ - char *out; - size_t len = 0, n; - - FLAC__ASSERT(0 != src); - - /* calculate length */ - { - uint32_t i; - for (i = 0; i < length; i++) { - n = local__ucs2len(src[i]); - if(len + n < len) /* overflow check */ - return 0; - len += n; - } - } - - /* allocate */ - out = safe_malloc_mul_2op_(len, /*times*/sizeof(char)); - if (0 == out) - return 0; - - /* convert */ - { - uint8_t *u = (uint8_t *)out; - for ( ; *src; src++) - u += local__ucs2_to_utf8(*src, u); - local__ucs2_to_utf8(*src, u); - } - - return out; -} - - -FLAC__bool FLAC_plugin__tags_get(const char *filename, FLAC__StreamMetadata **tags) -{ - if(!FLAC__metadata_get_tags(filename, tags)) - if(0 == (*tags = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT))) - return false; - return true; -} - -FLAC__bool FLAC_plugin__tags_set(const char *filename, const FLAC__StreamMetadata *tags) -{ - FLAC__Metadata_Chain *chain; - FLAC__Metadata_Iterator *iterator; - FLAC__StreamMetadata *block; - FLAC__bool got_vorbis_comments = false; - FLAC__bool ok; - - if(0 == (chain = FLAC__metadata_chain_new())) - return false; - - if(!FLAC__metadata_chain_read(chain, filename)) { - FLAC__metadata_chain_delete(chain); - return false; - } - - if(0 == (iterator = FLAC__metadata_iterator_new())) { - FLAC__metadata_chain_delete(chain); - return false; - } - - FLAC__metadata_iterator_init(iterator, chain); - - do { - if(FLAC__metadata_iterator_get_block_type(iterator) == FLAC__METADATA_TYPE_VORBIS_COMMENT) - got_vorbis_comments = true; - } while(!got_vorbis_comments && FLAC__metadata_iterator_next(iterator)); - - if(0 == (block = FLAC__metadata_object_clone(tags))) { - FLAC__metadata_chain_delete(chain); - FLAC__metadata_iterator_delete(iterator); - return false; - } - - if(got_vorbis_comments) - ok = FLAC__metadata_iterator_set_block(iterator, block); - else - ok = FLAC__metadata_iterator_insert_block_after(iterator, block); - - FLAC__metadata_iterator_delete(iterator); - - if(ok) { - FLAC__metadata_chain_sort_padding(chain); - ok = FLAC__metadata_chain_write(chain, /*use_padding=*/true, /*preserve_file_stats=*/true); - } - - FLAC__metadata_chain_delete(chain); - - return ok; -} - -void FLAC_plugin__tags_destroy(FLAC__StreamMetadata **tags) -{ - FLAC__metadata_object_delete(*tags); - *tags = 0; -} - -const char *FLAC_plugin__tags_get_tag_utf8(const FLAC__StreamMetadata *tags, const char *name) -{ - const int i = FLAC__metadata_object_vorbiscomment_find_entry_from(tags, /*offset=*/0, name); - return (i < 0? 0 : strchr((const char *)tags->data.vorbis_comment.comments[i].entry, '=')+1); -} - -FLAC__uint16 *FLAC_plugin__tags_get_tag_ucs2(const FLAC__StreamMetadata *tags, const char *name) -{ - const char *utf8 = FLAC_plugin__tags_get_tag_utf8(tags, name); - if(0 == utf8) - return 0; - return local__convert_utf8_to_ucs2(utf8, strlen(utf8)+1); /* +1 for terminating null */ -} - -int FLAC_plugin__tags_delete_tag(FLAC__StreamMetadata *tags, const char *name) -{ - return FLAC__metadata_object_vorbiscomment_remove_entries_matching(tags, name); -} - -int FLAC_plugin__tags_delete_all(FLAC__StreamMetadata *tags) -{ - int n = (int)tags->data.vorbis_comment.num_comments; - if(n > 0) { - if(!FLAC__metadata_object_vorbiscomment_resize_comments(tags, 0)) - n = -1; - } - return n; -} - -FLAC__bool FLAC_plugin__tags_add_tag_utf8(FLAC__StreamMetadata *tags, const char *name, const char *value, const char *separator) -{ - int i; - - FLAC__ASSERT(0 != tags); - FLAC__ASSERT(0 != name); - FLAC__ASSERT(0 != value); - - if(separator && (i = FLAC__metadata_object_vorbiscomment_find_entry_from(tags, /*offset=*/0, name)) >= 0) { - FLAC__StreamMetadata_VorbisComment_Entry *entry = tags->data.vorbis_comment.comments+i; - const size_t value_len = strlen(value); - const size_t separator_len = strlen(separator); - FLAC__byte *new_entry; - if(0 == (new_entry = safe_realloc_add_4op_(entry->entry, entry->length, /*+*/value_len, /*+*/separator_len, /*+*/1))) - return false; - memcpy(new_entry+entry->length, separator, separator_len); - entry->length += separator_len; - memcpy(new_entry+entry->length, value, value_len); - entry->length += value_len; - new_entry[entry->length] = '\0'; - entry->entry = new_entry; - } - else { - FLAC__StreamMetadata_VorbisComment_Entry entry; - if(!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, name, value)) - return false; - FLAC__metadata_object_vorbiscomment_append_comment(tags, entry, /*copy=*/false); - } - return true; -} - -FLAC__bool FLAC_plugin__tags_set_tag_ucs2(FLAC__StreamMetadata *tags, const char *name, const FLAC__uint16 *value, FLAC__bool replace_all) -{ - FLAC__StreamMetadata_VorbisComment_Entry entry; - - FLAC__ASSERT(0 != tags); - FLAC__ASSERT(0 != name); - FLAC__ASSERT(0 != value); - - { - char *utf8 = local__convert_ucs2_to_utf8(value, local__wide_strlen(value)+1); /* +1 for the terminating null */ - if(0 == utf8) - return false; - if(!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, name, utf8)) { - free(utf8); - return false; - } - free(utf8); - } - if(!FLAC__metadata_object_vorbiscomment_replace_comment(tags, entry, replace_all, /*copy=*/false)) - return false; - return true; -} diff --git a/src/plugin_common/tags.h b/src/plugin_common/tags.h deleted file mode 100644 index 8b45367d..00000000 --- a/src/plugin_common/tags.h +++ /dev/null @@ -1,75 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef FLAC__PLUGIN_COMMON__TAGS_H -#define FLAC__PLUGIN_COMMON__TAGS_H - -#include "FLAC/format.h" - -FLAC__bool FLAC_plugin__tags_get(const char *filename, FLAC__StreamMetadata **tags); -FLAC__bool FLAC_plugin__tags_set(const char *filename, const FLAC__StreamMetadata *tags); - -/* - * Deletes the tags object and sets '*tags' to NULL. - */ -void FLAC_plugin__tags_destroy(FLAC__StreamMetadata **tags); - -/* - * Gets the value (in UTF-8) of the first tag with the given name (NULL if no - * such tag exists). - */ -const char *FLAC_plugin__tags_get_tag_utf8(const FLAC__StreamMetadata *tags, const char *name); - -/* - * Gets the value (in UCS-2) of the first tag with the given name (NULL if no - * such tag exists). - * - * NOTE: the returned string is malloc()ed and must be free()d by the caller. - */ -FLAC__uint16 *FLAC_plugin__tags_get_tag_ucs2(const FLAC__StreamMetadata *tags, const char *name); - -/* - * Removes all tags with the given 'name'. Returns the number of tags removed, - * or -1 on memory allocation error. - */ -int FLAC_plugin__tags_delete_tag(FLAC__StreamMetadata *tags, const char *name); - -/* - * Removes all tags. Returns the number of tags removed, or -1 on memory - * allocation error. - */ -int FLAC_plugin__tags_delete_all(FLAC__StreamMetadata *tags); - -/* - * Adds a "name=value" tag to the tags. 'value' must be in UTF-8. If - * 'separator' is non-NULL and 'tags' already contains a tag for 'name', the - * first such tag's value is appended with separator, then value. - */ -FLAC__bool FLAC_plugin__tags_add_tag_utf8(FLAC__StreamMetadata *tags, const char *name, const char *value, const char *separator); - -/* - * Adds a "name=value" tag to the tags. 'value' must be in UCS-2. If 'tags' - * already contains a tag or tags for 'name', then they will be replaced - * according to 'replace_all': if 'replace_all' is false, only the first such - * tag will be replaced; if true, all matching tags will be replaced by the one - * new tag. - */ -FLAC__bool FLAC_plugin__tags_set_tag_ucs2(FLAC__StreamMetadata *tags, const char *name, const FLAC__uint16 *value, FLAC__bool replace_all); - -#endif diff --git a/src/plugin_xmms/CMakeLists.txt b/src/plugin_xmms/CMakeLists.txt deleted file mode 100644 index 3c4b716d..00000000 --- a/src/plugin_xmms/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -add_library(xmms-flac STATIC - charset.c - configure.c - fileinfo.c - http.c - plugin.c - tag.c) -target_link_libraries(xmms-flac plugin_common) diff --git a/src/plugin_xmms/Makefile.am b/src/plugin_xmms/Makefile.am deleted file mode 100644 index 3d011a31..00000000 --- a/src/plugin_xmms/Makefile.am +++ /dev/null @@ -1,67 +0,0 @@ -# libxmms-flac - XMMS FLAC input plugin -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite - -noinst_HEADERS = \ - charset.h \ - configure.h \ - http.h \ - locale_hack.h \ - plugin.h \ - tag.h - -AM_CFLAGS = @OGG_CFLAGS@ @XMMS_CFLAGS@ -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -I$(top_srcdir)/src -if FLaC__INSTALL_XMMS_PLUGIN_LOCALLY -xmmsinputplugindir = $(HOME)/.xmms/Plugins -else -xmmsinputplugindir = @XMMS_INPUT_PLUGIN_DIR@ -endif - -xmmsinputplugin_LTLIBRARIES = libxmms-flac.la - -plugin_sources = charset.c configure.c fileinfo.c http.c plugin.c tag.c - -libxmms_flac_la_SOURCES = $(plugin_sources) - -# work around the bug in libtool where its relinking fails with a different DESTDIR -# for libtool bug info see: -# http://mail.gnu.org/pipermail/bug-libtool/2002-February/003018.html -# http://mail.gnu.org/pipermail/libtool/2002-April/006244.html -# http://mail.gnu.org/pipermail/libtool/2002-April/006250.html -# for fix info see: -# http://lists.freshrpms.net/pipermail/rpm-list/2002-April/000746.html -# the workaround is the extra '-L$(top_builddir)/src/libFLAC/.libs' -libxmms_flac_la_LIBADD = \ - $(top_builddir)/src/plugin_common/libplugin_common.la \ - $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \ - $(top_builddir)/src/share/utf8/libutf8.la \ - $(top_builddir)/src/libFLAC/libFLAC.la \ - -L$(top_builddir)/src/libFLAC/.libs \ - @XMMS_LIBS@ \ - @LIBICONV@ -libxmms_flac_la_LDFLAGS = -module -avoid-version diff --git a/src/plugin_xmms/Makefile.lite b/src/plugin_xmms/Makefile.lite deleted file mode 100644 index 87f081e7..00000000 --- a/src/plugin_xmms/Makefile.lite +++ /dev/null @@ -1,45 +0,0 @@ -# libxmms-flac - XMMS FLAC input plugin -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/objs/$(BUILD)/lib - -LIB_NAME = libxmms-flac -INCLUDES = -I./include -I$(topdir)/include -I.. $(shell xmms-config --cflags) -# refer to the static libs explicitly -ifeq ($(OS),Darwin) - LIBS = $(libdir)/libFLAC.a $(libdir)/libplugin_common.a $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a $(OGG_EXPLICIT_LIBS) $(ICONV_LIBS) -lm -lstdc++ -lz -else - LIBS = $(libdir)/libFLAC.a $(libdir)/libplugin_common.a $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a $(OGG_LIBS) -lm -lsupc++ -lz -endif - -SRCS_C = \ - charset.c \ - configure.c \ - plugin.c \ - fileinfo.c \ - http.c \ - tag.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/plugin_xmms/charset.c b/src/plugin_xmms/charset.c deleted file mode 100644 index 6d868488..00000000 --- a/src/plugin_xmms/charset.c +++ /dev/null @@ -1,200 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Daisuke Shimamura - * - * Almost from charset.c - * EasyTAG - Tag editor for MP3 and OGG files - * Copyright (C) 1999-2001 Håvard Kvålen - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "plugin.h" - -#include -#include -#include -#include - -#include "plugin_common/charset.h" -#include "charset.h" -#include "configure.h" -#include "locale_hack.h" - - -/**************** - * Declarations * - ****************/ - -#define CHARSET_TRANS_ARRAY_LEN ( sizeof(charset_trans_array) / sizeof((charset_trans_array)[0]) ) -const CharsetInfo charset_trans_array[] = { - {N_("Arabic (IBM-864)"), "IBM864" }, - {N_("Arabic (ISO-8859-6)"), "ISO-8859-6" }, - {N_("Arabic (Windows-1256)"), "windows-1256" }, - {N_("Baltic (ISO-8859-13)"), "ISO-8859-13" }, - {N_("Baltic (ISO-8859-4)"), "ISO-8859-4" }, - {N_("Baltic (Windows-1257)"), "windows-1257" }, - {N_("Celtic (ISO-8859-14)"), "ISO-8859-14" }, - {N_("Central European (IBM-852)"), "IBM852" }, - {N_("Central European (ISO-8859-2)"), "ISO-8859-2" }, - {N_("Central European (Windows-1250)"), "windows-1250" }, - {N_("Chinese Simplified (GB18030)"), "gb18030" }, - {N_("Chinese Simplified (GB2312)"), "GB2312" }, - {N_("Chinese Traditional (Big5)"), "Big5" }, - {N_("Chinese Traditional (Big5-HKSCS)"), "Big5-HKSCS" }, - {N_("Cyrillic (IBM-855)"), "IBM855" }, - {N_("Cyrillic (ISO-8859-5)"), "ISO-8859-5" }, - {N_("Cyrillic (ISO-IR-111)"), "ISO-IR-111" }, - {N_("Cyrillic (KOI8-R)"), "KOI8-R" }, - {N_("Cyrillic (Windows-1251)"), "windows-1251" }, - {N_("Cyrillic/Russian (CP-866)"), "IBM866" }, - {N_("Cyrillic/Ukrainian (KOI8-U)"), "KOI8-U" }, - {N_("English (US-ASCII)"), "us-ascii" }, - {N_("Greek (ISO-8859-7)"), "ISO-8859-7" }, - {N_("Greek (Windows-1253)"), "windows-1253" }, - {N_("Hebrew (IBM-862)"), "IBM862" }, - {N_("Hebrew (Windows-1255)"), "windows-1255" }, - {N_("Japanese (EUC-JP)"), "EUC-JP" }, - {N_("Japanese (ISO-2022-JP)"), "ISO-2022-JP" }, - {N_("Japanese (Shift_JIS)"), "Shift_JIS" }, - {N_("Korean (EUC-KR)"), "EUC-KR" }, - {N_("Nordic (ISO-8859-10)"), "ISO-8859-10" }, - {N_("South European (ISO-8859-3)"), "ISO-8859-3" }, - {N_("Thai (TIS-620)"), "TIS-620" }, - {N_("Turkish (IBM-857)"), "IBM857" }, - {N_("Turkish (ISO-8859-9)"), "ISO-8859-9" }, - {N_("Turkish (Windows-1254)"), "windows-1254" }, - {N_("Unicode (UTF-7)"), "UTF-7" }, - {N_("Unicode (UTF-8)"), "UTF-8" }, - {N_("Unicode (UTF-16BE)"), "UTF-16BE" }, - {N_("Unicode (UTF-16LE)"), "UTF-16LE" }, - {N_("Unicode (UTF-32BE)"), "UTF-32BE" }, - {N_("Unicode (UTF-32LE)"), "UTF-32LE" }, - {N_("Vietnamese (VISCII)"), "VISCII" }, - {N_("Vietnamese (Windows-1258)"), "windows-1258" }, - {N_("Visual Hebrew (ISO-8859-8)"), "ISO-8859-8" }, - {N_("Western (IBM-850)"), "IBM850" }, - {N_("Western (ISO-8859-1)"), "ISO-8859-1" }, - {N_("Western (ISO-8859-15)"), "ISO-8859-15" }, - {N_("Western (Windows-1252)"), "windows-1252" } - - /* - * From this point, character sets aren't supported by iconv - */ -#if 0 - {N_("Arabic (IBM-864-I)"), "IBM864i" }, - {N_("Arabic (ISO-8859-6-E)"), "ISO-8859-6-E" }, - {N_("Arabic (ISO-8859-6-I)"), "ISO-8859-6-I" }, - {N_("Arabic (MacArabic)"), "x-mac-arabic" }, - {N_("Armenian (ARMSCII-8)"), "armscii-8" }, - {N_("Central European (MacCE)"), "x-mac-ce" }, - {N_("Chinese Simplified (GBK)"), "x-gbk" }, - {N_("Chinese Simplified (HZ)"), "HZ-GB-2312" }, - {N_("Chinese Traditional (EUC-TW)"), "x-euc-tw" }, - {N_("Croatian (MacCroatian)"), "x-mac-croatian" }, - {N_("Cyrillic (MacCyrillic)"), "x-mac-cyrillic" }, - {N_("Cyrillic/Ukrainian (MacUkrainian)"), "x-mac-ukrainian" }, - {N_("Farsi (MacFarsi)"), "x-mac-farsi"}, - {N_("Greek (MacGreek)"), "x-mac-greek" }, - {N_("Gujarati (MacGujarati)"), "x-mac-gujarati" }, - {N_("Gurmukhi (MacGurmukhi)"), "x-mac-gurmukhi" }, - {N_("Hebrew (ISO-8859-8-E)"), "ISO-8859-8-E" }, - {N_("Hebrew (ISO-8859-8-I)"), "ISO-8859-8-I" }, - {N_("Hebrew (MacHebrew)"), "x-mac-hebrew" }, - {N_("Hindi (MacDevanagari)"), "x-mac-devanagari" }, - {N_("Icelandic (MacIcelandic)"), "x-mac-icelandic" }, - {N_("Korean (JOHAB)"), "x-johab" }, - {N_("Korean (UHC)"), "x-windows-949" }, - {N_("Romanian (MacRomanian)"), "x-mac-romanian" }, - {N_("Turkish (MacTurkish)"), "x-mac-turkish" }, - {N_("User Defined"), "x-user-defined" }, - {N_("Vietnamese (TCVN)"), "x-viet-tcvn5712" }, - {N_("Vietnamese (VPS)"), "x-viet-vps" }, - {N_("Western (MacRoman)"), "x-mac-roman" }, - /* charsets whithout posibly translatable names */ - {"T61.8bit", "T61.8bit" }, - {"x-imap4-modified-utf7", "x-imap4-modified-utf7"}, - {"x-u-escaped", "x-u-escaped" }, - {"windows-936", "windows-936" } -#endif -}; - -/************* - * Functions * - *************/ - -/* - * Commons conversion functions - */ -char *convert_from_utf8_to_user(const char *string) -{ - return FLAC_plugin__charset_convert_string(string, "UTF-8", flac_cfg.title.user_char_set); -} - -char *convert_from_user_to_utf8(const char *string) -{ - return FLAC_plugin__charset_convert_string(string, flac_cfg.title.user_char_set, "UTF-8"); -} - -GList *Charset_Create_List (void) -{ - GList *list = NULL; - guint i; - - for (i=0; i - * - * 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., - * with this program; if not, write to the Free Software Foundation, Inc., - */ - - -#ifndef FLAC__PLUGIN_XMMS__CHARSET_H -#define FLAC__PLUGIN_XMMS__CHARSET_H - - -/*************** - * Declaration * - ***************/ - -typedef struct { - gchar *charset_title; - gchar *charset_name; -} CharsetInfo; - -/* translated charset titles */ -extern const CharsetInfo charset_trans_array[]; - -/************** - * Prototypes * - **************/ - -/* - * The returned strings are malloc()ed an must be free()d by the caller - */ -char *convert_from_utf8_to_user(const char *string); -char *convert_from_user_to_utf8(const char *string); - -GList *Charset_Create_List (void); -GList *Charset_Create_List_UTF8_Only (void); -gchar *Charset_Get_Name_From_Title (gchar *charset_title); -gchar *Charset_Get_Title_From_Name (gchar *charset_name); - -#endif /* __CHARSET_H__ */ - diff --git a/src/plugin_xmms/configure.c b/src/plugin_xmms/configure.c deleted file mode 100644 index a4889c06..00000000 --- a/src/plugin_xmms/configure.c +++ /dev/null @@ -1,825 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Daisuke Shimamura - * - * Based on mpg123 plugin - * and prefs.c - 2000/05/06 - * EasyTAG - Tag editor for MP3 and OGG files - * Copyright (C) 2000-2002 Jerome Couderc - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "plugin.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "share/replaygain_synthesis.h" /* for NOISE_SHAPING_LOW */ -#include "charset.h" -#include "configure.h" -#include "locale_hack.h" - -/* - * Initialize Global Variable - */ -flac_config_t flac_cfg = { - /* title */ - { - FALSE, /* tag_override */ - NULL, /* tag_format */ - FALSE, /* convert_char_set */ - NULL /* user_char_set */ - }, - /* stream */ - { - 100 /* KB */, /* http_buffer_size */ - 50, /* http_prebuffer */ - FALSE, /* use_proxy */ - NULL, /* proxy_host */ - 0, /* proxy_port */ - FALSE, /* proxy_use_auth */ - NULL, /* proxy_user */ - NULL, /* proxy_pass */ - FALSE, /* save_http_stream */ - NULL, /* save_http_path */ - FALSE, /* cast_title_streaming */ - FALSE /* use_udp_channel */ - }, - /* output */ - { - /* replaygain */ - { - FALSE, /* enable */ - TRUE, /* album_mode */ - 0, /* preamp */ - FALSE /* hard_limit */ - }, - /* resolution */ - { - /* normal */ - { - TRUE /* dither_24_to_16 */ - }, - /* replaygain */ - { - TRUE, /* dither */ - NOISE_SHAPING_LOW, /* noise_shaping */ - 16 /* bps_out */ - } - } - } -}; - - -static GtkWidget *flac_configurewin = NULL; -static GtkWidget *vbox, *notebook; - -static GtkWidget *title_tag_override, *title_tag_box, *title_tag_entry, *title_desc; -static GtkWidget *convert_char_set, *fileCharacterSetEntry, *userCharacterSetEntry; -static GtkWidget *replaygain_enable, *replaygain_album_mode; -static GtkWidget *replaygain_preamp_hscale, *replaygain_preamp_label, *replaygain_hard_limit; -static GtkObject *replaygain_preamp; -static GtkWidget *resolution_normal_dither_24_to_16; -static GtkWidget *resolution_replaygain_dither; -static GtkWidget *resolution_replaygain_noise_shaping_frame; -static GtkWidget *resolution_replaygain_noise_shaping_radio_none; -static GtkWidget *resolution_replaygain_noise_shaping_radio_low; -static GtkWidget *resolution_replaygain_noise_shaping_radio_medium; -static GtkWidget *resolution_replaygain_noise_shaping_radio_high; -static GtkWidget *resolution_replaygain_bps_out_frame; -static GtkWidget *resolution_replaygain_bps_out_radio_16bps; -static GtkWidget *resolution_replaygain_bps_out_radio_24bps; - -static GtkObject *streaming_size_adj, *streaming_pre_adj; -static GtkWidget *streaming_proxy_use, *streaming_proxy_host_entry; -static GtkWidget *streaming_proxy_port_entry, *streaming_save_use, *streaming_save_entry; -static GtkWidget *streaming_proxy_auth_use; -static GtkWidget *streaming_proxy_auth_pass_entry, *streaming_proxy_auth_user_entry; -static GtkWidget *streaming_proxy_auth_user_label, *streaming_proxy_auth_pass_label; -#ifdef FLAC_ICECAST -static GtkWidget *streaming_cast_title, *streaming_udp_title; -#endif -static GtkWidget *streaming_proxy_hbox, *streaming_proxy_auth_hbox, *streaming_save_dirbrowser; -static GtkWidget *streaming_save_hbox; - -static gchar *gtk_entry_get_text_1 (GtkWidget *widget); -static void flac_configurewin_ok(GtkWidget * widget, gpointer data); -static void configure_destroy(GtkWidget * w, gpointer data); - -static void flac_configurewin_ok(GtkWidget * widget, gpointer data) -{ - ConfigFile *cfg; - gchar *filename; - - (void)widget, (void)data; /* unused arguments */ - g_free(flac_cfg.title.tag_format); - flac_cfg.title.tag_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(title_tag_entry))); - flac_cfg.title.user_char_set = Charset_Get_Name_From_Title(gtk_entry_get_text_1(userCharacterSetEntry)); - - filename = g_strconcat(g_get_home_dir(), "/.xmms/config", NULL); - cfg = xmms_cfg_open_file(filename); - if (!cfg) - cfg = xmms_cfg_new(); - /* title */ - xmms_cfg_write_boolean(cfg, "flac", "title.tag_override", flac_cfg.title.tag_override); - xmms_cfg_write_string(cfg, "flac", "title.tag_format", flac_cfg.title.tag_format); - xmms_cfg_write_boolean(cfg, "flac", "title.convert_char_set", flac_cfg.title.convert_char_set); - xmms_cfg_write_string(cfg, "flac", "title.user_char_set", flac_cfg.title.user_char_set); - /* output */ - xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.enable", flac_cfg.output.replaygain.enable); - xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.album_mode", flac_cfg.output.replaygain.album_mode); - xmms_cfg_write_int(cfg, "flac", "output.replaygain.preamp", flac_cfg.output.replaygain.preamp); - xmms_cfg_write_boolean(cfg, "flac", "output.replaygain.hard_limit", flac_cfg.output.replaygain.hard_limit); - xmms_cfg_write_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", flac_cfg.output.resolution.normal.dither_24_to_16); - xmms_cfg_write_boolean(cfg, "flac", "output.resolution.replaygain.dither", flac_cfg.output.resolution.replaygain.dither); - xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", flac_cfg.output.resolution.replaygain.noise_shaping); - xmms_cfg_write_int(cfg, "flac", "output.resolution.replaygain.bps_out", flac_cfg.output.resolution.replaygain.bps_out); - /* streaming */ - flac_cfg.stream.http_buffer_size = (gint) GTK_ADJUSTMENT(streaming_size_adj)->value; - flac_cfg.stream.http_prebuffer = (gint) GTK_ADJUSTMENT(streaming_pre_adj)->value; - - flac_cfg.stream.use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use)); - if(flac_cfg.stream.proxy_host) - g_free(flac_cfg.stream.proxy_host); - flac_cfg.stream.proxy_host = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_host_entry))); - flac_cfg.stream.proxy_port = atoi(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_port_entry))); - - flac_cfg.stream.proxy_use_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use)); - - if(flac_cfg.stream.proxy_user) - g_free(flac_cfg.stream.proxy_user); - flac_cfg.stream.proxy_user = NULL; - if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))) > 0) - flac_cfg.stream.proxy_user = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_user_entry))); - - if(flac_cfg.stream.proxy_pass) - g_free(flac_cfg.stream.proxy_pass); - flac_cfg.stream.proxy_pass = NULL; - if(strlen(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))) > 0) - flac_cfg.stream.proxy_pass = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_proxy_auth_pass_entry))); - - - flac_cfg.stream.save_http_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); - if (flac_cfg.stream.save_http_path) - g_free(flac_cfg.stream.save_http_path); - flac_cfg.stream.save_http_path = g_strdup(gtk_entry_get_text(GTK_ENTRY(streaming_save_entry))); - -#ifdef FLAC_ICECAST - flac_cfg.stream.cast_title_streaming = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_cast_title)); - flac_cfg.stream.use_udp_channel = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_udp_title)); -#endif - - xmms_cfg_write_int(cfg, "flac", "stream.http_buffer_size", flac_cfg.stream.http_buffer_size); - xmms_cfg_write_int(cfg, "flac", "stream.http_prebuffer", flac_cfg.stream.http_prebuffer); - xmms_cfg_write_boolean(cfg, "flac", "stream.use_proxy", flac_cfg.stream.use_proxy); - xmms_cfg_write_string(cfg, "flac", "stream.proxy_host", flac_cfg.stream.proxy_host); - xmms_cfg_write_int(cfg, "flac", "stream.proxy_port", flac_cfg.stream.proxy_port); - xmms_cfg_write_boolean(cfg, "flac", "stream.proxy_use_auth", flac_cfg.stream.proxy_use_auth); - if(flac_cfg.stream.proxy_user) - xmms_cfg_write_string(cfg, "flac", "stream.proxy_user", flac_cfg.stream.proxy_user); - else - xmms_cfg_remove_key(cfg, "flac", "stream.proxy_user"); - if(flac_cfg.stream.proxy_pass) - xmms_cfg_write_string(cfg, "flac", "stream.proxy_pass", flac_cfg.stream.proxy_pass); - else - xmms_cfg_remove_key(cfg, "flac", "stream.proxy_pass"); - xmms_cfg_write_boolean(cfg, "flac", "stream.save_http_stream", flac_cfg.stream.save_http_stream); - xmms_cfg_write_string(cfg, "flac", "stream.save_http_path", flac_cfg.stream.save_http_path); -#ifdef FLAC_ICECAST - xmms_cfg_write_boolean(cfg, "flac", "stream.cast_title_streaming", flac_cfg.stream.cast_title_streaming); - xmms_cfg_write_boolean(cfg, "flac", "stream.use_udp_channel", flac_cfg.stream.use_udp_channel); -#endif - - xmms_cfg_write_file(cfg, filename); - xmms_cfg_free(cfg); - g_free(filename); - gtk_widget_destroy(flac_configurewin); -} - -static void configure_destroy(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ -} - -static void title_tag_override_cb(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ - flac_cfg.title.tag_override = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(title_tag_override)); - - gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override); - gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override); - -} - -static void convert_char_set_cb(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ - flac_cfg.title.convert_char_set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(convert_char_set)); - - gtk_widget_set_sensitive(fileCharacterSetEntry, FALSE); - gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set); -} - -static void replaygain_enable_cb(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ - flac_cfg.output.replaygain.enable = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_enable)); - - gtk_widget_set_sensitive(replaygain_album_mode, flac_cfg.output.replaygain.enable); - gtk_widget_set_sensitive(replaygain_preamp_hscale, flac_cfg.output.replaygain.enable); - gtk_widget_set_sensitive(replaygain_hard_limit, flac_cfg.output.replaygain.enable); -} - -static void replaygain_album_mode_cb(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ - flac_cfg.output.replaygain.album_mode = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_album_mode)); -} - -static void replaygain_hard_limit_cb(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ - flac_cfg.output.replaygain.hard_limit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit)); -} - -static void replaygain_preamp_cb(GtkWidget *widget, gpointer data) -{ - GString *gstring = g_string_new(""); - (void)widget, (void)data; /* unused arguments */ - flac_cfg.output.replaygain.preamp = (int) floor(GTK_ADJUSTMENT(replaygain_preamp)->value + 0.5); - - g_string_sprintf(gstring, "%i dB", flac_cfg.output.replaygain.preamp); - gtk_label_set_text(GTK_LABEL(replaygain_preamp_label), _(gstring->str)); -} - -static void resolution_normal_dither_24_to_16_cb(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ - flac_cfg.output.resolution.normal.dither_24_to_16 = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16)); -} - -static void resolution_replaygain_dither_cb(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ - flac_cfg.output.resolution.replaygain.dither = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither)); - - gtk_widget_set_sensitive(resolution_replaygain_noise_shaping_frame, flac_cfg.output.resolution.replaygain.dither); -} - -static void resolution_replaygain_noise_shaping_cb(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ - flac_cfg.output.resolution.replaygain.noise_shaping = - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none))? 0 : - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low))? 1 : - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium))? 2 : - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high))? 3 : - 0 - ; -} - -static void resolution_replaygain_bps_out_cb(GtkWidget *widget, gpointer data) -{ - (void)widget, (void)data; /* unused arguments */ - flac_cfg.output.resolution.replaygain.bps_out = - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps))? 16 : - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps))? 24 : - 16 - ; -} - -static void proxy_use_cb(GtkWidget * w, gpointer data) -{ - gboolean use_proxy, use_proxy_auth; - (void) w; - (void) data; - - use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use)); - use_proxy_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use)); - - gtk_widget_set_sensitive(streaming_proxy_hbox, use_proxy); - gtk_widget_set_sensitive(streaming_proxy_auth_use, use_proxy); - gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy && use_proxy_auth); -} - -static void proxy_auth_use_cb(GtkWidget *w, gpointer data) -{ - gboolean use_proxy, use_proxy_auth; - (void) w; - (void) data; - - use_proxy = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_use)); - use_proxy_auth = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use)); - - gtk_widget_set_sensitive(streaming_proxy_auth_hbox, use_proxy && use_proxy_auth); -} - -static void streaming_save_dirbrowser_cb(gchar * dir) -{ - gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), dir); -} - -static void streaming_save_browse_cb(GtkWidget * w, gpointer data) -{ - (void) w; - (void) data; - if (!streaming_save_dirbrowser) - { - streaming_save_dirbrowser = xmms_create_dir_browser(_("Select the directory where you want to store the MPEG streams:"), - flac_cfg.stream.save_http_path, GTK_SELECTION_SINGLE, streaming_save_dirbrowser_cb); - gtk_signal_connect(GTK_OBJECT(streaming_save_dirbrowser), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &streaming_save_dirbrowser); - gtk_window_set_transient_for(GTK_WINDOW(streaming_save_dirbrowser), GTK_WINDOW(flac_configurewin)); - gtk_widget_show(streaming_save_dirbrowser); - } -} - -static void streaming_save_use_cb(GtkWidget * w, gpointer data) -{ - gboolean save_stream; - (void) w; - (void) data; - - save_stream = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(streaming_save_use)); - - gtk_widget_set_sensitive(streaming_save_hbox, save_stream); -} - - -void FLAC_XMMS__configure(void) -{ - GtkWidget *title_frame, *title_tag_vbox, *title_tag_label; - GtkWidget *replaygain_frame, *resolution_frame, *output_vbox, *resolution_normal_frame, *resolution_replaygain_frame; - GtkWidget *replaygain_vbox, *resolution_hbox, *resolution_normal_vbox, *resolution_replaygain_vbox; - GtkWidget *resolution_replaygain_noise_shaping_vbox; - GtkWidget *resolution_replaygain_bps_out_vbox; - GtkWidget *label, *hbox; - GtkWidget *bbox, *ok, *cancel; - GList *list; - - GtkWidget *streaming_vbox; - GtkWidget *streaming_buf_frame, *streaming_buf_hbox; - GtkWidget *streaming_size_box, *streaming_size_label, *streaming_size_spin; - GtkWidget *streaming_pre_box, *streaming_pre_label, *streaming_pre_spin; - GtkWidget *streaming_proxy_frame, *streaming_proxy_vbox; - GtkWidget *streaming_proxy_port_label, *streaming_proxy_host_label; - GtkWidget *streaming_save_frame, *streaming_save_vbox; - GtkWidget *streaming_save_label, *streaming_save_browse; -#ifdef FLAC_ICECAST - GtkWidget *streaming_cast_frame, *streaming_cast_vbox; -#endif - char *temp; - - if (flac_configurewin != NULL) { - gdk_window_raise(flac_configurewin->window); - return; - } - flac_configurewin = gtk_window_new(GTK_WINDOW_DIALOG); - gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &flac_configurewin); - gtk_signal_connect(GTK_OBJECT(flac_configurewin), "destroy", GTK_SIGNAL_FUNC(configure_destroy), &flac_configurewin); - gtk_window_set_title(GTK_WINDOW(flac_configurewin), _("Flac Configuration")); - gtk_window_set_policy(GTK_WINDOW(flac_configurewin), FALSE, FALSE, FALSE); - gtk_container_border_width(GTK_CONTAINER(flac_configurewin), 10); - - vbox = gtk_vbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(flac_configurewin), vbox); - - notebook = gtk_notebook_new(); - gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); - - /* Title config.. */ - - title_frame = gtk_frame_new(_("Tag Handling")); - gtk_container_border_width(GTK_CONTAINER(title_frame), 5); - - title_tag_vbox = gtk_vbox_new(FALSE, 10); - gtk_container_border_width(GTK_CONTAINER(title_tag_vbox), 5); - gtk_container_add(GTK_CONTAINER(title_frame), title_tag_vbox); - - /* Convert Char Set */ - - convert_char_set = gtk_check_button_new_with_label(_("Convert Character Set")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(convert_char_set), flac_cfg.title.convert_char_set); - gtk_signal_connect(GTK_OBJECT(convert_char_set), "clicked", convert_char_set_cb, NULL); - gtk_box_pack_start(GTK_BOX(title_tag_vbox), convert_char_set, FALSE, FALSE, 0); - /* Combo boxes... */ - hbox = gtk_hbox_new(FALSE,4); - gtk_container_add(GTK_CONTAINER(title_tag_vbox),hbox); - label = gtk_label_new(_("Convert character set from :")); - gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0); - fileCharacterSetEntry = gtk_combo_new(); - gtk_box_pack_start(GTK_BOX(hbox),fileCharacterSetEntry,TRUE,TRUE,0); - - label = gtk_label_new (_("to :")); - gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0); - userCharacterSetEntry = gtk_combo_new(); - gtk_box_pack_start(GTK_BOX(hbox),userCharacterSetEntry,TRUE,TRUE,0); - - gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(fileCharacterSetEntry)->entry),FALSE); - gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),FALSE); - gtk_combo_set_value_in_list(GTK_COMBO(fileCharacterSetEntry),TRUE,FALSE); - gtk_combo_set_value_in_list(GTK_COMBO(userCharacterSetEntry),TRUE,FALSE); - - list = Charset_Create_List(); - gtk_combo_set_popdown_strings(GTK_COMBO(fileCharacterSetEntry),Charset_Create_List_UTF8_Only()); - gtk_combo_set_popdown_strings(GTK_COMBO(userCharacterSetEntry),list); - gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(userCharacterSetEntry)->entry),Charset_Get_Title_From_Name(flac_cfg.title.user_char_set)); - gtk_widget_set_sensitive(fileCharacterSetEntry, FALSE); - gtk_widget_set_sensitive(userCharacterSetEntry, flac_cfg.title.convert_char_set); - - /* Override Tagging Format */ - - title_tag_override = gtk_check_button_new_with_label(_("Override generic titles")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(title_tag_override), flac_cfg.title.tag_override); - gtk_signal_connect(GTK_OBJECT(title_tag_override), "clicked", title_tag_override_cb, NULL); - gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_override, FALSE, FALSE, 0); - - title_tag_box = gtk_hbox_new(FALSE, 5); - gtk_widget_set_sensitive(title_tag_box, flac_cfg.title.tag_override); - gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_tag_box, FALSE, FALSE, 0); - - title_tag_label = gtk_label_new(_("Title format:")); - gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_label, FALSE, FALSE, 0); - - title_tag_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(title_tag_entry), flac_cfg.title.tag_format); - gtk_box_pack_start(GTK_BOX(title_tag_box), title_tag_entry, TRUE, TRUE, 0); - - title_desc = xmms_titlestring_descriptions("pafFetnygc", 2); - gtk_widget_set_sensitive(title_desc, flac_cfg.title.tag_override); - gtk_box_pack_start(GTK_BOX(title_tag_vbox), title_desc, FALSE, FALSE, 0); - - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), title_frame, gtk_label_new(_("Title"))); - - /* Output config.. */ - - output_vbox = gtk_vbox_new(FALSE, 10); - gtk_container_border_width(GTK_CONTAINER(output_vbox), 5); - - /* replaygain */ - - replaygain_frame = gtk_frame_new(_("ReplayGain")); - gtk_container_border_width(GTK_CONTAINER(replaygain_frame), 5); - gtk_box_pack_start(GTK_BOX(output_vbox), replaygain_frame, TRUE, TRUE, 0); - - replaygain_vbox = gtk_vbox_new(FALSE, 10); - gtk_container_border_width(GTK_CONTAINER(replaygain_vbox), 5); - gtk_container_add(GTK_CONTAINER(replaygain_frame), replaygain_vbox); - - replaygain_enable = gtk_check_button_new_with_label(_("Enable ReplayGain processing")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_enable), flac_cfg.output.replaygain.enable); - gtk_signal_connect(GTK_OBJECT(replaygain_enable), "clicked", replaygain_enable_cb, NULL); - gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_enable, FALSE, FALSE, 0); - - replaygain_album_mode = gtk_check_button_new_with_label(_("Album mode")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_album_mode), flac_cfg.output.replaygain.album_mode); - gtk_signal_connect(GTK_OBJECT(replaygain_album_mode), "clicked", replaygain_album_mode_cb, NULL); - gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_album_mode, FALSE, FALSE, 0); - - hbox = gtk_hbox_new(FALSE,3); - gtk_container_add(GTK_CONTAINER(replaygain_vbox),hbox); - label = gtk_label_new(_("Preamp:")); - gtk_box_pack_start(GTK_BOX(hbox),label,FALSE,FALSE,0); - replaygain_preamp = gtk_adjustment_new(flac_cfg.output.replaygain.preamp, -24.0, +24.0, 1.0, 6.0, 0.0); - gtk_signal_connect(GTK_OBJECT(replaygain_preamp), "value-changed", replaygain_preamp_cb, NULL); - replaygain_preamp_hscale = gtk_hscale_new(GTK_ADJUSTMENT(replaygain_preamp)); - gtk_scale_set_draw_value(GTK_SCALE(replaygain_preamp_hscale), FALSE); - gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_hscale,TRUE,TRUE,0); - replaygain_preamp_label = gtk_label_new(_("0 dB")); - gtk_box_pack_start(GTK_BOX(hbox),replaygain_preamp_label,FALSE,FALSE,0); - gtk_adjustment_value_changed(GTK_ADJUSTMENT(replaygain_preamp)); - - replaygain_hard_limit = gtk_check_button_new_with_label(_("6dB hard limiting")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygain_hard_limit), flac_cfg.output.replaygain.hard_limit); - gtk_signal_connect(GTK_OBJECT(replaygain_hard_limit), "clicked", replaygain_hard_limit_cb, NULL); - gtk_box_pack_start(GTK_BOX(replaygain_vbox), replaygain_hard_limit, FALSE, FALSE, 0); - - replaygain_enable_cb(replaygain_enable, NULL); - - /* resolution */ - - resolution_frame = gtk_frame_new(_("Resolution")); - gtk_container_border_width(GTK_CONTAINER(resolution_frame), 5); - gtk_box_pack_start(GTK_BOX(output_vbox), resolution_frame, TRUE, TRUE, 0); - - resolution_hbox = gtk_hbox_new(FALSE, 10); - gtk_container_border_width(GTK_CONTAINER(resolution_hbox), 5); - gtk_container_add(GTK_CONTAINER(resolution_frame), resolution_hbox); - - resolution_normal_frame = gtk_frame_new(_("Without ReplayGain")); - gtk_container_border_width(GTK_CONTAINER(resolution_normal_frame), 5); - gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_normal_frame, TRUE, TRUE, 0); - - resolution_normal_vbox = gtk_vbox_new(FALSE, 10); - gtk_container_border_width(GTK_CONTAINER(resolution_normal_vbox), 5); - gtk_container_add(GTK_CONTAINER(resolution_normal_frame), resolution_normal_vbox); - - resolution_normal_dither_24_to_16 = gtk_check_button_new_with_label(_("Dither 24bps to 16bps")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_normal_dither_24_to_16), flac_cfg.output.resolution.normal.dither_24_to_16); - gtk_signal_connect(GTK_OBJECT(resolution_normal_dither_24_to_16), "clicked", resolution_normal_dither_24_to_16_cb, NULL); - gtk_box_pack_start(GTK_BOX(resolution_normal_vbox), resolution_normal_dither_24_to_16, FALSE, FALSE, 0); - - resolution_replaygain_frame = gtk_frame_new(_("With ReplayGain")); - gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_frame), 5); - gtk_box_pack_start(GTK_BOX(resolution_hbox), resolution_replaygain_frame, TRUE, TRUE, 0); - - resolution_replaygain_vbox = gtk_vbox_new(FALSE, 10); - gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_vbox), 5); - gtk_container_add(GTK_CONTAINER(resolution_replaygain_frame), resolution_replaygain_vbox); - - resolution_replaygain_dither = gtk_check_button_new_with_label(_("Enable dithering")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_dither), flac_cfg.output.resolution.replaygain.dither); - gtk_signal_connect(GTK_OBJECT(resolution_replaygain_dither), "clicked", resolution_replaygain_dither_cb, NULL); - gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), resolution_replaygain_dither, FALSE, FALSE, 0); - - hbox = gtk_hbox_new(FALSE, 10); - gtk_container_border_width(GTK_CONTAINER(hbox), 5); - gtk_box_pack_start(GTK_BOX(resolution_replaygain_vbox), hbox, TRUE, TRUE, 0); - - resolution_replaygain_noise_shaping_frame = gtk_frame_new(_("Noise shaping")); - gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), 5); - gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_noise_shaping_frame, TRUE, TRUE, 0); - - resolution_replaygain_noise_shaping_vbox = gtk_vbutton_box_new(); - gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), 5); - gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_frame), resolution_replaygain_noise_shaping_vbox); - - resolution_replaygain_noise_shaping_radio_none = gtk_radio_button_new_with_label(NULL, _("none")); - if(flac_cfg.output.resolution.replaygain.noise_shaping == 0) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_none), TRUE); - gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_none), "clicked", resolution_replaygain_noise_shaping_cb, NULL); - gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_none); - - resolution_replaygain_noise_shaping_radio_low = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("low")); - if(flac_cfg.output.resolution.replaygain.noise_shaping == 1) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_low), TRUE); - gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_low), "clicked", resolution_replaygain_noise_shaping_cb, NULL); - gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_low); - - resolution_replaygain_noise_shaping_radio_medium = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("medium")); - if(flac_cfg.output.resolution.replaygain.noise_shaping == 2) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_medium), TRUE); - gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_medium), "clicked", resolution_replaygain_noise_shaping_cb, NULL); - gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_medium); - - resolution_replaygain_noise_shaping_radio_high = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_noise_shaping_radio_none), _("high")); - if(flac_cfg.output.resolution.replaygain.noise_shaping == 3) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_noise_shaping_radio_high), TRUE); - gtk_signal_connect(GTK_OBJECT(resolution_replaygain_noise_shaping_radio_high), "clicked", resolution_replaygain_noise_shaping_cb, NULL); - gtk_container_add(GTK_CONTAINER(resolution_replaygain_noise_shaping_vbox), resolution_replaygain_noise_shaping_radio_high); - - resolution_replaygain_bps_out_frame = gtk_frame_new(_("Dither to")); - gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_frame), 5); - gtk_box_pack_start(GTK_BOX(hbox), resolution_replaygain_bps_out_frame, FALSE, FALSE, 0); - - resolution_replaygain_bps_out_vbox = gtk_vbutton_box_new(); - gtk_container_border_width(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), 0); - gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_frame), resolution_replaygain_bps_out_vbox); - - resolution_replaygain_bps_out_radio_16bps = gtk_radio_button_new_with_label(NULL, _("16 bps")); - if(flac_cfg.output.resolution.replaygain.bps_out == 16) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_16bps), TRUE); - gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_16bps), "clicked", resolution_replaygain_bps_out_cb, NULL); - gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_16bps); - - resolution_replaygain_bps_out_radio_24bps = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(resolution_replaygain_bps_out_radio_16bps), _("24 bps")); - if(flac_cfg.output.resolution.replaygain.bps_out == 24) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(resolution_replaygain_bps_out_radio_24bps), TRUE); - gtk_signal_connect(GTK_OBJECT(resolution_replaygain_bps_out_radio_24bps), "clicked", resolution_replaygain_bps_out_cb, NULL); - gtk_container_add(GTK_CONTAINER(resolution_replaygain_bps_out_vbox), resolution_replaygain_bps_out_radio_24bps); - - resolution_replaygain_dither_cb(resolution_replaygain_dither, NULL); - - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), output_vbox, gtk_label_new(_("Output"))); - - /* Streaming */ - - streaming_vbox = gtk_vbox_new(FALSE, 0); - - streaming_buf_frame = gtk_frame_new(_("Buffering:")); - gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_frame), 5); - gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_buf_frame, FALSE, FALSE, 0); - - streaming_buf_hbox = gtk_hbox_new(TRUE, 5); - gtk_container_set_border_width(GTK_CONTAINER(streaming_buf_hbox), 5); - gtk_container_add(GTK_CONTAINER(streaming_buf_frame), streaming_buf_hbox); - - streaming_size_box = gtk_hbox_new(FALSE, 5); - /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_size_box,0,1,0,1); */ - gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_size_box, TRUE, TRUE, 0); - streaming_size_label = gtk_label_new(_("Buffer size (kb):")); - gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_label, FALSE, FALSE, 0); - streaming_size_adj = gtk_adjustment_new(flac_cfg.stream.http_buffer_size, 4, 4096, 4, 4, 4); - streaming_size_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_size_adj), 8, 0); - gtk_widget_set_usize(streaming_size_spin, 60, -1); - gtk_box_pack_start(GTK_BOX(streaming_size_box), streaming_size_spin, FALSE, FALSE, 0); - - streaming_pre_box = gtk_hbox_new(FALSE, 5); - /*gtk_table_attach_defaults(GTK_TABLE(streaming_buf_table),streaming_pre_box,1,2,0,1); */ - gtk_box_pack_start(GTK_BOX(streaming_buf_hbox), streaming_pre_box, TRUE, TRUE, 0); - streaming_pre_label = gtk_label_new(_("Pre-buffer (percent):")); - gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_label, FALSE, FALSE, 0); - streaming_pre_adj = gtk_adjustment_new(flac_cfg.stream.http_prebuffer, 0, 90, 1, 1, 1); - streaming_pre_spin = gtk_spin_button_new(GTK_ADJUSTMENT(streaming_pre_adj), 1, 0); - gtk_widget_set_usize(streaming_pre_spin, 60, -1); - gtk_box_pack_start(GTK_BOX(streaming_pre_box), streaming_pre_spin, FALSE, FALSE, 0); - - /* - * Proxy config. - */ - streaming_proxy_frame = gtk_frame_new(_("Proxy:")); - gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_frame), 5); - gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_proxy_frame, FALSE, FALSE, 0); - - streaming_proxy_vbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(streaming_proxy_vbox), 5); - gtk_container_add(GTK_CONTAINER(streaming_proxy_frame), streaming_proxy_vbox); - - streaming_proxy_use = gtk_check_button_new_with_label(_("Use proxy")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_use), flac_cfg.stream.use_proxy); - gtk_signal_connect(GTK_OBJECT(streaming_proxy_use), "clicked", GTK_SIGNAL_FUNC(proxy_use_cb), NULL); - gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_use, FALSE, FALSE, 0); - - streaming_proxy_hbox = gtk_hbox_new(FALSE, 5); - gtk_widget_set_sensitive(streaming_proxy_hbox, flac_cfg.stream.use_proxy); - gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_hbox, FALSE, FALSE, 0); - - streaming_proxy_host_label = gtk_label_new(_("Host:")); - gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_label, FALSE, FALSE, 0); - - streaming_proxy_host_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(streaming_proxy_host_entry), flac_cfg.stream.proxy_host? flac_cfg.stream.proxy_host : ""); - gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_host_entry, TRUE, TRUE, 0); - - streaming_proxy_port_label = gtk_label_new(_("Port:")); - gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_label, FALSE, FALSE, 0); - - streaming_proxy_port_entry = gtk_entry_new(); - gtk_widget_set_usize(streaming_proxy_port_entry, 50, -1); - temp = g_strdup_printf("%d", flac_cfg.stream.proxy_port); - gtk_entry_set_text(GTK_ENTRY(streaming_proxy_port_entry), temp); - g_free(temp); - gtk_box_pack_start(GTK_BOX(streaming_proxy_hbox), streaming_proxy_port_entry, FALSE, FALSE, 0); - - streaming_proxy_auth_use = gtk_check_button_new_with_label(_("Use authentication")); - gtk_widget_set_sensitive(streaming_proxy_auth_use, flac_cfg.stream.use_proxy); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_proxy_auth_use), flac_cfg.stream.proxy_use_auth); - gtk_signal_connect(GTK_OBJECT(streaming_proxy_auth_use), "clicked", GTK_SIGNAL_FUNC(proxy_auth_use_cb), NULL); - gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_use, FALSE, FALSE, 0); - - streaming_proxy_auth_hbox = gtk_hbox_new(FALSE, 5); - gtk_widget_set_sensitive(streaming_proxy_auth_hbox, flac_cfg.stream.use_proxy && flac_cfg.stream.proxy_use_auth); - gtk_box_pack_start(GTK_BOX(streaming_proxy_vbox), streaming_proxy_auth_hbox, FALSE, FALSE, 0); - - streaming_proxy_auth_user_label = gtk_label_new(_("Username:")); - gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_user_label, FALSE, FALSE, 0); - - streaming_proxy_auth_user_entry = gtk_entry_new(); - if(flac_cfg.stream.proxy_user) - gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_user_entry), flac_cfg.stream.proxy_user); - gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_user_entry, TRUE, TRUE, 0); - - streaming_proxy_auth_pass_label = gtk_label_new(_("Password:")); - gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_pass_label, FALSE, FALSE, 0); - - streaming_proxy_auth_pass_entry = gtk_entry_new(); - if(flac_cfg.stream.proxy_pass) - gtk_entry_set_text(GTK_ENTRY(streaming_proxy_auth_pass_entry), flac_cfg.stream.proxy_pass); - gtk_entry_set_visibility(GTK_ENTRY(streaming_proxy_auth_pass_entry), FALSE); - gtk_box_pack_start(GTK_BOX(streaming_proxy_auth_hbox), streaming_proxy_auth_pass_entry, TRUE, TRUE, 0); - - - /* - * Save to disk config. - */ - streaming_save_frame = gtk_frame_new(_("Save stream to disk:")); - gtk_container_set_border_width(GTK_CONTAINER(streaming_save_frame), 5); - gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_save_frame, FALSE, FALSE, 0); - - streaming_save_vbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(streaming_save_vbox), 5); - gtk_container_add(GTK_CONTAINER(streaming_save_frame), streaming_save_vbox); - - streaming_save_use = gtk_check_button_new_with_label(_("Save stream to disk")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_save_use), flac_cfg.stream.save_http_stream); - gtk_signal_connect(GTK_OBJECT(streaming_save_use), "clicked", GTK_SIGNAL_FUNC(streaming_save_use_cb), NULL); - gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_use, FALSE, FALSE, 0); - - streaming_save_hbox = gtk_hbox_new(FALSE, 5); - gtk_widget_set_sensitive(streaming_save_hbox, flac_cfg.stream.save_http_stream); - gtk_box_pack_start(GTK_BOX(streaming_save_vbox), streaming_save_hbox, FALSE, FALSE, 0); - - streaming_save_label = gtk_label_new(_("Path:")); - gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_label, FALSE, FALSE, 0); - - streaming_save_entry = gtk_entry_new(); - gtk_entry_set_text(GTK_ENTRY(streaming_save_entry), flac_cfg.stream.save_http_path? flac_cfg.stream.save_http_path : ""); - gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_entry, TRUE, TRUE, 0); - - streaming_save_browse = gtk_button_new_with_label(_("Browse")); - gtk_signal_connect(GTK_OBJECT(streaming_save_browse), "clicked", GTK_SIGNAL_FUNC(streaming_save_browse_cb), NULL); - gtk_box_pack_start(GTK_BOX(streaming_save_hbox), streaming_save_browse, FALSE, FALSE, 0); - -#ifdef FLAC_ICECAST - streaming_cast_frame = gtk_frame_new(_("SHOUT/Icecast:")); - gtk_container_set_border_width(GTK_CONTAINER(streaming_cast_frame), 5); - gtk_box_pack_start(GTK_BOX(streaming_vbox), streaming_cast_frame, FALSE, FALSE, 0); - - streaming_cast_vbox = gtk_vbox_new(5, FALSE); - gtk_container_add(GTK_CONTAINER(streaming_cast_frame), streaming_cast_vbox); - - streaming_cast_title = gtk_check_button_new_with_label(_("Enable SHOUT/Icecast title streaming")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_cast_title), flac_cfg.stream.cast_title_streaming); - gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_cast_title, FALSE, FALSE, 0); - - streaming_udp_title = gtk_check_button_new_with_label(_("Enable Icecast Metadata UDP Channel")); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(streaming_udp_title), flac_cfg.stream.use_udp_channel); - gtk_box_pack_start(GTK_BOX(streaming_cast_vbox), streaming_udp_title, FALSE, FALSE, 0); -#endif - - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), streaming_vbox, gtk_label_new(_("Streaming"))); - - /* Buttons */ - - bbox = gtk_hbutton_box_new(); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); - gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); - - ok = gtk_button_new_with_label(_("Ok")); - gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(flac_configurewin_ok), NULL); - GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0); - gtk_widget_grab_default(ok); - - cancel = gtk_button_new_with_label(_("Cancel")); - gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(flac_configurewin)); - GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); - - gtk_widget_show_all(flac_configurewin); -} - -void FLAC_XMMS__aboutbox(void) -{ - static GtkWidget *about_window; - - if (about_window) - gdk_window_raise(about_window->window); - - about_window = xmms_show_message( - _("About Flac Plugin"), - _("Flac Plugin by Josh Coalson\n" - "contributions by\n" - "......\n" - "......\n" - "and\n" - "Daisuke Shimamura\n" - "Visit http://xiph.org/flac/"), - _("Ok"), FALSE, NULL, NULL); - gtk_signal_connect(GTK_OBJECT(about_window), "destroy", - GTK_SIGNAL_FUNC(gtk_widget_destroyed), - &about_window); -} - -/* - * Get text of an Entry or a ComboBox - */ -static gchar *gtk_entry_get_text_1 (GtkWidget *widget) -{ - if (GTK_IS_COMBO(widget)) - { - return gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(widget)->entry)); - }else if (GTK_IS_ENTRY(widget)) - { - return gtk_entry_get_text(GTK_ENTRY(widget)); - }else - { - return NULL; - } -} diff --git a/src/plugin_xmms/configure.h b/src/plugin_xmms/configure.h deleted file mode 100644 index 6cde1390..00000000 --- a/src/plugin_xmms/configure.h +++ /dev/null @@ -1,77 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Daisuke Shimamura - * - * Based on mpg123 plugin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__PLUGIN_XMMS__CONFIGURE_H -#define FLAC__PLUGIN_XMMS__CONFIGURE_H - -#include - -typedef struct { - struct { - gboolean tag_override; - gchar *tag_format; - gboolean convert_char_set; - gchar *user_char_set; - } title; - - struct { - gint http_buffer_size; - gint http_prebuffer; - gboolean use_proxy; - gchar *proxy_host; - gint proxy_port; - gboolean proxy_use_auth; - gchar *proxy_user; - gchar *proxy_pass; - gboolean save_http_stream; - gchar *save_http_path; - gboolean cast_title_streaming; - gboolean use_udp_channel; - } stream; - - struct { - struct { - gboolean enable; - gboolean album_mode; - gint preamp; - gboolean hard_limit; - } replaygain; - struct { - struct { - gboolean dither_24_to_16; - } normal; - struct { - gboolean dither; - gint noise_shaping; /* value must be one of NoiseShaping enum, c.f. plugin_common/replaygain_synthesis.h */ - gint bps_out; - } replaygain; - } resolution; - } output; -} flac_config_t; - -extern flac_config_t flac_cfg; - -extern void FLAC_XMMS__configure(void); -extern void FLAC_XMMS__aboutbox(void); - -#endif - - - diff --git a/src/plugin_xmms/fileinfo.c b/src/plugin_xmms/fileinfo.c deleted file mode 100644 index 8eb1e115..00000000 --- a/src/plugin_xmms/fileinfo.c +++ /dev/null @@ -1,495 +0,0 @@ -/* XMMS - Cross-platform multimedia player - * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies - * Copyright (C) 1999,2000 Håvard Kvålen - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Daisuke Shimamura - * - * 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., - * with this program; if not, write to the Free Software Foundation, Inc., - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "plugin.h" - -#include -#include /* for strlen() */ -#include -#include -#include -#include -#include -#include - -#include "FLAC/metadata.h" -#include "charset.h" -#include "configure.h" -#include "plugin_common/replaygain.h" -#include "plugin_common/tags.h" -#include "locale_hack.h" - -static GtkWidget *window = NULL; -static GList *genre_list = NULL; -static GtkWidget *filename_entry, *tag_frame; -static GtkWidget *title_entry, *artist_entry, *album_entry, *date_entry, *tracknum_entry, *comment_entry; -static GtkWidget *replaygain_reference, *replaygain_track_gain, *replaygain_album_gain, *replaygain_track_peak, *replaygain_album_peak; -static GtkWidget *genre_combo; -static GtkWidget *flac_samplerate, *flac_channels, *flac_bits_per_sample, *flac_blocksize, *flac_filesize, *flac_samples, *flac_bitrate; - -static gchar *current_filename = NULL; -static FLAC__StreamMetadata *tags_ = NULL; - -static const gchar *vorbis_genres[] = -{ - N_("Blues"), N_("Classic Rock"), N_("Country"), N_("Dance"), - N_("Disco"), N_("Funk"), N_("Grunge"), N_("Hip-Hop"), - N_("Jazz"), N_("Metal"), N_("New Age"), N_("Oldies"), - N_("Other"), N_("Pop"), N_("R&B"), N_("Rap"), N_("Reggae"), - N_("Rock"), N_("Techno"), N_("Industrial"), N_("Alternative"), - N_("Ska"), N_("Death Metal"), N_("Pranks"), N_("Soundtrack"), - N_("Euro-Techno"), N_("Ambient"), N_("Trip-Hop"), N_("Vocal"), - N_("Jazz+Funk"), N_("Fusion"), N_("Trance"), N_("Classical"), - N_("Instrumental"), N_("Acid"), N_("House"), N_("Game"), - N_("Sound Clip"), N_("Gospel"), N_("Noise"), N_("Alt"), - N_("Bass"), N_("Soul"), N_("Punk"), N_("Space"), - N_("Meditative"), N_("Instrumental Pop"), - N_("Instrumental Rock"), N_("Ethnic"), N_("Gothic"), - N_("Darkwave"), N_("Techno-Industrial"), N_("Electronic"), - N_("Pop-Folk"), N_("Eurodance"), N_("Dream"), - N_("Southern Rock"), N_("Comedy"), N_("Cult"), - N_("Gangsta Rap"), N_("Top 40"), N_("Christian Rap"), - N_("Pop/Funk"), N_("Jungle"), N_("Native American"), - N_("Cabaret"), N_("New Wave"), N_("Psychedelic"), N_("Rave"), - N_("Showtunes"), N_("Trailer"), N_("Lo-Fi"), N_("Tribal"), - N_("Acid Punk"), N_("Acid Jazz"), N_("Polka"), N_("Retro"), - N_("Musical"), N_("Rock & Roll"), N_("Hard Rock"), N_("Folk"), - N_("Folk/Rock"), N_("National Folk"), N_("Swing"), - N_("Fast-Fusion"), N_("Bebob"), N_("Latin"), N_("Revival"), - N_("Celtic"), N_("Bluegrass"), N_("Avantgarde"), - N_("Gothic Rock"), N_("Progressive Rock"), - N_("Psychedelic Rock"), N_("Symphonic Rock"), N_("Slow Rock"), - N_("Big Band"), N_("Chorus"), N_("Easy Listening"), - N_("Acoustic"), N_("Humour"), N_("Speech"), N_("Chanson"), - N_("Opera"), N_("Chamber Music"), N_("Sonata"), N_("Symphony"), - N_("Booty Bass"), N_("Primus"), N_("Porn Groove"), - N_("Satire"), N_("Slow Jam"), N_("Club"), N_("Tango"), - N_("Samba"), N_("Folklore"), N_("Ballad"), N_("Power Ballad"), - N_("Rhythmic Soul"), N_("Freestyle"), N_("Duet"), - N_("Punk Rock"), N_("Drum Solo"), N_("A Cappella"), - N_("Euro-House"), N_("Dance Hall"), N_("Goa"), - N_("Drum & Bass"), N_("Club-House"), N_("Hardcore"), - N_("Terror"), N_("Indie"), N_("BritPop"), N_("Negerpunk"), - N_("Polsk Punk"), N_("Beat"), N_("Christian Gangsta Rap"), - N_("Heavy Metal"), N_("Black Metal"), N_("Crossover"), - N_("Contemporary Christian"), N_("Christian Rock"), - N_("Merengue"), N_("Salsa"), N_("Thrash Metal"), - N_("Anime"), N_("JPop"), N_("Synthpop") -}; - -static void label_set_text(GtkWidget * label, char *str, ...) -{ - va_list args; - gchar *tempstr; - - va_start(args, str); - tempstr = g_strdup_vprintf(str, args); - va_end(args); - - gtk_label_set_text(GTK_LABEL(label), tempstr); - g_free(tempstr); -} - -static void set_entry_tag(GtkEntry * entry, const char * utf8) -{ - if(utf8) { - if(flac_cfg.title.convert_char_set) { - char *text = convert_from_utf8_to_user(utf8); - gtk_entry_set_text(entry, text); - free(text); - } - else - gtk_entry_set_text(entry, utf8); - } - else - gtk_entry_set_text(entry, ""); -} - -static void get_entry_tag(GtkEntry * entry, const char *name) -{ - gchar *text; - char *utf8; - - text = gtk_entry_get_text(entry); - if (!text || strlen(text) == 0) - return; - if(flac_cfg.title.convert_char_set) - utf8 = convert_from_user_to_utf8(text); - else - utf8 = text; - - FLAC_plugin__tags_add_tag_utf8(tags_, name, utf8, /*separator=*/0); - - if(flac_cfg.title.convert_char_set) - free(utf8); -} - -static void show_tag(void) -{ - set_entry_tag(GTK_ENTRY(title_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "TITLE")); - set_entry_tag(GTK_ENTRY(artist_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "ARTIST")); - set_entry_tag(GTK_ENTRY(album_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "ALBUM")); - set_entry_tag(GTK_ENTRY(date_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "DATE")); - set_entry_tag(GTK_ENTRY(tracknum_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "TRACKNUMBER")); - set_entry_tag(GTK_ENTRY(comment_entry) , FLAC_plugin__tags_get_tag_utf8(tags_, "DESCRIPTION")); - set_entry_tag(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), FLAC_plugin__tags_get_tag_utf8(tags_, "GENRE")); -} - -static void save_tag(GtkWidget * w, gpointer data) -{ - (void)w; - (void)data; - - FLAC_plugin__tags_delete_tag(tags_, "TITLE"); - FLAC_plugin__tags_delete_tag(tags_, "ARTIST"); - FLAC_plugin__tags_delete_tag(tags_, "ALBUM"); - FLAC_plugin__tags_delete_tag(tags_, "DATE"); - FLAC_plugin__tags_delete_tag(tags_, "TRACKNUMBER"); - FLAC_plugin__tags_delete_tag(tags_, "DESCRIPTION"); - FLAC_plugin__tags_delete_tag(tags_, "GENRE"); - - get_entry_tag(GTK_ENTRY(title_entry) , "TITLE"); - get_entry_tag(GTK_ENTRY(artist_entry) , "ARTIST"); - get_entry_tag(GTK_ENTRY(album_entry) , "ALBUM"); - get_entry_tag(GTK_ENTRY(date_entry) , "DATE"); - get_entry_tag(GTK_ENTRY(tracknum_entry) , "TRACKNUMBER"); - get_entry_tag(GTK_ENTRY(comment_entry) , "DESCRIPTION"); - get_entry_tag(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), "GENRE"); - - FLAC_plugin__tags_set(current_filename, tags_); - gtk_widget_destroy(window); -} - -static void remove_tag(GtkWidget * w, gpointer data) -{ - (void)w; - (void)data; - - FLAC_plugin__tags_delete_tag(tags_, "TITLE"); - FLAC_plugin__tags_delete_tag(tags_, "ARTIST"); - FLAC_plugin__tags_delete_tag(tags_, "ALBUM"); - FLAC_plugin__tags_delete_tag(tags_, "DATE"); - FLAC_plugin__tags_delete_tag(tags_, "TRACKNUMBER"); - FLAC_plugin__tags_delete_tag(tags_, "DESCRIPTION"); - FLAC_plugin__tags_delete_tag(tags_, "GENRE"); - - FLAC_plugin__tags_set(current_filename, tags_); - gtk_widget_destroy(window); -} - -static void show_file_info(void) -{ - FLAC__StreamMetadata streaminfo; - struct stat _stat; - - gtk_label_set_text(GTK_LABEL(flac_samplerate), ""); - gtk_label_set_text(GTK_LABEL(flac_channels), ""); - gtk_label_set_text(GTK_LABEL(flac_bits_per_sample), ""); - gtk_label_set_text(GTK_LABEL(flac_blocksize), ""); - gtk_label_set_text(GTK_LABEL(flac_filesize), ""); - gtk_label_set_text(GTK_LABEL(flac_samples), ""); - gtk_label_set_text(GTK_LABEL(flac_bitrate), ""); - - if(!FLAC__metadata_get_streaminfo(current_filename, &streaminfo)) { - return; - } - - label_set_text(flac_samplerate, _("Samplerate: %d Hz"), streaminfo.data.stream_info.sample_rate); - label_set_text(flac_channels, _("Channels: %d"), streaminfo.data.stream_info.channels); - label_set_text(flac_bits_per_sample, _("Bits/Sample: %d"), streaminfo.data.stream_info.bits_per_sample); - if(streaminfo.data.stream_info.min_blocksize == streaminfo.data.stream_info.max_blocksize) - label_set_text(flac_blocksize, _("Blocksize: %d"), streaminfo.data.stream_info.min_blocksize); - else - label_set_text(flac_blocksize, _("Blocksize: variable\n min/max: %d/%d"), streaminfo.data.stream_info.min_blocksize, streaminfo.data.stream_info.max_blocksize); - - if (streaminfo.data.stream_info.total_samples) - label_set_text(flac_samples, _("Samples: %" PRIu64 "\nLength: %d:%.2d"), - streaminfo.data.stream_info.total_samples, - (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate / 60), - (int)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate % 60)); - - if(!stat(current_filename, &_stat) && S_ISREG(_stat.st_mode)) { - label_set_text(flac_filesize, _("Filesize: %zd B"), _stat.st_size); - if (streaminfo.data.stream_info.total_samples) - label_set_text(flac_bitrate, _("Avg. bitrate: %.1f kb/s\nCompression ratio: %.1f%%"), - 8.0 * (float)(_stat.st_size) / (1000.0 * (float)streaminfo.data.stream_info.total_samples / (float)streaminfo.data.stream_info.sample_rate), - 100.0 * (float)_stat.st_size / (float)(streaminfo.data.stream_info.bits_per_sample / 8 * streaminfo.data.stream_info.channels * streaminfo.data.stream_info.total_samples)); - } -} - -static void show_replaygain(void) -{ - /* known limitation: If only one of gain and peak is set, neither will be shown. This is true for - * both track and album replaygain tags. Written so it will be easy to fix, with some trouble. */ - - gtk_label_set_text(GTK_LABEL(replaygain_reference), ""); - gtk_label_set_text(GTK_LABEL(replaygain_track_gain), ""); - gtk_label_set_text(GTK_LABEL(replaygain_album_gain), ""); - gtk_label_set_text(GTK_LABEL(replaygain_track_peak), ""); - gtk_label_set_text(GTK_LABEL(replaygain_album_peak), ""); - - double reference, track_gain, track_peak, album_gain, album_peak; - FLAC__bool reference_set, track_gain_set, track_peak_set, album_gain_set, album_peak_set; - - if(!FLAC_plugin__replaygain_get_from_file( - current_filename, - &reference, &reference_set, - &track_gain, &track_gain_set, - &album_gain, &album_gain_set, - &track_peak, &track_peak_set, - &album_peak, &album_peak_set - )) - return; - - if(reference_set) - label_set_text(replaygain_reference, _("ReplayGain Reference Loudness: %2.1f dB"), reference); - if(track_gain_set) - label_set_text(replaygain_track_gain, _("ReplayGain Track Gain: %+2.2f dB"), track_gain); - if(album_gain_set) - label_set_text(replaygain_album_gain, _("ReplayGain Album Gain: %+2.2f dB"), album_gain); - if(track_peak_set) - label_set_text(replaygain_track_peak, _("ReplayGain Track Peak: %1.8f"), track_peak); - if(album_peak_set) - label_set_text(replaygain_album_peak, _("ReplayGain Album Peak: %1.8f"), album_peak); -} - -void FLAC_XMMS__file_info_box(char *filename) -{ - uint32_t i; - gchar *title; - - if (!window) - { - GtkWidget *vbox, *hbox, *left_vbox, *table; - GtkWidget *flac_frame, *flac_box; - GtkWidget *label, *filename_hbox; - GtkWidget *bbox, *save, *remove, *cancel; - - window = gtk_window_new(GTK_WINDOW_DIALOG); - gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE); - gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &window); - gtk_container_set_border_width(GTK_CONTAINER(window), 10); - - vbox = gtk_vbox_new(FALSE, 10); - gtk_container_add(GTK_CONTAINER(window), vbox); - - filename_hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), filename_hbox, FALSE, TRUE, 0); - - label = gtk_label_new(_("Filename:")); - gtk_box_pack_start(GTK_BOX(filename_hbox), label, FALSE, TRUE, 0); - filename_entry = gtk_entry_new(); - gtk_editable_set_editable(GTK_EDITABLE(filename_entry), FALSE); - gtk_box_pack_start(GTK_BOX(filename_hbox), filename_entry, TRUE, TRUE, 0); - - hbox = gtk_hbox_new(FALSE, 10); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); - - left_vbox = gtk_vbox_new(FALSE, 10); - gtk_box_pack_start(GTK_BOX(hbox), left_vbox, FALSE, FALSE, 0); - - tag_frame = gtk_frame_new(_("Tag:")); - gtk_box_pack_start(GTK_BOX(left_vbox), tag_frame, FALSE, FALSE, 0); - - table = gtk_table_new(5, 5, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 5); - gtk_container_add(GTK_CONTAINER(tag_frame), table); - - label = gtk_label_new(_("Title:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 5, 5); - - title_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), title_entry, 1, 4, 0, 1, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Artist:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 5, 5); - - artist_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), artist_entry, 1, 4, 1, 2, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Album:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, GTK_FILL, 5, 5); - - album_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), album_entry, 1, 4, 2, 3, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Comment:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, GTK_FILL, 5, 5); - - comment_entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), comment_entry, 1, 4, 3, 4, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Date:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5, GTK_FILL, GTK_FILL, 5, 5); - - date_entry = gtk_entry_new(); - gtk_widget_set_usize(date_entry, 40, -1); - gtk_table_attach(GTK_TABLE(table), date_entry, 1, 2, 4, 5, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Track number:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 2, 3, 4, 5, GTK_FILL, GTK_FILL, 5, 5); - - tracknum_entry = gtk_entry_new(); - gtk_widget_set_usize(tracknum_entry, 40, -1); - gtk_table_attach(GTK_TABLE(table), tracknum_entry, 3, 4, 4, 5, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - label = gtk_label_new(_("Genre:")); - gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); - gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 5, 5); - - genre_combo = gtk_combo_new(); - gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(genre_combo)->entry), TRUE); - - if (!genre_list) - { - for (i = 0; i < sizeof(vorbis_genres) / sizeof(*vorbis_genres) ; i++) - genre_list = g_list_prepend(genre_list, (char *)vorbis_genres[i]); - genre_list = g_list_prepend(genre_list, ""); - genre_list = g_list_sort(genre_list, (GCompareFunc)g_strcasecmp); - } - gtk_combo_set_popdown_strings(GTK_COMBO(genre_combo), genre_list); - - gtk_table_attach(GTK_TABLE(table), genre_combo, 1, 4, 5, 6, GTK_FILL | GTK_EXPAND | GTK_SHRINK, GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 5); - - bbox = gtk_hbutton_box_new(); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_button_box_set_spacing(GTK_BUTTON_BOX(bbox), 5); - gtk_box_pack_start(GTK_BOX(left_vbox), bbox, FALSE, FALSE, 0); - - save = gtk_button_new_with_label(_("Save")); - gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(save_tag), NULL); - GTK_WIDGET_SET_FLAGS(save, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(bbox), save, TRUE, TRUE, 0); - gtk_widget_grab_default(save); - - remove= gtk_button_new_with_label(_("Remove Tag")); - gtk_signal_connect(GTK_OBJECT(remove), "clicked", GTK_SIGNAL_FUNC(remove_tag), NULL); - GTK_WIDGET_SET_FLAGS(remove, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(bbox), remove, TRUE, TRUE, 0); - - cancel = gtk_button_new_with_label(_("Cancel")); - gtk_signal_connect_object(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(window)); - GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT); - gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0); - - flac_frame = gtk_frame_new(_("FLAC Info:")); - gtk_box_pack_start(GTK_BOX(hbox), flac_frame, FALSE, FALSE, 0); - - flac_box = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(flac_frame), flac_box); - gtk_container_set_border_width(GTK_CONTAINER(flac_box), 10); - gtk_box_set_spacing(GTK_BOX(flac_box), 0); - - flac_samplerate = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(flac_samplerate), 0, 0); - gtk_label_set_justify(GTK_LABEL(flac_samplerate), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), flac_samplerate, FALSE, FALSE, 0); - - flac_channels = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(flac_channels), 0, 0); - gtk_label_set_justify(GTK_LABEL(flac_channels), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), flac_channels, FALSE, FALSE, 0); - - flac_bits_per_sample = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(flac_bits_per_sample), 0, 0); - gtk_label_set_justify(GTK_LABEL(flac_bits_per_sample), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), flac_bits_per_sample, FALSE, FALSE, 0); - - flac_blocksize = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(flac_blocksize), 0, 0); - gtk_label_set_justify(GTK_LABEL(flac_blocksize), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), flac_blocksize, FALSE, FALSE, 0); - - flac_filesize = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(flac_filesize), 0, 0); - gtk_label_set_justify(GTK_LABEL(flac_filesize), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), flac_filesize, FALSE, FALSE, 0); - - flac_samples = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(flac_samples), 0, 0); - gtk_label_set_justify(GTK_LABEL(flac_samples), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), flac_samples, FALSE, FALSE, 0); - - flac_bitrate = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(flac_bitrate), 0, 0); - gtk_label_set_justify(GTK_LABEL(flac_bitrate), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), flac_bitrate, FALSE, FALSE, 0); - - replaygain_reference = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(replaygain_reference), 0, 0); - gtk_label_set_justify(GTK_LABEL(replaygain_reference), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), replaygain_reference, FALSE, FALSE, 0); - - replaygain_track_gain = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(replaygain_track_gain), 0, 0); - gtk_label_set_justify(GTK_LABEL(replaygain_track_gain), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), replaygain_track_gain, FALSE, FALSE, 0); - - replaygain_album_gain = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(replaygain_album_gain), 0, 0); - gtk_label_set_justify(GTK_LABEL(replaygain_album_gain), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), replaygain_album_gain, FALSE, FALSE, 0); - - replaygain_track_peak = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(replaygain_track_peak), 0, 0); - gtk_label_set_justify(GTK_LABEL(replaygain_track_peak), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), replaygain_track_peak, FALSE, FALSE, 0); - - replaygain_album_peak = gtk_label_new(""); - gtk_misc_set_alignment(GTK_MISC(replaygain_album_peak), 0, 0); - gtk_label_set_justify(GTK_LABEL(replaygain_album_peak), GTK_JUSTIFY_LEFT); - gtk_box_pack_start(GTK_BOX(flac_box), replaygain_album_peak, FALSE, FALSE, 0); - - gtk_widget_show_all(window); - } - - if(current_filename) - g_free(current_filename); - if(!(current_filename = g_strdup(filename))) - return; - - title = g_strdup_printf(_("File Info - %s"), g_basename(filename)); - gtk_window_set_title(GTK_WINDOW(window), title); - g_free(title); - - gtk_entry_set_text(GTK_ENTRY(filename_entry), filename); - gtk_editable_set_position(GTK_EDITABLE(filename_entry), -1); - - if(tags_) - FLAC_plugin__tags_destroy(&tags_); - - FLAC_plugin__tags_get(current_filename, &tags_); - - show_tag(); - show_file_info(); - show_replaygain(); - - gtk_widget_set_sensitive(tag_frame, TRUE); -} diff --git a/src/plugin_xmms/http.c b/src/plugin_xmms/http.c deleted file mode 100644 index 161d1b3d..00000000 --- a/src/plugin_xmms/http.c +++ /dev/null @@ -1,899 +0,0 @@ -/* XMMS - Cross-platform multimedia player - * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies - * - * 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., - * with this program; if not, write to the Free Software Foundation, Inc., - */ -/* modified for FLAC support by Steven Richman (2003) */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "plugin.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include "FLAC/format.h" -#include "configure.h" -#include "locale_hack.h" - -/* on FreeBSD we get socklen_t from */ -#if (!defined HAVE_SOCKLEN_T) && !defined(__FreeBSD__) -typedef uint32_t socklen_t; -#endif - -#define min(x,y) ((x)<(y)?(x):(y)) -#define min3(x,y,z) (min(x,y)<(z)?min(x,y):(z)) -#define min4(x,y,z,w) (min3(x,y,z)<(w)?min3(x,y,z):(w)) - -static gchar *icy_name = NULL; -static gint icy_metaint = 0; - -extern InputPlugin flac_ip; - -/* Static udp channel functions */ -static int udp_establish_listener (gint *sock); -static int udp_check_for_data(gint sock); - -static char *flac_http_get_title(char *url); - -static gboolean prebuffering, going, eof = FALSE; -static gint sock, rd_index, wr_index, buffer_length, prebuffer_length; -static guint64 buffer_read = 0; -static gchar *buffer; -static guint64 offset; -static pthread_t thread; -static GtkWidget *error_dialog = NULL; - -static FILE *output_file = NULL; - -#define BASE64_LENGTH(len) (4 * (((len) + 2) / 3)) - -/* Encode the string S of length LENGTH to base64 format and place it - to STORE. STORE will be 0-terminated, and must point to a writable - buffer of at least 1+BASE64_LENGTH(length) bytes. */ -static void base64_encode (const gchar *s, gchar *store, gint length) -{ - /* Conversion table. */ - static gchar tbl[64] = { - 'A','B','C','D','E','F','G','H', - 'I','J','K','L','M','N','O','P', - 'Q','R','S','T','U','V','W','X', - 'Y','Z','a','b','c','d','e','f', - 'g','h','i','j','k','l','m','n', - 'o','p','q','r','s','t','u','v', - 'w','x','y','z','0','1','2','3', - '4','5','6','7','8','9','+','/' - }; - gint i; - guchar *p = (guchar *)store; - - /* Transform the 3x8 bits to 4x6 bits, as required by base64. */ - for (i = 0; i < length; i += 3) - { - *p++ = tbl[s[0] >> 2]; - *p++ = tbl[((s[0] & 3) << 4) + (s[1] >> 4)]; - *p++ = tbl[((s[1] & 0xf) << 2) + (s[2] >> 6)]; - *p++ = tbl[s[2] & 0x3f]; - s += 3; - } - /* Pad the result if necessary... */ - if (i == length + 1) - *(p - 1) = '='; - else if (i == length + 2) - *(p - 1) = *(p - 2) = '='; - /* ...and zero-terminate it. */ - *p = '\0'; -} - -/* Create the authentication header contents for the `Basic' scheme. - This is done by encoding the string `USER:PASS' in base64 and - prepending `HEADER: Basic ' to it. */ -static gchar *basic_authentication_encode (const gchar *user, const gchar *passwd, const gchar *header) -{ - gchar *t1, *t2, *res; - gint len1 = strlen (user) + 1 + strlen (passwd); - gint len2 = BASE64_LENGTH (len1); - - t1 = g_strdup_printf("%s:%s", user, passwd); - t2 = g_malloc0(len2 + 1); - base64_encode (t1, t2, len1); - res = g_strdup_printf("%s: Basic %s\r\n", header, t2); - g_free(t2); - g_free(t1); - - return res; -} - -static void parse_url(const gchar * url, gchar ** user, gchar ** pass, gchar ** host, int *port, gchar ** filename) -{ - gchar *h, *p, *pt, *f, *temp, *ptr; - - temp = g_strdup(url); - ptr = temp; - - if (!strncasecmp("http://", ptr, 7)) - ptr += 7; - h = strchr(ptr, '@'); - f = strchr(ptr, '/'); - if (h != NULL && (!f || h < f)) - { - *h = '\0'; - p = strchr(ptr, ':'); - if (p != NULL && p < h) - { - *p = '\0'; - p++; - *pass = g_strdup(p); - } - else - *pass = NULL; - *user = g_strdup(ptr); - h++; - ptr = h; - } - else - { - *user = NULL; - *pass = NULL; - h = ptr; - } - pt = strchr(ptr, ':'); - if (pt != NULL && (f == NULL || pt < f)) - { - *pt = '\0'; - *port = atoi(pt + 1); - } - else - { - if (f) - *f = '\0'; - *port = 80; - } - *host = g_strdup(h); - - if (f) - *filename = g_strdup(f + 1); - else - *filename = NULL; - g_free(temp); -} - -void flac_http_close(void) -{ - going = FALSE; - - pthread_join(thread, NULL); - g_free(icy_name); - icy_name = NULL; -} - - -static gint http_used(void) -{ - if (wr_index >= rd_index) - return wr_index - rd_index; - return buffer_length - (rd_index - wr_index); -} - -static gint http_free(void) -{ - if (rd_index > wr_index) - return (rd_index - wr_index) - 1; - return (buffer_length - (wr_index - rd_index)) - 1; -} - -static void http_wait_for_data(gint bytes) -{ - while ((prebuffering || http_used() < bytes) && !eof && going) - xmms_usleep(10000); -} - -static void show_error_message(gchar *error) -{ - if(!error_dialog) - { - GDK_THREADS_ENTER(); - error_dialog = xmms_show_message(_("Error"), error, _("Ok"), FALSE, - NULL, NULL); - gtk_signal_connect(GTK_OBJECT(error_dialog), - "destroy", - GTK_SIGNAL_FUNC(gtk_widget_destroyed), - &error_dialog); - GDK_THREADS_LEAVE(); - } -} - -int flac_http_read(gpointer data, gint length) -{ - gint len, cnt, off = 0, meta_len, meta_off = 0, i; - gchar *meta_data, **tags, *temp, *title; - if (length > buffer_length) { - length = buffer_length; - } - - http_wait_for_data(length); - - if (!going) - return 0; - len = min(http_used(), length); - - while (len && http_used()) - { - if ((flac_cfg.stream.cast_title_streaming) && (icy_metaint > 0) && (buffer_read % icy_metaint) == 0 && (buffer_read > 0)) - { - meta_len = *((guchar *) buffer + rd_index) * 16; - rd_index = (rd_index + 1) % buffer_length; - if (meta_len > 0) - { - http_wait_for_data(meta_len); - meta_data = g_malloc0(meta_len); - if (http_used() >= meta_len) - { - while (meta_len) - { - cnt = min(meta_len, buffer_length - rd_index); - memcpy(meta_data + meta_off, buffer + rd_index, cnt); - rd_index = (rd_index + cnt) % buffer_length; - meta_len -= cnt; - meta_off += cnt; - } - tags = g_strsplit(meta_data, "';", 0); - - for (i = 0; tags[i]; i++) - { - if (!strncasecmp(tags[i], "StreamTitle=", 12)) - { - temp = g_strdup(tags[i] + 13); - title = g_strdup_printf("%s (%s)", temp, icy_name); - set_track_info(title, -1); - g_free(title); - g_free(temp); - } - - } - g_strfreev(tags); - - } - g_free(meta_data); - } - if (!http_used()) - http_wait_for_data(length - off); - cnt = min3(len, buffer_length - rd_index, http_used()); - } - else if ((icy_metaint > 0) && (flac_cfg.stream.cast_title_streaming)) - cnt = min4(len, buffer_length - rd_index, http_used(), icy_metaint - (gint) (buffer_read % icy_metaint)); - else - cnt = min3(len, buffer_length - rd_index, http_used()); - if (output_file) - fwrite(buffer + rd_index, 1, cnt, output_file); - - memcpy((gchar *)data + off, buffer + rd_index, cnt); - rd_index = (rd_index + cnt) % buffer_length; - buffer_read += cnt; - len -= cnt; - off += cnt; - } - if (!off) { - fprintf(stderr, "returning zero\n"); - } - return off; -} - -static gboolean http_check_for_data(void) -{ - - fd_set set; - struct timeval tv; - gint ret; - - tv.tv_sec = 0; - tv.tv_usec = 20000; - FD_ZERO(&set); - FD_SET(sock, &set); - ret = select(sock + 1, &set, NULL, NULL, &tv); - if (ret > 0) - return TRUE; - return FALSE; -} - -gint flac_http_read_line(gchar * buf, gint size) -{ - gint i = 0; - - while (going && i < size - 1) - { - if (http_check_for_data()) - { - if (read(sock, buf + i, 1) <= 0) - return -1; - if (buf[i] == '\n') - break; - if (buf[i] != '\r') - i++; - } - } - if (!going) - return -1; - buf[i] = '\0'; - return i; -} - -/* returns the file descriptor of the socket, or -1 on error */ -static int http_connect (gchar *url_, gboolean head, guint64 offset) -{ - gchar line[1024], *user, *pass, *host, *filename, - *status, *url, *temp, *file; - gchar *chost; - gint cnt, error, port, cport; - socklen_t err_len; - gboolean redirect; - int udp_sock = 0; - fd_set set; - struct hostent *hp; - struct sockaddr_in address; - struct timeval tv; - - url = g_strdup (url_); - - do - { - redirect=FALSE; - - g_strstrip(url); - - parse_url(url, &user, &pass, &host, &port, &filename); - - if ((!filename || !*filename) && url[strlen(url) - 1] != '/') - temp = g_strconcat(url, "/", NULL); - else - temp = g_strdup(url); - g_free(url); - url = temp; - - chost = flac_cfg.stream.use_proxy ? flac_cfg.stream.proxy_host : host; - cport = flac_cfg.stream.use_proxy ? flac_cfg.stream.proxy_port : port; - - sock = socket(AF_INET, SOCK_STREAM, 0); - fcntl(sock, F_SETFL, O_NONBLOCK); - address.sin_family = AF_INET; - - status = g_strdup_printf(_("LOOKING UP %s"), chost); - flac_ip.set_info_text(status); - g_free(status); - - if (!(hp = gethostbyname(chost))) - { - status = g_strdup_printf(_("Couldn't look up host %s"), chost); - show_error_message(status); - g_free(status); - - flac_ip.set_info_text(NULL); - eof = TRUE; - } - - if (!eof) - { - memcpy(&address.sin_addr.s_addr, *(hp->h_addr_list), sizeof (address.sin_addr.s_addr)); - address.sin_port = (gint) g_htons(cport); - - status = g_strdup_printf(_("CONNECTING TO %s:%d"), chost, cport); - flac_ip.set_info_text(status); - g_free(status); - if (connect(sock, (struct sockaddr *) &address, sizeof (struct sockaddr_in)) == -1) - { - if (errno != EINPROGRESS) - { - status = g_strdup_printf(_("Couldn't connect to host %s"), chost); - show_error_message(status); - g_free(status); - - flac_ip.set_info_text(NULL); - eof = TRUE; - } - } - while (going) - { - tv.tv_sec = 0; - tv.tv_usec = 10000; - FD_ZERO(&set); - FD_SET(sock, &set); - if (select(sock + 1, NULL, &set, NULL, &tv) > 0) - { - err_len = sizeof (error); - getsockopt(sock, SOL_SOCKET, SO_ERROR, &error, &err_len); - if (error) - { - status = g_strdup_printf(_("Couldn't connect to host %s"), - chost); - show_error_message(status); - g_free(status); - - flac_ip.set_info_text(NULL); - eof = TRUE; - - } - break; - } - } - if (!eof) - { - gchar *auth = NULL, *proxy_auth = NULL; - gchar udpspace[30]; - int udp_port; - - if (flac_cfg.stream.use_udp_channel) - { - udp_port = udp_establish_listener (&udp_sock); - if (udp_port > 0) - flac_snprintf (udpspace, sizeof (udpspace), "x-audiocast-udpport: %d\r\n", udp_port); - else - udp_sock = 0; - } - - if(user && pass) - auth = basic_authentication_encode(user, pass, "Authorization"); - - if (flac_cfg.stream.use_proxy) - { - file = g_strdup(url); - if(flac_cfg.stream.proxy_use_auth && flac_cfg.stream.proxy_user && flac_cfg.stream.proxy_pass) - { - proxy_auth = basic_authentication_encode(flac_cfg.stream.proxy_user, - flac_cfg.stream.proxy_pass, - "Proxy-Authorization"); - } - } - else - file = g_strconcat("/", filename, NULL); - - temp = g_strdup_printf("GET %s HTTP/1.0\r\n" - "Host: %s\r\n" - "User-Agent: %s/%s\r\n" - "%s%s%s%s", - file, host, "Reference FLAC Player", FLAC__VERSION_STRING, - proxy_auth ? proxy_auth : "", auth ? auth : "", - flac_cfg.stream.cast_title_streaming ? "Icy-MetaData:1\r\n" : "", - flac_cfg.stream.use_udp_channel ? udpspace : ""); - if (offset && !head) { - gchar *temp_dead = temp; - temp = g_strdup_printf ("%sRange: %" PRIu64 "-\r\n", temp, offset); - fputs (temp, stderr); - g_free (temp_dead); - } - - g_free(file); - if(proxy_auth) - g_free(proxy_auth); - if(auth) - g_free(auth); - write(sock, temp, strlen(temp)); - write(sock, "\r\n", 2); - g_free(temp); - flac_ip.set_info_text(_("CONNECTED: WAITING FOR REPLY")); - while (going && !eof) - { - if (http_check_for_data()) - { - if (flac_http_read_line(line, 1024)) - { - status = strchr(line, ' '); - if (status) - { - if (status[1] == '2') - break; - else if(status[1] == '3' && status[2] == '0' && status[3] == '2') - { - while(going) - { - if(http_check_for_data()) - { - if((cnt = flac_http_read_line(line, 1024)) != -1) - { - if(!cnt) - break; - if(!strncmp(line, "Location:", 9)) - { - g_free(url); - url = g_strdup(line+10); - } - } - else - { - eof=TRUE; - flac_ip.set_info_text(NULL); - break; - } - } - } - redirect=TRUE; - break; - } - else - { - status = g_strdup_printf(_("Couldn't connect to host %s\nServer reported: %s"), chost, status); - show_error_message(status); - g_free(status); - break; - } - } - } - else - { - eof = TRUE; - flac_ip.set_info_text(NULL); - } - } - } - - while (going && !redirect) - { - if (http_check_for_data()) - { - if ((cnt = flac_http_read_line(line, 1024)) != -1) - { - if (!cnt) - break; - if (!strncmp(line, "icy-name:", 9)) - icy_name = g_strdup(line + 9); - else if (!strncmp(line, "x-audiocast-name:", 17)) - icy_name = g_strdup(line + 17); - if (!strncmp(line, "icy-metaint:", 12)) - icy_metaint = atoi(line + 12); - if (!strncmp(line, "x-audiocast-udpport:", 20)) { -#ifndef NDEBUG - fprintf (stderr, "Server wants udp messages on port %d\n", atoi (line + 20)); -#endif - /*udp_serverport = atoi (line + 20);*/ - } - - } - else - { - eof = TRUE; - flac_ip.set_info_text(NULL); - break; - } - } - } - } - } - - if(redirect) - { - if (output_file) - { - fclose(output_file); - output_file = NULL; - } - close(sock); - } - - g_free(user); - g_free(pass); - g_free(host); - g_free(filename); - } while(redirect); - - g_free(url); - return eof ? -1 : sock; -} - -static void *http_buffer_loop(void *arg) -{ - gchar *status, *url, *temp, *file; - gint cnt, written; - int udp_sock = 0; - - url = (gchar *) arg; - sock = http_connect (url, false, offset); - - if (sock >= 0 && flac_cfg.stream.save_http_stream) { - gchar *output_name; - file = flac_http_get_title(url); - output_name = file; - if (!strncasecmp(output_name, "http://", 7)) - output_name += 7; - temp = strrchr(output_name, '.'); - if (temp && (!strcasecmp(temp, ".fla") || !strcasecmp(temp, ".flac"))) - *temp = '\0'; - - while ((temp = strchr(output_name, '/'))) - *temp = '_'; - output_name = g_strdup_printf("%s/%s.flac", flac_cfg.stream.save_http_path, output_name); - - g_free(file); - - output_file = fopen(output_name, "wb"); - g_free(output_name); - } - - while (going) - { - - if (!http_used() && !flac_ip.output->buffer_playing()) - prebuffering = TRUE; - if (http_free() > 0 && !eof) - { - if (http_check_for_data()) - { - cnt = min(http_free(), buffer_length - wr_index); - if (cnt > 1024) - cnt = 1024; - written = read(sock, buffer + wr_index, cnt); - if (written <= 0) - { - eof = TRUE; - if (prebuffering) - { - prebuffering = FALSE; - - flac_ip.set_info_text(NULL); - } - - } - else - wr_index = (wr_index + written) % buffer_length; - } - - if (prebuffering) - { - if (http_used() > prebuffer_length) - { - prebuffering = FALSE; - flac_ip.set_info_text(NULL); - } - else - { - status = g_strdup_printf(_("PRE-BUFFERING: %dKB/%dKB"), http_used() / 1024, prebuffer_length / 1024); - flac_ip.set_info_text(status); - g_free(status); - } - - } - } - else - xmms_usleep(10000); - - if (flac_cfg.stream.use_udp_channel && udp_sock != 0) - if (udp_check_for_data(udp_sock) < 0) - { - close(udp_sock); - udp_sock = 0; - } - } - if (output_file) - { - fclose(output_file); - output_file = NULL; - } - if (sock >= 0) { - close(sock); - } - if (udp_sock != 0) - close(udp_sock); - - g_free(buffer); - g_free(url); - - pthread_exit(NULL); - return NULL; /* avoid compiler warning */ -} - -int flac_http_open(const gchar * _url, guint64 _offset) -{ - gchar *url; - - url = g_strdup(_url); - - rd_index = 0; - wr_index = 0; - buffer_length = flac_cfg.stream.http_buffer_size * 1024; - prebuffer_length = (buffer_length * flac_cfg.stream.http_prebuffer) / 100; - buffer_read = 0; - icy_metaint = 0; - prebuffering = TRUE; - going = TRUE; - eof = FALSE; - buffer = g_malloc(buffer_length); - offset = _offset; - - pthread_create(&thread, NULL, http_buffer_loop, url); - - return 0; -} - -char *flac_http_get_title(char *url) -{ - if (icy_name) - return g_strdup(icy_name); - if (g_basename(url) && strlen(g_basename(url)) > 0) - return g_strdup(g_basename(url)); - return g_strdup(url); -} - -/* Start UDP Channel specific stuff */ - -/* Find a good local udp port and bind udp_sock to it, return the port */ -static int udp_establish_listener(int *sock) -{ - struct sockaddr_in sin; - socklen_t sinlen = sizeof (struct sockaddr_in); - -#ifndef NDEBUG - fprintf (stderr,"Establishing udp listener\n"); -#endif - - if ((*sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - { - g_log(NULL, G_LOG_LEVEL_CRITICAL, - "udp_establish_listener(): unable to create socket"); - return -1; - } - - memset(&sin, 0, sinlen); - sin.sin_family = AF_INET; - sin.sin_addr.s_addr = g_htonl(INADDR_ANY); - - if (bind(*sock, (struct sockaddr *)&sin, sinlen) < 0) - { - g_log(NULL, G_LOG_LEVEL_CRITICAL, - "udp_establish_listener(): Failed to bind socket to localhost: %s", strerror(errno)); - close(*sock); - return -1; - } - if (fcntl(*sock, F_SETFL, O_NONBLOCK) < 0) - { - g_log(NULL, G_LOG_LEVEL_CRITICAL, - "udp_establish_listener(): Failed to set flags: %s", strerror(errno)); - close(*sock); - return -1; - } - - memset(&sin, 0, sinlen); - if (getsockname(*sock, (struct sockaddr *)&sin, &sinlen) < 0) - { - g_log(NULL, G_LOG_LEVEL_CRITICAL, - "udp_establish_listener(): Failed to retrieve socket info: %s", strerror(errno)); - close(*sock); - return -1; - } - -#ifndef NDEBUG - fprintf (stderr,"Listening on local %s:%d\n", inet_ntoa(sin.sin_addr), g_ntohs(sin.sin_port)); -#endif - - return g_ntohs(sin.sin_port); -} - -static int udp_check_for_data(int sock) -{ - char buf[1025], **lines; - char *valptr; - gchar *title; - gint len, i; - struct sockaddr_in from; - socklen_t fromlen; - - fromlen = sizeof(struct sockaddr_in); - - if ((len = recvfrom(sock, buf, 1024, 0, (struct sockaddr *)&from, &fromlen)) < 0) - { - if (errno != EAGAIN) - { - g_log(NULL, G_LOG_LEVEL_CRITICAL, - "udp_read_data(): Error reading from socket: %s", strerror(errno)); - return -1; - } - return 0; - } - buf[len] = '\0'; -#ifndef NDEBUG - fprintf (stderr,"Received: [%s]\n", buf); -#endif - lines = g_strsplit(buf, "\n", 0); - if (!lines) - return 0; - - for (i = 0; lines[i]; i++) - { - while ((lines[i][strlen(lines[i]) - 1] == '\n') || - (lines[i][strlen(lines[i]) - 1] == '\r')) - lines[i][strlen(lines[i]) - 1] = '\0'; - - valptr = strchr(lines[i], ':'); - - if (!valptr) - continue; - else - valptr++; - - g_strstrip(valptr); - if (!strlen(valptr)) - continue; - - if (strstr(lines[i], "x-audiocast-streamtitle") != NULL) - { - title = g_strdup_printf ("%s (%s)", valptr, icy_name); - if (going) - set_track_info(title, -1); - g_free (title); - } - -#if 0 - else if (strstr(lines[i], "x-audiocast-streamlength") != NULL) - { - if (atoi(valptr) != -1) - set_track_info(NULL, atoi(valptr)); - } -#endif - - else if (strstr(lines[i], "x-audiocast-streammsg") != NULL) - { - /* set_track_info(title, -1); */ -/* xmms_show_message(_("Message"), valptr, _("Ok"), */ -/* FALSE, NULL, NULL); */ - g_message("Stream_message: %s", valptr); - } - -#if 0 - /* Use this to direct your webbrowser.. yeah right.. */ - else if (strstr(lines[i], "x-audiocast-streamurl") != NULL) - { - if (lasturl && g_strcmp (valptr, lasturl)) - { - c_message (stderr, "Song URL: %s\n", valptr); - g_free (lasturl); - lasturl = g_strdup (valptr); - } - } -#endif - else if (strstr(lines[i], "x-audiocast-udpseqnr:") != NULL) - { - gchar obuf[60]; - flac_snprintf(obuf, sizeof (obuf), "x-audiocast-ack: %ld \r\n", atol(valptr)); - if (sendto(sock, obuf, strlen(obuf), 0, (struct sockaddr *) &from, fromlen) < 0) - { - g_log(NULL, G_LOG_LEVEL_WARNING, - "udp_check_for_data(): Unable to send ack to server: %s", strerror(errno)); - } -#ifndef NDEBUG - else - fprintf(stderr,"Sent ack: %s", obuf); - fprintf (stderr,"Remote: %s:%d\n", inet_ntoa(from.sin_addr), g_ntohs(from.sin_port)); -#endif - } - } - g_strfreev(lines); - return 0; -} diff --git a/src/plugin_xmms/http.h b/src/plugin_xmms/http.h deleted file mode 100644 index a78e162b..00000000 --- a/src/plugin_xmms/http.h +++ /dev/null @@ -1,26 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__PLUGIN_XMMS__HTTP_H -#define FLAC__PLUGIN_XMMS__HTTP_H - -extern int flac_http_open(const gchar * url, guint64 offset); -extern void flac_http_close(void); -extern int flac_http_read(gpointer data, gint length); - - -#endif diff --git a/src/plugin_xmms/locale_hack.h b/src/plugin_xmms/locale_hack.h deleted file mode 100644 index 5737319b..00000000 --- a/src/plugin_xmms/locale_hack.h +++ /dev/null @@ -1,56 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * Based on: - * locale.h - 2000/05/05 13:10 Jerome Couderc - * EasyTAG - Tag editor for MP3 and OGG files - * Copyright (C) 1999-2001 H蛆ard Kvè™±en - * - * 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. - */ -/* - * Gettext support for EasyTAG - */ - - -#ifndef FLAC__PLUGIN_COMMON__LOCALE_HACK_H -#define FLAC__PLUGIN_COMMON__LOCALE_HACK_H - -#include - -/* - * Standard gettext macros. - */ -#ifdef ENABLE_NLS -# include -# define _(String) gettext (String) -# ifdef gettext_noop -# define N_(String) gettext_noop (String) -# else -# define N_(String) (String) -# endif -#else -# define textdomain(String) (String) -# define gettext(String) (String) -# define dgettext(Domain,Message) (Message) -# define dcgettext(Domain,Message,Type) (Message) -# define bindtextdomain(Domain,Directory) (Domain) -# define _(String) (String) -# define N_(String) (String) -#endif - - -#endif diff --git a/src/plugin_xmms/plugin.c b/src/plugin_xmms/plugin.c deleted file mode 100644 index 94fbae50..00000000 --- a/src/plugin_xmms/plugin.c +++ /dev/null @@ -1,688 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "plugin.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#ifdef HAVE_LANGINFO_CODESET -#include -#endif - -#include "FLAC/all.h" -#include "plugin_common/all.h" -#include "share/grabbag.h" -#include "share/replaygain_synthesis.h" -#include "configure.h" -#include "charset.h" -#include "http.h" -#include "tag.h" - -#ifdef min -#undef min -#endif -#define min(x,y) ((x)<(y)?(x):(y)) - -extern void FLAC_XMMS__file_info_box(char *filename); - -typedef struct { - FLAC__bool abort_flag; - FLAC__bool is_playing; - FLAC__bool is_http_source; - FLAC__bool eof; - FLAC__bool play_thread_open; /* if true, is_playing must also be true */ - FLAC__uint64 total_samples; - uint32_t bits_per_sample; - uint32_t channels; - uint32_t sample_rate; - int length_in_msec; /* int (instead of FLAC__uint64) only because that's what XMMS uses; seeking won't work right if this maxes out */ - gchar *title; - AFormat sample_format; - uint32_t sample_format_bytes_per_sample; - int seek_to_in_sec; - FLAC__bool has_replaygain; - double replay_scale; - DitherContext dither_context; -} stream_data_struct; - -static void FLAC_XMMS__init(void); -static int FLAC_XMMS__is_our_file(char *filename); -static void FLAC_XMMS__play_file(char *filename); -static void FLAC_XMMS__stop(void); -static void FLAC_XMMS__pause(short p); -static void FLAC_XMMS__seek(int time); -static int FLAC_XMMS__get_time(void); -static void FLAC_XMMS__cleanup(void); -static void FLAC_XMMS__get_song_info(char *filename, char **title, int *length); - -static void *play_loop_(void *arg); - -static FLAC__bool safe_decoder_init_(const char *filename, FLAC__StreamDecoder *decoder); -static void safe_decoder_finish_(FLAC__StreamDecoder *decoder); -static void safe_decoder_delete_(FLAC__StreamDecoder *decoder); - -static FLAC__StreamDecoderReadStatus http_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); -static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); -static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); -static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); - -InputPlugin flac_ip = -{ - NULL, - NULL, - "FLAC Player v" VERSION, - FLAC_XMMS__init, - FLAC_XMMS__aboutbox, - FLAC_XMMS__configure, - FLAC_XMMS__is_our_file, - NULL, - FLAC_XMMS__play_file, - FLAC_XMMS__stop, - FLAC_XMMS__pause, - FLAC_XMMS__seek, - NULL, - FLAC_XMMS__get_time, - NULL, - NULL, - FLAC_XMMS__cleanup, - NULL, - NULL, - NULL, - NULL, - FLAC_XMMS__get_song_info, - FLAC_XMMS__file_info_box, - NULL -}; - -#define SAMPLES_PER_WRITE 512 -#define SAMPLE_BUFFER_SIZE ((FLAC__MAX_BLOCK_SIZE + SAMPLES_PER_WRITE) * FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS * (24/8)) -static FLAC__byte sample_buffer_[SAMPLE_BUFFER_SIZE]; -static uint32_t sample_buffer_first_, sample_buffer_last_; - -static FLAC__StreamDecoder *decoder_ = 0; -static stream_data_struct stream_data_; -static pthread_t decode_thread_; -static FLAC__bool audio_error_ = false; -static FLAC__bool is_big_endian_host_; - -#define BITRATE_HIST_SEGMENT_MSEC 500 -/* 500ms * 50 = 25s should be enough */ -#define BITRATE_HIST_SIZE 50 -static uint32_t bitrate_history_[BITRATE_HIST_SIZE]; - - -FLAC_API InputPlugin *get_iplugin_info(void) -{ - flac_ip.description = g_strdup_printf("Reference FLAC Player v%s", FLAC__VERSION_STRING); - return &flac_ip; -} - -void set_track_info(const char* title, int length_in_msec) -{ - if (stream_data_.is_playing) { - flac_ip.set_info((char*) title, length_in_msec, stream_data_.sample_rate * stream_data_.channels * stream_data_.bits_per_sample, stream_data_.sample_rate, stream_data_.channels); - } -} - -static gchar* homedir(void) -{ - gchar *result; - char *env_home = getenv("HOME"); - if (env_home) { - result = g_strdup (env_home); - } else { - uid_t uid = getuid(); - struct passwd *pwent; - do { - pwent = getpwent(); - } while (pwent && pwent->pw_uid != uid); - result = pwent ? g_strdup (pwent->pw_dir) : NULL; - endpwent(); - } - return result; -} - -static FLAC__bool is_http_source(const char *source) -{ - return 0 == strncasecmp(source, "http://", 7); -} - -void FLAC_XMMS__init(void) -{ - ConfigFile *cfg; - FLAC__uint32 test = 1; - - is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true; - - flac_cfg.title.tag_override = FALSE; - if (flac_cfg.title.tag_format) - g_free(flac_cfg.title.tag_format); - flac_cfg.title.convert_char_set = FALSE; - - cfg = xmms_cfg_open_default_file(); - - /* title */ - - xmms_cfg_read_boolean(cfg, "flac", "title.tag_override", &flac_cfg.title.tag_override); - - if(!xmms_cfg_read_string(cfg, "flac", "title.tag_format", &flac_cfg.title.tag_format)) - flac_cfg.title.tag_format = g_strdup("%p - %t"); - - xmms_cfg_read_boolean(cfg, "flac", "title.convert_char_set", &flac_cfg.title.convert_char_set); - - if(!xmms_cfg_read_string(cfg, "flac", "title.user_char_set", &flac_cfg.title.user_char_set)) - flac_cfg.title.user_char_set = FLAC_plugin__charset_get_current(); - - /* replaygain */ - - xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.enable", &flac_cfg.output.replaygain.enable); - - xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.album_mode", &flac_cfg.output.replaygain.album_mode); - - if(!xmms_cfg_read_int(cfg, "flac", "output.replaygain.preamp", &flac_cfg.output.replaygain.preamp)) - flac_cfg.output.replaygain.preamp = 0; - - xmms_cfg_read_boolean(cfg, "flac", "output.replaygain.hard_limit", &flac_cfg.output.replaygain.hard_limit); - - xmms_cfg_read_boolean(cfg, "flac", "output.resolution.normal.dither_24_to_16", &flac_cfg.output.resolution.normal.dither_24_to_16); - xmms_cfg_read_boolean(cfg, "flac", "output.resolution.replaygain.dither", &flac_cfg.output.resolution.replaygain.dither); - - if(!xmms_cfg_read_int(cfg, "flac", "output.resolution.replaygain.noise_shaping", &flac_cfg.output.resolution.replaygain.noise_shaping)) - flac_cfg.output.resolution.replaygain.noise_shaping = 1; - - if(!xmms_cfg_read_int(cfg, "flac", "output.resolution.replaygain.bps_out", &flac_cfg.output.resolution.replaygain.bps_out)) - flac_cfg.output.resolution.replaygain.bps_out = 16; - - /* stream */ - - xmms_cfg_read_int(cfg, "flac", "stream.http_buffer_size", &flac_cfg.stream.http_buffer_size); - xmms_cfg_read_int(cfg, "flac", "stream.http_prebuffer", &flac_cfg.stream.http_prebuffer); - xmms_cfg_read_boolean(cfg, "flac", "stream.use_proxy", &flac_cfg.stream.use_proxy); - if(flac_cfg.stream.proxy_host) - g_free(flac_cfg.stream.proxy_host); - if(!xmms_cfg_read_string(cfg, "flac", "stream.proxy_host", &flac_cfg.stream.proxy_host)) - flac_cfg.stream.proxy_host = g_strdup(""); - xmms_cfg_read_int(cfg, "flac", "stream.proxy_port", &flac_cfg.stream.proxy_port); - xmms_cfg_read_boolean(cfg, "flac", "stream.proxy_use_auth", &flac_cfg.stream.proxy_use_auth); - if(flac_cfg.stream.proxy_user) - g_free(flac_cfg.stream.proxy_user); - flac_cfg.stream.proxy_user = NULL; - xmms_cfg_read_string(cfg, "flac", "stream.proxy_user", &flac_cfg.stream.proxy_user); - if(flac_cfg.stream.proxy_pass) - g_free(flac_cfg.stream.proxy_pass); - flac_cfg.stream.proxy_pass = NULL; - xmms_cfg_read_string(cfg, "flac", "stream.proxy_pass", &flac_cfg.stream.proxy_pass); - xmms_cfg_read_boolean(cfg, "flac", "stream.save_http_stream", &flac_cfg.stream.save_http_stream); - if (flac_cfg.stream.save_http_path) - g_free (flac_cfg.stream.save_http_path); - if (!xmms_cfg_read_string(cfg, "flac", "stream.save_http_path", &flac_cfg.stream.save_http_path) || ! *flac_cfg.stream.save_http_path) { - if (flac_cfg.stream.save_http_path) - g_free (flac_cfg.stream.save_http_path); - flac_cfg.stream.save_http_path = homedir(); - } - xmms_cfg_read_boolean(cfg, "flac", "stream.cast_title_streaming", &flac_cfg.stream.cast_title_streaming); - xmms_cfg_read_boolean(cfg, "flac", "stream.use_udp_channel", &flac_cfg.stream.use_udp_channel); - - decoder_ = FLAC__stream_decoder_new(); - - xmms_cfg_free(cfg); -} - -int FLAC_XMMS__is_our_file(char *filename) -{ - char *ext; - - ext = strrchr(filename, '.'); - if(ext) - if(!strcasecmp(ext, ".flac") || !strcasecmp(ext, ".fla")) - return 1; - return 0; -} - -void FLAC_XMMS__play_file(char *filename) -{ - FILE *f; - - sample_buffer_first_ = sample_buffer_last_ = 0; - audio_error_ = false; - stream_data_.abort_flag = false; - stream_data_.is_playing = false; - stream_data_.is_http_source = is_http_source(filename); - stream_data_.eof = false; - stream_data_.play_thread_open = false; - stream_data_.has_replaygain = false; - - if(!is_http_source(filename)) { - if(0 == (f = fopen(filename, "r"))) - return; - fclose(f); - } - - if(decoder_ == 0) - return; - - if(!safe_decoder_init_(filename, decoder_)) - return; - - if(stream_data_.has_replaygain && flac_cfg.output.replaygain.enable) { - if(flac_cfg.output.resolution.replaygain.bps_out == 8) { - stream_data_.sample_format = FMT_U8; - stream_data_.sample_format_bytes_per_sample = 1; - } - else if(flac_cfg.output.resolution.replaygain.bps_out == 16) { - stream_data_.sample_format = (is_big_endian_host_) ? FMT_S16_BE : FMT_S16_LE; - stream_data_.sample_format_bytes_per_sample = 2; - } - else { - /*@@@ need some error here like wa2: MessageBox(mod_.hMainWindow, "ERROR: plugin can only handle 8/16-bit samples\n", "ERROR: plugin can only handle 8/16-bit samples", 0); */ - fprintf(stderr, "libxmms-flac: can't handle %d bit output\n", flac_cfg.output.resolution.replaygain.bps_out); - safe_decoder_finish_(decoder_); - return; - } - } - else { - if(stream_data_.bits_per_sample == 8) { - stream_data_.sample_format = FMT_U8; - stream_data_.sample_format_bytes_per_sample = 1; - } - else if(stream_data_.bits_per_sample == 16 || (stream_data_.bits_per_sample == 24 && flac_cfg.output.resolution.normal.dither_24_to_16)) { - stream_data_.sample_format = (is_big_endian_host_) ? FMT_S16_BE : FMT_S16_LE; - stream_data_.sample_format_bytes_per_sample = 2; - } - else { - /*@@@ need some error here like wa2: MessageBox(mod_.hMainWindow, "ERROR: plugin can only handle 8/16-bit samples\n", "ERROR: plugin can only handle 8/16-bit samples", 0); */ - fprintf(stderr, "libxmms-flac: can't handle %u bit output\n", stream_data_.bits_per_sample); - safe_decoder_finish_(decoder_); - return; - } - } - FLAC__replaygain_synthesis__init_dither_context(&stream_data_.dither_context, stream_data_.sample_format_bytes_per_sample * 8, flac_cfg.output.resolution.replaygain.noise_shaping); - stream_data_.is_playing = true; - - if(flac_ip.output->open_audio(stream_data_.sample_format, stream_data_.sample_rate, stream_data_.channels) == 0) { - audio_error_ = true; - safe_decoder_finish_(decoder_); - return; - } - - stream_data_.title = flac_format_song_title(filename); - flac_ip.set_info(stream_data_.title, stream_data_.length_in_msec, stream_data_.sample_rate * stream_data_.channels * stream_data_.bits_per_sample, stream_data_.sample_rate, stream_data_.channels); - - stream_data_.seek_to_in_sec = -1; - stream_data_.play_thread_open = true; - pthread_create(&decode_thread_, NULL, play_loop_, NULL); -} - -void FLAC_XMMS__stop(void) -{ - if(stream_data_.is_playing) { - stream_data_.is_playing = false; - if(stream_data_.play_thread_open) { - stream_data_.play_thread_open = false; - pthread_join(decode_thread_, NULL); - } - flac_ip.output->close_audio(); - safe_decoder_finish_(decoder_); - } -} - -void FLAC_XMMS__pause(short p) -{ - flac_ip.output->pause(p); -} - -void FLAC_XMMS__seek(int time) -{ - if(!stream_data_.is_http_source) { - stream_data_.seek_to_in_sec = time; - stream_data_.eof = false; - - while(stream_data_.seek_to_in_sec != -1) - xmms_usleep(10000); - } -} - -int FLAC_XMMS__get_time(void) -{ - if(audio_error_) - return -2; - if(!stream_data_.is_playing || (stream_data_.eof && !flac_ip.output->buffer_playing())) - return -1; - else - return flac_ip.output->output_time(); -} - -void FLAC_XMMS__cleanup(void) -{ - safe_decoder_delete_(decoder_); - decoder_ = 0; -} - -void FLAC_XMMS__get_song_info(char *filename, char **title, int *length_in_msec) -{ - FLAC__StreamMetadata streaminfo; - - if(0 == filename) - filename = ""; - - if(!FLAC__metadata_get_streaminfo(filename, &streaminfo)) { - /* @@@ how to report the error? */ - if(title) { - if (!is_http_source(filename)) { - static const char *errtitle = "Invalid FLAC File: "; - if(strlen(errtitle) + 1 + strlen(filename) + 1 + 1 < strlen(filename)) { /* overflow check */ - *title = NULL; - } - else { - size_t len = strlen(errtitle) + 1 + strlen(filename) + 1 + 1; - *title = g_malloc(len); - flac_snprintf(*title, len, "%s\"%s\"", errtitle, filename); - } - } else { - *title = NULL; - } - } - if(length_in_msec) - *length_in_msec = -1; - return; - } - - if(title) { - *title = flac_format_song_title(filename); - } - if(length_in_msec) { - FLAC__uint64 l = (FLAC__uint64)((double)streaminfo.data.stream_info.total_samples / (double)streaminfo.data.stream_info.sample_rate * 1000.0 + 0.5); - if (l > INT_MAX) - l = INT_MAX; - *length_in_msec = (int)l; - } -} - -/*********************************************************************** - * local routines - **********************************************************************/ - -void *play_loop_(void *arg) -{ - uint32_t written_time_last = 0, bh_index_last_w = 0, bh_index_last_o = BITRATE_HIST_SIZE, blocksize = 1; - FLAC__uint64 decode_position_last = 0, decode_position_frame_last = 0, decode_position_frame = 0; - - (void)arg; - - while(stream_data_.is_playing) { - if(!stream_data_.eof) { - while(sample_buffer_last_ - sample_buffer_first_ < SAMPLES_PER_WRITE) { - uint32_t s; - - s = sample_buffer_last_ - sample_buffer_first_; - if(FLAC__stream_decoder_get_state(decoder_) == FLAC__STREAM_DECODER_END_OF_STREAM) { - stream_data_.eof = true; - break; - } - else if(!FLAC__stream_decoder_process_single(decoder_)) { - /*@@@ this should probably be a dialog */ - fprintf(stderr, "libxmms-flac: READ ERROR processing frame\n"); - stream_data_.eof = true; - break; - } - blocksize = sample_buffer_last_ - sample_buffer_first_ - s; - decode_position_frame_last = decode_position_frame; - if(stream_data_.is_http_source || !FLAC__stream_decoder_get_decode_position(decoder_, &decode_position_frame)) - decode_position_frame = 0; - } - if(sample_buffer_last_ - sample_buffer_first_ > 0) { - const uint32_t n = min(sample_buffer_last_ - sample_buffer_first_, SAMPLES_PER_WRITE); - int bytes = n * stream_data_.channels * stream_data_.sample_format_bytes_per_sample; - FLAC__byte *sample_buffer_start = sample_buffer_ + sample_buffer_first_ * stream_data_.channels * stream_data_.sample_format_bytes_per_sample; - uint32_t written_time, bh_index_w; - FLAC__uint64 decode_position; - - sample_buffer_first_ += n; - flac_ip.add_vis_pcm(flac_ip.output->written_time(), stream_data_.sample_format, stream_data_.channels, bytes, sample_buffer_start); - while(flac_ip.output->buffer_free() < (int)bytes && stream_data_.is_playing && stream_data_.seek_to_in_sec == -1) - xmms_usleep(10000); - if(stream_data_.is_playing && stream_data_.seek_to_in_sec == -1) - flac_ip.output->write_audio(sample_buffer_start, bytes); - - /* compute current bitrate */ - - written_time = flac_ip.output->written_time(); - bh_index_w = written_time / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; - if(bh_index_w != bh_index_last_w) { - bh_index_last_w = bh_index_w; - decode_position = decode_position_frame - (double)(sample_buffer_last_ - sample_buffer_first_) * (double)(decode_position_frame - decode_position_frame_last) / (double)blocksize; - bitrate_history_[(bh_index_w + BITRATE_HIST_SIZE - 1) % BITRATE_HIST_SIZE] = - decode_position > decode_position_last && written_time > written_time_last ? - 8000 * (decode_position - decode_position_last) / (written_time - written_time_last) : - stream_data_.sample_rate * stream_data_.channels * stream_data_.bits_per_sample; - decode_position_last = decode_position; - written_time_last = written_time; - } - } - else { - stream_data_.eof = true; - xmms_usleep(10000); - } - } - else - xmms_usleep(10000); - if(!stream_data_.is_http_source && stream_data_.seek_to_in_sec != -1) { - const double distance = (double)stream_data_.seek_to_in_sec * 1000.0 / (double)stream_data_.length_in_msec; - FLAC__uint64 target_sample = (FLAC__uint64)(distance * (double)stream_data_.total_samples); - if(stream_data_.total_samples > 0 && target_sample >= stream_data_.total_samples) - target_sample = stream_data_.total_samples - 1; - if(FLAC__stream_decoder_seek_absolute(decoder_, target_sample)) { - flac_ip.output->flush(stream_data_.seek_to_in_sec * 1000); - bh_index_last_w = bh_index_last_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; - if(!FLAC__stream_decoder_get_decode_position(decoder_, &decode_position_frame)) - decode_position_frame = 0; - stream_data_.eof = false; - sample_buffer_first_ = sample_buffer_last_ = 0; - } - else if(FLAC__stream_decoder_get_state(decoder_) == FLAC__STREAM_DECODER_SEEK_ERROR) { - /*@@@ this should probably be a dialog */ - fprintf(stderr, "libxmms-flac: SEEK ERROR\n"); - FLAC__stream_decoder_flush(decoder_); - stream_data_.eof = false; - sample_buffer_first_ = sample_buffer_last_ = 0; - } - stream_data_.seek_to_in_sec = -1; - } - else { - /* display the right bitrate from history */ - uint32_t bh_index_o = flac_ip.output->output_time() / BITRATE_HIST_SEGMENT_MSEC % BITRATE_HIST_SIZE; - if(bh_index_o != bh_index_last_o && bh_index_o != bh_index_last_w && bh_index_o != (bh_index_last_w + 1) % BITRATE_HIST_SIZE) { - bh_index_last_o = bh_index_o; - flac_ip.set_info(stream_data_.title, stream_data_.length_in_msec, bitrate_history_[bh_index_o], stream_data_.sample_rate, stream_data_.channels); - } - } - } - - safe_decoder_finish_(decoder_); - - /* are these two calls necessary? */ - flac_ip.output->buffer_free(); - flac_ip.output->buffer_free(); - - g_free(stream_data_.title); - - pthread_exit(NULL); - return 0; /* to silence the compiler warning about not returning a value */ -} - -FLAC__bool safe_decoder_init_(const char *filename, FLAC__StreamDecoder *decoder) -{ - if(decoder == 0) - return false; - - safe_decoder_finish_(decoder); - - FLAC__stream_decoder_set_md5_checking(decoder, false); - FLAC__stream_decoder_set_metadata_ignore_all(decoder); - FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_STREAMINFO); - FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); - if(stream_data_.is_http_source) { - flac_http_open(filename, 0); - if(FLAC__stream_decoder_init_stream(decoder, http_read_callback_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, write_callback_, metadata_callback_, error_callback_, /*client_data=*/&stream_data_) != FLAC__STREAM_DECODER_INIT_STATUS_OK) - return false; - } - else { - if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, metadata_callback_, error_callback_, /*client_data=*/&stream_data_) != FLAC__STREAM_DECODER_INIT_STATUS_OK) - return false; - } - - if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) - return false; - - return true; -} - -void safe_decoder_finish_(FLAC__StreamDecoder *decoder) -{ - if(decoder && FLAC__stream_decoder_get_state(decoder) != FLAC__STREAM_DECODER_UNINITIALIZED) - (void)FLAC__stream_decoder_finish(decoder); - if(stream_data_.is_http_source) - flac_http_close(); -} - -void safe_decoder_delete_(FLAC__StreamDecoder *decoder) -{ - if(decoder) { - safe_decoder_finish_(decoder); - FLAC__stream_decoder_delete(decoder); - } -} - -FLAC__StreamDecoderReadStatus http_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) -{ - (void)decoder; - (void)client_data; - *bytes = flac_http_read(buffer, *bytes); - return *bytes ? FLAC__STREAM_DECODER_READ_STATUS_CONTINUE : FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; -} - -FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - stream_data_struct *stream_data = (stream_data_struct *)client_data; - const uint32_t channels = stream_data->channels, wide_samples = frame->header.blocksize; - const uint32_t bits_per_sample = stream_data->bits_per_sample; - FLAC__byte *sample_buffer_start; - - (void)decoder; - - if(stream_data->abort_flag) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - - if((sample_buffer_last_ + wide_samples) > (SAMPLE_BUFFER_SIZE / (channels * stream_data->sample_format_bytes_per_sample))) { - memmove(sample_buffer_, sample_buffer_ + sample_buffer_first_ * channels * stream_data->sample_format_bytes_per_sample, (sample_buffer_last_ - sample_buffer_first_) * channels * stream_data->sample_format_bytes_per_sample); - sample_buffer_last_ -= sample_buffer_first_; - sample_buffer_first_ = 0; - } - sample_buffer_start = sample_buffer_ + sample_buffer_last_ * channels * stream_data->sample_format_bytes_per_sample; - if(stream_data->has_replaygain && flac_cfg.output.replaygain.enable) { - FLAC__replaygain_synthesis__apply_gain( - sample_buffer_start, - !is_big_endian_host_, - stream_data->sample_format_bytes_per_sample == 1, /* uint32_t_data_out */ - buffer, - wide_samples, - channels, - bits_per_sample, - stream_data->sample_format_bytes_per_sample * 8, - stream_data->replay_scale, - flac_cfg.output.replaygain.hard_limit, - flac_cfg.output.resolution.replaygain.dither, - &stream_data->dither_context - ); - } - else if(is_big_endian_host_) { - FLAC__plugin_common__pack_pcm_signed_big_endian( - sample_buffer_start, - buffer, - wide_samples, - channels, - bits_per_sample, - stream_data->sample_format_bytes_per_sample * 8 - ); - } - else { - FLAC__plugin_common__pack_pcm_signed_little_endian( - sample_buffer_start, - buffer, - wide_samples, - channels, - bits_per_sample, - stream_data->sample_format_bytes_per_sample * 8 - ); - } - - sample_buffer_last_ += wide_samples; - - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - stream_data_struct *stream_data = (stream_data_struct *)client_data; - (void)decoder; - if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { - stream_data->total_samples = metadata->data.stream_info.total_samples; - stream_data->bits_per_sample = metadata->data.stream_info.bits_per_sample; - stream_data->channels = metadata->data.stream_info.channels; - stream_data->sample_rate = metadata->data.stream_info.sample_rate; - { - FLAC__uint64 l = (FLAC__uint64)((double)stream_data->total_samples / (double)stream_data->sample_rate * 1000.0 + 0.5); - if (l > INT_MAX) - l = INT_MAX; - stream_data->length_in_msec = (int)l; - } - } - else if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - double reference, gain, peak; - if(grabbag__replaygain_load_from_vorbiscomment(metadata, flac_cfg.output.replaygain.album_mode, /*strict=*/false, &reference, &gain, &peak)) { - stream_data->has_replaygain = true; - stream_data->replay_scale = grabbag__replaygain_compute_scale_factor(peak, gain, (double)flac_cfg.output.replaygain.preamp, /*prevent_clipping=*/!flac_cfg.output.replaygain.hard_limit); - } - } -} - -void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - stream_data_struct *stream_data = (stream_data_struct *)client_data; - (void)decoder; - if(status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) - stream_data->abort_flag = true; -} diff --git a/src/plugin_xmms/plugin.h b/src/plugin_xmms/plugin.h deleted file mode 100644 index e3ba9896..00000000 --- a/src/plugin_xmms/plugin.h +++ /dev/null @@ -1,33 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2004-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__PLUGIN_XMMS__PLUGIN_H -#define FLAC__PLUGIN_XMMS__PLUGIN_H - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if defined(__GNUC_STDC_INLINE__) -# define G_INLINE_FUNC extern inline __attribute__((gnu_inline)) -#endif - -void set_track_info(const char* title, int length_in_msec); - -#endif diff --git a/src/plugin_xmms/tag.c b/src/plugin_xmms/tag.c deleted file mode 100644 index a8ecab43..00000000 --- a/src/plugin_xmms/tag.c +++ /dev/null @@ -1,157 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Daisuke Shimamura - * - * Based on FLAC plugin.c and mpg123 plugin - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "plugin.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "FLAC/metadata.h" -#include "plugin_common/tags.h" -#include "charset.h" -#include "configure.h" - -/* - * Function local__extname (filename) - * - * Return pointer within filename to its extension, or NULL if - * filename has no extension. - * - */ -static char *local__extname(const char *filename) -{ - char *ext = strrchr(filename, '.'); - - if (ext != NULL) - ++ext; - - return ext; -} - -static char *local__getstr(char* str) -{ - if (str && strlen(str) > 0) - return str; - return NULL; -} - -static int local__getnum(char* str) -{ - if (str && strlen(str) > 0) - return atoi(str); - return 0; -} - -static char *local__getfield(const FLAC__StreamMetadata *tags, const char *name) -{ - if (0 != tags) { - const char *utf8 = FLAC_plugin__tags_get_tag_utf8(tags, name); - if (0 != utf8) { - if(flac_cfg.title.convert_char_set) - return convert_from_utf8_to_user(utf8); - else - return strdup(utf8); - } - } - - return 0; -} - -static void local__safe_free(char *s) -{ - if (0 != s) - free(s); -} - -/* - * Function flac_format_song_title (tag, filename) - * - * Create song title according to `tag' and/or `filename' and - * return it. The title must be subsequently freed using g_free(). - * - */ -char *flac_format_song_title(char *filename) -{ - char *ret = NULL; - TitleInput *input = NULL; - FLAC__StreamMetadata *tags; - char *title, *artist, *performer, *album, *date, *tracknumber, *genre, *description; - - FLAC_plugin__tags_get(filename, &tags); - - title = local__getfield(tags, "TITLE"); - artist = local__getfield(tags, "ARTIST"); - performer = local__getfield(tags, "PERFORMER"); - album = local__getfield(tags, "ALBUM"); - date = local__getfield(tags, "DATE"); - tracknumber = local__getfield(tags, "TRACKNUMBER"); - genre = local__getfield(tags, "GENRE"); - description = local__getfield(tags, "DESCRIPTION"); - - XMMS_NEW_TITLEINPUT(input); - - input->performer = local__getstr(artist); - if(!input->performer) - input->performer = local__getstr(performer); - input->album_name = local__getstr(album); - input->track_name = local__getstr(title); - input->track_number = local__getnum(tracknumber); - input->year = local__getnum(date); - input->genre = local__getstr(genre); - input->comment = local__getstr(description); - - input->file_name = g_basename(filename); - input->file_path = filename; - input->file_ext = local__extname(filename); - ret = xmms_get_titlestring(flac_cfg.title.tag_override ? flac_cfg.title.tag_format : xmms_get_gentitle_format(), input); - g_free(input); - - if (!ret) { - /* - * Format according to filename. - */ - ret = g_strdup(g_basename(filename)); - if (local__extname(ret) != NULL) - *(local__extname(ret) - 1) = '\0'; /* removes period */ - } - - FLAC_plugin__tags_destroy(&tags); - local__safe_free(title); - local__safe_free(artist); - local__safe_free(performer); - local__safe_free(album); - local__safe_free(date); - local__safe_free(tracknumber); - local__safe_free(genre); - local__safe_free(description); - return ret; -} diff --git a/src/plugin_xmms/tag.h b/src/plugin_xmms/tag.h deleted file mode 100644 index cc5bccf2..00000000 --- a/src/plugin_xmms/tag.h +++ /dev/null @@ -1,24 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Daisuke Shimamura - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__PLUGIN_XMMS__TAG_H -#define FLAC__PLUGIN_XMMS__TAG_H - -gchar *flac_format_song_title(gchar * filename); - -#endif diff --git a/src/share/Makefile.am b/src/share/Makefile.am deleted file mode 100644 index 9ee826b4..00000000 --- a/src/share/Makefile.am +++ /dev/null @@ -1,99 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -AUTOMAKE_OPTIONS = subdir-objects - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include - -EXTRA_DIST = \ - Makefile.lite \ - README \ - getopt/CMakeLists.txt \ - getopt/Makefile.lite \ - getopt/getopt_static.vcproj \ - getopt/getopt_static.vcxproj \ - getopt/getopt_static.vcxproj.filters \ - grabbag/CMakeLists.txt \ - grabbag/Makefile.lite \ - grabbag/grabbag_static.vcproj \ - grabbag/grabbag_static.vcxproj \ - grabbag/grabbag_static.vcxproj.filters \ - replaygain_analysis/CMakeLists.txt \ - replaygain_analysis/Makefile.lite \ - replaygain_analysis/replaygain_analysis_static.vcproj \ - replaygain_analysis/replaygain_analysis_static.vcxproj \ - replaygain_analysis/replaygain_analysis_static.vcxproj.filters \ - replaygain_synthesis/CMakeLists.txt \ - replaygain_synthesis/Makefile.lite \ - replaygain_synthesis/replaygain_synthesis_static.vcproj \ - replaygain_synthesis/replaygain_synthesis_static.vcxproj \ - replaygain_synthesis/replaygain_synthesis_static.vcxproj.filters \ - utf8/CMakeLists.txt \ - utf8/Makefile.lite \ - utf8/charmaps.h \ - utf8/makemap.c \ - utf8/charset_test.c \ - utf8/utf8_static.vcproj \ - utf8/utf8_static.vcxproj \ - utf8/utf8_static.vcxproj.filters \ - win_utf8_io/Makefile.lite \ - win_utf8_io/win_utf8_io_static.vcproj \ - win_utf8_io/win_utf8_io_static.vcxproj \ - win_utf8_io/win_utf8_io_static.vcxproj.filters - - -noinst_LTLIBRARIES = \ - getopt/libgetopt.la \ - grabbag/libgrabbag.la \ - utf8/libutf8.la \ - $(libwin_utf8_io) \ - replaygain_analysis/libreplaygain_analysis.la \ - replaygain_synthesis/libreplaygain_synthesis.la - - -if OS_IS_WINDOWS -win_utf8_io_libwin_utf8_io_la_SOURCES = win_utf8_io/win_utf8_io.c -libwin_utf8_io = win_utf8_io/libwin_utf8_io.la -win_utf8_io_libwin_utf8_io_la_LIBADD = $(top_builddir)/src/libFLAC/libFLAC.la -lm -else -win_utf8_io_libwin_utf8_io_la_SOURCES = -libwin_utf8_io = -endif - -getopt_libgetopt_la_SOURCES = getopt/getopt.c getopt/getopt1.c - -grabbag_libgrabbag_la_SOURCES = \ - grabbag/alloc.c \ - grabbag/cuesheet.c \ - grabbag/file.c \ - grabbag/picture.c \ - grabbag/replaygain.c \ - grabbag/seektable.c \ - grabbag/snprintf.c - -utf8_libutf8_la_SOURCES = \ - utf8/charset.c \ - utf8/charset.h \ - utf8/iconvert.c \ - utf8/iconvert.h \ - utf8/utf8.c - -replaygain_analysis_libreplaygain_analysis_la_SOURCES = replaygain_analysis/replaygain_analysis.c - -replaygain_synthesis_libreplaygain_synthesis_la_CFLAGS = -I $(top_srcdir)/src/share/replaygain_synthesis/include -replaygain_synthesis_libreplaygain_synthesis_la_SOURCES = replaygain_synthesis/replaygain_synthesis.c diff --git a/src/share/Makefile.lite b/src/share/Makefile.lite deleted file mode 100644 index d5777874..00000000 --- a/src/share/Makefile.lite +++ /dev/null @@ -1,58 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -.PHONY: all getopt grabbag replaygain_analysis replaygain_synthesis utf8 -all: getopt replaygain_analysis grabbag replaygain_synthesis utf8 - -DEFAULT_CONFIG = release - -CONFIG = $(DEFAULT_CONFIG) - -debug : CONFIG = debug -valgrind: CONFIG = valgrind -release : CONFIG = release - -debug : all -valgrind: all -release : all - -getopt: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -replaygain_analysis: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -grabbag: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -replaygain_synthesis: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -utf8: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -win_utf8_io: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -clean: - -(cd getopt ; $(MAKE) -f Makefile.lite clean) - -(cd grabbag ; $(MAKE) -f Makefile.lite clean) - -(cd replaygain_analysis ; $(MAKE) -f Makefile.lite clean) - -(cd replaygain_synthesis ; $(MAKE) -f Makefile.lite clean) - -(cd utf8 ; $(MAKE) -f Makefile.lite clean) - -(cd win_utf8_io ; $(MAKE) -f Makefile.lite clean) diff --git a/src/share/README b/src/share/README deleted file mode 100644 index 1d4feded..00000000 --- a/src/share/README +++ /dev/null @@ -1,5 +0,0 @@ -This directory contains several convenience libraries used by the rest of the -tools and plugins. Two of them (getopt and utf8) are shamelessly copied from -vorbistools, one for manipulating UTF-8 strings (GPL) and one for implementing -getopt (LGPL). libFLAC does not link to either; the only FLAC tools that do -are GPL'ed. diff --git a/src/share/getopt/CMakeLists.txt b/src/share/getopt/CMakeLists.txt deleted file mode 100644 index 83b530e5..00000000 --- a/src/share/getopt/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -check_include_file("string.h" HAVE_STRING_H) - -find_package(Intl) - -add_library(getopt STATIC getopt.c getopt1.c) - -if(Intl_FOUND) - target_include_directories(getopt PRIVATE ${Intl_INCLUDE_DIRS}) - target_link_libraries(getopt PUBLIC ${Intl_LIBRARIES}) - target_compile_definitions(getopt PRIVATE HAVE_LIBINTL_H) -endif() diff --git a/src/share/getopt/Makefile.lite b/src/share/getopt/Makefile.lite deleted file mode 100644 index b4df6ec6..00000000 --- a/src/share/getopt/Makefile.lite +++ /dev/null @@ -1,16 +0,0 @@ -# -# GNU makefile -# - -topdir = ../../.. - -LIB_NAME = libgetopt -INCLUDES = -I$(topdir)/include - -SRCS_C = \ - getopt.c \ - getopt1.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/share/getopt/getopt.c b/src/share/getopt/getopt.c deleted file mode 100644 index 23c119c0..00000000 --- a/src/share/getopt/getopt.c +++ /dev/null @@ -1,1062 +0,0 @@ -/* - NOTE: - I cannot get the vanilla getopt code to work (i.e. compile only what - is needed and not duplicate symbols found in the standard library) - on all the platforms that FLAC supports. In particular the gating - of code with the ELIDE_CODE #define is not accurate enough on systems - that are POSIX but not glibc. If someone has a patch that works on - GNU/Linux, Darwin, AND Solaris please submit it on the project page: - https://sourceforge.net/p/flac/patches/ - - In the meantime I have munged the global symbols and removed gates - around code, while at the same time trying to touch the original as - little as possible. -*/ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to drepper@gnu.org - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 - Free Software Foundation, Inc. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* This tells Alpha OSF/1 not to define a getopt prototype in . - Ditto for AIX 3.2 and . */ -#ifndef _NO_PROTO -# define _NO_PROTO -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -# ifndef const -# define const -# endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -# include -# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -# define ELIDE_CODE -# endif -#endif - -#if 1 -/*[JEC] was:#ifndef ELIDE_CODE*/ - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -# include -# include -#endif /* GNU C library. */ - -#ifdef VMS -# include -# if HAVE_STRING_H - 0 -# include -# endif -#endif - -#ifndef _ -/* This is for other GNU distributions with internationalized messages. - When compiling libc, the _ macro is predefined. */ -# ifdef HAVE_LIBINTL_H -# include -# define _(msgid) gettext (msgid) -# else -# define _(msgid) (msgid) -# endif -#endif - -/* This version of `share__getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `share__getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "share/getopt.h" -/*[JEC] was:#include "getopt.h"*/ - -/* For communication from `share__getopt' to the caller. - When `share__getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -char *share__optarg = 0; /*[JEC] initialize to avoid being a 'Common' symbol */ - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `share__getopt'. - - On entry to `share__getopt', zero means this is the first call; initialize. - - When `share__getopt' returns -1, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `share__optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* 1003.2 says this must be 1 before any call. */ -int share__optind = 1; - -/* Formerly, initialization of getopt depended on share__optind==0, which - causes problems with re-calling getopt as programs generally don't - know that. */ - -static int share____getopt_initialized = 0; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int share__opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int share__optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `share__getopt' to return -1 with `share__optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -/* Value of POSIXLY_CORRECT environment variable. */ -static char *posixly_correct; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -# include -# define my_index strchr -#else - -#include - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -#ifndef getenv -extern char *getenv (const char * name); -#endif - -static char * -my_index (const char *str, int chr) -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -/* If using GCC, we can safely declare strlen this way. - If not using GCC, it is ok not to declare it. */ -#ifdef __GNUC__ -/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. - That was relevant to code that was here before. */ -# if (!defined __STDC__ || !__STDC__) && !defined strlen -/* gcc with -traditional declares the built-in strlen to return int, - and has done so at least since version 2.4.5. -- rms. */ -extern int strlen (const char *); -# endif /* not __STDC__ */ -#endif /* __GNUC__ */ - -#endif /* not __GNU_LIBRARY__ */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -#ifdef _LIBC -/* Bash 2.0 gives us an environment variable containing flags - indicating ARGV elements that should not be considered arguments. */ - -/* Defined in getopt_init.c */ -extern char *__getopt_nonoption_flags; - -static int nonoption_flags_max_len; -static int nonoption_flags_len; - -static int original_argc; -static char *const *original_argv; - -/* Make sure the environment variable bash 2.0 puts in the environment - is valid for the getopt call we must make sure that the ARGV passed - to getopt is that one passed to the process. */ -static void -__attribute__ ((unused)) -store_args_and_env (int argc, char *const *argv) -{ - /* XXX This is no good solution. We should rather copy the args so - that we can compare them later. But we must not use malloc(3). */ - original_argc = argc; - original_argv = argv; -} -# ifdef text_set_element -text_set_element (__libc_subinit, store_args_and_env); -# endif /* text_set_element */ - -# define SWAP_FLAGS(ch1, ch2) \ - if (nonoption_flags_len > 0) \ - { \ - char __tmp = __getopt_nonoption_flags[ch1]; \ - __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ - __getopt_nonoption_flags[ch2] = __tmp; \ - } -#else /* !_LIBC */ -# define SWAP_FLAGS(ch1, ch2) -#endif /* _LIBC */ - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,share__optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -#if defined __STDC__ && __STDC__ -static void exchange (char **); -#endif - -static void -exchange (argv) - char **argv; -{ - int bottom = first_nonopt; - int middle = last_nonopt; - int top = share__optind; - char *tem; - - /* Exchange the shorter segment with the far end of the longer segment. - That puts the shorter segment into the right place. - It leaves the longer segment in the right place overall, - but it consists of two parts that need to be swapped next. */ - -#ifdef _LIBC - /* First make sure the handling of the `__getopt_nonoption_flags' - string can work normally. Our top argument must be in the range - of the string. */ - if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) - { - /* We must extend the array. The user plays games with us and - presents new arguments. */ - char *new_str = malloc (top + 1); - if (new_str == NULL) - nonoption_flags_len = nonoption_flags_max_len = 0; - else - { - memset (__mempcpy (new_str, __getopt_nonoption_flags, - nonoption_flags_max_len), - '\0', top + 1 - nonoption_flags_max_len); - nonoption_flags_max_len = top + 1; - __getopt_nonoption_flags = new_str; - } - } -#endif - - while (top > middle && middle > bottom) - { - if (top - middle > middle - bottom) - { - /* Bottom segment is the short one. */ - int len = middle - bottom; - register int i; - - /* Swap it with the top part of the top segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[top - (middle - bottom) + i]; - argv[top - (middle - bottom) + i] = tem; - SWAP_FLAGS (bottom + i, top - (middle - bottom) + i); - } - /* Exclude the moved bottom segment from further swapping. */ - top -= len; - } - else - { - /* Top segment is the short one. */ - int len = top - middle; - register int i; - - /* Swap it with the bottom part of the bottom segment. */ - for (i = 0; i < len; i++) - { - tem = argv[bottom + i]; - argv[bottom + i] = argv[middle + i]; - argv[middle + i] = tem; - SWAP_FLAGS (bottom + i, middle + i); - } - /* Exclude the moved top segment from further swapping. */ - bottom += len; - } - } - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (share__optind - last_nonopt); - last_nonopt = share__optind; -} - -/* Initialize the internal data when the first call is made. */ - -#if defined __STDC__ && __STDC__ -static const char *share___getopt_initialize (int, char *const *, const char *); -#endif -static const char * -share___getopt_initialize (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - /* Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - first_nonopt = last_nonopt = share__optind; - - nextchar = NULL; - - posixly_correct = getenv ("POSIXLY_CORRECT"); - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (posixly_correct != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - -#ifdef _LIBC - if (posixly_correct == NULL - && argc == original_argc && argv == original_argv) - { - if (nonoption_flags_max_len == 0) - { - if (__getopt_nonoption_flags == NULL - || __getopt_nonoption_flags[0] == '\0') - nonoption_flags_max_len = -1; - else - { - const char *orig_str = __getopt_nonoption_flags; - int len = nonoption_flags_max_len = strlen (orig_str); - if (nonoption_flags_max_len < argc) - nonoption_flags_max_len = argc; - __getopt_nonoption_flags = - malloc (nonoption_flags_max_len); - if (__getopt_nonoption_flags == NULL) - nonoption_flags_max_len = -1; - else - memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), - '\0', nonoption_flags_max_len - len); - } - } - nonoption_flags_len = nonoption_flags_max_len; - } - else - nonoption_flags_len = 0; -#else - (void)argc, (void)argv; -#endif - - return optstring; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `share__getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `share__getopt' finds another option character, it returns that character, - updating `share__optind' and `nextchar' so that the next call to `share__getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `share__getopt' returns -1. - Then `share__optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `share__opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `share__optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `share__optarg', otherwise `share__optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `share__getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct share__option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -share___getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct share__option *longopts; - int *longind; - int long_only; -{ - share__optarg = NULL; - - if (share__optind == 0 || !share____getopt_initialized) - { - if (share__optind == 0) - share__optind = 1; /* Don't scan ARGV[0], the program name. */ - optstring = share___getopt_initialize (argc, argv, optstring); - share____getopt_initialized = 1; - } - - /* Test whether ARGV[share__optind] points to a non-option argument. - Either it does not have option syntax, or there is an environment flag - from the shell indicating it is not an option. The later information - is only used when the used in the GNU libc. */ -#ifdef _LIBC -# define NONOPTION_P (argv[share__optind][0] != '-' || argv[share__optind][1] == '\0' \ - || (share__optind < nonoption_flags_len \ - && __getopt_nonoption_flags[share__optind] == '1')) -#else -# define NONOPTION_P (argv[share__optind][0] != '-' || argv[share__optind][1] == '\0') -#endif - - if (nextchar == NULL || *nextchar == '\0') - { - /* Advance to the next ARGV-element. */ - - /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been - moved back by the user (who may also have changed the arguments). */ - if (last_nonopt > share__optind) - last_nonopt = share__optind; - if (first_nonopt > share__optind) - first_nonopt = share__optind; - - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != share__optind) - exchange ((char **) argv); - else if (last_nonopt != share__optind) - first_nonopt = share__optind; - - /* Skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (share__optind < argc && NONOPTION_P) - share__optind++; - last_nonopt = share__optind; - } - - /* The special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (share__optind != argc && !strcmp (argv[share__optind], "--")) - { - share__optind++; - - if (first_nonopt != last_nonopt && last_nonopt != share__optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = share__optind; - last_nonopt = argc; - - share__optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (share__optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - share__optind = first_nonopt; - return -1; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if (NONOPTION_P) - { - if (ordering == REQUIRE_ORDER) - return -1; - share__optarg = argv[share__optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Skip the initial punctuation. */ - - nextchar = (argv[share__optind] + 1 - + (longopts != NULL && argv[share__optind][1] == '-')); - } - - /* Decode the current option-ARGV-element. */ - - /* Check whether the ARGV-element is a long option. - - If long_only and the ARGV-element has the form "-f", where f is - a valid short option, don't consider it an abbreviated form of - a long option that starts with f. Otherwise there would be no - way to give the -f short option. - - On the other hand, if there's a long option "fubar" and - the ARGV-element is "-fu", do consider that an abbreviation of - the long option, just like "--fu", and not "-f" with arg "u". - - This distinction seems to be the most useful approach. */ - - if (longopts != NULL - && (argv[share__optind][1] == '-' - || (long_only && (argv[share__optind][2] || !my_index (optstring, argv[share__optind][1]))))) - { - char *nameend; - const struct share__option *p; - const struct share__option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = -1; - int option_index; - - for (nameend = nextchar; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((size_t) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (share__opterr) - fprintf (stderr, _("%s: option `%s' is ambiguous\n"), - argv[0], argv[share__optind]); - nextchar += strlen (nextchar); - share__optind++; - share__optopt = 0; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - share__optind++; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - share__optarg = nameend + 1; - else - { - if (share__opterr) - { - if (argv[share__optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - _("%s: option `--%s' doesn't allow an argument\n"), - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - _("%s: option `%c%s' doesn't allow an argument\n"), - argv[0], argv[share__optind - 1][0], pfound->name); - } - - nextchar += strlen (nextchar); - - share__optopt = pfound->val; - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (share__optind < argc) - share__optarg = argv[share__optind++]; - else - { - if (share__opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[share__optind - 1]); - nextchar += strlen (nextchar); - share__optopt = pfound->val; - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - - /* Can't find it as a long option. If this is not share__getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[share__optind][1] == '-' - || my_index (optstring, *nextchar) == NULL) - { - if (share__opterr) - { - if (argv[share__optind][1] == '-') - /* --option */ - fprintf (stderr, _("%s: unrecognized option `--%s'\n"), - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), - argv[0], argv[share__optind][0], nextchar); - } - nextchar = (char *) ""; - share__optind++; - share__optopt = 0; - return '?'; - } - } - - /* Look at and handle the next short option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `share__optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++share__optind; - - if (temp == NULL || c == ':') - { - if (share__opterr) - { - if (posixly_correct) - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: illegal option -- %c\n"), - argv[0], c); - else - fprintf (stderr, _("%s: invalid option -- %c\n"), - argv[0], c); - } - share__optopt = c; - return '?'; - } - /* Convenience. Treat POSIX -W foo same as long option --foo */ - if (temp[0] == 'W' && temp[1] == ';') - { - char *nameend; - const struct share__option *p; - const struct share__option *pfound = NULL; - int exact = 0; - int ambig = 0; - int indfound = 0; - int option_index; - - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - share__optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - share__optind++; - } - else if (share__optind == argc) - { - if (share__opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - share__optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - return c; - } - else - /* We already incremented `share__optind' once; - increment it again when taking next ARGV-elt as argument. */ - share__optarg = argv[share__optind++]; - - /* share__optarg is now the argument, see if it's in the - table of longopts. */ - - for (nextchar = nameend = share__optarg; *nameend && *nameend != '='; nameend++) - /* Do nothing. */ ; - - /* Test all long options for either exact match - or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!strncmp (p->name, nextchar, nameend - nextchar)) - { - if ((size_t) (nameend - nextchar) == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second or later nonexact match found. */ - ambig = 1; - } - if (ambig && !exact) - { - if (share__opterr) - fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), - argv[0], argv[share__optind]); - nextchar += strlen (nextchar); - share__optind++; - return '?'; - } - if (pfound != NULL) - { - option_index = indfound; - if (*nameend) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - share__optarg = nameend + 1; - else - { - if (share__opterr) - fprintf (stderr, _("\ -%s: option `-W %s' doesn't allow an argument\n"), - argv[0], pfound->name); - - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (share__optind < argc) - share__optarg = argv[share__optind++]; - else - { - if (share__opterr) - fprintf (stderr, - _("%s: option `%s' requires an argument\n"), - argv[0], argv[share__optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - nextchar = NULL; - return 'W'; /* Let the application handle it. */ - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - share__optarg = nextchar; - share__optind++; - } - else - share__optarg = NULL; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - share__optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - share__optind++; - } - else if (share__optind == argc) - { - if (share__opterr) - { - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, - _("%s: option requires an argument -- %c\n"), - argv[0], c); - } - share__optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `share__optind' once; - increment it again when taking next ARGV-elt as argument. */ - share__optarg = argv[share__optind++]; - nextchar = NULL; - } - } - return c; - } -} - -int -share__getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return share___getopt_internal (argc, argv, optstring, - (const struct share__option *) 0, - (int *) 0, - 0); -} - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `share__getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = share__optind ? share__optind : 1; - - c = share__getopt (argc, argv, "abc:d:0123456789"); - if (c == -1) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", share__optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (share__optind < argc) - { - printf ("non-option ARGV-elements: "); - while (share__optind < argc) - printf ("%s ", argv[share__optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/src/share/getopt/getopt1.c b/src/share/getopt/getopt1.c deleted file mode 100644 index 740e498b..00000000 --- a/src/share/getopt/getopt1.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - NOTE: - I cannot get the vanilla getopt code to work (i.e. compile only what - is needed and not duplicate symbols found in the standard library) - on all the platforms that FLAC supports. In particular the gating - of code with the ELIDE_CODE #define is not accurate enough on systems - that are POSIX but not glibc. If someone has a patch that works on - GNU/Linux, Darwin, AND Solaris please submit it on the project page: - https://sourceforge.net/p/flac/patches/ - - In the meantime I have munged the global symbols and removed gates - around code, while at the same time trying to touch the original as - little as possible. -*/ -/* getopt_long and getopt_long_only entry points for GNU getopt. - Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 - Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "share/getopt.h" -/*[JEC] was:#include "getopt.h"*/ - -#if !defined __STDC__ || !__STDC__ -/* This is a separate conditional since some stdc systems - reject `defined (const)'. */ -#ifndef const -#define const -#endif -#endif - -#include - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#define GETOPT_INTERFACE_VERSION 2 -#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2 -#include -#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION -#define ELIDE_CODE -#endif -#endif - -#if 1 -/*[JEC] was:#ifndef ELIDE_CODE*/ - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#include -#endif - -#ifndef NULL -#define NULL 0 -#endif - -int -share__getopt_long (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct share__option *long_options; - int *opt_index; -{ - return share___getopt_internal (argc, argv, options, long_options, opt_index, 0); -} - -/* Like share__getopt_long, but '-' as well as '--' can indicate a long option. - If an option that starts with '-' (not '--') doesn't match a long option, - but does match a short option, it is parsed as a short option - instead. */ - -int -share__getopt_long_only (argc, argv, options, long_options, opt_index) - int argc; - char *const *argv; - const char *options; - const struct share__option *long_options; - int *opt_index; -{ - return share___getopt_internal (argc, argv, options, long_options, opt_index, 1); -} - - -#endif /* Not ELIDE_CODE. */ - -#ifdef TEST - -#include - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = share__optind ? share__optind : 1; - int option_index = 0; - static struct share__option long_options[] = - { - {"add", 1, 0, 0}, - {"append", 0, 0, 0}, - {"delete", 1, 0, 0}, - {"verbose", 0, 0, 0}, - {"create", 0, 0, 0}, - {"file", 1, 0, 0}, - {0, 0, 0, 0} - }; - - c = share__getopt_long (argc, argv, "abc:d:0123456789", - long_options, &option_index); - if (c == -1) - break; - - switch (c) - { - case 0: - printf ("option %s", long_options[option_index].name); - if (share__optarg) - printf (" with arg %s", share__optarg); - printf ("\n"); - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", share__optarg); - break; - - case 'd': - printf ("option d with value `%s'\n", share__optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (share__optind < argc) - { - printf ("non-option ARGV-elements: "); - while (share__optind < argc) - printf ("%s ", argv[share__optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/src/share/getopt/getopt_static.vcproj b/src/share/getopt/getopt_static.vcproj deleted file mode 100644 index efc4ba76..00000000 --- a/src/share/getopt/getopt_static.vcproj +++ /dev/null @@ -1,186 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/share/getopt/getopt_static.vcxproj b/src/share/getopt/getopt_static.vcxproj deleted file mode 100644 index d536824e..00000000 --- a/src/share/getopt/getopt_static.vcxproj +++ /dev/null @@ -1,141 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc80-c215-11db-8314-0800200c9a66} - getopt_static - Win32Proj - - - - StaticLibrary - true - - - StaticLibrary - true - - - StaticLibrary - - - StaticLibrary - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/share/getopt/getopt_static.vcxproj.filters b/src/share/getopt/getopt_static.vcxproj.filters deleted file mode 100644 index b528a7df..00000000 --- a/src/share/getopt/getopt_static.vcxproj.filters +++ /dev/null @@ -1,29 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {98dc8c56-677d-4f5b-9c7e-031634c635f0} - - - - - Source Files - - - Source Files - - - - - Public Header Files - - - \ No newline at end of file diff --git a/src/share/grabbag/CMakeLists.txt b/src/share/grabbag/CMakeLists.txt deleted file mode 100644 index 203ae3f4..00000000 --- a/src/share/grabbag/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -add_library(grabbag STATIC - alloc.c - cuesheet.c - file.c - picture.c - replaygain.c - seektable.c - snprintf.c) -target_link_libraries(grabbag PUBLIC - FLAC - replaygain_analysis) -if(TARGET win_utf8_io) - target_link_libraries(grabbag PUBLIC win_utf8_io) -endif() diff --git a/src/share/grabbag/Makefile.lite b/src/share/grabbag/Makefile.lite deleted file mode 100644 index 6c8ff6c7..00000000 --- a/src/share/grabbag/Makefile.lite +++ /dev/null @@ -1,30 +0,0 @@ -# grabbag - Convenience lib for various routines common to several tools - -# -# GNU makefile -# - -topdir = ../../.. -libdir = $(topdir)/objs/$(BUILD)/lib - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC.a $(libdir)/libreplaygain_analysis.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lFLAC -lreplaygain_analysis $(OGG_LIBS) -lm -endif - -LIB_NAME = libgrabbag -INCLUDES = -I$(topdir)/include - -SRCS_C = \ - alloc.c \ - cuesheet.c \ - file.c \ - picture.c \ - replaygain.c \ - seektable.c \ - snprintf.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/share/grabbag/alloc.c b/src/share/grabbag/alloc.c deleted file mode 100644 index 82a77b12..00000000 --- a/src/share/grabbag/alloc.c +++ /dev/null @@ -1,48 +0,0 @@ -/* alloc - Convenience routines for safely allocating memory - * Copyright (C) 2007-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of the Xiph.org Foundation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#include "share/alloc.h" - -void *safe_malloc_mul_2op_(size_t size1, size_t size2) -{ - if(!size1 || !size2) - return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */ - if(size1 > SIZE_MAX / size2) - return 0; - return malloc(size1*size2); -} diff --git a/src/share/grabbag/cuesheet.c b/src/share/grabbag/cuesheet.c deleted file mode 100644 index 13784c28..00000000 --- a/src/share/grabbag/cuesheet.c +++ /dev/null @@ -1,656 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include "FLAC/assert.h" -#include "share/compat.h" -#include "share/grabbag.h" -#include "share/safe_str.h" - -uint32_t grabbag__cuesheet_msf_to_frame(uint32_t minutes, uint32_t seconds, uint32_t frames) -{ - return ((minutes * 60) + seconds) * 75 + frames; -} - -void grabbag__cuesheet_frame_to_msf(uint32_t frame, uint32_t *minutes, uint32_t *seconds, uint32_t *frames) -{ - *frames = frame % 75; - frame /= 75; - *seconds = frame % 60; - frame /= 60; - *minutes = frame; -} - -/* since we only care about values >= 0 or error, returns < 0 for any illegal string, else value */ -static int local__parse_int_(const char *s) -{ - int ret = 0; - char c; - - if(*s == '\0') - return -1; - - while('\0' != (c = *s++)) - if(c >= '0' && c <= '9') - ret = ret * 10 + (c - '0'); - else - return -1; - - return ret; -} - -/* since we only care about values >= 0 or error, returns < 0 for any illegal string, else value */ -static FLAC__int64 local__parse_int64_(const char *s) -{ - FLAC__int64 ret = 0; - char c; - - if(*s == '\0') - return -1; - - while('\0' != (c = *s++)) - if(c >= '0' && c <= '9') - ret = ret * 10 + (c - '0'); - else - return -1; - - return ret; -} - -/* accept minute:second:frame syntax of '[0-9]+:[0-9][0-9]?:[0-9][0-9]?', but max second of 59 and max frame of 74, e.g. 0:0:0, 123:45:67 - * return sample number or <0 for error - * WATCHOUT: if sample rate is not evenly divisible by 75, the resulting sample number will be approximate - */ -static FLAC__int64 local__parse_msf_(const char *s, uint32_t sample_rate) -{ - FLAC__int64 ret, field; - char c; - - c = *s++; - if(c >= '0' && c <= '9') - field = (c - '0'); - else - return -1; - while(':' != (c = *s++)) { - if(c >= '0' && c <= '9') - field = field * 10 + (c - '0'); - else - return -1; - } - - ret = field * 60 * sample_rate; - - c = *s++; - if(c >= '0' && c <= '9') - field = (c - '0'); - else - return -1; - if(':' != (c = *s++)) { - if(c >= '0' && c <= '9') { - field = field * 10 + (c - '0'); - c = *s++; - if(c != ':') - return -1; - } - else - return -1; - } - - if(field >= 60) - return -1; - - ret += field * sample_rate; - - c = *s++; - if(c >= '0' && c <= '9') - field = (c - '0'); - else - return -1; - if('\0' != (c = *s++)) { - if(c >= '0' && c <= '9') { - field = field * 10 + (c - '0'); - c = *s++; - } - else - return -1; - } - - if(c != '\0') - return -1; - - if(field >= 75) - return -1; - - ret += field * (sample_rate / 75); - - return ret; -} - -/* accept minute:second syntax of '[0-9]+:[0-9][0-9]?{,.[0-9]+}', but second < 60, e.g. 0:0.0, 3:5, 15:31.731 - * return sample number or <0 for error - * WATCHOUT: depending on the sample rate, the resulting sample number may be approximate with fractional seconds - */ -static FLAC__int64 local__parse_ms_(const char *s, uint32_t sample_rate) -{ - FLAC__int64 ret, field; - double x; - char c, *end; - - c = *s++; - if(c >= '0' && c <= '9') - field = (c - '0'); - else - return -1; - while(':' != (c = *s++)) { - if(c >= '0' && c <= '9') - field = field * 10 + (c - '0'); - else - return -1; - } - - ret = field * 60 * sample_rate; - - s++; /* skip the ':' */ - if(strspn(s, "0123456789.") != strlen(s)) - return -1; - x = strtod(s, &end); - if(*end || end == s) - return -1; - if(x < 0.0 || x >= 60.0) - return -1; - - ret += (FLAC__int64)(x * sample_rate); - - return ret; -} - -static char *local__get_field_(char **s, FLAC__bool allow_quotes) -{ - FLAC__bool has_quote = false; - char *p; - - FLAC__ASSERT(0 != s); - - if(0 == *s) - return 0; - - /* skip leading whitespace */ - while(**s && 0 != strchr(" \t\r\n", **s)) - (*s)++; - - if(**s == 0) { - *s = 0; - return 0; - } - - if(allow_quotes && (**s == '"')) { - has_quote = true; - (*s)++; - if(**s == 0) { - *s = 0; - return 0; - } - } - - p = *s; - - if(has_quote) { - *s = strchr(*s, '\"'); - /* if there is no matching end quote, it's an error */ - if(0 == *s) - p = *s = 0; - else { - **s = '\0'; - (*s)++; - } - } - else { - while(**s && 0 == strchr(" \t\r\n", **s)) - (*s)++; - if(**s) { - **s = '\0'; - (*s)++; - } - else - *s = 0; - } - - return p; -} - -static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, uint32_t *last_line_read, FLAC__StreamMetadata *cuesheet, uint32_t sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset) -{ - char buffer[4096], *line, *field; - uint32_t forced_leadout_track_num = 0; - FLAC__uint64 forced_leadout_track_offset = 0; - int in_track_num = -1, in_index_num = -1; - FLAC__bool disc_has_catalog = false, track_has_flags = false, track_has_isrc = false, has_forced_leadout = false; - FLAC__StreamMetadata_CueSheet *cs = &cuesheet->data.cue_sheet; - - FLAC__ASSERT(!is_cdda || sample_rate == 44100); - /* double protection */ - if(is_cdda && sample_rate != 44100) { - *error_message = "CD-DA cuesheet only allowed with 44.1kHz sample rate"; - return false; - } - - cs->lead_in = is_cdda? 2 * 44100 /* The default lead-in size for CD-DA */ : 0; - cs->is_cd = is_cdda; - - while(0 != fgets(buffer, sizeof(buffer), file)) { - (*last_line_read)++; - line = buffer; - - { - size_t linelen = strlen(line); - if((linelen == sizeof(buffer)-1) && line[linelen-1] != '\n') { - *error_message = "line too long"; - return false; - } - } - - if(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) { - if(0 == FLAC__STRCASECMP(field, "CATALOG")) { - if(disc_has_catalog) { - *error_message = "found multiple CATALOG commands"; - return false; - } - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/true))) { - *error_message = "CATALOG is missing catalog number"; - return false; - } - if(strlen(field) >= sizeof(cs->media_catalog_number)) { - *error_message = "CATALOG number is too long"; - return false; - } - if(is_cdda && (strlen(field) != 13 || strspn(field, "0123456789") != 13)) { - *error_message = "CD-DA CATALOG number must be 13 decimal digits"; - return false; - } - safe_strncpy(cs->media_catalog_number, field, sizeof(cs->media_catalog_number)); - disc_has_catalog = true; - } - else if(0 == FLAC__STRCASECMP(field, "FLAGS")) { - if(track_has_flags) { - *error_message = "found multiple FLAGS commands"; - return false; - } - if(in_track_num < 0 || in_index_num >= 0) { - *error_message = "FLAGS command must come after TRACK but before INDEX"; - return false; - } - while(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) { - if(0 == FLAC__STRCASECMP(field, "PRE")) - cs->tracks[cs->num_tracks-1].pre_emphasis = 1; - } - track_has_flags = true; - } - else if(0 == FLAC__STRCASECMP(field, "INDEX")) { - FLAC__int64 xx; - FLAC__StreamMetadata_CueSheet_Track *track = &cs->tracks[cs->num_tracks-1]; - if(in_track_num < 0) { - *error_message = "found INDEX before any TRACK"; - return false; - } - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { - *error_message = "INDEX is missing index number"; - return false; - } - in_index_num = local__parse_int_(field); - if(in_index_num < 0) { - *error_message = "INDEX has invalid index number"; - return false; - } - FLAC__ASSERT(cs->num_tracks > 0); - if(track->num_indices == 0) { - /* it's the first index point of the track */ - if(in_index_num > 1) { - *error_message = "first INDEX number of a TRACK must be 0 or 1"; - return false; - } - } - else { - if(in_index_num != track->indices[track->num_indices-1].number + 1) { - *error_message = "INDEX numbers must be sequential"; - return false; - } - } - if(is_cdda && in_index_num > 99) { - *error_message = "CD-DA INDEX number must be between 0 and 99, inclusive"; - return false; - } - /*@@@ search for duplicate track number? */ - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { - *error_message = "INDEX is missing an offset after the index number"; - return false; - } - /* first parse as minute:second:frame format */ - xx = local__parse_msf_(field, sample_rate); - if(xx < 0) { - /* CD-DA must use only MM:SS:FF format */ - if(is_cdda) { - *error_message = "illegal INDEX offset (not of the form MM:SS:FF)"; - return false; - } - /* as an extension for non-CD-DA we allow MM:SS.SS or raw sample number */ - xx = local__parse_ms_(field, sample_rate); - if(xx < 0) { - xx = local__parse_int64_(field); - if(xx < 0) { - *error_message = "illegal INDEX offset"; - return false; - } - } - } - else if(sample_rate % 75 && xx) { - /* only sample zero is exact */ - *error_message = "illegal INDEX offset (MM:SS:FF form not allowed if sample rate is not a multiple of 75)"; - return false; - } - if(is_cdda && cs->num_tracks == 1 && cs->tracks[0].num_indices == 0 && xx != 0) { - *error_message = "first INDEX of first TRACK must have an offset of 00:00:00"; - return false; - } - if(is_cdda && track->num_indices > 0 && (FLAC__uint64)xx <= track->indices[track->num_indices-1].offset) { - *error_message = "CD-DA INDEX offsets must increase in time"; - return false; - } - /* fill in track offset if it's the first index of the track */ - if(track->num_indices == 0) - track->offset = (FLAC__uint64)xx; - if(is_cdda && cs->num_tracks > 1) { - const FLAC__StreamMetadata_CueSheet_Track *prev = &cs->tracks[cs->num_tracks-2]; - if((FLAC__uint64)xx <= prev->offset + prev->indices[prev->num_indices-1].offset) { - *error_message = "CD-DA INDEX offsets must increase in time"; - return false; - } - } - if(!FLAC__metadata_object_cuesheet_track_insert_blank_index(cuesheet, cs->num_tracks-1, track->num_indices)) { - *error_message = "memory allocation error"; - return false; - } - track->indices[track->num_indices-1].offset = (FLAC__uint64)xx - track->offset; - track->indices[track->num_indices-1].number = in_index_num; - } - else if(0 == FLAC__STRCASECMP(field, "ISRC")) { - char *l, *r; - if(track_has_isrc) { - *error_message = "found multiple ISRC commands"; - return false; - } - if(in_track_num < 0 || in_index_num >= 0) { - *error_message = "ISRC command must come after TRACK but before INDEX"; - return false; - } - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/true))) { - *error_message = "ISRC is missing ISRC number"; - return false; - } - /* strip out dashes */ - for(l = r = field; *r; r++) { - if(*r != '-') - *l++ = *r; - } - *l = '\0'; - if(strlen(field) != 12 || strspn(field, "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") < 5 || strspn(field+5, "1234567890") != 7) { - *error_message = "invalid ISRC number"; - return false; - } - safe_strncpy(cs->tracks[cs->num_tracks-1].isrc, field, sizeof(cs->tracks[cs->num_tracks-1].isrc)); - track_has_isrc = true; - } - else if(0 == FLAC__STRCASECMP(field, "TRACK")) { - if(cs->num_tracks > 0) { - const FLAC__StreamMetadata_CueSheet_Track *prev = &cs->tracks[cs->num_tracks-1]; - if( - prev->num_indices == 0 || - ( - is_cdda && - ( - (prev->num_indices == 1 && prev->indices[0].number != 1) || - (prev->num_indices == 2 && prev->indices[0].number != 1 && prev->indices[1].number != 1) - ) - ) - ) { - *error_message = is_cdda? - "previous TRACK must specify at least one INDEX 01" : - "previous TRACK must specify at least one INDEX"; - return false; - } - } - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { - *error_message = "TRACK is missing track number"; - return false; - } - in_track_num = local__parse_int_(field); - if(in_track_num < 0) { - *error_message = "TRACK has invalid track number"; - return false; - } - if(in_track_num == 0) { - *error_message = "TRACK number must be greater than 0"; - return false; - } - if(is_cdda) { - if(in_track_num > 99) { - *error_message = "CD-DA TRACK number must be between 1 and 99, inclusive"; - return false; - } - } - else { - if(in_track_num == 255) { - *error_message = "TRACK number 255 is reserved for the lead-out"; - return false; - } - else if(in_track_num > 255) { - *error_message = "TRACK number must be between 1 and 254, inclusive"; - return false; - } - } - if(is_cdda && cs->num_tracks > 0 && in_track_num != cs->tracks[cs->num_tracks-1].number + 1) { - *error_message = "CD-DA TRACK numbers must be sequential"; - return false; - } - /*@@@ search for duplicate track number? */ - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { - *error_message = "TRACK is missing a track type after the track number"; - return false; - } - if(!FLAC__metadata_object_cuesheet_insert_blank_track(cuesheet, cs->num_tracks)) { - *error_message = "memory allocation error"; - return false; - } - cs->tracks[cs->num_tracks-1].number = in_track_num; - cs->tracks[cs->num_tracks-1].type = (0 == FLAC__STRCASECMP(field, "AUDIO"))? 0 : 1; /*@@@ should we be more strict with the value here? */ - in_index_num = -1; - track_has_flags = false; - track_has_isrc = false; - } - else if(0 == FLAC__STRCASECMP(field, "REM")) { - if(0 != (field = local__get_field_(&line, /*allow_quotes=*/false))) { - if(0 == strcmp(field, "FLAC__lead-in")) { - FLAC__int64 xx; - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { - *error_message = "FLAC__lead-in is missing offset"; - return false; - } - xx = local__parse_int64_(field); - if(xx < 0) { - *error_message = "illegal FLAC__lead-in offset"; - return false; - } - if(is_cdda && xx % 588 != 0) { - *error_message = "illegal CD-DA FLAC__lead-in offset, must be even multiple of 588 samples"; - return false; - } - cs->lead_in = (FLAC__uint64)xx; - } - else if(0 == strcmp(field, "FLAC__lead-out")) { - int track_num; - FLAC__int64 offset; - if(has_forced_leadout) { - *error_message = "multiple FLAC__lead-out commands"; - return false; - } - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { - *error_message = "FLAC__lead-out is missing track number"; - return false; - } - track_num = local__parse_int_(field); - if(track_num < 0) { - *error_message = "illegal FLAC__lead-out track number"; - return false; - } - forced_leadout_track_num = (uint32_t)track_num; - /*@@@ search for duplicate track number? */ - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { - *error_message = "FLAC__lead-out is missing offset"; - return false; - } - offset = local__parse_int64_(field); - if(offset < 0) { - *error_message = "illegal FLAC__lead-out offset"; - return false; - } - forced_leadout_track_offset = (FLAC__uint64)offset; - if(forced_leadout_track_offset != lead_out_offset) { - *error_message = "FLAC__lead-out offset does not match end-of-stream offset"; - return false; - } - has_forced_leadout = true; - } - } - } - } - } - - if(cs->num_tracks == 0) { - *error_message = "there must be at least one TRACK command"; - return false; - } - else { - const FLAC__StreamMetadata_CueSheet_Track *prev = &cs->tracks[cs->num_tracks-1]; - if( - prev->num_indices == 0 || - ( - is_cdda && - ( - (prev->num_indices == 1 && prev->indices[0].number != 1) || - (prev->num_indices == 2 && prev->indices[0].number != 1 && prev->indices[1].number != 1) - ) - ) - ) { - *error_message = is_cdda? - "previous TRACK must specify at least one INDEX 01" : - "previous TRACK must specify at least one INDEX"; - return false; - } - } - - if(!has_forced_leadout) { - forced_leadout_track_num = is_cdda? 170 : 255; - forced_leadout_track_offset = lead_out_offset; - } - if(!FLAC__metadata_object_cuesheet_insert_blank_track(cuesheet, cs->num_tracks)) { - *error_message = "memory allocation error"; - return false; - } - cs->tracks[cs->num_tracks-1].number = forced_leadout_track_num; - cs->tracks[cs->num_tracks-1].offset = forced_leadout_track_offset; - - if(!feof(file)) { - *error_message = "read error"; - return false; - } - return true; -} - -FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_message, uint32_t *last_line_read, uint32_t sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset) -{ - FLAC__StreamMetadata *cuesheet; - - FLAC__ASSERT(0 != file); - FLAC__ASSERT(0 != error_message); - FLAC__ASSERT(0 != last_line_read); - - *last_line_read = 0; - cuesheet = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET); - - if(0 == cuesheet) { - *error_message = "memory allocation error"; - return 0; - } - - if(!local__cuesheet_parse_(file, error_message, last_line_read, cuesheet, sample_rate, is_cdda, lead_out_offset)) { - FLAC__metadata_object_delete(cuesheet); - return 0; - } - - return cuesheet; -} - -void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, const char *file_reference) -{ - const FLAC__StreamMetadata_CueSheet *cs; - uint32_t track_num, index_num; - - FLAC__ASSERT(0 != file); - FLAC__ASSERT(0 != cuesheet); - FLAC__ASSERT(cuesheet->type == FLAC__METADATA_TYPE_CUESHEET); - - cs = &cuesheet->data.cue_sheet; - - if(*(cs->media_catalog_number)) - fprintf(file, "CATALOG %s\n", cs->media_catalog_number); - fprintf(file, "FILE %s\n", file_reference); - - for(track_num = 0; track_num < cs->num_tracks-1; track_num++) { - const FLAC__StreamMetadata_CueSheet_Track *track = cs->tracks + track_num; - - fprintf(file, " TRACK %02u %s\n", (uint32_t)track->number, track->type == 0? "AUDIO" : "DATA"); - - if(track->pre_emphasis) - fprintf(file, " FLAGS PRE\n"); - if(*(track->isrc)) - fprintf(file, " ISRC %s\n", track->isrc); - - for(index_num = 0; index_num < track->num_indices; index_num++) { - const FLAC__StreamMetadata_CueSheet_Index *indx = track->indices + index_num; - - fprintf(file, " INDEX %02u ", (uint32_t)indx->number); - if(cs->is_cd) { - const uint32_t logical_frame = (uint32_t)((track->offset + indx->offset) / (44100 / 75)); - uint32_t m, s, f; - grabbag__cuesheet_frame_to_msf(logical_frame, &m, &s, &f); - fprintf(file, "%02u:%02u:%02u\n", m, s, f); - } - else - fprintf(file, "%" PRIu64 "\n", (track->offset + indx->offset)); - } - } - - fprintf(file, "REM FLAC__lead-in %" PRIu64 "\n", cs->lead_in); - fprintf(file, "REM FLAC__lead-out %u %" PRIu64 "\n", (uint32_t)cs->tracks[track_num].number, cs->tracks[track_num].offset); -} diff --git a/src/share/grabbag/file.c b/src/share/grabbag/file.c deleted file mode 100644 index 5f3bc4ef..00000000 --- a/src/share/grabbag/file.c +++ /dev/null @@ -1,193 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if defined _MSC_VER || defined __MINGW32__ -#include /* for utime() */ -#include /* for chmod(), _setmode(), unlink() */ -#include /* for _O_BINARY */ -#else -#include /* some flavors of BSD (like OS X) require this to get time_t */ -#endif -#if defined __EMX__ -#include /* for setmode(), O_BINARY */ -#include /* for _O_BINARY */ -#endif -#include /* for stat(), maybe chmod() */ -#if defined _WIN32 && !defined __CYGWIN__ -#else -#include /* for unlink() */ -#endif -#include -#include -#include /* for strrchr() */ -#if defined _WIN32 && !defined __CYGWIN__ -// for GetFileInformationByHandle() etc -#include -#include -#endif -#include "share/grabbag.h" -#include "share/compat.h" - - -void grabbag__file_copy_metadata(const char *srcpath, const char *destpath) -{ - struct flac_stat_s srcstat; - - if(0 == flac_stat(srcpath, &srcstat)) { -#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) - struct timespec srctime[2] = {}; - srctime[0].tv_sec = srcstat.st_atime; - srctime[1].tv_sec = srcstat.st_mtime; -#else - struct utimbuf srctime; - srctime.actime = srcstat.st_atime; - srctime.modtime = srcstat.st_mtime; -#endif - (void)flac_chmod(destpath, srcstat.st_mode); - (void)flac_utime(destpath, &srctime); - } -} - -FLAC__off_t grabbag__file_get_filesize(const char *srcpath) -{ - struct flac_stat_s srcstat; - - if(0 == flac_stat(srcpath, &srcstat)) - return srcstat.st_size; - else - return -1; -} - -const char *grabbag__file_get_basename(const char *srcpath) -{ - const char *p; - - p = strrchr(srcpath, '/'); - if(0 == p) { - p = strrchr(srcpath, '\\'); - if(0 == p) - return srcpath; - } - return ++p; -} - -FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only) -{ - struct flac_stat_s stats; - - if(0 == flac_stat(filename, &stats)) { -#if !defined _MSC_VER && !defined __MINGW32__ - if(read_only) { - stats.st_mode &= ~S_IWUSR; - stats.st_mode &= ~S_IWGRP; - stats.st_mode &= ~S_IWOTH; - } - else { - stats.st_mode |= S_IWUSR; - } -#else - if(read_only) - stats.st_mode &= ~S_IWRITE; - else - stats.st_mode |= S_IWRITE; -#endif - if(0 != flac_chmod(filename, stats.st_mode)) - return false; - } - else - return false; - - return true; -} - -FLAC__bool grabbag__file_are_same(const char *f1, const char *f2) -{ -#if defined _WIN32 && !defined __CYGWIN__ - /* see - * http://www.hydrogenaudio.org/forums/index.php?showtopic=49439&pid=444300&st=0 - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getfileinformationbyhandle.asp - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/by_handle_file_information_str.asp - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/createfile.asp - * apparently both the files have to be open at the same time for the comparison to work - */ - FLAC__bool same = false; - BY_HANDLE_FILE_INFORMATION info1, info2; - HANDLE h1, h2; - BOOL ok = 1; - h1 = CreateFile_utf8(f1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - h2 = CreateFile_utf8(f2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if(h1 == INVALID_HANDLE_VALUE || h2 == INVALID_HANDLE_VALUE) - ok = 0; - ok &= GetFileInformationByHandle(h1, &info1); - ok &= GetFileInformationByHandle(h2, &info2); - if(ok) - same = - info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber && - info1.nFileIndexHigh == info2.nFileIndexHigh && - info1.nFileIndexLow == info2.nFileIndexLow - ; - if(h1 != INVALID_HANDLE_VALUE) - CloseHandle(h1); - if(h2 != INVALID_HANDLE_VALUE) - CloseHandle(h2); - return same; -#else - struct flac_stat_s s1, s2; - return f1 && f2 && flac_stat(f1, &s1) == 0 && flac_stat(f2, &s2) == 0 && s1.st_ino == s2.st_ino && s1.st_dev == s2.st_dev; -#endif -} - -FLAC__bool grabbag__file_remove_file(const char *filename) -{ - return grabbag__file_change_stats(filename, /*read_only=*/false) && 0 == flac_unlink(filename); -} - -FILE *grabbag__file_get_binary_stdin(void) -{ - /* if something breaks here it is probably due to the presence or - * absence of an underscore before the identifiers 'setmode', - * 'fileno', and/or 'O_BINARY'; check your system header files. - */ -#if defined _MSC_VER || defined __MINGW32__ - _setmode(_fileno(stdin), _O_BINARY); -#elif defined __EMX__ - setmode(fileno(stdin), O_BINARY); -#endif - - return stdin; -} - -FILE *grabbag__file_get_binary_stdout(void) -{ - /* if something breaks here it is probably due to the presence or - * absence of an underscore before the identifiers 'setmode', - * 'fileno', and/or 'O_BINARY'; check your system header files. - */ -#if defined _MSC_VER || defined __MINGW32__ - _setmode(_fileno(stdout), _O_BINARY); -#elif defined __EMX__ - setmode(fileno(stdout), O_BINARY); -#endif - - return stdout; -} diff --git a/src/share/grabbag/grabbag_static.vcproj b/src/share/grabbag/grabbag_static.vcproj deleted file mode 100644 index d9f5a8a2..00000000 --- a/src/share/grabbag/grabbag_static.vcproj +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/share/grabbag/grabbag_static.vcxproj b/src/share/grabbag/grabbag_static.vcxproj deleted file mode 100644 index 8ae6a28f..00000000 --- a/src/share/grabbag/grabbag_static.vcxproj +++ /dev/null @@ -1,165 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc81-c215-11db-8314-0800200c9a66} - grabbag_static - Win32Proj - - - - StaticLibrary - true - - - StaticLibrary - true - - - StaticLibrary - - - StaticLibrary - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - - - - - - - - - - - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - {4cefbc89-c215-11db-8314-0800200c9a66} - false - - - {4cefbe02-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/share/grabbag/grabbag_static.vcxproj.filters b/src/share/grabbag/grabbag_static.vcxproj.filters deleted file mode 100644 index 421b6d51..00000000 --- a/src/share/grabbag/grabbag_static.vcxproj.filters +++ /dev/null @@ -1,62 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {d4e83ff0-6406-4b76-bd64-6192e6b8e47a} - - - {82df5da8-3a2c-402e-a7cd-a88de1a7be91} - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Public Header Files - - - Public Header Files\grabbag - - - Public Header Files\grabbag - - - Public Header Files\grabbag - - - Public Header Files\grabbag - - - Public Header Files\grabbag - - - \ No newline at end of file diff --git a/src/share/grabbag/picture.c b/src/share/grabbag/picture.c deleted file mode 100644 index 89d5cc92..00000000 --- a/src/share/grabbag/picture.c +++ /dev/null @@ -1,508 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2006-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "share/alloc.h" -#include "share/grabbag.h" -#include "FLAC/assert.h" -#include -#include -#include -#include "share/compat.h" -#include "share/safe_str.h" - -/* slightly different that strndup(): this always copies 'size' bytes starting from s into a NUL-terminated string. */ -static char *local__strndup_(const char *s, size_t size) -{ - char *x = safe_malloc_add_2op_(size, /*+*/1); - if(x) { - memcpy(x, s, size); - x[size] = '\0'; - } - return x; -} - -static FLAC__bool local__parse_type_(const char *s, size_t len, FLAC__StreamMetadata_Picture *picture) -{ - size_t i; - FLAC__uint32 val = 0; - - picture->type = FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER; - - if(len == 0) - return true; /* empty string implies default to 'front cover' */ - - for(i = 0; i < len; i++) { - if(s[i] >= '0' && s[i] <= '9') - val = 10*val + (FLAC__uint32)(s[i] - '0'); - else - return false; - } - - if(i == len) - picture->type = val; - else - return false; - - return true; -} - -static FLAC__bool local__parse_resolution_(const char *s, size_t len, FLAC__StreamMetadata_Picture *picture) -{ - int state = 0; - size_t i; - FLAC__uint32 val = 0; - - picture->width = picture->height = picture->depth = picture->colors = 0; - - if(len == 0) - return true; /* empty string implies client wants to get info from the file itself */ - - for(i = 0; i < len; i++) { - if(s[i] == 'x') { - if(state == 0) - picture->width = val; - else if(state == 1) - picture->height = val; - else - return false; - state++; - val = 0; - } - else if(s[i] == '/') { - if(state == 2) - picture->depth = val; - else - return false; - state++; - val = 0; - } - else if(s[i] >= '0' && s[i] <= '9') - val = 10*val + (FLAC__uint32)(s[i] - '0'); - else - return false; - } - - if(state < 2) - return false; - else if(state == 2) - picture->depth = val; - else if(state == 3) - picture->colors = val; - else - return false; - if(picture->depth < 32 && 1u<depth < picture->colors) - return false; - - return true; -} - -static FLAC__bool local__extract_mime_type_(FLAC__StreamMetadata *obj) -{ - if(obj->data.picture.data_length >= 8 && 0 == memcmp(obj->data.picture.data, "\x89PNG\x0d\x0a\x1a\x0a", 8)) - return FLAC__metadata_object_picture_set_mime_type(obj, "image/png", /*copy=*/true); - else if(obj->data.picture.data_length >= 6 && (0 == memcmp(obj->data.picture.data, "GIF87a", 6) || 0 == memcmp(obj->data.picture.data, "GIF89a", 6))) - return FLAC__metadata_object_picture_set_mime_type(obj, "image/gif", /*copy=*/true); - else if(obj->data.picture.data_length >= 2 && 0 == memcmp(obj->data.picture.data, "\xff\xd8", 2)) - return FLAC__metadata_object_picture_set_mime_type(obj, "image/jpeg", /*copy=*/true); - return false; -} - -static FLAC__bool local__extract_resolution_color_info_(FLAC__StreamMetadata_Picture *picture) -{ - const FLAC__byte *data = picture->data; - FLAC__uint32 len = picture->data_length; - - if(0 == strcmp(picture->mime_type, "image/png")) { - /* c.f. http://www.w3.org/TR/PNG/ */ - FLAC__bool need_palette = false; /* if IHDR has color_type=3, we need to also read the PLTE chunk to get the #colors */ - if(len < 8 || memcmp(data, "\x89PNG\x0d\x0a\x1a\x0a", 8)) - return false; - /* try to find IHDR chunk */ - data += 8; - len -= 8; - while(len > 12) { /* every PNG chunk must be at least 12 bytes long */ - const FLAC__uint32 clen = (FLAC__uint32)data[0] << 24 | (FLAC__uint32)data[1] << 16 | (FLAC__uint32)data[2] << 8 | (FLAC__uint32)data[3]; - if(0 == memcmp(data+4, "IHDR", 4) && clen == 13) { - uint32_t color_type = data[17]; - picture->width = (FLAC__uint32)data[8] << 24 | (FLAC__uint32)data[9] << 16 | (FLAC__uint32)data[10] << 8 | (FLAC__uint32)data[11]; - picture->height = (FLAC__uint32)data[12] << 24 | (FLAC__uint32)data[13] << 16 | (FLAC__uint32)data[14] << 8 | (FLAC__uint32)data[15]; - if(color_type == 3) { - /* even though the bit depth for color_type==3 can be 1,2,4,or 8, - * the spec in 11.2.2 of http://www.w3.org/TR/PNG/ says that the - * sample depth is always 8 - */ - picture->depth = 8 * 3u; - need_palette = true; - data += 12 + clen; - len -= 12 + clen; - } - else { - if(color_type == 0) /* greyscale, 1 sample per pixel */ - picture->depth = (FLAC__uint32)data[16]; - if(color_type == 2) /* truecolor, 3 samples per pixel */ - picture->depth = (FLAC__uint32)data[16] * 3u; - if(color_type == 4) /* greyscale+alpha, 2 samples per pixel */ - picture->depth = (FLAC__uint32)data[16] * 2u; - if(color_type == 6) /* truecolor+alpha, 4 samples per pixel */ - picture->depth = (FLAC__uint32)data[16] * 4u; - picture->colors = 0; - return true; - } - } - else if(need_palette && 0 == memcmp(data+4, "PLTE", 4)) { - picture->colors = clen / 3u; - return true; - } - else if(clen + 12 > len) - return false; - else { - data += 12 + clen; - len -= 12 + clen; - } - } - } - else if(0 == strcmp(picture->mime_type, "image/jpeg")) { - /* c.f. http://www.w3.org/Graphics/JPEG/itu-t81.pdf and Q22 of http://www.faqs.org/faqs/jpeg-faq/part1/ */ - if(len < 2 || memcmp(data, "\xff\xd8", 2)) - return false; - data += 2; - len -= 2; - while(1) { - /* look for sync FF byte */ - for( ; len > 0; data++, len--) { - if(*data == 0xff) - break; - } - if(len == 0) - return false; - /* eat any extra pad FF bytes before marker */ - for( ; len > 0; data++, len--) { - if(*data != 0xff) - break; - } - if(len == 0) - return false; - /* if we hit SOS or EOI, bail */ - if(*data == 0xda || *data == 0xd9) - return false; - /* looking for some SOFn */ - else if(memchr("\xc0\xc1\xc2\xc3\xc5\xc6\xc7\xc9\xca\xcb\xcd\xce\xcf", *data, 13)) { - data++; len--; /* skip marker byte */ - if(len < 2) - return false; - else { - const FLAC__uint32 clen = (FLAC__uint32)data[0] << 8 | (FLAC__uint32)data[1]; - if(clen < 8 || len < clen) - return false; - picture->width = (FLAC__uint32)data[5] << 8 | (FLAC__uint32)data[6]; - picture->height = (FLAC__uint32)data[3] << 8 | (FLAC__uint32)data[4]; - picture->depth = (FLAC__uint32)data[2] * (FLAC__uint32)data[7]; - picture->colors = 0; - return true; - } - } - /* else skip it */ - else { - data++; len--; /* skip marker byte */ - if(len < 2) - return false; - else { - const FLAC__uint32 clen = (FLAC__uint32)data[0] << 8 | (FLAC__uint32)data[1]; - if(clen < 2 || len < clen) - return false; - data += clen; - len -= clen; - } - } - } - } - else if(0 == strcmp(picture->mime_type, "image/gif")) { - /* c.f. http://www.w3.org/Graphics/GIF/spec-gif89a.txt */ - if(len < 14) - return false; - if(memcmp(data, "GIF87a", 6) && memcmp(data, "GIF89a", 6)) - return false; -#if 0 - /* according to the GIF spec, even if the GCTF is 0, the low 3 bits should still tell the total # colors used */ - if(data[10] & 0x80 == 0) - return false; -#endif - picture->width = (FLAC__uint32)data[6] | ((FLAC__uint32)data[7] << 8); - picture->height = (FLAC__uint32)data[8] | ((FLAC__uint32)data[9] << 8); -#if 0 - /* this value doesn't seem to be reliable... */ - picture->depth = (((FLAC__uint32)(data[10] & 0x70) >> 4) + 1) * 3u; -#else - /* ...just pessimistically assume it's 24-bit color without scanning all the color tables */ - picture->depth = 8u * 3u; -#endif - picture->colors = 1u << ((FLAC__uint32)(data[10] & 0x07) + 1u); - return true; - } - return false; -} - -static const char *error_messages[] = { - "memory allocation error", - "invalid picture specification", - "invalid picture specification: can't parse resolution/color part", - "unable to extract resolution and color info from URL, user must set explicitly", - "unable to extract resolution and color info from file, user must set explicitly", - "error opening picture file", - "error reading picture file", - "invalid picture type", - "unable to guess MIME type from file, user must set explicitly", - "type 1 icon must be a 32x32 pixel PNG", - "file not found", /* currently unused */ - "file is too large" -}; - -static const char * read_file (const char * filepath, FLAC__StreamMetadata * obj) -{ - const FLAC__off_t size = grabbag__file_get_filesize(filepath); - FLAC__byte *buffer; - FILE *file; - const char *error_message=NULL; - - if (size < 0) - return error_messages[5]; - - if (size >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) /* actual limit is less because of other fields in the PICTURE metadata block */ - return error_messages[11]; - - if ((buffer = safe_malloc_(size)) == NULL) - return error_messages[0]; - - if ((file = flac_fopen(filepath, "rb")) == NULL) { - free(buffer); - return error_messages[5]; - } - - if (fread(buffer, 1, size, file) != (size_t) size) { - fclose(file); - free(buffer); - return error_messages[6]; - } - fclose(file); - - if (!FLAC__metadata_object_picture_set_data(obj, buffer, size, /*copy=*/false)) - error_message = error_messages[6]; - /* try to extract MIME type if user left it blank */ - else if (*obj->data.picture.mime_type == '\0' && !local__extract_mime_type_(obj)) - error_message = error_messages[8]; - /* try to extract resolution/color info if user left it blank */ - else if ((obj->data.picture.width == 0 || obj->data.picture.height == 0 || obj->data.picture.depth == 0) && !local__extract_resolution_color_info_(&obj->data.picture)) - error_message = error_messages[4]; - /* check metadata block size */ - else if (obj->length >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) - error_message = error_messages[11]; - - return error_message; -} - -FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, const char **error_message) -{ - FLAC__StreamMetadata *obj; - int state = 0; - - FLAC__ASSERT(0 != spec); - FLAC__ASSERT(0 != error_message); - - /* double protection */ - if(0 == spec) - return 0; - if(0 == error_message) - return 0; - - *error_message = 0; - - if(0 == (obj = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PICTURE))) { - *error_message = error_messages[0]; - return obj; - } - - if(strchr(spec, '|')) { /* full format */ - const char *p; - char *q; - for(p = spec; *error_message==0 && *p; ) { - if(*p == '|') { - switch(state) { - case 0: /* type */ - if(!local__parse_type_(spec, p-spec, &obj->data.picture)) - *error_message = error_messages[7]; - break; - case 1: /* mime type */ - if(p-spec) { /* if blank, we'll try to guess later from the picture data */ - if(0 == (q = local__strndup_(spec, p-spec))) - *error_message = error_messages[0]; - else if(!FLAC__metadata_object_picture_set_mime_type(obj, q, /*copy=*/false)) - *error_message = error_messages[0]; - } - break; - case 2: /* description */ - if(0 == (q = local__strndup_(spec, p-spec))) - *error_message = error_messages[0]; - else if(!FLAC__metadata_object_picture_set_description(obj, (FLAC__byte*)q, /*copy=*/false)) - *error_message = error_messages[0]; - break; - case 3: /* resolution/color (e.g. [300x300x16[/1234]] */ - if(!local__parse_resolution_(spec, p-spec, &obj->data.picture)) - *error_message = error_messages[2]; - break; - default: - *error_message = error_messages[1]; - break; - } - p++; - spec = p; - state++; - } - else - p++; - } - } - else { /* simple format, filename only, everything else guessed */ - if(!local__parse_type_("", 0, &obj->data.picture)) /* use default picture type */ - *error_message = error_messages[7]; - /* leave MIME type to be filled in later */ - /* leave description empty */ - /* leave the rest to be filled in later: */ - else if(!local__parse_resolution_("", 0, &obj->data.picture)) - *error_message = error_messages[2]; - else - state = 4; - } - - /* parse filename, read file, try to extract resolution/color info if needed */ - if(*error_message == 0) { - if(state != 4) - *error_message = error_messages[1]; - else { /* 'spec' points to filename/URL */ - if(0 == strcmp(obj->data.picture.mime_type, "-->")) { /* magic MIME type means URL */ - if(!FLAC__metadata_object_picture_set_data(obj, (FLAC__byte*)spec, strlen(spec), /*copy=*/true)) - *error_message = error_messages[0]; - else if(obj->data.picture.width == 0 || obj->data.picture.height == 0 || obj->data.picture.depth == 0) - *error_message = error_messages[3]; - } - else { /* regular picture file */ - *error_message = read_file (spec, obj); - } - } - } - - if(*error_message == 0) { - if( - obj->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && - ( - (strcmp(obj->data.picture.mime_type, "image/png") && strcmp(obj->data.picture.mime_type, "-->")) || - obj->data.picture.width != 32 || - obj->data.picture.height != 32 - ) - ) - *error_message = error_messages[9]; - } - - if(*error_message && obj) { - FLAC__metadata_object_delete(obj); - obj = 0; - } - - return obj; -} - -FLAC__StreamMetadata *grabbag__picture_from_specification(int type, const char *mime_type_in, const char * description, - const PictureResolution * res, const char * filepath, const char **error_message) -{ - - FLAC__StreamMetadata *obj; - char mime_type [64] ; - - if (error_message == 0) - return 0; - - safe_strncpy(mime_type, mime_type_in, sizeof (mime_type)); - - *error_message = 0; - - if ((obj = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PICTURE)) == 0) { - *error_message = error_messages[0]; - return obj; - } - - /* Picture type if known. */ - obj->data.picture.type = type >= 0 ? type : FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER; - - /* Mime type if known. */ - if (mime_type_in && ! FLAC__metadata_object_picture_set_mime_type(obj, mime_type, /*copy=*/true)) { - *error_message = error_messages[0]; - return obj; - } - - /* Description if present. */ - if (description && ! FLAC__metadata_object_picture_set_description(obj, (FLAC__byte*) description, /*copy=*/true)) { - *error_message = error_messages[0]; - return obj; - } - - if (res == NULL) { - obj->data.picture.width = 0; - obj->data.picture.height = 0; - obj->data.picture.depth = 0; - obj->data.picture.colors = 0; - } - else { - obj->data.picture.width = res->width; - obj->data.picture.height = res->height; - obj->data.picture.depth = res->depth; - obj->data.picture.colors = res->colors; - } - - if (strcmp(obj->data.picture.mime_type, "-->") == 0) { /* magic MIME type means URL */ - if (!FLAC__metadata_object_picture_set_data(obj, (FLAC__byte*)filepath, strlen(filepath), /*copy=*/true)) - *error_message = error_messages[0]; - else if (obj->data.picture.width == 0 || obj->data.picture.height == 0 || obj->data.picture.depth == 0) - *error_message = error_messages[3]; - } - else { - *error_message = read_file (filepath, obj); - } - - if (*error_message == NULL) { - if ( - obj->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && - ( - (strcmp(obj->data.picture.mime_type, "image/png") && strcmp(obj->data.picture.mime_type, "-->")) || - obj->data.picture.width != 32 || - obj->data.picture.height != 32 - ) - ) - *error_message = error_messages[9]; - } - - if (*error_message && obj) { - FLAC__metadata_object_delete(obj); - obj = 0; - } - - return obj; -} diff --git a/src/share/grabbag/replaygain.c b/src/share/grabbag/replaygain.c deleted file mode 100644 index fb23a474..00000000 --- a/src/share/grabbag/replaygain.c +++ /dev/null @@ -1,668 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#if defined _MSC_VER || defined __MINGW32__ -#include /* for chmod() */ -#endif -#include /* for stat(), maybe chmod() */ - -#include "FLAC/assert.h" -#include "FLAC/metadata.h" -#include "FLAC/stream_decoder.h" -#include "share/grabbag.h" -#include "share/replaygain_analysis.h" -#include "share/safe_str.h" - -#ifdef local_min -#undef local_min -#endif -#define local_min(a,b) ((a)<(b)?(a):(b)) - -#ifdef local_max -#undef local_max -#endif -#define local_max(a,b) ((a)>(b)?(a):(b)) - -static const char *reference_format_ = "%s=%2.1f dB"; -static const char *gain_format_ = "%s=%+2.2f dB"; -static const char *peak_format_ = "%s=%1.8f"; - -static double album_peak_, title_peak_; - -const uint32_t GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED = 190; -/* - FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 29 + 1 + 8 + - FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 21 + 1 + 10 + - FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 21 + 1 + 12 + - FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 21 + 1 + 10 + - FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + 21 + 1 + 12 -*/ - -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS = (const FLAC__byte * const)"REPLAYGAIN_REFERENCE_LOUDNESS"; -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN = (const FLAC__byte * const)"REPLAYGAIN_TRACK_GAIN"; -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK = (const FLAC__byte * const)"REPLAYGAIN_TRACK_PEAK"; -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN = (const FLAC__byte * const)"REPLAYGAIN_ALBUM_GAIN"; -const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK = (const FLAC__byte * const)"REPLAYGAIN_ALBUM_PEAK"; - - -static FLAC__bool get_file_stats_(const char *filename, struct flac_stat_s *stats) -{ - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != stats); - return (0 == flac_stat(filename, stats)); -} - -static void set_file_stats_(const char *filename, struct flac_stat_s *stats) -{ - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != stats); - - (void)flac_chmod(filename, stats->st_mode); -} - -static FLAC__bool append_tag_(FLAC__StreamMetadata *block, const char *format, const FLAC__byte *name, float value) -{ - char buffer[256]; - char *saved_locale; - FLAC__StreamMetadata_VorbisComment_Entry entry; - - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - FLAC__ASSERT(0 != format); - FLAC__ASSERT(0 != name); - - buffer[sizeof(buffer)-1] = '\0'; - /* - * We need to save the old locale and switch to "C" because the locale - * influences the formatting of %f and we want it a certain way. - */ - saved_locale = strdup(setlocale(LC_ALL, 0)); - if (0 == saved_locale) - return false; - setlocale(LC_ALL, "C"); - flac_snprintf(buffer, sizeof(buffer), format, name, value); - setlocale(LC_ALL, saved_locale); - free(saved_locale); - - entry.entry = (FLAC__byte *)buffer; - entry.length = strlen(buffer); - - return FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true); -} - -FLAC__bool grabbag__replaygain_is_valid_sample_frequency(uint32_t sample_frequency) -{ - return ValidGainFrequency( sample_frequency ); -} - -FLAC__bool grabbag__replaygain_init(uint32_t sample_frequency) -{ - title_peak_ = album_peak_ = 0.0; - return InitGainAnalysis((long)sample_frequency) == INIT_GAIN_ANALYSIS_OK; -} - -FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__bool is_stereo, uint32_t bps, uint32_t samples) -{ - /* using a small buffer improves data locality; we'd like it to fit easily in the dcache */ - static flac_float_t lbuffer[2048], rbuffer[2048]; - static const uint32_t nbuffer = sizeof(lbuffer) / sizeof(lbuffer[0]); - FLAC__int32 block_peak = 0, s; - uint32_t i, j; - - FLAC__ASSERT(bps >= 4 && bps <= FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE); - FLAC__ASSERT(FLAC__MIN_BITS_PER_SAMPLE == 4); - /* - * We use abs() on a FLAC__int32 which is undefined for the most negative value. - * If the reference codec ever handles 32bps we will have to write a special - * case here. - */ - FLAC__ASSERT(FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE < 32); - - if(bps == 16) { - if(is_stereo) { - j = 0; - while(samples > 0) { - const uint32_t n = local_min(samples, nbuffer); - for(i = 0; i < n; i++, j++) { - s = input[0][j]; - lbuffer[i] = (flac_float_t)s; - s = abs(s); - block_peak = local_max(block_peak, s); - - s = input[1][j]; - rbuffer[i] = (flac_float_t)s; - s = abs(s); - block_peak = local_max(block_peak, s); - } - samples -= n; - if(AnalyzeSamples(lbuffer, rbuffer, n, 2) != GAIN_ANALYSIS_OK) - return false; - } - } - else { - j = 0; - while(samples > 0) { - const uint32_t n = local_min(samples, nbuffer); - for(i = 0; i < n; i++, j++) { - s = input[0][j]; - lbuffer[i] = (flac_float_t)s; - s = abs(s); - block_peak = local_max(block_peak, s); - } - samples -= n; - if(AnalyzeSamples(lbuffer, 0, n, 1) != GAIN_ANALYSIS_OK) - return false; - } - } - } - else { /* bps must be < 32 according to above assertion */ - const double scale = ( - (bps > 16)? - (double)1. / (double)(1u << (bps - 16)) : - (double)(1u << (16 - bps)) - ); - - if(is_stereo) { - j = 0; - while(samples > 0) { - const uint32_t n = local_min(samples, nbuffer); - for(i = 0; i < n; i++, j++) { - s = input[0][j]; - lbuffer[i] = (flac_float_t)(scale * (double)s); - s = abs(s); - block_peak = local_max(block_peak, s); - - s = input[1][j]; - rbuffer[i] = (flac_float_t)(scale * (double)s); - s = abs(s); - block_peak = local_max(block_peak, s); - } - samples -= n; - if(AnalyzeSamples(lbuffer, rbuffer, n, 2) != GAIN_ANALYSIS_OK) - return false; - } - } - else { - j = 0; - while(samples > 0) { - const uint32_t n = local_min(samples, nbuffer); - for(i = 0; i < n; i++, j++) { - s = input[0][j]; - lbuffer[i] = (flac_float_t)(scale * (double)s); - s = abs(s); - block_peak = local_max(block_peak, s); - } - samples -= n; - if(AnalyzeSamples(lbuffer, 0, n, 1) != GAIN_ANALYSIS_OK) - return false; - } - } - } - - { - const double peak_scale = (double)(1u << (bps - 1)); - double peak = (double)block_peak / peak_scale; - if(peak > title_peak_) - title_peak_ = peak; - if(peak > album_peak_) - album_peak_ = peak; - } - - return true; -} - -void grabbag__replaygain_get_album(float *gain, float *peak) -{ - *gain = (float)GetAlbumGain(); - *peak = (float)album_peak_; - album_peak_ = 0.0; -} - -void grabbag__replaygain_get_title(float *gain, float *peak) -{ - *gain = (float)GetTitleGain(); - *peak = (float)title_peak_; - title_peak_ = 0.0; -} - - -typedef struct { - uint32_t channels; - uint32_t bits_per_sample; - uint32_t sample_rate; - FLAC__bool error; -} DecoderInstance; - -static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - DecoderInstance *instance = (DecoderInstance*)client_data; - const uint32_t bits_per_sample = frame->header.bits_per_sample; - const uint32_t channels = frame->header.channels; - const uint32_t sample_rate = frame->header.sample_rate; - const uint32_t samples = frame->header.blocksize; - - (void)decoder; - - if( - !instance->error && - (channels == 2 || channels == 1) && - bits_per_sample == instance->bits_per_sample && - channels == instance->channels && - sample_rate == instance->sample_rate - ) { - instance->error = !grabbag__replaygain_analyze(buffer, channels==2, bits_per_sample, samples); - } - else { - instance->error = true; - } - - if(!instance->error) - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; - else - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; -} - -static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - DecoderInstance *instance = (DecoderInstance*)client_data; - - (void)decoder; - - if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { - instance->bits_per_sample = metadata->data.stream_info.bits_per_sample; - instance->channels = metadata->data.stream_info.channels; - instance->sample_rate = metadata->data.stream_info.sample_rate; - - if(instance->channels != 1 && instance->channels != 2) { - instance->error = true; - return; - } - - if(!grabbag__replaygain_is_valid_sample_frequency(instance->sample_rate)) { - instance->error = true; - return; - } - } -} - -static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - DecoderInstance *instance = (DecoderInstance*)client_data; - - (void)decoder, (void)status; - - instance->error = true; -} - -const char *grabbag__replaygain_analyze_file(const char *filename, float *title_gain, float *title_peak) -{ - DecoderInstance instance; - FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new(); - - if(0 == decoder) - return "memory allocation error"; - - instance.error = false; - - /* It does these three by default but lets be explicit: */ - FLAC__stream_decoder_set_md5_checking(decoder, false); - FLAC__stream_decoder_set_metadata_ignore_all(decoder); - FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_STREAMINFO); - - if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, metadata_callback_, error_callback_, &instance) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - FLAC__stream_decoder_delete(decoder); - return "initializing decoder"; - } - - if(!FLAC__stream_decoder_process_until_end_of_stream(decoder) || instance.error) { - FLAC__stream_decoder_delete(decoder); - return "decoding file"; - } - - FLAC__stream_decoder_delete(decoder); - - grabbag__replaygain_get_title(title_gain, title_peak); - - return 0; -} - -const char *grabbag__replaygain_store_to_vorbiscomment(FLAC__StreamMetadata *block, float album_gain, float album_peak, float title_gain, float title_peak) -{ - const char *error; - - if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_reference(block))) - return error; - - if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_title(block, title_gain, title_peak))) - return error; - - if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_album(block, album_gain, album_peak))) - return error; - - return 0; -} - -const char *grabbag__replaygain_store_to_vorbiscomment_reference(FLAC__StreamMetadata *block) -{ - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - - if(FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS) < 0) - return "memory allocation error"; - - if(!append_tag_(block, reference_format_, GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS, ReplayGainReferenceLoudness)) - return "memory allocation error"; - - return 0; -} - -const char *grabbag__replaygain_store_to_vorbiscomment_album(FLAC__StreamMetadata *block, float album_gain, float album_peak) -{ - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - - if( - FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN) < 0 || - FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK) < 0 - ) - return "memory allocation error"; - - if( - !append_tag_(block, gain_format_, GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN, album_gain) || - !append_tag_(block, peak_format_, GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK, album_peak) - ) - return "memory allocation error"; - - return 0; -} - -const char *grabbag__replaygain_store_to_vorbiscomment_title(FLAC__StreamMetadata *block, float title_gain, float title_peak) -{ - FLAC__ASSERT(0 != block); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - - if( - FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN) < 0 || - FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, (const char *)GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK) < 0 - ) - return "memory allocation error"; - - if( - !append_tag_(block, gain_format_, GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN, title_gain) || - !append_tag_(block, peak_format_, GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK, title_peak) - ) - return "memory allocation error"; - - return 0; -} - -static const char *store_to_file_pre_(const char *filename, FLAC__Metadata_Chain **chain, FLAC__StreamMetadata **block) -{ - FLAC__Metadata_Iterator *iterator; - const char *error; - FLAC__bool found_vc_block = false; - - if(0 == (*chain = FLAC__metadata_chain_new())) - return "memory allocation error"; - - if(!FLAC__metadata_chain_read(*chain, filename)) { - error = FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(*chain)]; - FLAC__metadata_chain_delete(*chain); - return error; - } - - if(0 == (iterator = FLAC__metadata_iterator_new())) { - FLAC__metadata_chain_delete(*chain); - return "memory allocation error"; - } - - FLAC__metadata_iterator_init(iterator, *chain); - - do { - *block = FLAC__metadata_iterator_get_block(iterator); - if((*block)->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) - found_vc_block = true; - } while(!found_vc_block && FLAC__metadata_iterator_next(iterator)); - - if(!found_vc_block) { - /* create a new block */ - *block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); - if(0 == *block) { - FLAC__metadata_chain_delete(*chain); - FLAC__metadata_iterator_delete(iterator); - return "memory allocation error"; - } - while(FLAC__metadata_iterator_next(iterator)) - ; - if(!FLAC__metadata_iterator_insert_block_after(iterator, *block)) { - error = FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(*chain)]; - FLAC__metadata_chain_delete(*chain); - FLAC__metadata_iterator_delete(iterator); - return error; - } - /* iterator is left pointing to new block */ - FLAC__ASSERT(FLAC__metadata_iterator_get_block(iterator) == *block); - } - - FLAC__metadata_iterator_delete(iterator); - - FLAC__ASSERT(0 != *block); - FLAC__ASSERT((*block)->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - - return 0; -} - -static const char *store_to_file_post_(const char *filename, FLAC__Metadata_Chain *chain, FLAC__bool preserve_modtime) -{ - struct flac_stat_s stats; - const FLAC__bool have_stats = get_file_stats_(filename, &stats); - - (void)grabbag__file_change_stats(filename, /*read_only=*/false); - - FLAC__metadata_chain_sort_padding(chain); - if(!FLAC__metadata_chain_write(chain, /*use_padding=*/true, preserve_modtime)) { - const char *error; - error = FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(chain)]; - FLAC__metadata_chain_delete(chain); - return error; - } - - FLAC__metadata_chain_delete(chain); - - if(have_stats) - set_file_stats_(filename, &stats); - - return 0; -} - -const char *grabbag__replaygain_store_to_file(const char *filename, float album_gain, float album_peak, float title_gain, float title_peak, FLAC__bool preserve_modtime) -{ - FLAC__Metadata_Chain *chain; - FLAC__StreamMetadata *block = NULL; - const char *error; - - if(0 != (error = store_to_file_pre_(filename, &chain, &block))) - return error; - - if(0 != (error = grabbag__replaygain_store_to_vorbiscomment(block, album_gain, album_peak, title_gain, title_peak))) { - FLAC__metadata_chain_delete(chain); - return error; - } - - if(0 != (error = store_to_file_post_(filename, chain, preserve_modtime))) - return error; - - return 0; -} - -const char *grabbag__replaygain_store_to_file_reference(const char *filename, FLAC__bool preserve_modtime) -{ - FLAC__Metadata_Chain *chain; - FLAC__StreamMetadata *block = NULL; - const char *error; - - if(0 != (error = store_to_file_pre_(filename, &chain, &block))) - return error; - - if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_reference(block))) { - FLAC__metadata_chain_delete(chain); - return error; - } - - if(0 != (error = store_to_file_post_(filename, chain, preserve_modtime))) - return error; - - return 0; -} - -const char *grabbag__replaygain_store_to_file_album(const char *filename, float album_gain, float album_peak, FLAC__bool preserve_modtime) -{ - FLAC__Metadata_Chain *chain; - FLAC__StreamMetadata *block = NULL; - const char *error; - - if(0 != (error = store_to_file_pre_(filename, &chain, &block))) - return error; - - if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_album(block, album_gain, album_peak))) { - FLAC__metadata_chain_delete(chain); - return error; - } - - if(0 != (error = store_to_file_post_(filename, chain, preserve_modtime))) - return error; - - return 0; -} - -const char *grabbag__replaygain_store_to_file_title(const char *filename, float title_gain, float title_peak, FLAC__bool preserve_modtime) -{ - FLAC__Metadata_Chain *chain; - FLAC__StreamMetadata *block = NULL; - const char *error; - - if(0 != (error = store_to_file_pre_(filename, &chain, &block))) - return error; - - if(0 != (error = grabbag__replaygain_store_to_vorbiscomment_title(block, title_gain, title_peak))) { - FLAC__metadata_chain_delete(chain); - return error; - } - - if(0 != (error = store_to_file_post_(filename, chain, preserve_modtime))) - return error; - - return 0; -} - -static FLAC__bool parse_double_(const FLAC__StreamMetadata_VorbisComment_Entry *entry, double *val) -{ - char s[32], *end; - const char *p, *q; - double v; - - FLAC__ASSERT(0 != entry); - FLAC__ASSERT(0 != val); - - p = (const char *)entry->entry; - q = strchr(p, '='); - if(0 == q) - return false; - q++; - safe_strncpy(s, q, local_min(sizeof(s), (size_t) (entry->length - (q-p)))); - - v = strtod(s, &end); - if(end == s) - return false; - - *val = v; - return true; -} - -FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadata *block, FLAC__bool album_mode, FLAC__bool strict, double *reference, double *gain, double *peak) -{ - int reference_offset, gain_offset, peak_offset; - char *saved_locale; - FLAC__bool res = true; - - FLAC__ASSERT(0 != block); - FLAC__ASSERT(0 != reference); - FLAC__ASSERT(0 != gain); - FLAC__ASSERT(0 != peak); - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - - /* Default to current level until overridden by a detected tag; this - * will always be true until we change replaygain_analysis.c - */ - *reference = ReplayGainReferenceLoudness; - - /* - * We need to save the old locale and switch to "C" because the locale - * influences the behaviour of strtod and we want it a certain way. - */ - saved_locale = strdup(setlocale(LC_ALL, 0)); - if (0 == saved_locale) - return false; - setlocale(LC_ALL, "C"); - - if(0 <= (reference_offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, /*offset=*/0, (const char *)GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS))) - (void)parse_double_(block->data.vorbis_comment.comments + reference_offset, reference); - - if(0 > (gain_offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, /*offset=*/0, (const char *)(album_mode? GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN : GRABBAG__REPLAYGAIN_TAG_TITLE_GAIN)))) - res = false; - if(0 > (peak_offset = FLAC__metadata_object_vorbiscomment_find_entry_from(block, /*offset=*/0, (const char *)(album_mode? GRABBAG__REPLAYGAIN_TAG_ALBUM_PEAK : GRABBAG__REPLAYGAIN_TAG_TITLE_PEAK)))) - res = false; - - if(res && !parse_double_(block->data.vorbis_comment.comments + gain_offset, gain)) - res = false; - if(res && !parse_double_(block->data.vorbis_comment.comments + peak_offset, peak)) - res = false; - - setlocale(LC_ALL, saved_locale); - free(saved_locale); - - /* something failed; retry with strict */ - if (!res && !strict) - res = grabbag__replaygain_load_from_vorbiscomment(block, !album_mode, /*strict=*/true, reference, gain, peak); - - return res; -} - -double grabbag__replaygain_compute_scale_factor(double peak, double gain, double preamp, FLAC__bool prevent_clipping) -{ - double scale; - FLAC__ASSERT(peak >= 0.0); - gain += preamp; - scale = (float) pow(10.0, gain * 0.05); - if(prevent_clipping && peak > 0.0) { - const double max_scale = (float)(1.0 / peak); - if(scale > max_scale) - scale = max_scale; - } - return scale; -} diff --git a/src/share/grabbag/seektable.c b/src/share/grabbag/seektable.c deleted file mode 100644 index 2211e12e..00000000 --- a/src/share/grabbag/seektable.c +++ /dev/null @@ -1,106 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "share/grabbag.h" -#include "share/compat.h" -#include "FLAC/assert.h" -#include /* for atoi() */ -#include - -FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, uint32_t sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points) -{ - uint32_t i; - const char *pt; - - FLAC__ASSERT(0 != spec); - FLAC__ASSERT(0 != seektable_template); - FLAC__ASSERT(seektable_template->type == FLAC__METADATA_TYPE_SEEKTABLE); - - if(0 != spec_has_real_points) - *spec_has_real_points = false; - - for(pt = spec, i = 0; pt && *pt; i++) { - const char *q = strchr(pt, ';'); - FLAC__ASSERT(0 != q); - - if(q > pt) { - if(0 == strncmp(pt, "X;", 2)) { /* -S X */ - if(!FLAC__metadata_object_seektable_template_append_placeholders(seektable_template, 1)) - return false; - } - else if(q[-1] == 'x') { /* -S #x */ - if(total_samples_to_encode > 0) { /* we can only do these if we know the number of samples to encode up front */ - if(0 != spec_has_real_points) - *spec_has_real_points = true; - if(!only_explicit_placeholders) { - const int n = (uint32_t)atoi(pt); - if(n > 0) - if(!FLAC__metadata_object_seektable_template_append_spaced_points(seektable_template, (uint32_t)n, total_samples_to_encode)) - return false; - } - } - } - else if(q[-1] == 's') { /* -S #s */ - if(total_samples_to_encode > 0) { /* we can only do these if we know the number of samples to encode up front */ - FLAC__ASSERT(sample_rate > 0); - if(0 != spec_has_real_points) - *spec_has_real_points = true; - if(!only_explicit_placeholders) { - const double sec = atof(pt); - if(sec > 0.0) { - uint32_t samples = (uint32_t)(sec * (double)sample_rate); - /* Restrict seekpoints to two per second of audio. */ - samples = samples < sample_rate / 2 ? sample_rate / 2 : samples; - if(samples > 0) { - /* +1 for the initial point at sample 0 */ - if(!FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(seektable_template, samples, total_samples_to_encode)) - return false; - } - } - } - } - } - else { /* -S # */ - if(0 != spec_has_real_points) - *spec_has_real_points = true; - if(!only_explicit_placeholders) { - char *endptr; - const FLAC__int64 n = (FLAC__int64)strtoll(pt, &endptr, 10); - if( - (n > 0 || (endptr > pt && *endptr == ';')) && /* is a valid number (extra check needed for "0") */ - (total_samples_to_encode == 0 || (FLAC__uint64)n < total_samples_to_encode) /* number is not >= the known total_samples_to_encode */ - ) - if(!FLAC__metadata_object_seektable_template_append_point(seektable_template, (FLAC__uint64)n)) - return false; - } - } - } - - pt = ++q; - } - - if(!FLAC__metadata_object_seektable_template_sort(seektable_template, /*compact=*/true)) - return false; - - return true; -} diff --git a/src/share/grabbag/snprintf.c b/src/share/grabbag/snprintf.c deleted file mode 100644 index d8e4be34..00000000 --- a/src/share/grabbag/snprintf.c +++ /dev/null @@ -1,101 +0,0 @@ -/* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2013-2016 Xiph.org Foundation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of the Xiph.org Foundation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include "share/compat.h" - -/* - * FLAC needs to compile and work correctly on systems with a normal ISO C99 - * snprintf as well as Microsoft Visual Studio which has an non-standards - * conformant snprint_s function. - * - * The important difference occurs when the resultant string (plus string - * terminator) would have been longer than the supplied size parameter. When - * this happens, ISO C's snprintf returns the length of resultant string, but - * does not over-write the end of the buffer. MS's snprintf_s in this case - * returns -1. - * - * The _MSC_VER code below attempts to modify the return code for vsnprintf_s - * to something that is more compatible with the behaviour of the ISO C version. - */ - -int -flac_snprintf(char *str, size_t size, const char *fmt, ...) -{ - va_list va; - int rc; - -#if defined _MSC_VER - if (size == 0) - return 1024; -#endif - - va_start (va, fmt); - -#if defined _MSC_VER - rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va); - if (rc < 0) - rc = size - 1; -#elif defined __MINGW32__ - rc = __mingw_vsnprintf (str, size, fmt, va); -#else - rc = vsnprintf (str, size, fmt, va); -#endif - va_end (va); - - return rc; -} - -int -flac_vsnprintf(char *str, size_t size, const char *fmt, va_list va) -{ - int rc; - -#if defined _MSC_VER - if (size == 0) - return 1024; - rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va); - if (rc < 0) - rc = size - 1; -#elif defined __MINGW32__ - rc = __mingw_vsnprintf (str, size, fmt, va); -#else - rc = vsnprintf (str, size, fmt, va); -#endif - - return rc; -} diff --git a/src/share/replaygain_analysis/CMakeLists.txt b/src/share/replaygain_analysis/CMakeLists.txt deleted file mode 100644 index 4362b902..00000000 --- a/src/share/replaygain_analysis/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library(replaygain_analysis STATIC - replaygain_analysis.c) diff --git a/src/share/replaygain_analysis/Makefile.lite b/src/share/replaygain_analysis/Makefile.lite deleted file mode 100644 index 4fa2cc90..00000000 --- a/src/share/replaygain_analysis/Makefile.lite +++ /dev/null @@ -1,15 +0,0 @@ -# -# GNU makefile -# - -topdir = ../../.. - -LIB_NAME = libreplaygain_analysis -INCLUDES = -I$(topdir)/include - -SRCS_C = \ - replaygain_analysis.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/share/replaygain_analysis/replaygain_analysis.c b/src/share/replaygain_analysis/replaygain_analysis.c deleted file mode 100644 index 37b77ab0..00000000 --- a/src/share/replaygain_analysis/replaygain_analysis.c +++ /dev/null @@ -1,575 +0,0 @@ -/* - * ReplayGainAnalysis - analyzes input samples and give the recommended dB change - * Copyright (C) 2001 David Robinson and Glen Sawyer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * concept and filter values by David Robinson (David@Robinson.org) - * -- blame him if you think the idea is flawed - * original coding by Glen Sawyer (glensawyer@hotmail.com) - * -- blame him if you think this runs too slowly, or the coding is otherwise flawed - * - * lots of code improvements by Frank Klemm ( http://www.uni-jena.de/~pfk/mpp/ ) - * -- credit him for all the _good_ programming ;) - * - * minor cosmetic tweaks to integrate with FLAC by Josh Coalson - * - * - * For an explanation of the concepts and the basic algorithms involved, go to: - * http://www.replaygain.org/ - */ - -/* - * Here's the deal. Call - * - * InitGainAnalysis ( long samplefreq ); - * - * to initialize everything. Call - * - * AnalyzeSamples ( const flac_float_t* left_samples, - * const flac_float_t* right_samples, - * size_t num_samples, - * int num_channels ); - * - * as many times as you want, with as many or as few samples as you want. - * If mono, pass the sample buffer in through left_samples, leave - * right_samples NULL, and make sure num_channels = 1. - * - * GetTitleGain() - * - * will return the recommended dB level change for all samples analyzed - * SINCE THE LAST TIME you called GetTitleGain() OR InitGainAnalysis(). - * - * GetAlbumGain() - * - * will return the recommended dB level change for all samples analyzed - * since InitGainAnalysis() was called and finalized with GetTitleGain(). - * - * Pseudo-code to process an album: - * - * flac_float_t l_samples [4096]; - * flac_float_t r_samples [4096]; - * size_t num_samples; - * uint32_t num_songs; - * uint32_t i; - * - * InitGainAnalysis ( 44100 ); - * for ( i = 1; i <= num_songs; i++ ) { - * while ( ( num_samples = getSongSamples ( song[i], left_samples, right_samples ) ) > 0 ) - * AnalyzeSamples ( left_samples, right_samples, num_samples, 2 ); - * fprintf ("Recommended dB change for song %2d: %+6.2f dB\n", i, GetTitleGain() ); - * } - * fprintf ("Recommended dB change for whole album: %+6.2f dB\n", GetAlbumGain() ); - */ - -/* - * So here's the main source of potential code confusion: - * - * The filters applied to the incoming samples are IIR filters, - * meaning they rely on up to number of previous samples - * AND up to number of previous filtered samples. - * - * I set up the AnalyzeSamples routine to minimize memory usage and interface - * complexity. The speed isn't compromised too much (I don't think), but the - * internal complexity is higher than it should be for such a relatively - * simple routine. - * - * Optimization/clarity suggestions are welcome. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include "share/alloc.h" -#include "share/compat.h" -#include "share/replaygain_analysis.h" - -flac_float_t ReplayGainReferenceLoudness = 89.0; /* in dB SPL */ - -#define YULE_ORDER 10 -#define BUTTER_ORDER 2 -#define RMS_PERCENTILE 0.95 /* percentile which is louder than the proposed level */ -#define RMS_WINDOW_TIME 50 /* Time slice size [ms] */ -#define STEPS_per_dB 100. /* Table entries per dB */ -#define MAX_dB 120. /* Table entries for 0...MAX_dB (normal max. values are 70...80 dB) */ - -#define MAX_ORDER (BUTTER_ORDER > YULE_ORDER ? BUTTER_ORDER : YULE_ORDER) -#define PINK_REF 64.82 /* 298640883795 */ /* calibration value */ - -static flac_float_t linprebuf [MAX_ORDER * 2]; -static flac_float_t* linpre; /* left input samples, with pre-buffer */ -static flac_float_t* lstepbuf; -static flac_float_t* lstep; /* left "first step" (i.e. post first filter) samples */ -static flac_float_t* loutbuf; -static flac_float_t* lout; /* left "out" (i.e. post second filter) samples */ -static flac_float_t rinprebuf [MAX_ORDER * 2]; -static flac_float_t* rinpre; /* right input samples ... */ -static flac_float_t* rstepbuf; -static flac_float_t* rstep; -static flac_float_t* routbuf; -static flac_float_t* rout; -static uint32_t sampleWindow; /* number of samples required to reach number of milliseconds required for RMS window */ -static uint64_t totsamp; -static double lsum; -static double rsum; -#if 0 -static uint32_t A [(size_t)(STEPS_per_dB * MAX_dB)]; -static uint32_t B [(size_t)(STEPS_per_dB * MAX_dB)]; -#else -/* [JEC] Solaris Forte compiler doesn't like float calc in array indices */ -static uint32_t A [120 * 100]; -static uint32_t B [120 * 100]; -#endif - -#ifdef _MSC_VER -#pragma warning ( disable : 4305 ) -#endif - -struct ReplayGainFilter { - long rate; - uint32_t downsample; - flac_float_t BYule[YULE_ORDER+1]; - flac_float_t AYule[YULE_ORDER+1]; - flac_float_t BButter[BUTTER_ORDER+1]; - flac_float_t AButter[BUTTER_ORDER+1]; -}; - -static struct ReplayGainFilter *replaygainfilter; - -static const struct ReplayGainFilter ReplayGainFilters[] = { - - { - 48000, 0, /* ORIGINAL */ - { 0.03857599435200, -0.02160367184185, -0.00123395316851, -0.00009291677959, -0.01655260341619, 0.02161526843274, -0.02074045215285, 0.00594298065125, 0.00306428023191, 0.00012025322027, 0.00288463683916 }, - { 1.00000000000000, -3.84664617118067, 7.81501653005538, -11.34170355132042, 13.05504219327545, -12.28759895145294, 9.48293806319790, -5.87257861775999, 2.75465861874613, -0.86984376593551, 0.13919314567432 }, - { 0.98621192462708, -1.97242384925416, 0.98621192462708 }, - { 1.00000000000000, -1.97223372919527, 0.97261396931306 }, - }, - - { - 44100, 0, /* ORIGINAL */ - { 0.05418656406430, -0.02911007808948, -0.00848709379851, -0.00851165645469, -0.00834990904936, 0.02245293253339, -0.02596338512915, 0.01624864962975, -0.00240879051584, 0.00674613682247, -0.00187763777362 }, - { 1.00000000000000, -3.47845948550071, 6.36317777566148, -8.54751527471874, 9.47693607801280, -8.81498681370155, 6.85401540936998, -4.39470996079559, 2.19611684890774, -0.75104302451432, 0.13149317958808 }, - { 0.98500175787242, -1.97000351574484, 0.98500175787242 }, - { 1.00000000000000, -1.96977855582618, 0.97022847566350 }, - }, - - { - 37800, 0, - { 0.10296717174470, -0.04877975583256, -0.02878009075237, -0.03519509188311, 0.02888717172493, -0.00609872684844, 0.00209851217112, 0.00911704668543, 0.01154404718589, -0.00630293688700, 0.00107527155228 }, - { 1.00000000000000, -2.64848054923531, 3.58406058405771, -3.83794914179161, 3.90142345804575, -3.50179818637243, 2.67085284083076, -1.82581142372418, 1.09530368139801, -0.47689017820395, 0.11171431535905 }, - { 0.98252400815195, -1.96504801630391, 0.98252400815195 }, - { 1.00000000000000, -1.96474258269041, 0.96535344991740 }, - }, - - { - 36000, 0, - { 0.11572297028613, -0.04120916051252, -0.04977731768022, -0.01047308680426, 0.00750863219157, 0.00055507694408, 0.00140344192886, 0.01286095246036, 0.00998223033885, -0.00725013810661, 0.00326503346879 }, - { 1.00000000000000, -2.43606802820871, 3.01907406973844, -2.90372016038192, 2.67947188094303, -2.17606479220391, 1.44912956803015, -0.87785765549050, 0.53592202672557, -0.26469344817509, 0.07495878059717 }, - { 0.98165826840326, -1.96331653680652, 0.98165826840326 }, - { 1.00000000000000, -1.96298008938934, 0.96365298422371 }, - }, - - { - 32000, 0, /* ORIGINAL */ - { 0.15457299681924, -0.09331049056315, -0.06247880153653, 0.02163541888798, -0.05588393329856, 0.04781476674921, 0.00222312597743, 0.03174092540049, -0.01390589421898, 0.00651420667831, -0.00881362733839 }, - { 1.00000000000000, -2.37898834973084, 2.84868151156327, -2.64577170229825, 2.23697657451713, -1.67148153367602, 1.00595954808547, -0.45953458054983, 0.16378164858596, -0.05032077717131, 0.02347897407020 }, - { 0.97938932735214, -1.95877865470428, 0.97938932735214 }, - { 1.00000000000000, -1.95835380975398, 0.95920349965459 }, - }, - - { - 28000, 0, - { 0.23882392323383, -0.22007791534089, -0.06014581950332, 0.05004458058021, -0.03293111254977, 0.02348678189717, 0.04290549799671, -0.00938141862174, 0.00015095146303, -0.00712601540885, -0.00626520210162 }, - { 1.00000000000000, -2.06894080899139, 1.76944699577212, -0.81404732584187, 0.25418286850232, -0.30340791669762, 0.35616884070937, -0.14967310591258, -0.07024154183279, 0.11078404345174, -0.03551838002425 }, - { 0.97647981663949, -1.95295963327897, 0.97647981663949 }, - { 1.00000000000000, -1.95240635772520, 0.95351290883275 }, - - }, - - { - 24000, 0, /* ORIGINAL */ - { 0.30296907319327, -0.22613988682123, -0.08587323730772, 0.03282930172664, -0.00915702933434, -0.02364141202522, -0.00584456039913, 0.06276101321749, -0.00000828086748, 0.00205861885564, -0.02950134983287 }, - { 1.00000000000000, -1.61273165137247, 1.07977492259970, -0.25656257754070, -0.16276719120440, -0.22638893773906, 0.39120800788284, -0.22138138954925, 0.04500235387352, 0.02005851806501, 0.00302439095741 }, - { 0.97531843204928, -1.95063686409857, 0.97531843204928 }, - { 1.00000000000000, -1.95002759149878, 0.95124613669835 }, - }, - - { - 22050, 0, /* ORIGINAL */ - { 0.33642304856132, -0.25572241425570, -0.11828570177555, 0.11921148675203, -0.07834489609479, -0.00469977914380, -0.00589500224440, 0.05724228140351, 0.00832043980773, -0.01635381384540, -0.01760176568150 }, - { 1.00000000000000, -1.49858979367799, 0.87350271418188, 0.12205022308084, -0.80774944671438, 0.47854794562326, -0.12453458140019, -0.04067510197014, 0.08333755284107, -0.04237348025746, 0.02977207319925 }, - { 0.97316523498161, -1.94633046996323, 0.97316523498161 }, - { 1.00000000000000, -1.94561023566527, 0.94705070426118 }, - }, - - { - 18900, 0, - { 0.38412657295385, -0.44533729608120, 0.20426638066221, -0.28031676047946, 0.31484202614802, -0.26078311203207, 0.12925201224848, -0.01141164696062, 0.03036522115769, -0.03776339305406, 0.00692036603586 }, - { 1.00000000000000, -1.74403915585708, 1.96686095832499, -2.10081452941881, 1.90753918182846, -1.83814263754422, 1.36971352214969, -0.77883609116398, 0.39266422457649, -0.12529383592986, 0.05424760697665 }, - { 0.96535326815829, -1.93070653631658, 0.96535326815829 }, - { 1.00000000000000, -1.92950577983524, 0.93190729279793 }, - }, - - { - 16000, 0, /* ORIGINAL */ - { 0.44915256608450, -0.14351757464547, -0.22784394429749, -0.01419140100551, 0.04078262797139, -0.12398163381748, 0.04097565135648, 0.10478503600251, -0.01863887810927, -0.03193428438915, 0.00541907748707 }, - { 1.00000000000000, -0.62820619233671, 0.29661783706366, -0.37256372942400, 0.00213767857124, -0.42029820170918, 0.22199650564824, 0.00613424350682, 0.06747620744683, 0.05784820375801, 0.03222754072173 }, - { 0.96454515552826, -1.92909031105652, 0.96454515552826 }, - { 1.00000000000000, -1.92783286977036, 0.93034775234268 }, - }, - - { - 12000, 0, /* ORIGINAL */ - { 0.56619470757641, -0.75464456939302, 0.16242137742230, 0.16744243493672, -0.18901604199609, 0.30931782841830, -0.27562961986224, 0.00647310677246, 0.08647503780351, -0.03788984554840, -0.00588215443421 }, - { 1.00000000000000, -1.04800335126349, 0.29156311971249, -0.26806001042947, 0.00819999645858, 0.45054734505008, -0.33032403314006, 0.06739368333110, -0.04784254229033, 0.01639907836189, 0.01807364323573 }, - { 0.96009142950541, -1.92018285901082, 0.96009142950541 }, - { 1.00000000000000, -1.91858953033784, 0.92177618768381 }, - }, - - { - 11025, 0, /* ORIGINAL */ - { 0.58100494960553, -0.53174909058578, -0.14289799034253, 0.17520704835522, 0.02377945217615, 0.15558449135573, -0.25344790059353, 0.01628462406333, 0.06920467763959, -0.03721611395801, -0.00749618797172 }, - { 1.00000000000000, -0.51035327095184, -0.31863563325245, -0.20256413484477, 0.14728154134330, 0.38952639978999, -0.23313271880868, -0.05246019024463, -0.02505961724053, 0.02442357316099, 0.01818801111503 }, - { 0.95856916599601, -1.91713833199203, 0.95856916599601 }, - { 1.00000000000000, -1.91542108074780, 0.91885558323625 }, - }, - - { - 8000, 0, /* ORIGINAL */ - { 0.53648789255105, -0.42163034350696, -0.00275953611929, 0.04267842219415, -0.10214864179676, 0.14590772289388, -0.02459864859345, -0.11202315195388, -0.04060034127000, 0.04788665548180, -0.02217936801134 }, - { 1.00000000000000, -0.25049871956020, -0.43193942311114, -0.03424681017675, -0.04678328784242, 0.26408300200955, 0.15113130533216, -0.17556493366449, -0.18823009262115, 0.05477720428674, 0.04704409688120 }, - { 0.94597685600279, -1.89195371200558, 0.94597685600279 }, - { 1.00000000000000, -1.88903307939452, 0.89487434461664 }, - }, - -}; - -#ifdef _MSC_VER -#pragma warning ( default : 4305 ) -#endif - -/* When calling this procedure, make sure that ip[-order] and op[-order] point to real data! */ - -static void -filter ( const flac_float_t* input, flac_float_t* output, size_t nSamples, const flac_float_t* a, const flac_float_t* b, size_t order, uint32_t downsample ) -{ - double y; - size_t i; - size_t k; - - const flac_float_t* input_head = input; - const flac_float_t* input_tail; - - flac_float_t* output_head = output; - flac_float_t* output_tail; - - for ( i = 0; i < nSamples; i++, input_head += downsample, ++output_head ) { - - input_tail = input_head; - output_tail = output_head; - - y = *input_head * b[0]; - - for ( k = 1; k <= order; k++ ) { - input_tail -= downsample; - --output_tail; - y += *input_tail * b[k] - *output_tail * a[k]; - } - - output[i] = (flac_float_t)y; - } -} - -/* returns a INIT_GAIN_ANALYSIS_OK if successful, INIT_GAIN_ANALYSIS_ERROR if not */ - -static struct ReplayGainFilter* -CreateGainFilter ( long samplefreq ) -{ - uint32_t i; - long maxrate = 0; - uint32_t downsample = 1; - struct ReplayGainFilter* gainfilter = malloc(sizeof(*gainfilter)); - - if ( !gainfilter ) - return 0; - - while (1) { - for ( i = 0; i < sizeof(ReplayGainFilters)/sizeof(ReplayGainFilters[0]); ++i ) { - if (maxrate < ReplayGainFilters[i].rate) - maxrate = ReplayGainFilters[i].rate; - - if ( ReplayGainFilters[i].rate == samplefreq ) { - *gainfilter = ReplayGainFilters[i]; - gainfilter->downsample = downsample; - return gainfilter; - } - } - - if (samplefreq < maxrate) - break; - - while (samplefreq > maxrate) { - downsample *= 2; - samplefreq /= 2; - } - } - - free(gainfilter); - - return 0; -} - -static void* -ReallocateWindowBuffer(uint32_t window_size, flac_float_t **window_buffer) -{ - *window_buffer = safe_realloc_(*window_buffer, sizeof(**window_buffer) * (window_size + MAX_ORDER)); - return *window_buffer; -} - -static int -ResetSampleFrequency ( long samplefreq ) { - int i; - - free(replaygainfilter); - - replaygainfilter = CreateGainFilter( samplefreq ); - - if ( ! replaygainfilter) - return INIT_GAIN_ANALYSIS_ERROR; - - sampleWindow = - (replaygainfilter->rate * RMS_WINDOW_TIME + 1000-1) / 1000; - - if ( ! ReallocateWindowBuffer(sampleWindow, &lstepbuf) || - ! ReallocateWindowBuffer(sampleWindow, &rstepbuf) || - ! ReallocateWindowBuffer(sampleWindow, &loutbuf) || - ! ReallocateWindowBuffer(sampleWindow, &routbuf) ) { - - return INIT_GAIN_ANALYSIS_ERROR; - } - - /* zero out initial values */ - for ( i = 0; i < MAX_ORDER; i++ ) - linprebuf[i] = lstepbuf[i] = loutbuf[i] = rinprebuf[i] = rstepbuf[i] = routbuf[i] = 0.; - - lsum = 0.; - rsum = 0.; - totsamp = 0; - - memset ( A, 0, sizeof(A) ); - - return INIT_GAIN_ANALYSIS_OK; -} - -int -ValidGainFrequency ( long samplefreq ) -{ - struct ReplayGainFilter* gainfilter = CreateGainFilter( samplefreq ); - - if (gainfilter == 0) { - return 0; - } else { - free(gainfilter); - return 1; - } -} - -int -InitGainAnalysis ( long samplefreq ) -{ - if (ResetSampleFrequency(samplefreq) != INIT_GAIN_ANALYSIS_OK) { - return INIT_GAIN_ANALYSIS_ERROR; - } - - linpre = linprebuf + MAX_ORDER; - rinpre = rinprebuf + MAX_ORDER; - lstep = lstepbuf + MAX_ORDER; - rstep = rstepbuf + MAX_ORDER; - lout = loutbuf + MAX_ORDER; - rout = routbuf + MAX_ORDER; - - memset ( B, 0, sizeof(B) ); - - return INIT_GAIN_ANALYSIS_OK; -} - -/* returns GAIN_ANALYSIS_OK if successful, GAIN_ANALYSIS_ERROR if not */ - -int -AnalyzeSamples ( const flac_float_t* left_samples, const flac_float_t* right_samples, size_t num_samples, int num_channels ) -{ - uint32_t downsample = replaygainfilter->downsample; - const flac_float_t* curleft; - const flac_float_t* curright; - long prebufsamples; - long batchsamples; - long cursamples; - long cursamplepos; - int i; - - num_samples /= downsample; - - if ( num_samples == 0 ) - return GAIN_ANALYSIS_OK; - - cursamplepos = 0; - batchsamples = num_samples; - - switch ( num_channels) { - case 1: right_samples = left_samples; - case 2: break; - default: return GAIN_ANALYSIS_ERROR; - } - - prebufsamples = MAX_ORDER; - if ((size_t) prebufsamples > num_samples) - prebufsamples = num_samples; - - for ( i = 0; i < prebufsamples; ++i ) { - linprebuf[i+MAX_ORDER] = left_samples [i * downsample]; - rinprebuf[i+MAX_ORDER] = right_samples[i * downsample]; - } - - while ( batchsamples > 0 ) { - cursamples = batchsamples > (long)(sampleWindow-totsamp) ? (long)(sampleWindow - totsamp) : batchsamples; - if ( cursamplepos < MAX_ORDER ) { - downsample = 1; - curleft = linpre+cursamplepos; - curright = rinpre+cursamplepos; - if (cursamples > MAX_ORDER - cursamplepos ) - cursamples = MAX_ORDER - cursamplepos; - } - else { - downsample = replaygainfilter->downsample; - curleft = left_samples + cursamplepos * downsample; - curright = right_samples + cursamplepos * downsample; - } - - filter ( curleft , lstep + totsamp, cursamples, replaygainfilter->AYule, replaygainfilter->BYule, YULE_ORDER, downsample ); - filter ( curright, rstep + totsamp, cursamples, replaygainfilter->AYule, replaygainfilter->BYule, YULE_ORDER, downsample ); - - filter ( lstep + totsamp, lout + totsamp, cursamples, replaygainfilter->AButter, replaygainfilter->BButter, BUTTER_ORDER, 1 ); - filter ( rstep + totsamp, rout + totsamp, cursamples, replaygainfilter->AButter, replaygainfilter->BButter, BUTTER_ORDER, 1 ); - - for ( i = 0; i < cursamples; i++ ) { /* Get the squared values */ - lsum += lout [totsamp+i] * lout [totsamp+i]; - rsum += rout [totsamp+i] * rout [totsamp+i]; - } - - batchsamples -= cursamples; - cursamplepos += cursamples; - totsamp += cursamples; - if ( totsamp == sampleWindow ) { /* Get the Root Mean Square (RMS) for this set of samples */ - double val = STEPS_per_dB * 10. * log10 ( (lsum+rsum) / totsamp * 0.5 + 1.e-37 ); - int ival = (int) val; - if ( ival < 0 ) ival = 0; - if ( ival >= (int)(sizeof(A)/sizeof(*A)) ) ival = (int)(sizeof(A)/sizeof(*A)) - 1; - A [ival]++; - lsum = rsum = 0.; - memmove ( loutbuf , loutbuf + totsamp, MAX_ORDER * sizeof(flac_float_t) ); - memmove ( routbuf , routbuf + totsamp, MAX_ORDER * sizeof(flac_float_t) ); - memmove ( lstepbuf, lstepbuf + totsamp, MAX_ORDER * sizeof(flac_float_t) ); - memmove ( rstepbuf, rstepbuf + totsamp, MAX_ORDER * sizeof(flac_float_t) ); - totsamp = 0; - } - if ( totsamp > sampleWindow ) /* somehow I really screwed up: Error in programming! Contact author about totsamp > sampleWindow */ - return GAIN_ANALYSIS_ERROR; - } - - if ( num_samples < MAX_ORDER ) { - memmove ( linprebuf, linprebuf + num_samples, (MAX_ORDER-num_samples) * sizeof(flac_float_t) ); - memmove ( rinprebuf, rinprebuf + num_samples, (MAX_ORDER-num_samples) * sizeof(flac_float_t) ); - memcpy ( linprebuf + MAX_ORDER - num_samples, left_samples, num_samples * sizeof(flac_float_t) ); - memcpy ( rinprebuf + MAX_ORDER - num_samples, right_samples, num_samples * sizeof(flac_float_t) ); - } - else { - downsample = replaygainfilter->downsample; - - left_samples += (num_samples - MAX_ORDER) * downsample; - right_samples += (num_samples - MAX_ORDER) * downsample; - - for ( i = 0; i < MAX_ORDER; ++i ) { - linprebuf[i] = left_samples [i * downsample]; - rinprebuf[i] = right_samples[i * downsample]; - } - } - - return GAIN_ANALYSIS_OK; -} - - -static flac_float_t -analyzeResult ( uint32_t* Array, size_t len ) -{ - uint32_t elems; - int32_t upper; - size_t i; - - elems = 0; - for ( i = 0; i < len; i++ ) - elems += Array[i]; - if ( elems == 0 ) - return GAIN_NOT_ENOUGH_SAMPLES; - -/* workaround for GCC bug #61423: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61423 */ -#if 0 - upper = (int32_t) ceil (elems * (1. - RMS_PERCENTILE)); -#else - upper = (int32_t) (elems / 20 + ((elems % 20) ? 1 : 0)); -#endif - for ( i = len; i-- > 0; ) { - if ( (upper -= Array[i]) <= 0 ) - break; - } - - return (flac_float_t) ((flac_float_t)PINK_REF - (flac_float_t)i / (flac_float_t)STEPS_per_dB); -} - - -flac_float_t -GetTitleGain ( void ) -{ - flac_float_t retval; - uint32_t i; - - retval = analyzeResult ( A, sizeof(A)/sizeof(*A) ); - - for ( i = 0; i < sizeof(A)/sizeof(*A); i++ ) { - B[i] += A[i]; - A[i] = 0; - } - - for ( i = 0; i < MAX_ORDER; i++ ) - linprebuf[i] = lstepbuf[i] = loutbuf[i] = rinprebuf[i] = rstepbuf[i] = routbuf[i] = 0.f; - - totsamp = 0; - lsum = rsum = 0.; - return retval; -} - - -flac_float_t -GetAlbumGain ( void ) -{ - return analyzeResult ( B, sizeof(B)/sizeof(*B) ); -} - -/* end of replaygain_analysis.c */ diff --git a/src/share/replaygain_analysis/replaygain_analysis_static.vcproj b/src/share/replaygain_analysis/replaygain_analysis_static.vcproj deleted file mode 100644 index 9645da5f..00000000 --- a/src/share/replaygain_analysis/replaygain_analysis_static.vcproj +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/share/replaygain_analysis/replaygain_analysis_static.vcxproj b/src/share/replaygain_analysis/replaygain_analysis_static.vcxproj deleted file mode 100644 index 6824f815..00000000 --- a/src/share/replaygain_analysis/replaygain_analysis_static.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc89-c215-11db-8314-0800200c9a66} - replaygain_analysis_static - Win32Proj - - - - StaticLibrary - true - - - StaticLibrary - true - - - StaticLibrary - - - StaticLibrary - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - - - - - - - - \ No newline at end of file diff --git a/src/share/replaygain_analysis/replaygain_analysis_static.vcxproj.filters b/src/share/replaygain_analysis/replaygain_analysis_static.vcxproj.filters deleted file mode 100644 index f1207d35..00000000 --- a/src/share/replaygain_analysis/replaygain_analysis_static.vcxproj.filters +++ /dev/null @@ -1,26 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {9e16659d-14e5-4477-be88-76193fff5d31} - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Public Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/src/share/replaygain_synthesis/CMakeLists.txt b/src/share/replaygain_synthesis/CMakeLists.txt deleted file mode 100644 index 0736f4fc..00000000 --- a/src/share/replaygain_synthesis/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_library(replaygain_synthesis STATIC - replaygain_synthesis.c) diff --git a/src/share/replaygain_synthesis/Makefile.lite b/src/share/replaygain_synthesis/Makefile.lite deleted file mode 100644 index a944234a..00000000 --- a/src/share/replaygain_synthesis/Makefile.lite +++ /dev/null @@ -1,15 +0,0 @@ -# -# GNU makefile -# - -topdir = ../../.. - -LIB_NAME = libreplaygain_synthesis -INCLUDES = -I./include -I$(topdir)/include - -SRCS_C = \ - replaygain_synthesis.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/share/replaygain_synthesis/replaygain_synthesis.c b/src/share/replaygain_synthesis/replaygain_synthesis.c deleted file mode 100644 index 9881794a..00000000 --- a/src/share/replaygain_synthesis/replaygain_synthesis.c +++ /dev/null @@ -1,429 +0,0 @@ -/* replaygain_synthesis - Routines for applying ReplayGain to a signal - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -/* - * This is an aggregation of pieces of code from John Edwards' WaveGain - * program. Mostly cosmetic changes were made; otherwise, the dithering - * code is almost untouched and the gain processing was converted from - * processing a whole file to processing chunks of samples. - * - * The original copyright notices for WaveGain's dither.c and wavegain.c - * appear below: - */ -/* - * (c) 2002 John Edwards - * mostly lifted from work by Frank Klemm - * random functions for dithering. - */ -/* - * Copyright (C) 2002 John Edwards - * Additional code by Magnus Holmgren and Gian-Carlo Pascutto - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include /* for memset() */ -#include -#include "share/compat.h" -#include "share/replaygain_synthesis.h" -#include "FLAC/assert.h" - -#define FLAC__I64L(x) x##LL - - -/* - * the following is based on parts of dither.c - */ - - -/* - * This is a simple random number generator with good quality for audio purposes. - * It consists of two polycounters with opposite rotation direction and different - * periods. The periods are coprime, so the total period is the product of both. - * - * ------------------------------------------------------------------------------------------------- - * +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| - * | ------------------------------------------------------------------------------------------------- - * | | | | | | | - * | +--+--+--+-XOR-+--------+ - * | | - * +--------------------------------------------------------------------------------------+ - * - * ------------------------------------------------------------------------------------------------- - * |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+ - * ------------------------------------------------------------------------------------------------- | - * | | | | | - * +--+----XOR----+--+ | - * | | - * +----------------------------------------------------------------------------------------+ - * - * - * The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481, - * which gives a period of 18.410.713.077.675.721.215. The result is the - * XORed values of both generators. - */ - -static uint32_t random_int_(void) -{ - static const uint8_t parity_[256] = { - 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, - 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, - 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, - 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, - 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0, - 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, - 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1, - 1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0 - }; - static uint32_t r1_ = 1; - static uint32_t r2_ = 1; - - uint32_t t1, t2, t3, t4; - - /* Parity calculation is done via table lookup, this is also available - * on CPUs without parity, can be implemented in C and avoid unpredictable - * jumps and slow rotate through the carry flag operations. - */ - t3 = t1 = r1_; t4 = t2 = r2_; - t1 &= 0xF5; t2 >>= 25; - t1 = parity_[t1]; t2 &= 0x63; - t1 <<= 31; t2 = parity_[t2]; - - return (r1_ = (t3 >> 1) | t1 ) ^ (r2_ = (t4 + t4) | t2 ); -} - -/* gives a equal distributed random number */ -/* between -2^31*mult and +2^31*mult */ -static double random_equi_(double mult) -{ - return mult * (int) random_int_(); -} - -/* gives a triangular distributed random number */ -/* between -2^32*mult and +2^32*mult */ -static double random_triangular_(double mult) -{ - return mult * ( (double) (int) random_int_() + (double) (int) random_int_() ); -} - - -static const float F44_0 [16 + 32] = { - (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, - (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, - - (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, - (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, - - (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, - (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0, (float)0 -}; - - -static const float F44_1 [16 + 32] = { /* SNR(w) = 4.843163 dB, SNR = -3.192134 dB */ - (float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833, - (float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967, - (float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116, - (float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024, - - (float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833, - (float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967, - (float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116, - (float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024, - - (float) 0.85018292704024355931, (float) 0.29089597350995344721, (float)-0.05021866022121039450, (float)-0.23545456294599161833, - (float)-0.58362726442227032096, (float)-0.67038978965193036429, (float)-0.38566861572833459221, (float)-0.15218663390367969967, - (float)-0.02577543084864530676, (float) 0.14119295297688728127, (float) 0.22398848581628781612, (float) 0.15401727203382084116, - (float) 0.05216161232906000929, (float)-0.00282237820999675451, (float)-0.03042794608323867363, (float)-0.03109780942998826024, -}; - - -static const float F44_2 [16 + 32] = { /* SNR(w) = 10.060213 dB, SNR = -12.766730 dB */ - (float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437, - (float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264, - (float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562, - (float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816, - - (float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437, - (float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264, - (float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562, - (float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816, - - (float) 1.78827593892108555290, (float) 0.95508210637394326553, (float)-0.18447626783899924429, (float)-0.44198126506275016437, - (float)-0.88404052492547413497, (float)-1.42218907262407452967, (float)-1.02037566838362314995, (float)-0.34861755756425577264, - (float)-0.11490230170431934434, (float) 0.12498899339968611803, (float) 0.38065885268563131927, (float) 0.31883491321310506562, - (float) 0.10486838686563442765, (float)-0.03105361685110374845, (float)-0.06450524884075370758, (float)-0.02939198261121969816, -}; - - -static const float F44_3 [16 + 32] = { /* SNR(w) = 15.382598 dB, SNR = -29.402334 dB */ - (float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515, - (float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785, - (float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927, - (float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099, - - (float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515, - (float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785, - (float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927, - (float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099, - - (float) 2.89072132015058161445, (float) 2.68932810943698754106, (float) 0.21083359339410251227, (float)-0.98385073324997617515, - (float)-1.11047823227097316719, (float)-2.18954076314139673147, (float)-2.36498032881953056225, (float)-0.95484132880101140785, - (float)-0.23924057925542965158, (float)-0.13865235703915925642, (float) 0.43587843191057992846, (float) 0.65903257226026665927, - (float) 0.24361815372443152787, (float)-0.00235974960154720097, (float) 0.01844166574603346289, (float) 0.01722945988740875099 -}; - - -static double scalar16_(const float* x, const float* y) -{ - return - x[ 0]*y[ 0] + x[ 1]*y[ 1] + x[ 2]*y[ 2] + x[ 3]*y[ 3] + - x[ 4]*y[ 4] + x[ 5]*y[ 5] + x[ 6]*y[ 6] + x[ 7]*y[ 7] + - x[ 8]*y[ 8] + x[ 9]*y[ 9] + x[10]*y[10] + x[11]*y[11] + - x[12]*y[12] + x[13]*y[13] + x[14]*y[14] + x[15]*y[15]; -} - - -void FLAC__replaygain_synthesis__init_dither_context(DitherContext *d, int bits, int shapingtype) -{ - static uint8_t default_dither [] = { 92, 92, 88, 84, 81, 78, 74, 67, 0, 0 }; - static const float* F [] = { F44_0, F44_1, F44_2, F44_3 }; - - int indx; - - if (shapingtype < 0) shapingtype = 0; - if (shapingtype > 3) shapingtype = 3; - d->ShapingType = (NoiseShaping)shapingtype; - indx = bits - 11 - shapingtype; - if (indx < 0) indx = 0; - if (indx > 9) indx = 9; - - memset ( d->ErrorHistory , 0, sizeof (d->ErrorHistory ) ); - memset ( d->DitherHistory, 0, sizeof (d->DitherHistory) ); - - d->FilterCoeff = F [shapingtype]; - d->Mask = ((FLAC__uint64)-1) << (32 - bits); - d->Add = 0.5 * ((1L << (32 - bits)) - 1); - d->Dither = 0.01f*default_dither[indx] / (((FLAC__int64)1) << bits); - d->LastHistoryIndex = 0; -} - -static inline int64_t -ROUND64 (DitherContext *d, double x) -{ - union { - double d; - int64_t i; - } doubletmp; - - doubletmp.d = x + d->Add + (int64_t)FLAC__I64L(0x001FFFFD80000000); - - return doubletmp.i - (int64_t)FLAC__I64L(0x433FFFFD80000000); -} - -/* - * the following is based on parts of wavegain.c - */ - -static int64_t dither_output_(DitherContext *d, FLAC__bool do_dithering, int shapingtype, int i, double Sum, int k) -{ - double Sum2; - int64_t val; - - if(do_dithering) { - if(shapingtype == 0) { - double tmp = random_equi_(d->Dither); - Sum2 = tmp - d->LastRandomNumber [k]; - d->LastRandomNumber [k] = (int)tmp; - Sum2 = Sum += Sum2; - val = ROUND64(d, Sum2) & d->Mask; - } - else { - Sum2 = random_triangular_(d->Dither) - scalar16_(d->DitherHistory[k], d->FilterCoeff + i); - Sum += d->DitherHistory [k] [(-1-i)&15] = (float)Sum2; - Sum2 = Sum + scalar16_(d->ErrorHistory [k], d->FilterCoeff + i); - val = ROUND64(d, Sum2) & d->Mask; - d->ErrorHistory [k] [(-1-i)&15] = (float)(Sum - val); - } - return val; - } - - return ROUND64(d, Sum); -} - -#if 0 - float peak = 0.f, - new_peak, - factor_clip - double scale, - dB; - - ... - - peak is in the range -32768.0 .. 32767.0 - - /* calculate factors for ReplayGain and ClippingPrevention */ - *track_gain = GetTitleGain() + settings->man_gain; - scale = (float) pow(10., *track_gain * 0.05); - if(settings->clip_prev) { - factor_clip = (float) (32767./( peak + 1)); - if(scale < factor_clip) - factor_clip = 1.f; - else - factor_clip /= scale; - scale *= factor_clip; - } - new_peak = (float) peak * scale; - - dB = 20. * log10(scale); - *track_gain = (float) dB; - - const double scale = pow(10., (double)gain * 0.05); -#endif - - -size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool uint32_t_data_out, const FLAC__int32 * const input[], uint32_t wide_samples, uint32_t channels, const uint32_t source_bps, const uint32_t target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context) -{ - static const FLAC__int64 hard_clip_factors_[33] = { - 0, /* 0 bits-per-sample (not supported) */ - 0, /* 1 bits-per-sample (not supported) */ - 0, /* 2 bits-per-sample (not supported) */ - 0, /* 3 bits-per-sample (not supported) */ - -8, /* 4 bits-per-sample */ - -16, /* 5 bits-per-sample */ - -32, /* 6 bits-per-sample */ - -64, /* 7 bits-per-sample */ - -128, /* 8 bits-per-sample */ - -256, /* 9 bits-per-sample */ - -512, /* 10 bits-per-sample */ - -1024, /* 11 bits-per-sample */ - -2048, /* 12 bits-per-sample */ - -4096, /* 13 bits-per-sample */ - -8192, /* 14 bits-per-sample */ - -16384, /* 15 bits-per-sample */ - -32768, /* 16 bits-per-sample */ - -65536, /* 17 bits-per-sample */ - -131072, /* 18 bits-per-sample */ - -262144, /* 19 bits-per-sample */ - -524288, /* 20 bits-per-sample */ - -1048576, /* 21 bits-per-sample */ - -2097152, /* 22 bits-per-sample */ - -4194304, /* 23 bits-per-sample */ - -8388608, /* 24 bits-per-sample */ - -16777216, /* 25 bits-per-sample */ - -33554432, /* 26 bits-per-sample */ - -67108864, /* 27 bits-per-sample */ - -134217728, /* 28 bits-per-sample */ - -268435456, /* 29 bits-per-sample */ - -536870912, /* 30 bits-per-sample */ - -1073741824, /* 31 bits-per-sample */ - (FLAC__int64)(-1073741824) * 2 /* 32 bits-per-sample */ - }; - const FLAC__int32 conv_shift = 32 - target_bps; - const FLAC__int64 hard_clip_factor = hard_clip_factors_[target_bps]; - /* - * The integer input coming in has a varying range based on the - * source_bps. We want to normalize it to [-1.0, 1.0) so instead - * of doing two multiplies on each sample, we just multiple - * 'scale' by 1/(2^(source_bps-1)) - */ - const double multi_scale = scale / (double)(1u << (source_bps-1)); - - FLAC__byte * const start = data_out; - uint32_t i, channel; - const FLAC__int32 *input_; - double sample; - const uint32_t bytes_per_sample = target_bps / 8; - const uint32_t last_history_index = dither_context->LastHistoryIndex; - NoiseShaping noise_shaping = dither_context->ShapingType; - FLAC__int64 val64; - FLAC__int32 val32; - FLAC__int32 uval32; - const FLAC__uint32 twiggle = 1u << (target_bps - 1); - - FLAC__ASSERT(channels > 0 && channels <= FLAC_SHARE__MAX_SUPPORTED_CHANNELS); - FLAC__ASSERT(source_bps >= 4); - FLAC__ASSERT(target_bps >= 4); - FLAC__ASSERT(source_bps <= 32); - FLAC__ASSERT(target_bps < 32); - FLAC__ASSERT((target_bps & 7) == 0); - - for(channel = 0; channel < channels; channel++) { - const uint32_t incr = bytes_per_sample * channels; - data_out = start + bytes_per_sample * channel; - input_ = input[channel]; - for(i = 0; i < wide_samples; i++, data_out += incr) { - sample = (double)input_[i] * multi_scale; - - if(hard_limit) { - /* hard 6dB limiting */ - if(sample < -0.5) - sample = tanh((sample + 0.5) / (1-0.5)) * (1-0.5) - 0.5; - else if(sample > 0.5) - sample = tanh((sample - 0.5) / (1-0.5)) * (1-0.5) + 0.5; - } - sample *= 2147483647.; - - val64 = dither_output_(dither_context, do_dithering, noise_shaping, (i + last_history_index) % 32, sample, channel) >> conv_shift; - - val32 = (FLAC__int32)val64; - if(val64 >= -hard_clip_factor) - val32 = (FLAC__int32)(-(hard_clip_factor+1)); - else if(val64 < hard_clip_factor) - val32 = (FLAC__int32)hard_clip_factor; - - uval32 = (FLAC__uint32)val32; - if (uint32_t_data_out) - uval32 ^= twiggle; - - if (little_endian_data_out) { - switch(target_bps) { - case 24: - data_out[2] = (FLAC__byte)(uval32 >> 16); - /* fall through */ - case 16: - data_out[1] = (FLAC__byte)(uval32 >> 8); - /* fall through */ - case 8: - data_out[0] = (FLAC__byte)uval32; - break; - } - } - else { - switch(target_bps) { - case 24: - data_out[0] = (FLAC__byte)(uval32 >> 16); - data_out[1] = (FLAC__byte)(uval32 >> 8); - data_out[2] = (FLAC__byte)uval32; - break; - case 16: - data_out[0] = (FLAC__byte)(uval32 >> 8); - data_out[1] = (FLAC__byte)uval32; - break; - case 8: - data_out[0] = (FLAC__byte)uval32; - break; - } - } - } - } - dither_context->LastHistoryIndex = (last_history_index + wide_samples) % 32; - - return wide_samples * channels * (target_bps/8); -} diff --git a/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj b/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj deleted file mode 100644 index 7e148830..00000000 --- a/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/share/replaygain_synthesis/replaygain_synthesis_static.vcxproj b/src/share/replaygain_synthesis/replaygain_synthesis_static.vcxproj deleted file mode 100644 index b8379c07..00000000 --- a/src/share/replaygain_synthesis/replaygain_synthesis_static.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc8a-c215-11db-8314-0800200c9a66} - replaygain_synthesis_static - Win32Proj - - - - StaticLibrary - true - - - StaticLibrary - true - - - StaticLibrary - - - StaticLibrary - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - - - - - - - - \ No newline at end of file diff --git a/src/share/replaygain_synthesis/replaygain_synthesis_static.vcxproj.filters b/src/share/replaygain_synthesis/replaygain_synthesis_static.vcxproj.filters deleted file mode 100644 index ace3776b..00000000 --- a/src/share/replaygain_synthesis/replaygain_synthesis_static.vcxproj.filters +++ /dev/null @@ -1,26 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {47ae72f8-630b-4044-b8ce-f4d560d70f4f} - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Public Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/src/share/utf8/CMakeLists.txt b/src/share/utf8/CMakeLists.txt deleted file mode 100644 index 389b09e2..00000000 --- a/src/share/utf8/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.12) - -add_library(utf8 STATIC - charset.c - iconvert.c - utf8.c) - -target_link_libraries(utf8 PUBLIC grabbag $) diff --git a/src/share/utf8/Makefile.lite b/src/share/utf8/Makefile.lite deleted file mode 100644 index ad504921..00000000 --- a/src/share/utf8/Makefile.lite +++ /dev/null @@ -1,25 +0,0 @@ -# -# GNU makefile -# - -topdir = ../../.. -libdir = $(topdir)/objs/$(BUILD)/lib - -LIB_NAME = libutf8 - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(ICONV_LIBS) -else - LIBS = -lgrabbag $(ICONV_LIBS) -endif - -INCLUDES = -I$(topdir)/include - -SRCS_C = \ - charset.c \ - iconvert.c \ - utf8.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/share/utf8/charmaps.h b/src/share/utf8/charmaps.h deleted file mode 100644 index 16d049a2..00000000 --- a/src/share/utf8/charmaps.h +++ /dev/null @@ -1,57 +0,0 @@ - -/* - * If you need to generate more maps, use makemap.c on a system - * with a decent iconv. - */ - -static const uint16_t mapping_iso_8859_2[256] = { - 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, - 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, - 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, - 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, - 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, - 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, - 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, - 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, - 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, - 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, - 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, - 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, - 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, - 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, - 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, - 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, - 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, - 0x0088, 0x0089, 0x008a, 0x008b, 0x008c, 0x008d, 0x008e, 0x008f, - 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, - 0x0098, 0x0099, 0x009a, 0x009b, 0x009c, 0x009d, 0x009e, 0x009f, - 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, - 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, - 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, - 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, - 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, - 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, - 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, - 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, - 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, - 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9 -}; - -static struct { - const char *name; - const uint16_t *map; - struct charset *charset; -} maps[] = { - { "ISO-8859-2", mapping_iso_8859_2, 0 }, - { 0, 0, 0 } -}; - -static const struct { - const char *bad; - const char *good; -} names[] = { - { "ANSI_X3.4-1968", "us-ascii" }, - { 0, 0 } -}; diff --git a/src/share/utf8/charset.c b/src/share/utf8/charset.c deleted file mode 100644 index 5c5693d1..00000000 --- a/src/share/utf8/charset.c +++ /dev/null @@ -1,534 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans - * - * 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. - */ - -/* - * See the corresponding header file for a description of the functions - * that this file provides. - * - * This was first written for Ogg Vorbis but could be of general use. - * - * The only deliberate assumption about data sizes is that a short has - * at least 16 bits, but this code has only been tested on systems with - * 8-bit char, 16-bit short and 32-bit int. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if !defined _WIN32 && !defined HAVE_ICONV /* should be && defined USE_CHARSET_CONVERT */ - -#include - -#include "share/alloc.h" -#include "charset.h" - -#include "charmaps.h" - -/* - * This is like the standard strcasecmp, but it does not depend - * on the locale. Locale-dependent functions can be dangerous: - * we once had a bug involving strcasecmp("iso", "ISO") in a - * Turkish locale! - * - * (I'm not really sure what the official standard says - * about the sign of strcasecmp("Z", "["), but usually - * we're only interested in whether it's zero.) - */ - -static int ascii_strcasecmp(const char *s1, const char *s2) -{ - char c1, c2; - - for (;; s1++, s2++) { - if (!*s1 || !*s2) - break; - if (*s1 == *s2) - continue; - c1 = *s1; - if ('a' <= c1 && c1 <= 'z') - c1 += 'A' - 'a'; - c2 = *s2; - if ('a' <= c2 && c2 <= 'z') - c2 += 'A' - 'a'; - if (c1 != c2) - break; - } - return (uint8_t)*s1 - (uint8_t)*s2; -} - -/* - * UTF-8 equivalents of the C library's wctomb() and mbtowc(). - */ - -int utf8_mbtowc(int *pwc, const char *s, size_t n) -{ - uint8_t c; - int wc, i, k; - - if (!n || !s) - return 0; - - c = *s; - if (c < 0x80) { - if (pwc) - *pwc = c; - return c ? 1 : 0; - } - else if (c < 0xc2) - return -1; - else if (c < 0xe0) { - if (n >= 2 && (s[1] & 0xc0) == 0x80) { - if (pwc) - *pwc = ((c & 0x1f) << 6) | (s[1] & 0x3f); - return 2; - } - else - return -1; - } - else if (c < 0xf0) - k = 3; - else if (c < 0xf8) - k = 4; - else if (c < 0xfc) - k = 5; - else if (c < 0xfe) - k = 6; - else - return -1; - - if (n < (size_t)k) - return -1; - wc = *s++ & ((1 << (7 - k)) - 1); - for (i = 1; i < k; i++) { - if ((*s & 0xc0) != 0x80) - return -1; - wc = (wc << 6) | (*s++ & 0x3f); - } - if (wc < (1 << (5 * k - 4))) - return -1; - if (pwc) - *pwc = wc; - return k; -} - -int utf8_wctomb(char *s, int wc1) -{ - uint32_t wc = wc1; - - if (!s) - return 0; - if (wc < (1u << 7)) { - *s++ = wc; - return 1; - } - else if (wc < (1u << 11)) { - *s++ = 0xc0 | (wc >> 6); - *s++ = 0x80 | (wc & 0x3f); - return 2; - } - else if (wc < (1u << 16)) { - *s++ = 0xe0 | (wc >> 12); - *s++ = 0x80 | ((wc >> 6) & 0x3f); - *s++ = 0x80 | (wc & 0x3f); - return 3; - } - else if (wc < (1u << 21)) { - *s++ = 0xf0 | (wc >> 18); - *s++ = 0x80 | ((wc >> 12) & 0x3f); - *s++ = 0x80 | ((wc >> 6) & 0x3f); - *s++ = 0x80 | (wc & 0x3f); - return 4; - } - else if (wc < (1u << 26)) { - *s++ = 0xf8 | (wc >> 24); - *s++ = 0x80 | ((wc >> 18) & 0x3f); - *s++ = 0x80 | ((wc >> 12) & 0x3f); - *s++ = 0x80 | ((wc >> 6) & 0x3f); - *s++ = 0x80 | (wc & 0x3f); - return 5; - } - else if (wc < (1u << 31)) { - *s++ = 0xfc | (wc >> 30); - *s++ = 0x80 | ((wc >> 24) & 0x3f); - *s++ = 0x80 | ((wc >> 18) & 0x3f); - *s++ = 0x80 | ((wc >> 12) & 0x3f); - *s++ = 0x80 | ((wc >> 6) & 0x3f); - *s++ = 0x80 | (wc & 0x3f); - return 6; - } - else - return -1; -} - -/* - * The charset "object" and methods. - */ - -struct charset { - int max; - int (*mbtowc)(void *table, int *pwc, const char *s, size_t n); - int (*wctomb)(void *table, char *s, int wc); - void *map; -}; - -int charset_mbtowc(struct charset *charset, int *pwc, const char *s, size_t n) -{ - return (*charset->mbtowc)(charset->map, pwc, s, n); -} - -int charset_wctomb(struct charset *charset, char *s, int wc) -{ - return (*charset->wctomb)(charset->map, s, wc); -} - -int charset_max(struct charset *charset) -{ - return charset->max; -} - -/* - * Implementation of UTF-8. - */ - -static int mbtowc_utf8(void *map, int *pwc, const char *s, size_t n) -{ - (void)map; - return utf8_mbtowc(pwc, s, n); -} - -static int wctomb_utf8(void *map, char *s, int wc) -{ - (void)map; - return utf8_wctomb(s, wc); -} - -/* - * Implementation of US-ASCII. - * Probably on most architectures this compiles to less than 256 bytes - * of code, so we can save space by not having a table for this one. - */ - -static int mbtowc_ascii(void *map, int *pwc, const char *s, size_t n) -{ - int wc; - - (void)map; - if (!n || !s) - return 0; - wc = (uint8_t)*s; - if (wc & ~0x7f) - return -1; - if (pwc) - *pwc = wc; - return wc ? 1 : 0; -} - -static int wctomb_ascii(void *map, char *s, int wc) -{ - (void)map; - if (!s) - return 0; - if (wc & ~0x7f) - return -1; - *s = wc; - return 1; -} - -/* - * Implementation of ISO-8859-1. - * Probably on most architectures this compiles to less than 256 bytes - * of code, so we can save space by not having a table for this one. - */ - -static int mbtowc_iso1(void *map, int *pwc, const char *s, size_t n) -{ - int wc; - - (void)map; - if (!n || !s) - return 0; - wc = (uint8_t)*s; - if (wc & ~0xff) - return -1; - if (pwc) - *pwc = wc; - return wc ? 1 : 0; -} - -static int wctomb_iso1(void *map, char *s, int wc) -{ - (void)map; - if (!s) - return 0; - if (wc & ~0xff) - return -1; - *s = wc; - return 1; -} - -/* - * Implementation of any 8-bit charset. - */ - -struct map { - const uint16_t *from; - struct inverse_map *to; -}; - -static int mbtowc_8bit(void *map1, int *pwc, const char *s, size_t n) -{ - struct map *map = map1; - uint16_t wc; - - if (!n || !s) - return 0; - wc = map->from[(uint8_t)*s]; - if (wc == 0xffff) - return -1; - if (pwc) - *pwc = (int)wc; - return wc ? 1 : 0; -} - -/* - * For the inverse map we use a hash table, which has the advantages - * of small constant memory requirement and simple memory allocation, - * but the disadvantage of slow conversion in the worst case. - * If you need real-time performance while letting a potentially - * malicious user define their own map, then the method used in - * linux/drivers/char/consolemap.c would be more appropriate. - */ - -struct inverse_map { - uint8_t first[256]; - uint8_t next[256]; -}; - -/* - * The simple hash is good enough for this application. - * Use the alternative trivial hashes for testing. - */ -#define HASH(i) ((i) & 0xff) -/* #define HASH(i) 0 */ -/* #define HASH(i) 99 */ - -static struct inverse_map *make_inverse_map(const uint16_t *from) -{ - struct inverse_map *to; - char used[256]; - int i, j, k; - - to = malloc(sizeof(struct inverse_map)); - if (!to) - return 0; - for (i = 0; i < 256; i++) - to->first[i] = to->next[i] = used[i] = 0; - for (i = 255; i >= 0; i--) - if (from[i] != 0xffff) { - k = HASH(from[i]); - to->next[i] = to->first[k]; - to->first[k] = i; - used[k] = 1; - } - - /* Point the empty buckets at an empty list. */ - for (i = 0; i < 256; i++) - if (!to->next[i]) - break; - if (i < 256) - for (j = 0; j < 256; j++) - if (!used[j]) - to->first[j] = i; - - return to; -} - -static int wctomb_8bit(void *map1, char *s, int wc1) -{ - struct map *map = map1; - uint16_t wc = wc1; - int i; - - if (!s) - return 0; - - if (wc1 & ~0xffff) - return -1; - - if (1) /* Change 1 to 0 to test the case where malloc fails. */ - if (!map->to) - map->to = make_inverse_map(map->from); - - if (map->to) { - /* Use the inverse map. */ - i = map->to->first[HASH(wc)]; - for (;;) { - if (map->from[i] == wc) { - *s = i; - return 1; - } - if (!(i = map->to->next[i])) - break; - } - } - else { - /* We don't have an inverse map, so do a linear search. */ - for (i = 0; i < 256; i++) - if (map->from[i] == wc) { - *s = i; - return 1; - } - } - - return -1; -} - -/* - * The "constructor" charset_find(). - */ - -struct charset charset_utf8 = { - 6, - &mbtowc_utf8, - &wctomb_utf8, - 0 -}; - -struct charset charset_iso1 = { - 1, - &mbtowc_iso1, - &wctomb_iso1, - 0 -}; - -struct charset charset_ascii = { - 1, - &mbtowc_ascii, - &wctomb_ascii, - 0 -}; - -struct charset *charset_find(const char *code) -{ - int i; - - /* Find good (MIME) name. */ - for (i = 0; names[i].bad; i++) - if (!ascii_strcasecmp(code, names[i].bad)) { - code = names[i].good; - break; - } - - /* Recognise some charsets for which we avoid using a table. */ - if (!ascii_strcasecmp(code, "UTF-8")) - return &charset_utf8; - if (!ascii_strcasecmp(code, "US-ASCII")) - return &charset_ascii; - if (!ascii_strcasecmp(code, "ISO-8859-1")) - return &charset_iso1; - - /* Look for a mapping for a simple 8-bit encoding. */ - for (i = 0; maps[i].name; i++) - if (!ascii_strcasecmp(code, maps[i].name)) { - if (!maps[i].charset) { - maps[i].charset = malloc(sizeof(struct charset)); - if (maps[i].charset) { - struct map *map = malloc(sizeof(struct map)); - if (!map) { - free(maps[i].charset); - maps[i].charset = 0; - } - else { - maps[i].charset->max = 1; - maps[i].charset->mbtowc = &mbtowc_8bit; - maps[i].charset->wctomb = &wctomb_8bit; - maps[i].charset->map = map; - map->from = maps[i].map; - map->to = 0; /* inverse mapping is created when required */ - } - } - } - return maps[i].charset; - } - - return 0; -} - -/* - * Function to convert a buffer from one encoding to another. - * Invalid bytes are replaced by '#', and characters that are - * not available in the target encoding are replaced by '?'. - * Each of TO and TOLEN may be zero, if the result is not needed. - * The output buffer is null-terminated, so it is all right to - * use charset_convert(fromcode, tocode, s, strlen(s), &t, 0). - */ - -int charset_convert(const char *fromcode, const char *tocode, - const char *from, size_t fromlen, - char **to, size_t *tolen) -{ - int ret = 0; - struct charset *charset1, *charset2; - char *tobuf, *p; - int i, j, wc; - - charset1 = charset_find(fromcode); - charset2 = charset_find(tocode); - if (!charset1 || !charset2 ) - return -1; - - tobuf = safe_malloc_mul2add_(fromlen, /*times*/charset2->max, /*+*/1); - if (!tobuf) - return -2; - - for (p = tobuf; fromlen; from += i, fromlen -= i, p += j) { - i = charset_mbtowc(charset1, &wc, from, fromlen); - if (!i) - i = 1; - else if (i == -1) { - i = 1; - wc = '#'; - ret = 2; - } - j = charset_wctomb(charset2, p, wc); - if (j == -1) { - if (!ret) - ret = 1; - j = charset_wctomb(charset2, p, '?'); - if (j == -1) - j = 0; - } - } - - if (tolen) - *tolen = p - tobuf; - *p++ = '\0'; - if (to) { - char *tobuf_saved = tobuf; - *to = realloc(tobuf, p - tobuf); - if (*to == NULL) - *to = tobuf_saved; - } - else - free(tobuf); - - return ret; -} - -#endif /* USE_CHARSET_ICONV */ diff --git a/src/share/utf8/charset.h b/src/share/utf8/charset.h deleted file mode 100644 index ea8e31e1..00000000 --- a/src/share/utf8/charset.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans - * - * 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. - */ - -#include - -/* - * These functions are like the C library's mbtowc() and wctomb(), - * but instead of depending on the locale they always work in UTF-8, - * and they use int instead of wchar_t. - */ - -int utf8_mbtowc(int *pwc, const char *s, size_t n); -int utf8_wctomb(char *s, int wc); - -/* - * This is an object-oriented version of mbtowc() and wctomb(). - * The caller first uses charset_find() to get a pointer to struct - * charset, then uses the mbtowc() and wctomb() methods on it. - * The function charset_max() gives the maximum length of a - * multibyte character in that encoding. - * This API is only appropriate for stateless encodings like UTF-8 - * or ISO-8859-3, but I have no intention of implementing anything - * other than UTF-8 and 8-bit encodings. - * - * MINOR BUG: If there is no memory charset_find() may return 0 and - * there is no way to distinguish this case from an unknown encoding. - */ - -struct charset; - -struct charset *charset_find(const char *code); - -int charset_mbtowc(struct charset *charset, int *pwc, const char *s, size_t n); -int charset_wctomb(struct charset *charset, char *s, int wc); -int charset_max(struct charset *charset); - -/* - * Function to convert a buffer from one encoding to another. - * Invalid bytes are replaced by '#', and characters that are - * not available in the target encoding are replaced by '?'. - * Each of TO and TOLEN may be zero if the result is not wanted. - * The input or output may contain null bytes, but the output - * buffer is also null-terminated, so it is all right to - * use charset_convert(fromcode, tocode, s, strlen(s), &t, 0). - * - * Return value: - * - * -2 : memory allocation failed - * -1 : unknown encoding - * 0 : data was converted exactly - * 1 : valid data was converted approximately (using '?') - * 2 : input was invalid (but still converted, using '#') - */ - -int charset_convert(const char *fromcode, const char *tocode, - const char *from, size_t fromlen, - char **to, size_t *tolen); diff --git a/src/share/utf8/charset_test.c b/src/share/utf8/charset_test.c deleted file mode 100644 index 6761100c..00000000 --- a/src/share/utf8/charset_test.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include "charset.h" - -void test_any(struct charset *charset) -{ - int wc; - char s[2]; - - assert(charset); - - /* Decoder */ - - assert(charset_mbtowc(charset, 0, 0, 0) == 0); - assert(charset_mbtowc(charset, 0, 0, 1) == 0); - assert(charset_mbtowc(charset, 0, (char *)(-1), 0) == 0); - - assert(charset_mbtowc(charset, 0, "a", 0) == 0); - assert(charset_mbtowc(charset, 0, "", 1) == 0); - assert(charset_mbtowc(charset, 0, "b", 1) == 1); - assert(charset_mbtowc(charset, 0, "", 2) == 0); - assert(charset_mbtowc(charset, 0, "c", 2) == 1); - - wc = 'x'; - assert(charset_mbtowc(charset, &wc, "a", 0) == 0 && wc == 'x'); - assert(charset_mbtowc(charset, &wc, "", 1) == 0 && wc == 0); - assert(charset_mbtowc(charset, &wc, "b", 1) == 1 && wc == 'b'); - assert(charset_mbtowc(charset, &wc, "", 2) == 0 && wc == 0); - assert(charset_mbtowc(charset, &wc, "c", 2) == 1 && wc == 'c'); - - /* Encoder */ - - assert(charset_wctomb(charset, 0, 0) == 0); - - s[0] = s[1] = '.'; - assert(charset_wctomb(charset, s, 0) == 1 && - s[0] == '\0' && s[1] == '.'); - assert(charset_wctomb(charset, s, 'x') == 1 && - s[0] == 'x' && s[1] == '.'); -} - -void test_utf8() -{ - struct charset *charset; - int wc; - char s[8]; - - charset = charset_find("UTF-8"); - test_any(charset); - - /* Decoder */ - wc = 0; - assert(charset_mbtowc(charset, &wc, "\177", 1) == 1 && wc == 127); - assert(charset_mbtowc(charset, &wc, "\200", 2) == -1); - assert(charset_mbtowc(charset, &wc, "\301\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\302\200", 1) == -1); - assert(charset_mbtowc(charset, &wc, "\302\200", 2) == 2 && wc == 128); - assert(charset_mbtowc(charset, &wc, "\302\200", 3) == 2 && wc == 128); - assert(charset_mbtowc(charset, &wc, "\340\237\200", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\340\240\200", 9) == 3 && - wc == 1 << 11); - assert(charset_mbtowc(charset, &wc, "\360\217\277\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\360\220\200\200", 9) == 4 && - wc == 1 << 16); - assert(charset_mbtowc(charset, &wc, "\370\207\277\277\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\370\210\200\200\200", 9) == 5 && - wc == 1 << 21); - assert(charset_mbtowc(charset, &wc, "\374\203\277\277\277\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\374\204\200\200\200\200", 9) == 6 && - wc == 1 << 26); - assert(charset_mbtowc(charset, &wc, "\375\277\277\277\277\277", 9) == 6 && - wc == 0x7fffffff); - - assert(charset_mbtowc(charset, &wc, "\302\000", 2) == -1); - assert(charset_mbtowc(charset, &wc, "\302\300", 2) == -1); - assert(charset_mbtowc(charset, &wc, "\340\040\200", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\340\340\200", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\340\240\000", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\340\240\300", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\360\020\200\200", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\360\320\200\200", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\360\220\000\200", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\360\220\300\200", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\360\220\200\000", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\360\220\200\300", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\375\077\277\277\277\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\375\377\277\277\277\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\375\277\077\277\277\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\375\277\377\277\277\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\375\277\277\277\077\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\375\277\277\277\377\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\375\277\277\277\277\077", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\375\277\277\277\277\377", 9) == -1); - - assert(charset_mbtowc(charset, &wc, "\376\277\277\277\277\277", 9) == -1); - assert(charset_mbtowc(charset, &wc, "\377\277\277\277\277\277", 9) == -1); - - /* Encoder */ - safe_strncpy(s, ".......", sizeof(s)); - assert(charset_wctomb(charset, s, 1u << 31) == -1 && - !strcmp(s, ".......")); - assert(charset_wctomb(charset, s, 127) == 1 && - !strcmp(s, "\177......")); - assert(charset_wctomb(charset, s, 128) == 2 && - !strcmp(s, "\302\200.....")); - assert(charset_wctomb(charset, s, 0x7ff) == 2 && - !strcmp(s, "\337\277.....")); - assert(charset_wctomb(charset, s, 0x800) == 3 && - !strcmp(s, "\340\240\200....")); - assert(charset_wctomb(charset, s, 0xffff) == 3 && - !strcmp(s, "\357\277\277....")); - assert(charset_wctomb(charset, s, 0x10000) == 4 && - !strcmp(s, "\360\220\200\200...")); - assert(charset_wctomb(charset, s, 0x1fffff) == 4 && - !strcmp(s, "\367\277\277\277...")); - assert(charset_wctomb(charset, s, 0x200000) == 5 && - !strcmp(s, "\370\210\200\200\200..")); - assert(charset_wctomb(charset, s, 0x3ffffff) == 5 && - !strcmp(s, "\373\277\277\277\277..")); - assert(charset_wctomb(charset, s, 0x4000000) == 6 && - !strcmp(s, "\374\204\200\200\200\200.")); - assert(charset_wctomb(charset, s, 0x7fffffff) == 6 && - !strcmp(s, "\375\277\277\277\277\277.")); -} - -void test_ascii() -{ - struct charset *charset; - int wc; - char s[3]; - - charset = charset_find("us-ascii"); - test_any(charset); - - /* Decoder */ - wc = 0; - assert(charset_mbtowc(charset, &wc, "\177", 2) == 1 && wc == 127); - assert(charset_mbtowc(charset, &wc, "\200", 2) == -1); - - /* Encoder */ - safe_strncpy(s, "..", sizeof(s)); - assert(charset_wctomb(charset, s, 256) == -1 && !strcmp(s, "..")); - assert(charset_wctomb(charset, s, 255) == -1); - assert(charset_wctomb(charset, s, 128) == -1); - assert(charset_wctomb(charset, s, 127) == 1 && !strcmp(s, "\177.")); -} - -void test_iso1() -{ - struct charset *charset; - int wc; - char s[3]; - - charset = charset_find("iso-8859-1"); - test_any(charset); - - /* Decoder */ - wc = 0; - assert(charset_mbtowc(charset, &wc, "\302\200", 9) == 1 && wc == 0xc2); - - /* Encoder */ - safe_strncpy(s, "..", sizeof(s)); - assert(charset_wctomb(charset, s, 256) == -1 && !strcmp(s, "..")); - assert(charset_wctomb(charset, s, 255) == 1 && !strcmp(s, "\377.")); - assert(charset_wctomb(charset, s, 128) == 1 && !strcmp(s, "\200.")); -} - -void test_iso2() -{ - struct charset *charset; - int wc; - char s[3]; - - charset = charset_find("iso-8859-2"); - test_any(charset); - - /* Decoder */ - wc = 0; - assert(charset_mbtowc(charset, &wc, "\302\200", 9) == 1 && wc == 0xc2); - assert(charset_mbtowc(charset, &wc, "\377", 2) == 1 && wc == 0x2d9); - - /* Encoder */ - safe_strncpy(s, "..", sizeof(s)); - assert(charset_wctomb(charset, s, 256) == -1 && !strcmp(s, "..")); - assert(charset_wctomb(charset, s, 255) == -1 && !strcmp(s, "..")); - assert(charset_wctomb(charset, s, 258) == 1 && !strcmp(s, "\303.")); - assert(charset_wctomb(charset, s, 128) == 1 && !strcmp(s, "\200.")); -} - -void test_convert() -{ - const char *p; - char *q, *r; - char s[256]; - size_t n, n2; - int i; - - p = "\000x\302\200\375\277\277\277\277\277"; - assert(charset_convert("UTF-8", "UTF-8", p, 10, &q, &n) == 0 && - n == 10 && !strcmp(p, q)); - assert(charset_convert("UTF-8", "UTF-8", "x\301\277y", 4, &q, &n) == 2 && - n == 4 && !strcmp(q, "x##y")); - assert(charset_convert("UTF-8", "UTF-8", "x\301\277y", 4, 0, &n) == 2 && - n == 4); - assert(charset_convert("UTF-8", "UTF-8", "x\301\277y", 4, &q, 0) == 2 && - !strcmp(q, "x##y")); - assert(charset_convert("UTF-8", "iso-8859-1", - "\302\200\304\200x", 5, &q, &n) == 1 && - n == 3 && !strcmp(q, "\200?x")); - assert(charset_convert("iso-8859-1", "UTF-8", - "\000\200\377", 3, &q, &n) == 0 && - n == 5 && !memcmp(q, "\000\302\200\303\277", 5)); - assert(charset_convert("iso-8859-1", "iso-8859-1", - "\000\200\377", 3, &q, &n) == 0 && - n == 3 && !memcmp(q, "\000\200\377", 3)); - - assert(charset_convert("iso-8859-2", "utf-8", "\300", 1, &q, &n) == 0 && - n == 2 && !strcmp(q, "\305\224")); - assert(charset_convert("utf-8", "iso-8859-2", "\305\224", 2, &q, &n) == 0 && - n == 1 && !strcmp(q, "\300")); - - for (i = 0; i < 256; i++) - s[i] = i; - - assert(charset_convert("iso-8859-2", "utf-8", s, 256, &q, &n) == 0); - assert(charset_convert("utf-8", "iso-8859-2", q, n, &r, &n2) == 0); - assert(n2 == 256 && !memcmp(r, s, n2)); -} - -int main() -{ - test_utf8(); - test_ascii(); - test_iso1(); - test_iso2(); - - test_convert(); - - return 0; -} diff --git a/src/share/utf8/iconvert.c b/src/share/utf8/iconvert.c deleted file mode 100644 index 8ab53c10..00000000 --- a/src/share/utf8/iconvert.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#if !defined _WIN32 && defined HAVE_ICONV - -#include -#include -#include -#include -#include -#include - -#include "iconvert.h" -#include "share/alloc.h" -#include "share/safe_str.h" - -/* - * Convert data from one encoding to another. Return: - * - * -2 : memory allocation failed - * -1 : unknown encoding - * 0 : data was converted exactly - * 1 : data was converted inexactly - * 2 : data was invalid (but still converted) - * - * We convert in two steps, via UTF-8, as this is the only - * reliable way of distinguishing between invalid input - * and valid input which iconv refuses to transliterate. - * We convert from UTF-8 twice, because we have no way of - * knowing whether the conversion was exact if iconv returns - * E2BIG (due to a bug in the specification of iconv). - * An alternative approach is to assume that the output of - * iconv is never more than 4 times as long as the input, - * but I prefer to avoid that assumption if possible. - */ - -int iconvert(const char *fromcode, const char *tocode, - const char *from, size_t fromlen, - char **to, size_t *tolen) -{ - int ret = 0; - iconv_t cd1, cd2; - char *ib; - char *ob; - char *utfbuf = 0, *outbuf, *newbuf; - size_t utflen, outlen, ibl, obl, k; - char tbuf[2048]; - - cd1 = iconv_open("UTF-8", fromcode); - if (cd1 == (iconv_t)(-1)) - return -1; - - cd2 = (iconv_t)(-1); - /* Don't use strcasecmp() as it's locale-dependent. */ - if (!strchr("Uu", tocode[0]) || - !strchr("Tt", tocode[1]) || - !strchr("Ff", tocode[2]) || - tocode[3] != '-' || - tocode[4] != '8' || - tocode[5] != '\0') { - char *tocode1; - int rc; - /* - * Try using this non-standard feature of glibc and libiconv. - * This is deliberately not a config option as people often - * change their iconv library without rebuilding applications. - */ - - rc = asprintf(&tocode1, "%s//TRANSLIT", tocode); - if (rc < 0 || ! tocode1) - goto fail; - - cd2 = iconv_open(tocode1, "UTF-8"); - free(tocode1); - - if (cd2 == (iconv_t)(-1)) - cd2 = iconv_open(tocode, fromcode); - - if (cd2 == (iconv_t)(-1)) { - iconv_close(cd1); - return -1; - } - } - - utflen = 1; /*fromlen * 2 + 1; XXX */ - utfbuf = malloc(utflen); - if (!utfbuf) - goto fail; - - /* Convert to UTF-8 */ - ib = (char *)from; - ibl = fromlen; - ob = utfbuf; - obl = utflen; - for (;;) { - k = iconv(cd1, &ib, &ibl, &ob, &obl); - assert((!k && !ibl) || - (k == (size_t)(-1) && errno == E2BIG && ibl && obl < 6) || - (k == (size_t)(-1) && - (errno == EILSEQ || errno == EINVAL) && ibl)); - if (!ibl) - break; - if (obl < 6) { - /* Enlarge the buffer */ - if(utflen*2 < utflen) /* overflow check */ - goto fail; - utflen *= 2; - newbuf = realloc(utfbuf, utflen); - if (!newbuf) - goto fail; - ob = (ob - utfbuf) + newbuf; - obl = utflen - (ob - newbuf); - utfbuf = newbuf; - } - else { - /* Invalid input */ - ib++, ibl--; - *ob++ = '#', obl--; - ret = 2; - iconv(cd1, 0, 0, 0, 0); - } - } - - if (cd2 == (iconv_t)(-1)) { - /* The target encoding was UTF-8 */ - if (tolen) - *tolen = ob - utfbuf; - if (!to) { - free(utfbuf); - iconv_close(cd1); - return ret; - } - newbuf = safe_realloc_add_2op_(utfbuf, (ob - utfbuf), /*+*/1); - if (!newbuf) - goto fail; - ob = (ob - utfbuf) + newbuf; - *ob = '\0'; - *to = newbuf; - iconv_close(cd1); - return ret; - } - - /* Truncate the buffer to be tidy */ - utflen = ob - utfbuf; - newbuf = realloc(utfbuf, utflen); - if (!newbuf) - goto fail; - utfbuf = newbuf; - - /* Convert from UTF-8 to discover how long the output is */ - outlen = 0; - ib = utfbuf; - ibl = utflen; - while (ibl) { - ob = tbuf; - obl = sizeof(tbuf); - k = iconv(cd2, &ib, &ibl, &ob, &obl); - assert((k != (size_t)(-1) && !ibl) || - (k == (size_t)(-1) && errno == E2BIG && ibl) || - (k == (size_t)(-1) && errno == EILSEQ && ibl)); - if (ibl && !(k == (size_t)(-1) && errno == E2BIG)) { - /* Replace one character */ - char *tb = "?"; - size_t tbl = 1; - - outlen += ob - tbuf; - ob = tbuf; - obl = sizeof(tbuf); - k = iconv(cd2, &tb, &tbl, &ob, &obl); - assert((!k && !tbl) || - (k == (size_t)(-1) && errno == EILSEQ && tbl)); - for (++ib, --ibl; ibl && (*ib & 0x80); ib++, ibl--) - ; - } - outlen += ob - tbuf; - } - ob = tbuf; - obl = sizeof(tbuf); - k = iconv(cd2, 0, 0, &ob, &obl); - assert(!k); - outlen += ob - tbuf; - - /* Convert from UTF-8 for real */ - outbuf = safe_malloc_add_2op_(outlen, /*+*/1); - if (!outbuf) - goto fail; - ib = utfbuf; - ibl = utflen; - ob = outbuf; - obl = outlen; - while (ibl) { - k = iconv(cd2, &ib, &ibl, &ob, &obl); - assert((k != (size_t)(-1) && !ibl) || - (k == (size_t)(-1) && errno == EILSEQ && ibl)); - if (k && !ret) - ret = 1; - if (ibl && !(k == (size_t)(-1) && errno == E2BIG)) { - /* Replace one character */ - char *tb = "?"; - size_t tbl = 1; - - k = iconv(cd2, &tb, &tbl, &ob, &obl); - assert((!k && !tbl) || - (k == (size_t)(-1) && errno == EILSEQ && tbl)); - for (++ib, --ibl; ibl && (*ib & 0x80); ib++, ibl--) - ; - } - } - k = iconv(cd2, 0, 0, &ob, &obl); - assert(!k); - assert(!obl); - *ob = '\0'; - - free(utfbuf); - iconv_close(cd1); - iconv_close(cd2); - if (tolen) - *tolen = outlen; - if (!to) { - free(outbuf); - return ret; - } - *to = outbuf; - return ret; - - fail: - if(0 != utfbuf) - free(utfbuf); - iconv_close(cd1); - if (cd2 != (iconv_t)(-1)) - iconv_close(cd2); - return -2; -} - -#endif /* HAVE_ICONV */ diff --git a/src/share/utf8/iconvert.h b/src/share/utf8/iconvert.h deleted file mode 100644 index a2d75a27..00000000 --- a/src/share/utf8/iconvert.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#ifdef HAVE_ICONV - -/* - * Convert data from one encoding to another. Return: - * - * -2 : memory allocation failed - * -1 : unknown encoding - * 0 : data was converted exactly - * 1 : data was converted inexactly - * 2 : data was invalid (but still converted) - * - * We convert in two steps, via UTF-8, as this is the only - * reliable way of distinguishing between invalid input - * and valid input which iconv refuses to transliterate. - * We convert from UTF-8 twice, because we have no way of - * knowing whether the conversion was exact if iconv returns - * E2BIG (due to a bug in the specification of iconv). - * An alternative approach is to assume that the output of - * iconv is never more than 4 times as long as the input, - * but I prefer to avoid that assumption if possible. - */ - -int iconvert(const char *fromcode, const char *tocode, - const char *from, size_t fromlen, - char **to, size_t *tolen) ; - -#endif /* HAVE_ICONV */ diff --git a/src/share/utf8/makemap.c b/src/share/utf8/makemap.c deleted file mode 100644 index 790021c6..00000000 --- a/src/share/utf8/makemap.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2001 Edmund Grimley Evans - * - * 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -int main(int argc, char *argv[]) -{ - iconv_t cd; - const char *ib; - char *ob; - size_t ibl, obl, k; - uint8_t c, buf[4]; - int i, wc; - - if (argc != 2) { - printf("Usage: %s ENCODING\n", argv[0]); - printf("Output a charset map for the 8-bit ENCODING.\n"); - return 1; - } - - cd = iconv_open("UCS-4", argv[1]); - if (cd == (iconv_t)(-1)) { - perror("iconv_open"); - return 1; - } - - for (i = 0; i < 256; i++) { - c = i; - ib = &c; - ibl = 1; - ob = buf; - obl = 4; - k = iconv(cd, &ib, &ibl, &ob, &obl); - if (!k && !ibl && !obl) { - wc = (buf[0] << 24) + (buf[1] << 16) + (buf[2] << 8) + buf[3]; - if (wc >= 0xffff) { - printf("Dodgy value.\n"); - return 1; - } - } - else if (k == (size_t)(-1) && errno == EILSEQ) - wc = 0xffff; - else { - printf("Non-standard iconv.\n"); - return 1; - } - - if (i % 8 == 0) - printf(" "); - printf("0x%04x", wc); - if (i == 255) - printf("\n"); - else if (i % 8 == 7) - printf(",\n"); - else - printf(", "); - } - - return 0; -} diff --git a/src/share/utf8/utf8.c b/src/share/utf8/utf8.c deleted file mode 100644 index 34af187b..00000000 --- a/src/share/utf8/utf8.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2001 Peter Harris - * Copyright (C) 2001 Edmund Grimley Evans - * - * Buffer overflow checking added: Josh Coalson, 9/9/2007 - * - * Win32 part rewritten: lvqcl, 2/2/2016 - * - * 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. - */ - -/* - * Convert a string between UTF-8 and the locale's charset. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include "share/alloc.h" -#include "share/utf8.h" - -#ifdef _WIN32 - -#include - -int utf8_encode(const char *from, char **to) -{ - wchar_t *unicode = NULL; - char *utf8 = NULL; - int ret = -1; - - do { - int len; - - len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, -1, NULL, 0); - if(len == 0) break; - unicode = (wchar_t*) safe_malloc_mul_2op_((size_t)len, sizeof(wchar_t)); - if(unicode == NULL) break; - len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, -1, unicode, len); - if(len == 0) break; - - len = WideCharToMultiByte(CP_UTF8, 0, unicode, -1, NULL, 0, NULL, NULL); - if(len == 0) break; - utf8 = (char*) safe_malloc_mul_2op_((size_t)len, sizeof(char)); - if(utf8 == NULL) break; - len = WideCharToMultiByte(CP_UTF8, 0, unicode, -1, utf8, len, NULL, NULL); - if(len == 0) break; - - ret = 0; - - } while(0); - - free(unicode); - - if(ret == 0) { - *to = utf8; - } else { - free(utf8); - *to = NULL; - } - - return ret; -} - -int utf8_decode(const char *from, char **to) -{ - wchar_t *unicode = NULL; - char *acp = NULL; - int ret = -1; - - do { - int len; - - len = MultiByteToWideChar(CP_UTF8, 0, from, -1, NULL, 0); - if(len == 0) break; - unicode = (wchar_t*) safe_malloc_mul_2op_((size_t)len, sizeof(wchar_t)); - if(unicode == NULL) break; - len = MultiByteToWideChar(CP_UTF8, 0, from, -1, unicode, len); - if(len == 0) break; - - len = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, NULL, 0, NULL, NULL); - if(len == 0) break; - acp = (char*) safe_malloc_mul_2op_((size_t)len, sizeof(char)); - if(acp == NULL) break; - len = WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, unicode, -1, acp, len, NULL, NULL); - if(len == 0) break; - - ret = 0; - - } while(0); - - free(unicode); - - if(ret == 0) { - *to = acp; - } else { - free(acp); - *to = NULL; - } - - return ret; -} - -#else /* End win32. Rest is for real operating systems */ - - -#ifdef HAVE_LANGINFO_CODESET -#include -#endif - -#include - -#include "share/safe_str.h" -#include "iconvert.h" -#include "charset.h" - -static const char *current_charset(void) -{ - const char *c = 0; -#ifdef HAVE_LANGINFO_CODESET - c = nl_langinfo(CODESET); -#endif - - if (!c) - c = getenv("CHARSET"); - - return c? c : "US-ASCII"; -} - -static int convert_buffer(const char *fromcode, const char *tocode, - const char *from, size_t fromlen, - char **to, size_t *tolen) -{ - int ret = -1; - -#ifdef HAVE_ICONV - ret = iconvert(fromcode, tocode, from, fromlen, to, tolen); - if (ret != -1) - return ret; -#endif - -#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */ - ret = charset_convert(fromcode, tocode, from, fromlen, to, tolen); - if (ret != -1) - return ret; -#endif - - return ret; -} - -static int convert_string(const char *fromcode, const char *tocode, - const char *from, char **to, char replace) -{ - int ret; - size_t fromlen; - char *s; - - fromlen = strlen(from); - ret = convert_buffer(fromcode, tocode, from, fromlen, to, 0); - if (ret == -2) - return -1; - if (ret != -1) - return ret; - - s = safe_malloc_add_2op_(fromlen, /*+*/1); - if (!s) - return -1; - snprintf(s, fromlen + 1, "%s", from); - *to = s; - for (; *s; s++) - if (*s & ~0x7f) - *s = replace; - return 3; -} - -int utf8_encode(const char *from, char **to) -{ - return convert_string(current_charset(), "UTF-8", from, to, '#'); -} - -int utf8_decode(const char *from, char **to) -{ - return convert_string("UTF-8", current_charset(), from, to, '?'); -} - -#endif diff --git a/src/share/utf8/utf8_static.vcproj b/src/share/utf8/utf8_static.vcproj deleted file mode 100644 index 45a031a0..00000000 --- a/src/share/utf8/utf8_static.vcproj +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/share/utf8/utf8_static.vcxproj b/src/share/utf8/utf8_static.vcxproj deleted file mode 100644 index 5298e924..00000000 --- a/src/share/utf8/utf8_static.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc92-c215-11db-8314-0800200c9a66} - utf8_static - Win32Proj - - - - StaticLibrary - true - - - StaticLibrary - true - - - StaticLibrary - - - StaticLibrary - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - - - - - - - - \ No newline at end of file diff --git a/src/share/utf8/utf8_static.vcxproj.filters b/src/share/utf8/utf8_static.vcxproj.filters deleted file mode 100644 index dfbaa99c..00000000 --- a/src/share/utf8/utf8_static.vcxproj.filters +++ /dev/null @@ -1,26 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {c96e2c5d-a952-4c1d-b3d7-294a5b216154} - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Public Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/src/share/win_utf8_io/Makefile.lite b/src/share/win_utf8_io/Makefile.lite deleted file mode 100644 index 15492669..00000000 --- a/src/share/win_utf8_io/Makefile.lite +++ /dev/null @@ -1,21 +0,0 @@ -# -# GNU makefile -# - -topdir = ../../.. - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lFLAC $(OGG_LIBS) -lm -endif - -LIB_NAME = libwin_utf8_io -INCLUDES = -I$(topdir)/include - -SRCS_C = \ - win_utf8_io.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/share/win_utf8_io/win_utf8_io.c b/src/share/win_utf8_io/win_utf8_io.c deleted file mode 100644 index bbb6a74a..00000000 --- a/src/share/win_utf8_io/win_utf8_io.c +++ /dev/null @@ -1,271 +0,0 @@ -/* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2013-2016 Xiph.Org Foundation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * - Neither the name of the Xiph.org Foundation nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "share/win_utf8_io.h" -#include "share/windows_unicode_filenames.h" - -#define UTF8_BUFFER_SIZE 32768 - -static int local_vsnprintf(char *str, size_t size, const char *fmt, va_list va) -{ - int rc; - -#if defined _MSC_VER - if (size == 0) - return 1024; - rc = vsnprintf_s(str, size, _TRUNCATE, fmt, va); - if (rc < 0) - rc = size - 1; -#elif defined __MINGW32__ - rc = __mingw_vsnprintf(str, size, fmt, va); -#else - rc = vsnprintf(str, size, fmt, va); -#endif - - return rc; -} - -/* convert WCHAR stored Unicode string to UTF-8. Caller is responsible for freeing memory */ -static char *utf8_from_wchar(const wchar_t *wstr) -{ - char *utf8str; - int len; - - if (!wstr) - return NULL; - if ((len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL)) == 0) - return NULL; - if ((utf8str = (char *)malloc(len)) == NULL) - return NULL; - if (WideCharToMultiByte(CP_UTF8, 0, wstr, -1, utf8str, len, NULL, NULL) == 0) { - free(utf8str); - utf8str = NULL; - } - - return utf8str; -} - -/* convert UTF-8 back to WCHAR. Caller is responsible for freeing memory */ -static wchar_t *wchar_from_utf8(const char *str) -{ - wchar_t *widestr; - int len; - - if (!str) - return NULL; - if ((len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0)) == 0) - return NULL; - if ((widestr = (wchar_t *)malloc(len*sizeof(wchar_t))) == NULL) - return NULL; - if (MultiByteToWideChar(CP_UTF8, 0, str, -1, widestr, len) == 0) { - free(widestr); - widestr = NULL; - } - - return widestr; -} - -/* retrieve WCHAR commandline, expand wildcards and convert everything to UTF-8 */ -int get_utf8_argv(int *argc, char ***argv) -{ - typedef int (__cdecl *wgetmainargs_t)(int*, wchar_t***, wchar_t***, int, int*); - wgetmainargs_t wgetmainargs; - HMODULE handle; - int wargc; - wchar_t **wargv; - wchar_t **wenv; - char **utf8argv; - int ret, i; - - if ((handle = LoadLibraryW(L"msvcrt.dll")) == NULL) return 1; - if ((wgetmainargs = (wgetmainargs_t)GetProcAddress(handle, "__wgetmainargs")) == NULL) { - FreeLibrary(handle); - return 1; - } - i = 0; - /* when the 4th argument is 1, __wgetmainargs expands wildcards but also erroneously converts \\?\c:\path\to\file.flac to \\file.flac */ - if (wgetmainargs(&wargc, &wargv, &wenv, 1, &i) != 0) { - FreeLibrary(handle); - return 1; - } - if ((utf8argv = (char **)calloc(wargc, sizeof(char*))) == NULL) { - FreeLibrary(handle); - return 1; - } - - ret = 0; - for (i=0; i - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/share/win_utf8_io/win_utf8_io_static.vcxproj b/src/share/win_utf8_io/win_utf8_io_static.vcxproj deleted file mode 100644 index aa9a3eeb..00000000 --- a/src/share/win_utf8_io/win_utf8_io_static.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbe02-c215-11db-8314-0800200c9a66} - win_utf8_io_static - Win32Proj - - - - StaticLibrary - true - - - StaticLibrary - true - - - StaticLibrary - - - StaticLibrary - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - Disabled - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - - - - - - - - \ No newline at end of file diff --git a/src/share/win_utf8_io/win_utf8_io_static.vcxproj.filters b/src/share/win_utf8_io/win_utf8_io_static.vcxproj.filters deleted file mode 100644 index e44a0c7a..00000000 --- a/src/share/win_utf8_io/win_utf8_io_static.vcxproj.filters +++ /dev/null @@ -1,22 +0,0 @@ - - - - - {6469e7f2-0837-4004-9f36-27d45ed62336} - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Public Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/src/test_grabbag/CMakeLists.txt b/src/test_grabbag/CMakeLists.txt deleted file mode 100644 index 56abe810..00000000 --- a/src/test_grabbag/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_subdirectory(cuesheet) -add_subdirectory(picture) diff --git a/src/test_grabbag/Makefile.am b/src/test_grabbag/Makefile.am deleted file mode 100644 index c13ca3b7..00000000 --- a/src/test_grabbag/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -SUBDIRS = cuesheet picture - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite diff --git a/src/test_grabbag/Makefile.lite b/src/test_grabbag/Makefile.lite deleted file mode 100644 index a0e4447b..00000000 --- a/src/test_grabbag/Makefile.lite +++ /dev/null @@ -1,41 +0,0 @@ -# test_grabbag - Simple testers for the grabbag library -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -.PHONY: cuesheet picture -all: cuesheet picture - -DEFAULT_CONFIG = release - -CONFIG = $(DEFAULT_CONFIG) - -debug : CONFIG = debug -valgrind: CONFIG = valgrind -release : CONFIG = release - -debug : all -valgrind: all -release : all - -cuesheet: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) -picture: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -clean: - -(cd cuesheet ; $(MAKE) -f Makefile.lite clean) - -(cd picture ; $(MAKE) -f Makefile.lite clean) diff --git a/src/test_grabbag/cuesheet/CMakeLists.txt b/src/test_grabbag/cuesheet/CMakeLists.txt deleted file mode 100644 index 5f9a646c..00000000 --- a/src/test_grabbag/cuesheet/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_executable(test_cuesheet - main.c - $<$:../../../include/share/win_utf8_io.h> - $<$:../../share/win_utf8_io/win_utf8_io.c>) -target_link_libraries(test_cuesheet FLAC grabbag) diff --git a/src/test_grabbag/cuesheet/Makefile.am b/src/test_grabbag/cuesheet/Makefile.am deleted file mode 100644 index 6b88be4b..00000000 --- a/src/test_grabbag/cuesheet/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -# test_cuesheet - Simple tester for cuesheet routines in grabbag -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - test_cuesheet.vcproj \ - test_cuesheet.vcxproj \ - test_cuesheet.vcxproj.filters - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -check_PROGRAMS = test_cuesheet -test_cuesheet_SOURCES = \ - main.c -test_cuesheet_LDADD = \ - $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/libFLAC/libFLAC.la - -CLEANFILES = test_cuesheet.exe diff --git a/src/test_grabbag/cuesheet/Makefile.lite b/src/test_grabbag/cuesheet/Makefile.lite deleted file mode 100644 index e66d10b6..00000000 --- a/src/test_grabbag/cuesheet/Makefile.lite +++ /dev/null @@ -1,43 +0,0 @@ -# test_cuesheet - Simple tester for cuesheet routines in grabbag -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = test_cuesheet - -INCLUDES = -I./include -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lgrabbag -lreplaygain_analysis -lFLAC $(OGG_LIBS) -lm -endif - -SRCS_C = \ - main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/test_grabbag/cuesheet/main.c b/src/test_grabbag/cuesheet/main.c deleted file mode 100644 index 433d11a6..00000000 --- a/src/test_grabbag/cuesheet/main.c +++ /dev/null @@ -1,147 +0,0 @@ -/* test_cuesheet - Simple tester for cuesheet routines in grabbag - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include "FLAC/assert.h" -#include "FLAC/metadata.h" -#include "share/grabbag.h" - -static int do_cuesheet(const char *infilename, uint32_t sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset) -{ - FILE *fin, *fout; - const char *error_message, *tmpfilenamebase; - char tmpfilename[4096]; - uint32_t last_line_read; - FLAC__StreamMetadata *cuesheet; - - FLAC__ASSERT(strlen(infilename) + 2 < sizeof(tmpfilename)); - - /* - * pass 1 - */ - if(0 == strcmp(infilename, "-")) { - fin = stdin; - } - else if(0 == (fin = flac_fopen(infilename, "r"))) { - fprintf(stderr, "can't open file %s for reading: %s\n", infilename, strerror(errno)); - return 255; - } - if(0 != (cuesheet = grabbag__cuesheet_parse(fin, &error_message, &last_line_read, sample_rate, is_cdda, lead_out_offset))) { - if(fin != stdin) - fclose(fin); - } - else { - printf("pass1: parse error, line %u: \"%s\"\n", last_line_read, error_message); - if(fin != stdin) - fclose(fin); - return 1; - } - if(!FLAC__metadata_object_cuesheet_is_legal(cuesheet, is_cdda, &error_message)) { - printf("pass1: illegal cuesheet: \"%s\"\n", error_message); - FLAC__metadata_object_delete(cuesheet); - return 1; - } - - tmpfilenamebase = strstr(infilename, "cuesheets/"); - tmpfilenamebase = tmpfilenamebase == NULL ? infilename : tmpfilenamebase; - - flac_snprintf(tmpfilename, sizeof (tmpfilename), "%s.1", tmpfilenamebase); - if(0 == (fout = flac_fopen(tmpfilename, "w"))) { - fprintf(stderr, "can't open file %s for writing: %s\n", tmpfilename, strerror(errno)); - FLAC__metadata_object_delete(cuesheet); - return 255; - } - grabbag__cuesheet_emit(fout, cuesheet, "\"dummy.wav\" WAVE"); - FLAC__metadata_object_delete(cuesheet); - fclose(fout); - - /* - * pass 2 - */ - if(0 == (fin = flac_fopen(tmpfilename, "r"))) { - fprintf(stderr, "can't open file %s for reading: %s\n", tmpfilename, strerror(errno)); - return 255; - } - if(0 != (cuesheet = grabbag__cuesheet_parse(fin, &error_message, &last_line_read, sample_rate, is_cdda, lead_out_offset))) { - if(fin != stdin) - fclose(fin); - } - else { - printf("pass2: parse error, line %u: \"%s\"\n", last_line_read, error_message); - if(fin != stdin) - fclose(fin); - return 1; - } - if(!FLAC__metadata_object_cuesheet_is_legal(cuesheet, is_cdda, &error_message)) { - printf("pass2: illegal cuesheet: \"%s\"\n", error_message); - FLAC__metadata_object_delete(cuesheet); - return 1; - } - flac_snprintf(tmpfilename, sizeof (tmpfilename), "%s.2", tmpfilenamebase); - if(0 == (fout = flac_fopen(tmpfilename, "w"))) { - fprintf(stderr, "can't open file %s for writing: %s\n", tmpfilename, strerror(errno)); - FLAC__metadata_object_delete(cuesheet); - return 255; - } - grabbag__cuesheet_emit(fout, cuesheet, "\"dummy.wav\" WAVE"); - FLAC__metadata_object_delete(cuesheet); - fclose(fout); - - return 0; -} - -int main(int argc, char *argv[]) -{ - FLAC__uint64 lead_out_offset; - uint32_t sample_rate = 48000; - FLAC__bool is_cdda = false; - const char *usage = "usage: test_cuesheet cuesheet_file lead_out_offset [ [ sample_rate ] cdda ]\n"; - - if(argc > 1 && 0 == strcmp(argv[1], "-h")) { - puts(usage); - return 0; - } - - if(argc < 3 || argc > 5) { - fputs(usage, stderr); - return 255; - } - - lead_out_offset = (FLAC__uint64)strtoul(argv[2], 0, 10); - if(argc >= 4) { - sample_rate = (uint32_t)atoi(argv[3]); - if(argc >= 5) { - if(0 == strcmp(argv[4], "cdda")) - is_cdda = true; - else { - fputs(usage, stderr); - return 255; - } - } - } - - return do_cuesheet(argv[1], sample_rate, is_cdda, lead_out_offset); -} diff --git a/src/test_grabbag/cuesheet/test_cuesheet.vcproj b/src/test_grabbag/cuesheet/test_cuesheet.vcproj deleted file mode 100644 index cf0f4d9d..00000000 --- a/src/test_grabbag/cuesheet/test_cuesheet.vcproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test_grabbag/cuesheet/test_cuesheet.vcxproj b/src/test_grabbag/cuesheet/test_cuesheet.vcxproj deleted file mode 100644 index 301fa154..00000000 --- a/src/test_grabbag/cuesheet/test_cuesheet.vcxproj +++ /dev/null @@ -1,178 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc8b-c215-11db-8314-0800200c9a66} - test_cuesheet - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - - - {4cefbc81-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/test_grabbag/cuesheet/test_cuesheet.vcxproj.filters b/src/test_grabbag/cuesheet/test_cuesheet.vcxproj.filters deleted file mode 100644 index 5c9040b8..00000000 --- a/src/test_grabbag/cuesheet/test_cuesheet.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/src/test_grabbag/picture/CMakeLists.txt b/src/test_grabbag/picture/CMakeLists.txt deleted file mode 100644 index 77f1a388..00000000 --- a/src/test_grabbag/picture/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_executable(test_picture - main.c - $<$:../../../include/share/win_utf8_io.h> - $<$:../../share/win_utf8_io/win_utf8_io.c>) -target_link_libraries(test_picture FLAC grabbag) diff --git a/src/test_grabbag/picture/Makefile.am b/src/test_grabbag/picture/Makefile.am deleted file mode 100644 index 36b79f84..00000000 --- a/src/test_grabbag/picture/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -# test_picture - Simple tester for picture routines in grabbag -# Copyright (C) 2006-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - test_picture.vcproj \ - test_picture.vcxproj \ - test_picture.vcxproj.filters - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -check_PROGRAMS = test_picture -test_picture_SOURCES = \ - main.c - -if OS_IS_WINDOWS -win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la -endif - -test_picture_LDADD = \ - $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/libFLAC/libFLAC.la \ - $(win_utf8_lib) - -CLEANFILES = test_picture.exe diff --git a/src/test_grabbag/picture/Makefile.lite b/src/test_grabbag/picture/Makefile.lite deleted file mode 100644 index 2844923e..00000000 --- a/src/test_grabbag/picture/Makefile.lite +++ /dev/null @@ -1,47 +0,0 @@ -# test_picture - Simple tester for picture routines in grabbag -# Copyright (C) 2006-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = test_picture - -INCLUDES = -I./include -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else -ifeq ($(findstring Windows,$(OS)),Windows) - LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -lwin_utf8_io $(OGG_LIBS) -lm -else - LIBS = -lgrabbag -lreplaygain_analysis -lFLAC $(OGG_LIBS) -lm -endif -endif - -SRCS_C = \ - main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/test_grabbag/picture/main.c b/src/test_grabbag/picture/main.c deleted file mode 100644 index df914098..00000000 --- a/src/test_grabbag/picture/main.c +++ /dev/null @@ -1,222 +0,0 @@ -/* test_picture - Simple tester for picture routines in grabbag - * Copyright (C) 2006-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include "FLAC/assert.h" -#include "share/grabbag.h" - -typedef struct { - const char *path; - const char *mime_type; - const char *description; - FLAC__uint32 width; - FLAC__uint32 height; - FLAC__uint32 depth; - FLAC__uint32 colors; - FLAC__StreamMetadata_Picture_Type type; -} PictureFile; - -PictureFile picturefiles[] = { - { "0.gif", "image/gif" , "", 24, 24, 24, 2, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "1.gif", "image/gif" , "", 12, 8, 24, 256, FLAC__STREAM_METADATA_PICTURE_TYPE_BACK_COVER }, - { "2.gif", "image/gif" , "", 16, 14, 24, 128, FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER }, - { "0.jpg", "image/jpeg", "", 30, 20, 8, 0, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "4.jpg", "image/jpeg", "", 31, 47, 24, 0, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "0.png", "image/png" , "", 30, 20, 8, 0, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "1.png", "image/png" , "", 30, 20, 8, 0, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "2.png", "image/png" , "", 30, 20, 24, 7, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "3.png", "image/png" , "", 30, 20, 24, 7, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "4.png", "image/png" , "", 31, 47, 24, 0, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "5.png", "image/png" , "", 31, 47, 24, 0, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "6.png", "image/png" , "", 31, 47, 24, 23, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "7.png", "image/png" , "", 31, 47, 24, 23, FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER }, - { "8.png", "image/png" , "", 32, 32, 32, 0, 999 } -}; - -static FLAC__bool debug_ = false; - -static FLAC__bool failed_(const char *msg) -{ - if(msg) - printf("FAILED, %s\n", msg); - else - printf("FAILED\n"); - - return false; -} - -static FLAC__bool test_one_picture(const char *prefix, const PictureFile *pf, const PictureResolution * res, FLAC__bool fn_only) -{ - FLAC__StreamMetadata *obj; - const char *error; - char s[4096]; - if(fn_only) - flac_snprintf(s, sizeof(s), "pictures/%s", pf->path); - else if (res == NULL) - flac_snprintf(s, sizeof(s), "%u|%s|%s||pictures/%s", (uint32_t)pf->type, pf->mime_type, pf->description, pf->path); - else - flac_snprintf(s, sizeof(s), "%u|%s|%s|%dx%dx%d/%d|pictures/%s", (uint32_t)pf->type, pf->mime_type, pf->description, res->width, res->height, res->depth, res->colors, pf->path); - - printf("testing grabbag__picture_parse_specification(\"%s\")... ", s); - - flac_snprintf(s, sizeof(s), "%s/%s", prefix, pf->path); - if((obj = grabbag__picture_from_specification(fn_only? FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER : pf->type, pf->mime_type, pf->description, res, s, &error)) == 0) - return failed_(error); - if(debug_) { - printf("\ntype=%u (%s)\nmime_type=%s\ndescription=%s\nwidth=%u\nheight=%u\ndepth=%u\ncolors=%u\ndata_length=%u\n", - obj->data.picture.type, - obj->data.picture.type < FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED? - FLAC__StreamMetadata_Picture_TypeString[obj->data.picture.type] : "UNDEFINED", - obj->data.picture.mime_type, - obj->data.picture.description, - obj->data.picture.width, - obj->data.picture.height, - obj->data.picture.depth, - obj->data.picture.colors, - obj->data.picture.data_length - ); - } - if(obj->data.picture.type != (fn_only? FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER : pf->type)) - return failed_("picture type mismatch"); - if(strcmp(obj->data.picture.mime_type, pf->mime_type)) - return failed_("picture MIME type mismatch"); - if(strcmp((const char *)obj->data.picture.description, (const char *)pf->description)) - return failed_("picture description mismatch"); - if(obj->data.picture.width != pf->width) - return failed_("picture width mismatch"); - if(obj->data.picture.height != pf->height) - return failed_("picture height mismatch"); - if(obj->data.picture.depth != pf->depth) - return failed_("picture depth mismatch"); - if(obj->data.picture.colors != pf->colors) - return failed_("picture colors mismatch"); - printf("OK\n"); - FLAC__metadata_object_delete(obj); - return true; -} - -static FLAC__bool do_picture(const char *prefix) -{ - FLAC__StreamMetadata *obj; - PictureResolution res; - const char *error; - size_t i; - - printf("\n+++ grabbag unit test: picture\n\n"); - - /* invalid spec: no filename */ - printf("testing grabbag__picture_parse_specification(\"\")... "); - if(0 != (obj = grabbag__picture_parse_specification("", &error))) - return failed_("expected error, got object"); - printf("OK (failed as expected, error: %s)\n", error); - - /* invalid spec: no filename */ - printf("testing grabbag__picture_parse_specification(\"||||\")... "); - if(0 != (obj = grabbag__picture_parse_specification("||||", &error))) - return failed_("expected error, got object"); - printf("OK (failed as expected: %s)\n", error); - - /* invalid spec: no filename */ - printf("testing grabbag__picture_parse_specification(\"|image/gif|||\")... "); - if(0 != (obj = grabbag__picture_parse_specification("|image/gif|||", &error))) - return failed_("expected error, got object"); - printf("OK (failed as expected: %s)\n", error); - - /* invalid spec: bad resolution */ - printf("testing grabbag__picture_parse_specification(\"|image/gif|desc|320|0.gif\")... "); - if(0 != (obj = grabbag__picture_parse_specification("|image/gif|desc|320|0.gif", &error))) - return failed_("expected error, got object"); - printf("OK (failed as expected: %s)\n", error); - - /* invalid spec: bad resolution */ - printf("testing grabbag__picture_parse_specification(\"|image/gif|desc|320x240|0.gif\")... "); - if(0 != (obj = grabbag__picture_parse_specification("|image/gif|desc|320x240|0.gif", &error))) - return failed_("expected error, got object"); - printf("OK (failed as expected: %s)\n", error); - - /* invalid spec: no filename */ - printf("testing grabbag__picture_parse_specification(\"|image/gif|desc|320x240x9|\")... "); - if(0 != (obj = grabbag__picture_parse_specification("|image/gif|desc|320x240x9|", &error))) - return failed_("expected error, got object"); - printf("OK (failed as expected: %s)\n", error); - - /* invalid spec: #colors exceeds color depth */ - printf("testing grabbag__picture_parse_specification(\"|image/gif|desc|320x240x9/2345|0.gif\")... "); - if(0 != (obj = grabbag__picture_parse_specification("|image/gif|desc|320x240x9/2345|0.gif", &error))) - return failed_("expected error, got object"); - printf("OK (failed as expected: %s)\n", error); - - /* invalid spec: standard icon has to be 32x32 PNG */ - printf("testing grabbag__picture_parse_specification(\"1|-->|desc|32x24x9|0.gif\")... "); - if(0 != (obj = grabbag__picture_parse_specification("1|-->|desc|32x24x9|0.gif", &error))) - return failed_("expected error, got object"); - printf("OK (failed as expected: %s)\n", error); - - /* invalid spec: need resolution for linked URL */ - printf("testing grabbag__picture_parse_specification(\"|-->|desc||http://blah.blah.blah/z.gif\")... "); - if(0 != (obj = grabbag__picture_parse_specification("|-->|desc||http://blah.blah.blah/z.gif", &error))) - return failed_("expected error, got object"); - printf("OK (failed as expected: %s)\n", error); - - printf("testing grabbag__picture_parse_specification(\"|-->|desc|320x240x9|http://blah.blah.blah/z.gif\")... "); - if(0 == (obj = grabbag__picture_parse_specification("|-->|desc|320x240x9|http://blah.blah.blah/z.gif", &error))) - return failed_(error); - printf("OK\n"); - FLAC__metadata_object_delete(obj); - - /* test automatic parsing of picture files from only the file name */ - for(i = 0; i < sizeof(picturefiles)/sizeof(picturefiles[0]); i++) - if(!test_one_picture(prefix, picturefiles+i, NULL, /*fn_only=*/true)) - return false; - - /* test automatic parsing of picture files to get resolution/color info */ - for(i = 0; i < sizeof(picturefiles)/sizeof(picturefiles[0]); i++) - if(!test_one_picture(prefix, picturefiles+i, NULL, /*fn_only=*/false)) - return false; - - res.width = picturefiles[0].width = 320; - res.height = picturefiles[0].height = 240; - res.depth = picturefiles[0].depth = 3; - res.colors = picturefiles[0].colors = 2; - if(!test_one_picture(prefix, picturefiles+0, &res, /*fn_only=*/false)) - return false; - - return true; -} - -int main(int argc, char *argv[]) -{ - const char *usage = "usage: test_pictures path_prefix\n"; - - if(argc > 1 && 0 == strcmp(argv[1], "-h")) { - puts(usage); - return 0; - } - - if(argc != 2) { - fputs(usage, stderr); - return 255; - } - - return do_picture(argv[1])? 0 : 1; -} diff --git a/src/test_grabbag/picture/test_picture.vcproj b/src/test_grabbag/picture/test_picture.vcproj deleted file mode 100644 index 9ea05727..00000000 --- a/src/test_grabbag/picture/test_picture.vcproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test_grabbag/picture/test_picture.vcxproj b/src/test_grabbag/picture/test_picture.vcxproj deleted file mode 100644 index 588c19e6..00000000 --- a/src/test_grabbag/picture/test_picture.vcxproj +++ /dev/null @@ -1,178 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc8f-c215-11db-8314-0800200c9a66} - test_picture - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - - - {4cefbc81-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/test_grabbag/picture/test_picture.vcxproj.filters b/src/test_grabbag/picture/test_picture.vcxproj.filters deleted file mode 100644 index 5c9040b8..00000000 --- a/src/test_grabbag/picture/test_picture.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/src/test_libFLAC++/CMakeLists.txt b/src/test_libFLAC++/CMakeLists.txt deleted file mode 100644 index 2fa7b1e7..00000000 --- a/src/test_libFLAC++/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_executable(test_libFLAC++ - decoders.cpp - encoders.cpp - main.cpp - metadata.cpp - metadata_manip.cpp - metadata_object.cpp - $<$:../../include/share/win_utf8_io.h> - $<$:../share/win_utf8_io/win_utf8_io.c>) -target_link_libraries(test_libFLAC++ FLAC++ test_libs_common grabbag) diff --git a/src/test_libFLAC++/Makefile.am b/src/test_libFLAC++/Makefile.am deleted file mode 100644 index 3183be73..00000000 --- a/src/test_libFLAC++/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -# test_libFLAC++ - Unit tester for libFLAC++ -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - test_libFLAC++.vcproj \ - test_libFLAC++.vcxproj \ - test_libFLAC++.vcxproj.filters - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -check_PROGRAMS = test_libFLAC++ - -if OS_IS_WINDOWS -win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la -endif - -test_libFLAC___LDADD = \ - $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/test_libs_common/libtest_libs_common.la \ - $(top_builddir)/src/libFLAC++/libFLAC++.la \ - $(top_builddir)/src/libFLAC/libFLAC.la \ - $(win_utf8_lib) \ - @OGG_LIBS@ \ - -lm - -test_libFLAC___SOURCES = \ - decoders.cpp \ - encoders.cpp \ - main.cpp \ - metadata.cpp \ - metadata_manip.cpp \ - metadata_object.cpp \ - decoders.h \ - encoders.h \ - metadata.h - -CLEANFILES = test_libFLAC++.exe diff --git a/src/test_libFLAC++/Makefile.lite b/src/test_libFLAC++/Makefile.lite deleted file mode 100644 index dd67788d..00000000 --- a/src/test_libFLAC++/Makefile.lite +++ /dev/null @@ -1,54 +0,0 @@ -# test_libFLAC++ - Unit tester for libFLAC++ -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = test_libFLAC++ - -INCLUDES = -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else -ifeq ($(findstring Windows,$(OS)),Windows) - LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC++ -lFLAC -lwin_utf8_io $(OGG_LIBS) -lm -else - LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC++ -lFLAC $(OGG_LIBS) -lm -endif -endif - -SRCS_CPP = \ - decoders.cpp \ - encoders.cpp \ - main.cpp \ - metadata.cpp \ - metadata_manip.cpp \ - metadata_object.cpp - -include $(topdir)/build/exe.mk - -LINK = $(CCC) $(LINKAGE) - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/test_libFLAC++/decoders.cpp b/src/test_libFLAC++/decoders.cpp deleted file mode 100644 index a3633092..00000000 --- a/src/test_libFLAC++/decoders.cpp +++ /dev/null @@ -1,1183 +0,0 @@ -/* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include "decoders.h" -#include "FLAC/assert.h" -#include "FLAC/metadata.h" // for ::FLAC__metadata_object_is_equal() -#include "FLAC++/decoder.h" -#include "share/grabbag.h" -#include "share/compat.h" -extern "C" { -#include "test_libs_common/file_utils_flac.h" -#include "test_libs_common/metadata_utils.h" -} - -#ifdef _MSC_VER -// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning) -#pragma warning ( disable : 4800 ) -#endif - -typedef enum { - LAYER_STREAM = 0, /* FLAC__stream_decoder_init_stream() without seeking */ - LAYER_SEEKABLE_STREAM, /* FLAC__stream_decoder_init_stream() with seeking */ - LAYER_FILE, /* FLAC__stream_decoder_init_FILE() */ - LAYER_FILENAME /* FLAC__stream_decoder_init_file() */ -} Layer; - -static const char * const LayerString[] = { - "Stream", - "Seekable Stream", - "FILE*", - "Filename" -}; - -static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, picture_, unknown_; -static ::FLAC__StreamMetadata *expected_metadata_sequence_[9]; -static uint32_t num_expected_; -static FLAC__off_t flacfilesize_; - -static const char *flacfilename(bool is_ogg) -{ - return is_ogg? "metadata.oga" : "metadata.flac"; -} - -static bool die_(const char *msg) -{ - printf("ERROR: %s\n", msg); - return false; -} - -static FLAC__bool die_s_(const char *msg, const FLAC::Decoder::Stream *decoder) -{ - FLAC::Decoder::Stream::State state = decoder->get_state(); - - if(msg) - printf("FAILED, %s", msg); - else - printf("FAILED"); - - printf(", state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); - - return false; -} - -static void init_metadata_blocks_() -{ - mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &picture_, &unknown_); -} - -static void free_metadata_blocks_() -{ - mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &picture_, &unknown_); -} - -static bool generate_file_(FLAC__bool is_ogg) -{ - printf("\n\ngenerating %sFLAC file for decoder tests...\n", is_ogg? "Ogg ":""); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - /* WATCHOUT: for Ogg FLAC the encoder should move the VORBIS_COMMENT block to the front, right after STREAMINFO */ - - if(!file_utils__generate_flacfile(is_ogg, flacfilename(is_ogg), &flacfilesize_, 512 * 1024, &streaminfo_, expected_metadata_sequence_, num_expected_)) - return die_("creating the encoded file"); - - return true; -} - - -class DecoderCommon { -public: - Layer layer_; - uint32_t current_metadata_number_; - bool ignore_errors_; - bool error_occurred_; - - DecoderCommon(Layer layer): layer_(layer), current_metadata_number_(0), ignore_errors_(false), error_occurred_(false) { } - virtual ~DecoderCommon(void) { } - ::FLAC__StreamDecoderWriteStatus common_write_callback_(const ::FLAC__Frame *frame); - void common_metadata_callback_(const ::FLAC__StreamMetadata *metadata); - void common_error_callback_(::FLAC__StreamDecoderErrorStatus status); -}; - -::FLAC__StreamDecoderWriteStatus DecoderCommon::common_write_callback_(const ::FLAC__Frame *frame) -{ - if(error_occurred_) - return ::FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - - if( - (frame->header.number_type == ::FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER && frame->header.number.frame_number == 0) || - (frame->header.number_type == ::FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER && frame->header.number.sample_number == 0) - ) { - printf("content... "); - fflush(stdout); - } - - return ::FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -void DecoderCommon::common_metadata_callback_(const ::FLAC__StreamMetadata *metadata) -{ - if(error_occurred_) - return; - - printf("%u... ", current_metadata_number_); - fflush(stdout); - - if(current_metadata_number_ >= num_expected_) { - (void)die_("got more metadata blocks than expected"); - error_occurred_ = true; - } - else { - if(!::FLAC__metadata_object_is_equal(expected_metadata_sequence_[current_metadata_number_], metadata)) { - (void)die_("metadata block mismatch"); - error_occurred_ = true; - } - } - current_metadata_number_++; -} - -void DecoderCommon::common_error_callback_(::FLAC__StreamDecoderErrorStatus status) -{ - if(!ignore_errors_) { - printf("ERROR: got error callback: err = %u (%s)\n", (uint32_t)status, ::FLAC__StreamDecoderErrorStatusString[status]); - error_occurred_ = true; - } -} - -class StreamDecoder : public FLAC::Decoder::Stream, public DecoderCommon { -public: - FILE *file_; - - StreamDecoder(Layer layer): FLAC::Decoder::Stream(), DecoderCommon(layer), file_(0) { } - ~StreamDecoder() { } - - // from FLAC::Decoder::Stream - ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes); - ::FLAC__StreamDecoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset); - ::FLAC__StreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset); - ::FLAC__StreamDecoderLengthStatus length_callback(FLAC__uint64 *stream_length); - bool eof_callback(); - ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]); - void metadata_callback(const ::FLAC__StreamMetadata *metadata); - void error_callback(::FLAC__StreamDecoderErrorStatus status); - - bool test_respond(bool is_ogg); -private: - StreamDecoder(const StreamDecoder&); - StreamDecoder&operator=(const StreamDecoder&); -}; - -::FLAC__StreamDecoderReadStatus StreamDecoder::read_callback(FLAC__byte buffer[], size_t *bytes) -{ - const size_t requested_bytes = *bytes; - - if(error_occurred_) - return ::FLAC__STREAM_DECODER_READ_STATUS_ABORT; - - if(feof(file_)) { - *bytes = 0; - return ::FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - } - else if(requested_bytes > 0) { - *bytes = ::fread(buffer, 1, requested_bytes, file_); - if(*bytes == 0) { - if(feof(file_)) - return ::FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - else - return ::FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; - } - else { - return ::FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; - } - } - else - return ::FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */ -} - -::FLAC__StreamDecoderSeekStatus StreamDecoder::seek_callback(FLAC__uint64 absolute_byte_offset) -{ - if(layer_ == LAYER_STREAM) - return ::FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; - - if(error_occurred_) - return ::FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - - if(fseeko(file_, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0) { - error_occurred_ = true; - return ::FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - } - - return ::FLAC__STREAM_DECODER_SEEK_STATUS_OK; -} - -::FLAC__StreamDecoderTellStatus StreamDecoder::tell_callback(FLAC__uint64 *absolute_byte_offset) -{ - if(layer_ == LAYER_STREAM) - return ::FLAC__STREAM_DECODER_TELL_STATUS_UNSUPPORTED; - - if(error_occurred_) - return ::FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - - FLAC__off_t offset = ftello(file_); - *absolute_byte_offset = (FLAC__uint64)offset; - - if(offset < 0) { - error_occurred_ = true; - return ::FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - } - - return ::FLAC__STREAM_DECODER_TELL_STATUS_OK; -} - -::FLAC__StreamDecoderLengthStatus StreamDecoder::length_callback(FLAC__uint64 *stream_length) -{ - if(layer_ == LAYER_STREAM) - return ::FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED; - - if(error_occurred_) - return ::FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; - - *stream_length = (FLAC__uint64)flacfilesize_; - return ::FLAC__STREAM_DECODER_LENGTH_STATUS_OK; -} - -bool StreamDecoder::eof_callback() -{ - if(layer_ == LAYER_STREAM) - return false; - - if(error_occurred_) - return true; - - return (bool)feof(file_); -} - -::FLAC__StreamDecoderWriteStatus StreamDecoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) -{ - (void)buffer; - - return common_write_callback_(frame); -} - -void StreamDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) -{ - common_metadata_callback_(metadata); -} - -void StreamDecoder::error_callback(::FLAC__StreamDecoderErrorStatus status) -{ - common_error_callback_(status); -} - -bool StreamDecoder::test_respond(bool is_ogg) -{ - ::FLAC__StreamDecoderInitStatus init_status; - - if(!set_md5_checking(true)) { - printf("FAILED at set_md5_checking(), returned false\n"); - return false; - } - - printf("testing init%s()... ", is_ogg? "_ogg":""); - init_status = is_ogg? init_ogg() : init(); - if(init_status != ::FLAC__STREAM_DECODER_INIT_STATUS_OK) - return die_s_(0, this); - printf("OK\n"); - - current_metadata_number_ = 0; - - if(fseeko(file_, 0, SEEK_SET) < 0) { - printf("FAILED rewinding input, errno = %d\n", errno); - return false; - } - - printf("testing process_until_end_of_stream()... "); - if(!process_until_end_of_stream()) { - State state = get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); - return false; - } - printf("OK\n"); - - printf("testing finish()... "); - if(!finish()) { - State state = get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); - return false; - } - printf("OK\n"); - - return true; -} - -class FileDecoder : public FLAC::Decoder::File, public DecoderCommon { -public: - FileDecoder(Layer layer): FLAC::Decoder::File(), DecoderCommon(layer) { } - ~FileDecoder() { } - - // from FLAC::Decoder::Stream - ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]); - void metadata_callback(const ::FLAC__StreamMetadata *metadata); - void error_callback(::FLAC__StreamDecoderErrorStatus status); - - bool test_respond(bool is_ogg); -}; - -::FLAC__StreamDecoderWriteStatus FileDecoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) -{ - (void)buffer; - return common_write_callback_(frame); -} - -void FileDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) -{ - common_metadata_callback_(metadata); -} - -void FileDecoder::error_callback(::FLAC__StreamDecoderErrorStatus status) -{ - common_error_callback_(status); -} - -bool FileDecoder::test_respond(bool is_ogg) -{ - ::FLAC__StreamDecoderInitStatus init_status; - - if(!set_md5_checking(true)) { - printf("FAILED at set_md5_checking(), returned false\n"); - return false; - } - - switch(layer_) { - case LAYER_FILE: - { - printf("opening %sFLAC file... ", is_ogg? "Ogg ":""); - FILE *file = ::flac_fopen(flacfilename(is_ogg), "rb"); - if(0 == file) { - printf("ERROR (%s)\n", strerror(errno)); - return false; - } - printf("OK\n"); - - printf("testing init%s()... ", is_ogg? "_ogg":""); - init_status = is_ogg? init_ogg(file) : init(file); - } - break; - case LAYER_FILENAME: - printf("testing init%s()... ", is_ogg? "_ogg":""); - init_status = is_ogg? init_ogg(flacfilename(is_ogg)) : init(flacfilename(is_ogg)); - break; - default: - die_("internal error 001"); - return false; - } - if(init_status != ::FLAC__STREAM_DECODER_INIT_STATUS_OK) - return die_s_(0, this); - printf("OK\n"); - - current_metadata_number_ = 0; - - printf("testing process_until_end_of_stream()... "); - if(!process_until_end_of_stream()) { - State state = get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); - return false; - } - printf("OK\n"); - - printf("testing finish()... "); - if(!finish()) { - State state = get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); - return false; - } - printf("OK\n"); - - return true; -} - - -static FLAC::Decoder::Stream *new_by_layer(Layer layer) -{ - if(layer < LAYER_FILE) - return new StreamDecoder(layer); - else - return new FileDecoder(layer); -} - -static bool test_stream_decoder(Layer layer, bool is_ogg) -{ - FLAC::Decoder::Stream *decoder; - ::FLAC__StreamDecoderInitStatus init_status; - bool expect; - - printf("\n+++ libFLAC++ unit test: FLAC::Decoder::%s (layer: %s, format: %s)\n\n", layer delete - // - printf("allocating decoder instance... "); - decoder = new_by_layer(layer); - if(0 == decoder) { - printf("FAILED, new returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing is_valid()... "); - if(!decoder->is_valid()) { - printf("FAILED, returned false\n"); - delete decoder; - return false; - } - printf("OK\n"); - - printf("freeing decoder instance... "); - delete decoder; - printf("OK\n"); - - // - // test new -> init -> delete - // - printf("allocating decoder instance... "); - decoder = new_by_layer(layer); - if(0 == decoder) { - printf("FAILED, new returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing is_valid()... "); - if(!decoder->is_valid()) { - printf("FAILED, returned false\n"); - delete decoder; - return false; - } - printf("OK\n"); - - printf("testing init%s()... ", is_ogg? "_ogg":""); - switch(layer) { - case LAYER_STREAM: - case LAYER_SEEKABLE_STREAM: - dynamic_cast(decoder)->file_ = stdin; - init_status = is_ogg? decoder->init_ogg() : decoder->init(); - break; - case LAYER_FILE: - init_status = is_ogg? - dynamic_cast(decoder)->init_ogg(stdin) : - dynamic_cast(decoder)->init(stdin); - break; - case LAYER_FILENAME: - init_status = is_ogg? - dynamic_cast(decoder)->init_ogg(flacfilename(is_ogg)) : - dynamic_cast(decoder)->init(flacfilename(is_ogg)); - break; - default: - die_("internal error 006"); - delete decoder; - return false; - } - if(init_status != ::FLAC__STREAM_DECODER_INIT_STATUS_OK) - return die_s_(0, decoder); - printf("OK\n"); - - printf("freeing decoder instance... "); - delete decoder; - printf("OK\n"); - - // - // test normal usage - // - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - - printf("allocating decoder instance... "); - decoder = new_by_layer(layer); - if(0 == decoder) { - printf("FAILED, new returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing is_valid()... "); - if(!decoder->is_valid()) { - printf("FAILED, returned false\n"); - delete decoder; - return false; - } - printf("OK\n"); - - if(is_ogg) { - printf("testing set_ogg_serial_number()... "); - if(!decoder->set_ogg_serial_number(file_utils__ogg_serial_number)) - return die_s_("returned false", decoder); - printf("OK\n"); - } - - if(!decoder->set_md5_checking(true)) { - printf("FAILED at set_md5_checking(), returned false\n"); - return false; - } - - switch(layer) { - case LAYER_STREAM: - case LAYER_SEEKABLE_STREAM: - printf("opening %sFLAC file... ", is_ogg? "Ogg ":""); - dynamic_cast(decoder)->file_ = ::flac_fopen(flacfilename(is_ogg), "rb"); - if(0 == dynamic_cast(decoder)->file_) { - printf("ERROR (%s)\n", strerror(errno)); - return false; - } - printf("OK\n"); - - printf("testing init%s()... ", is_ogg? "_ogg":""); - init_status = is_ogg? decoder->init_ogg() : decoder->init(); - break; - case LAYER_FILE: - { - printf("opening FLAC file... "); - FILE *file = ::flac_fopen(flacfilename(is_ogg), "rb"); - if(0 == file) { - printf("ERROR (%s)\n", strerror(errno)); - return false; - } - printf("OK\n"); - - printf("testing init%s()... ", is_ogg? "_ogg":""); - init_status = is_ogg? - dynamic_cast(decoder)->init_ogg(file) : - dynamic_cast(decoder)->init(file); - } - break; - case LAYER_FILENAME: - printf("testing init%s()... ", is_ogg? "_ogg":""); - init_status = is_ogg? - dynamic_cast(decoder)->init_ogg(flacfilename(is_ogg)) : - dynamic_cast(decoder)->init(flacfilename(is_ogg)); - break; - default: - die_("internal error 009"); - return false; - } - if(init_status != ::FLAC__STREAM_DECODER_INIT_STATUS_OK) - return die_s_(0, decoder); - printf("OK\n"); - - printf("testing get_state()... "); - FLAC::Decoder::Stream::State state = decoder->get_state(); - printf("returned state = %u (%s)... OK\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); - - dynamic_cast(decoder)->current_metadata_number_ = 0; - dynamic_cast(decoder)->ignore_errors_ = false; - dynamic_cast(decoder)->error_occurred_ = false; - - printf("testing get_md5_checking()... "); - if(!decoder->get_md5_checking()) { - printf("FAILED, returned false, expected true\n"); - return false; - } - printf("OK\n"); - - printf("testing process_until_end_of_metadata()... "); - if(!decoder->process_until_end_of_metadata()) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing process_single()... "); - if(!decoder->process_single()) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing skip_single_frame()... "); - if(!decoder->skip_single_frame()) - return die_s_("returned false", decoder); - printf("OK\n"); - - if(layer < LAYER_FILE) { - printf("testing flush()... "); - if(!decoder->flush()) - return die_s_("returned false", decoder); - printf("OK\n"); - - dynamic_cast(decoder)->ignore_errors_ = true; - printf("testing process_single()... "); - if(!decoder->process_single()) - return die_s_("returned false", decoder); - printf("OK\n"); - dynamic_cast(decoder)->ignore_errors_ = false; - } - - expect = (layer != LAYER_STREAM); - printf("testing seek_absolute()... "); - if(decoder->seek_absolute(0) != expect) - return die_s_(expect? "returned false" : "returned true", decoder); - printf("OK\n"); - - printf("testing process_until_end_of_stream()... "); - if(!decoder->process_until_end_of_stream()) - return die_s_("returned false", decoder); - printf("OK\n"); - - expect = (layer != LAYER_STREAM); - printf("testing seek_absolute()... "); - if(decoder->seek_absolute(0) != expect) - return die_s_(expect? "returned false" : "returned true", decoder); - printf("OK\n"); - - printf("testing get_channels()... "); - { - uint32_t channels = decoder->get_channels(); - if(channels != streaminfo_.data.stream_info.channels) { - printf("FAILED, returned %u, expected %u\n", channels, streaminfo_.data.stream_info.channels); - return false; - } - } - printf("OK\n"); - - printf("testing get_bits_per_sample()... "); - { - uint32_t bits_per_sample = decoder->get_bits_per_sample(); - if(bits_per_sample != streaminfo_.data.stream_info.bits_per_sample) { - printf("FAILED, returned %u, expected %u\n", bits_per_sample, streaminfo_.data.stream_info.bits_per_sample); - return false; - } - } - printf("OK\n"); - - printf("testing get_sample_rate()... "); - { - uint32_t sample_rate = decoder->get_sample_rate(); - if(sample_rate != streaminfo_.data.stream_info.sample_rate) { - printf("FAILED, returned %u, expected %u\n", sample_rate, streaminfo_.data.stream_info.sample_rate); - return false; - } - } - printf("OK\n"); - - printf("testing get_blocksize()... "); - { - uint32_t blocksize = decoder->get_blocksize(); - /* value could be anything since we're at the last block, so accept any reasonable answer */ - printf("returned %u... %s\n", blocksize, blocksize>0? "OK" : "FAILED"); - if(blocksize == 0) - return false; - } - - printf("testing get_channel_assignment()... "); - { - ::FLAC__ChannelAssignment ca = decoder->get_channel_assignment(); - printf("returned %u (%s)... OK\n", (uint32_t)ca, ::FLAC__ChannelAssignmentString[ca]); - } - - if(layer < LAYER_FILE) { - printf("testing reset()... "); - if(!decoder->reset()) - return die_s_("returned false", decoder); - printf("OK\n"); - - if(layer == LAYER_STREAM) { - /* after a reset() we have to rewind the input ourselves */ - printf("rewinding input... "); - if(fseeko(dynamic_cast(decoder)->file_, 0, SEEK_SET) < 0) { - printf("FAILED, errno = %d\n", errno); - return false; - } - printf("OK\n"); - } - - dynamic_cast(decoder)->current_metadata_number_ = 0; - - printf("testing process_until_end_of_stream()... "); - if(!decoder->process_until_end_of_stream()) - return die_s_("returned false", decoder); - printf("OK\n"); - } - - printf("testing finish()... "); - if(!decoder->finish()) { - state = decoder->get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); - return false; - } - printf("OK\n"); - - /* - * respond all - */ - - printf("testing set_metadata_respond_all()... "); - if(!decoder->set_metadata_respond_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * ignore all - */ - - printf("testing set_metadata_ignore_all()... "); - if(!decoder->set_metadata_ignore_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * respond all, ignore VORBIS_COMMENT - */ - - printf("testing set_metadata_respond_all()... "); - if(!decoder->set_metadata_respond_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_ignore(VORBIS_COMMENT)... "); - if(!decoder->set_metadata_ignore(FLAC__METADATA_TYPE_VORBIS_COMMENT)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * respond all, ignore APPLICATION - */ - - printf("testing set_metadata_respond_all()... "); - if(!decoder->set_metadata_respond_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_ignore(APPLICATION)... "); - if(!decoder->set_metadata_ignore(FLAC__METADATA_TYPE_APPLICATION)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * respond all, ignore APPLICATION id of app#1 - */ - - printf("testing set_metadata_respond_all()... "); - if(!decoder->set_metadata_respond_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_ignore_application(of app block #1)... "); - if(!decoder->set_metadata_ignore_application(application1_.data.application.id)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * respond all, ignore APPLICATION id of app#1 & app#2 - */ - - printf("testing set_metadata_respond_all()... "); - if(!decoder->set_metadata_respond_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_ignore_application(of app block #1)... "); - if(!decoder->set_metadata_ignore_application(application1_.data.application.id)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_ignore_application(of app block #2)... "); - if(!decoder->set_metadata_ignore_application(application2_.data.application.id)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * ignore all, respond VORBIS_COMMENT - */ - - printf("testing set_metadata_ignore_all()... "); - if(!decoder->set_metadata_ignore_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_respond(VORBIS_COMMENT)... "); - if(!decoder->set_metadata_respond(FLAC__METADATA_TYPE_VORBIS_COMMENT)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * ignore all, respond APPLICATION - */ - - printf("testing set_metadata_ignore_all()... "); - if(!decoder->set_metadata_ignore_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_respond(APPLICATION)... "); - if(!decoder->set_metadata_respond(FLAC__METADATA_TYPE_APPLICATION)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * ignore all, respond APPLICATION id of app#1 - */ - - printf("testing set_metadata_ignore_all()... "); - if(!decoder->set_metadata_ignore_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_respond_application(of app block #1)... "); - if(!decoder->set_metadata_respond_application(application1_.data.application.id)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &application1_; - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * ignore all, respond APPLICATION id of app#1 & app#2 - */ - - printf("testing set_metadata_ignore_all()... "); - if(!decoder->set_metadata_ignore_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_respond_application(of app block #1)... "); - if(!decoder->set_metadata_respond_application(application1_.data.application.id)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_respond_application(of app block #2)... "); - if(!decoder->set_metadata_respond_application(application2_.data.application.id)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * respond all, ignore APPLICATION, respond APPLICATION id of app#1 - */ - - printf("testing set_metadata_respond_all()... "); - if(!decoder->set_metadata_respond_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_ignore(APPLICATION)... "); - if(!decoder->set_metadata_ignore(FLAC__METADATA_TYPE_APPLICATION)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_respond_application(of app block #1)... "); - if(!decoder->set_metadata_respond_application(application1_.data.application.id)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - /* - * ignore all, respond APPLICATION, ignore APPLICATION id of app#1 - */ - - printf("testing set_metadata_ignore_all()... "); - if(!decoder->set_metadata_ignore_all()) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_respond(APPLICATION)... "); - if(!decoder->set_metadata_respond(FLAC__METADATA_TYPE_APPLICATION)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing set_metadata_ignore_application(of app block #1)... "); - if(!decoder->set_metadata_ignore_application(application1_.data.application.id)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &application2_; - - if(!(layer < LAYER_FILE? dynamic_cast(decoder)->test_respond(is_ogg) : dynamic_cast(decoder)->test_respond(is_ogg))) - return false; - - if(layer < LAYER_FILE) /* for LAYER_FILE, FLAC__stream_decoder_finish() closes the file */ - ::fclose(dynamic_cast(decoder)->file_); - - printf("freeing decoder instance... "); - delete decoder; - printf("OK\n"); - - printf("\nPASSED!\n"); - - return true; -} - -bool test_decoders() -{ - FLAC__bool is_ogg = false; - - while(1) { - init_metadata_blocks_(); - - if(!generate_file_(is_ogg)) - return false; - - if(!test_stream_decoder(LAYER_STREAM, is_ogg)) - return false; - - if(!test_stream_decoder(LAYER_SEEKABLE_STREAM, is_ogg)) - return false; - - if(!test_stream_decoder(LAYER_FILE, is_ogg)) - return false; - - if(!test_stream_decoder(LAYER_FILENAME, is_ogg)) - return false; - - (void) grabbag__file_remove_file(flacfilename(is_ogg)); - - free_metadata_blocks_(); - - if(!FLAC_API_SUPPORTS_OGG_FLAC || is_ogg) - break; - is_ogg = true; - } - - return true; -} diff --git a/src/test_libFLAC++/decoders.h b/src/test_libFLAC++/decoders.h deleted file mode 100644 index 39e1e833..00000000 --- a/src/test_libFLAC++/decoders.h +++ /dev/null @@ -1,25 +0,0 @@ -/* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLACPP_DECODERS_H -#define FLAC__TEST_LIBFLACPP_DECODERS_H - -bool test_decoders(); - -#endif diff --git a/src/test_libFLAC++/encoders.cpp b/src/test_libFLAC++/encoders.cpp deleted file mode 100644 index 306e3232..00000000 --- a/src/test_libFLAC++/encoders.cpp +++ /dev/null @@ -1,564 +0,0 @@ -/* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "encoders.h" -#include "FLAC/assert.h" -#include "FLAC++/encoder.h" -#include "share/grabbag.h" -extern "C" { -#include "test_libs_common/file_utils_flac.h" -#include "test_libs_common/metadata_utils.h" -} -#include -#include -#include -#include -#include "share/compat.h" - -#ifdef _MSC_VER -// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning) -#pragma warning ( disable : 4800 ) -#endif - -typedef enum { - LAYER_STREAM = 0, /* FLAC__stream_encoder_init_stream() without seeking */ - LAYER_SEEKABLE_STREAM, /* FLAC__stream_encoder_init_stream() with seeking */ - LAYER_FILE, /* FLAC__stream_encoder_init_FILE() */ - LAYER_FILENAME /* FLAC__stream_encoder_init_file() */ -} Layer; - -static const char * const LayerString[] = { - "Stream", - "Seekable Stream", - "FILE*", - "Filename" -}; - -static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, picture_, unknown_; -static ::FLAC__StreamMetadata *metadata_sequence_[] = { &vorbiscomment_, &padding_, &seektable_, &application1_, &application2_, &cuesheet_, &picture_, &unknown_ }; -static const uint32_t num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]); - -static const char *flacfilename(bool is_ogg) -{ - return is_ogg? "metadata.oga" : "metadata.flac"; -} - -static bool die_(const char *msg) -{ - printf("ERROR: %s\n", msg); - return false; -} - -static bool die_s_(const char *msg, const FLAC::Encoder::Stream *encoder) -{ - FLAC::Encoder::Stream::State state = encoder->get_state(); - - if(msg) - printf("FAILED, %s", msg); - else - printf("FAILED"); - - printf(", state = %u (%s)\n", (uint32_t)((::FLAC__StreamEncoderState)state), state.as_cstring()); - if(state == ::FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { - FLAC::Decoder::Stream::State dstate = encoder->get_verify_decoder_state(); - printf(" verify decoder state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); - } - - return false; -} - -static void init_metadata_blocks_() -{ - mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &picture_, &unknown_); -} - -static void free_metadata_blocks_() -{ - mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &picture_, &unknown_); -} - -class StreamEncoder : public FLAC::Encoder::Stream { -public: - Layer layer_; - FILE *file_; - - StreamEncoder(Layer layer): FLAC::Encoder::Stream(), layer_(layer), file_(0) { } - ~StreamEncoder() { } - - // from FLAC::Encoder::Stream - ::FLAC__StreamEncoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes); - ::FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame); - ::FLAC__StreamEncoderSeekStatus seek_callback(FLAC__uint64 absolute_byte_offset); - ::FLAC__StreamEncoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset); - void metadata_callback(const ::FLAC__StreamMetadata *metadata); -private: - StreamEncoder(const StreamEncoder&); - StreamEncoder&operator=(const StreamEncoder&); -}; - -::FLAC__StreamEncoderReadStatus StreamEncoder::read_callback(FLAC__byte buffer[], size_t *bytes) -{ - if(*bytes > 0) { - *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file_); - if(ferror(file_)) - return ::FLAC__STREAM_ENCODER_READ_STATUS_ABORT; - else if(*bytes == 0) - return ::FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM; - else - return ::FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE; - } - else - return ::FLAC__STREAM_ENCODER_READ_STATUS_ABORT; -} - -::FLAC__StreamEncoderWriteStatus StreamEncoder::write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame) -{ - (void)samples, (void)current_frame; - - if(fwrite(buffer, 1, bytes, file_) != bytes) - return ::FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; - else - return ::FLAC__STREAM_ENCODER_WRITE_STATUS_OK; -} - -::FLAC__StreamEncoderSeekStatus StreamEncoder::seek_callback(FLAC__uint64 absolute_byte_offset) -{ - if(layer_==LAYER_STREAM) - return ::FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED; - else if(fseeko(file_, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0) - return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR; - else - return FLAC__STREAM_ENCODER_SEEK_STATUS_OK; -} - -::FLAC__StreamEncoderTellStatus StreamEncoder::tell_callback(FLAC__uint64 *absolute_byte_offset) -{ - FLAC__off_t pos; - if(layer_==LAYER_STREAM) - return ::FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED; - else if((pos = ftello(file_)) < 0) - return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR; - else { - *absolute_byte_offset = (FLAC__uint64)pos; - return FLAC__STREAM_ENCODER_TELL_STATUS_OK; - } -} - -void StreamEncoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) -{ - (void)metadata; -} - -class FileEncoder : public FLAC::Encoder::File { -public: - Layer layer_; - - FileEncoder(Layer layer): FLAC::Encoder::File(), layer_(layer) { } - ~FileEncoder() { } - - // from FLAC::Encoder::File - void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate); -}; - -void FileEncoder::progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate) -{ - (void)bytes_written, (void)samples_written, (void)frames_written, (void)total_frames_estimate; -} - -static FLAC::Encoder::Stream *new_by_layer(Layer layer) -{ - if(layer < LAYER_FILE) - return new StreamEncoder(layer); - else - return new FileEncoder(layer); -} - -static bool test_stream_encoder(Layer layer, bool is_ogg) -{ - FLAC::Encoder::Stream *encoder; - ::FLAC__StreamEncoderInitStatus init_status; - FILE *file = 0; - FLAC__int32 samples[1024]; - FLAC__int32 *samples_array[1] = { samples }; - uint32_t i; - - printf("\n+++ libFLAC++ unit test: FLAC::Encoder::%s (layer: %s, format: %s)\n\n", layeris_valid()) { - printf("FAILED, returned false\n"); - delete encoder; - return false; - } - printf("OK\n"); - - if(is_ogg) { - printf("testing set_ogg_serial_number()... "); - if(!encoder->set_ogg_serial_number(file_utils__ogg_serial_number)) - return die_s_("returned false", encoder); - printf("OK\n"); - } - - printf("testing set_verify()... "); - if(!encoder->set_verify(true)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_streamable_subset()... "); - if(!encoder->set_streamable_subset(true)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_channels()... "); - if(!encoder->set_channels(streaminfo_.data.stream_info.channels)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_bits_per_sample()... "); - if(!encoder->set_bits_per_sample(streaminfo_.data.stream_info.bits_per_sample)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_sample_rate()... "); - if(!encoder->set_sample_rate(streaminfo_.data.stream_info.sample_rate)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_compression_level()... "); - if(!encoder->set_compression_level((uint32_t)(-1))) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_blocksize()... "); - if(!encoder->set_blocksize(streaminfo_.data.stream_info.min_blocksize)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_do_mid_side_stereo()... "); - if(!encoder->set_do_mid_side_stereo(false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_loose_mid_side_stereo()... "); - if(!encoder->set_loose_mid_side_stereo(false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_max_lpc_order()... "); - if(!encoder->set_max_lpc_order(0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_qlp_coeff_precision()... "); - if(!encoder->set_qlp_coeff_precision(0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_do_qlp_coeff_prec_search()... "); - if(!encoder->set_do_qlp_coeff_prec_search(false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_do_escape_coding()... "); - if(!encoder->set_do_escape_coding(false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_do_exhaustive_model_search()... "); - if(!encoder->set_do_exhaustive_model_search(false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_min_residual_partition_order()... "); - if(!encoder->set_min_residual_partition_order(0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_max_residual_partition_order()... "); - if(!encoder->set_max_residual_partition_order(0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_rice_parameter_search_dist()... "); - if(!encoder->set_rice_parameter_search_dist(0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_total_samples_estimate()... "); - if(!encoder->set_total_samples_estimate(streaminfo_.data.stream_info.total_samples)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing set_metadata()... "); - if(!encoder->set_metadata(metadata_sequence_, num_metadata_)) - return die_s_("returned false", encoder); - printf("OK\n"); - - if(layer < LAYER_FILENAME) { - printf("opening file for FLAC output... "); - file = ::flac_fopen(flacfilename(is_ogg), "w+b"); - if(0 == file) { - printf("ERROR (%s)\n", strerror(errno)); - return false; - } - printf("OK\n"); - if(layer < LAYER_FILE) - dynamic_cast(encoder)->file_ = file; - } - - switch(layer) { - case LAYER_STREAM: - case LAYER_SEEKABLE_STREAM: - printf("testing init%s()... ", is_ogg? "_ogg":""); - init_status = is_ogg? encoder->init_ogg() : encoder->init(); - break; - case LAYER_FILE: - printf("testing init%s()... ", is_ogg? "_ogg":""); - init_status = is_ogg? - dynamic_cast(encoder)->init_ogg(file) : - dynamic_cast(encoder)->init(file); - break; - case LAYER_FILENAME: - printf("testing init%s()... ", is_ogg? "_ogg":""); - init_status = is_ogg? - dynamic_cast(encoder)->init_ogg(flacfilename(is_ogg)) : - dynamic_cast(encoder)->init(flacfilename(is_ogg)); - break; - default: - die_("internal error 001"); - return false; - } - if(init_status != ::FLAC__STREAM_ENCODER_INIT_STATUS_OK) - return die_s_(0, encoder); - printf("OK\n"); - - printf("testing get_state()... "); - FLAC::Encoder::Stream::State state = encoder->get_state(); - printf("returned state = %u (%s)... OK\n", (uint32_t)((::FLAC__StreamEncoderState)state), state.as_cstring()); - - printf("testing get_verify_decoder_state()... "); - FLAC::Decoder::Stream::State dstate = encoder->get_verify_decoder_state(); - printf("returned state = %u (%s)... OK\n", (uint32_t)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); - - { - FLAC__uint64 absolute_sample; - uint32_t frame_number; - uint32_t channel; - uint32_t sample; - FLAC__int32 expected; - FLAC__int32 got; - - printf("testing get_verify_decoder_error_stats()... "); - encoder->get_verify_decoder_error_stats(&absolute_sample, &frame_number, &channel, &sample, &expected, &got); - printf("OK\n"); - } - - printf("testing get_verify()... "); - if(encoder->get_verify() != true) { - printf("FAILED, expected true, got false\n"); - return false; - } - printf("OK\n"); - - printf("testing get_streamable_subset()... "); - if(encoder->get_streamable_subset() != true) { - printf("FAILED, expected true, got false\n"); - return false; - } - printf("OK\n"); - - printf("testing get_do_mid_side_stereo()... "); - if(encoder->get_do_mid_side_stereo() != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing get_loose_mid_side_stereo()... "); - if(encoder->get_loose_mid_side_stereo() != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing get_channels()... "); - if(encoder->get_channels() != streaminfo_.data.stream_info.channels) { - printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.channels, encoder->get_channels()); - return false; - } - printf("OK\n"); - - printf("testing get_bits_per_sample()... "); - if(encoder->get_bits_per_sample() != streaminfo_.data.stream_info.bits_per_sample) { - printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.bits_per_sample, encoder->get_bits_per_sample()); - return false; - } - printf("OK\n"); - - printf("testing get_sample_rate()... "); - if(encoder->get_sample_rate() != streaminfo_.data.stream_info.sample_rate) { - printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.sample_rate, encoder->get_sample_rate()); - return false; - } - printf("OK\n"); - - printf("testing get_blocksize()... "); - if(encoder->get_blocksize() != streaminfo_.data.stream_info.min_blocksize) { - printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.min_blocksize, encoder->get_blocksize()); - return false; - } - printf("OK\n"); - - printf("testing get_max_lpc_order()... "); - if(encoder->get_max_lpc_order() != 0) { - printf("FAILED, expected %d, got %u\n", 0, encoder->get_max_lpc_order()); - return false; - } - printf("OK\n"); - - printf("testing get_qlp_coeff_precision()... "); - (void)encoder->get_qlp_coeff_precision(); - /* we asked the encoder to auto select this so we accept anything */ - printf("OK\n"); - - printf("testing get_do_qlp_coeff_prec_search()... "); - if(encoder->get_do_qlp_coeff_prec_search() != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing get_do_escape_coding()... "); - if(encoder->get_do_escape_coding() != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing get_do_exhaustive_model_search()... "); - if(encoder->get_do_exhaustive_model_search() != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing get_min_residual_partition_order()... "); - if(encoder->get_min_residual_partition_order() != 0) { - printf("FAILED, expected %d, got %u\n", 0, encoder->get_min_residual_partition_order()); - return false; - } - printf("OK\n"); - - printf("testing get_max_residual_partition_order()... "); - if(encoder->get_max_residual_partition_order() != 0) { - printf("FAILED, expected %d, got %u\n", 0, encoder->get_max_residual_partition_order()); - return false; - } - printf("OK\n"); - - printf("testing get_rice_parameter_search_dist()... "); - if(encoder->get_rice_parameter_search_dist() != 0) { - printf("FAILED, expected %d, got %u\n", 0, encoder->get_rice_parameter_search_dist()); - return false; - } - printf("OK\n"); - - printf("testing get_total_samples_estimate()... "); - if(encoder->get_total_samples_estimate() != streaminfo_.data.stream_info.total_samples) { - printf("FAILED, expected %" PRIu64 ", got %" PRIu64 "\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate()); - return false; - } - printf("OK\n"); - - /* init the dummy sample buffer */ - for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++) - samples[i] = i & 7; - - printf("testing process()... "); - if(!encoder->process(samples_array, sizeof(samples) / sizeof(FLAC__int32))) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing process_interleaved()... "); - if(!encoder->process_interleaved(samples, sizeof(samples) / sizeof(FLAC__int32))) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing finish()... "); - if(!encoder->finish()) { - state = encoder->get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamEncoderState)state), state.as_cstring()); - return false; - } - printf("OK\n"); - - if(layer < LAYER_FILE) - ::fclose(dynamic_cast(encoder)->file_); - - printf("freeing encoder instance... "); - delete encoder; - printf("OK\n"); - - printf("\nPASSED!\n"); - - return true; -} - -bool test_encoders() -{ - FLAC__bool is_ogg = false; - - while(1) { - init_metadata_blocks_(); - - if(!test_stream_encoder(LAYER_STREAM, is_ogg)) - return false; - - if(!test_stream_encoder(LAYER_SEEKABLE_STREAM, is_ogg)) - return false; - - if(!test_stream_encoder(LAYER_FILE, is_ogg)) - return false; - - if(!test_stream_encoder(LAYER_FILENAME, is_ogg)) - return false; - - (void) grabbag__file_remove_file(flacfilename(is_ogg)); - - free_metadata_blocks_(); - - if(!FLAC_API_SUPPORTS_OGG_FLAC || is_ogg) - break; - is_ogg = true; - } - - return true; -} diff --git a/src/test_libFLAC++/encoders.h b/src/test_libFLAC++/encoders.h deleted file mode 100644 index a611cae4..00000000 --- a/src/test_libFLAC++/encoders.h +++ /dev/null @@ -1,25 +0,0 @@ -/* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLACPP_ENCODERS_H -#define FLAC__TEST_LIBFLACPP_ENCODERS_H - -bool test_encoders(); - -#endif diff --git a/src/test_libFLAC++/main.cpp b/src/test_libFLAC++/main.cpp deleted file mode 100644 index f111fc72..00000000 --- a/src/test_libFLAC++/main.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "decoders.h" -#include "encoders.h" -#include "metadata.h" - -int main(int argc, char *argv[]) -{ - (void)argc, (void)argv; - - if(!test_encoders()) - return 1; - - if(!test_decoders()) - return 1; - - if(!test_metadata()) - return 1; - - return 0; -} diff --git a/src/test_libFLAC++/metadata.cpp b/src/test_libFLAC++/metadata.cpp deleted file mode 100644 index 19971fcc..00000000 --- a/src/test_libFLAC++/metadata.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "metadata.h" -#include - -extern bool test_metadata_object(); -extern bool test_metadata_file_manipulation(); - -bool test_metadata() -{ - if(!test_metadata_object()) - return false; - - if(!test_metadata_file_manipulation()) - return false; - - printf("\nPASSED!\n"); - - return true; -} diff --git a/src/test_libFLAC++/metadata.h b/src/test_libFLAC++/metadata.h deleted file mode 100644 index e66e578c..00000000 --- a/src/test_libFLAC++/metadata.h +++ /dev/null @@ -1,25 +0,0 @@ -/* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLACPP_METADATA_H -#define FLAC__TEST_LIBFLACPP_METADATA_H - -bool test_metadata(); - -#endif diff --git a/src/test_libFLAC++/metadata_manip.cpp b/src/test_libFLAC++/metadata_manip.cpp deleted file mode 100644 index f9380d9e..00000000 --- a/src/test_libFLAC++/metadata_manip.cpp +++ /dev/null @@ -1,2235 +0,0 @@ -/* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include /* for malloc() */ -#include /* for memcpy()/memset() */ -#include /* some flavors of BSD (like OS X) require this to get time_t */ -#ifdef _MSC_VER -#include -#endif -#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__ -#include /* for chown(), unlink() */ -#endif -#include /* for stat(), maybe chmod() */ -#include "FLAC/assert.h" -#include "FLAC++/decoder.h" -#include "FLAC++/metadata.h" -#include "share/grabbag.h" -#include "share/compat.h" -#include "share/macros.h" -#include "share/safe_str.h" -extern "C" { -#include "test_libs_common/file_utils_flac.h" -} - -/****************************************************************************** - The general strategy of these tests (for interface levels 1 and 2) is - to create a dummy FLAC file with a known set of initial metadata - blocks, then keep a mirror locally of what we expect the metadata to be - after each operation. Then testing becomes a simple matter of running - a FLAC::Decoder::File over the dummy file after each operation, comparing - the decoded metadata to what's in our local copy. If there are any - differences in the metadata, or the actual audio data is corrupted, we - will catch it while decoding. -******************************************************************************/ - -class OurFileDecoder: public FLAC::Decoder::File { -public: - inline OurFileDecoder(bool ignore_metadata): ignore_metadata_(ignore_metadata), error_occurred_(false) { } - - bool ignore_metadata_; - bool error_occurred_; -protected: - ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]); - void metadata_callback(const ::FLAC__StreamMetadata *metadata); - void error_callback(::FLAC__StreamDecoderErrorStatus status); -}; - -struct OurMetadata { - FLAC::Metadata::Prototype *blocks[64]; - uint32_t num_blocks; -}; - -/* our copy of the metadata in flacfilename() */ -static OurMetadata our_metadata_; - -/* the current block number that corresponds to the position of the iterator we are testing */ -static uint32_t mc_our_block_number_ = 0; - -static const char *flacfilename(bool is_ogg) -{ - return is_ogg? "metadata.oga" : "metadata.flac"; -} - -static bool die_(const char *msg) -{ - printf("ERROR: %s\n", msg); - return false; -} - -static bool die_c_(const char *msg, FLAC::Metadata::Chain::Status status) -{ - printf("ERROR: %s\n", msg); - printf(" status=%u (%s)\n", (uint32_t)((::FLAC__Metadata_ChainStatus)status), status.as_cstring()); - return false; -} - -static bool die_ss_(const char *msg, FLAC::Metadata::SimpleIterator &iterator) -{ - const FLAC::Metadata::SimpleIterator::Status status = iterator.status(); - printf("ERROR: %s\n", msg); - printf(" status=%u (%s)\n", (uint32_t)((::FLAC__Metadata_SimpleIteratorStatus)status), status.as_cstring()); - return false; -} - -static void *malloc_or_die_(size_t size) -{ - void *x = malloc(size); - if(0 == x) { - fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size); - exit(1); - } - return x; -} - -static char *strdup_or_die_(const char *s) -{ - char *x = strdup(s); - if(0 == x) { - fprintf(stderr, "ERROR: out of memory copying string \"%s\"\n", s); - exit(1); - } - return x; -} - -/* functions for working with our metadata copy */ - -static bool replace_in_our_metadata_(FLAC::Metadata::Prototype *block, uint32_t position, bool copy) -{ - uint32_t i; - FLAC::Metadata::Prototype *obj = block; - FLAC__ASSERT(position < our_metadata_.num_blocks); - if(copy) { - if(0 == (obj = FLAC::Metadata::clone(block))) - return die_("during FLAC::Metadata::clone()"); - } - delete our_metadata_.blocks[position]; - our_metadata_.blocks[position] = obj; - - /* set the is_last flags */ - for(i = 0; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i]->set_is_last(false); - our_metadata_.blocks[i]->set_is_last(true); - - return true; -} - -static bool insert_to_our_metadata_(FLAC::Metadata::Prototype *block, uint32_t position, bool copy) -{ - uint32_t i; - FLAC::Metadata::Prototype *obj = block; - if(copy) { - if(0 == (obj = FLAC::Metadata::clone(block))) - return die_("during FLAC::Metadata::clone()"); - } - if(position > our_metadata_.num_blocks) { - position = our_metadata_.num_blocks; - } - else { - for(i = our_metadata_.num_blocks; i > position; i--) - our_metadata_.blocks[i] = our_metadata_.blocks[i-1]; - } - our_metadata_.blocks[position] = obj; - our_metadata_.num_blocks++; - - /* set the is_last flags */ - for(i = 0; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i]->set_is_last(false); - our_metadata_.blocks[i]->set_is_last(true); - - return true; -} - -static void delete_from_our_metadata_(uint32_t position) -{ - uint32_t i; - FLAC__ASSERT(position < our_metadata_.num_blocks); - delete our_metadata_.blocks[position]; - for(i = position; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i] = our_metadata_.blocks[i+1]; - our_metadata_.num_blocks--; - - /* set the is_last flags */ - if(our_metadata_.num_blocks > 0) { - for(i = 0; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i]->set_is_last(false); - our_metadata_.blocks[i]->set_is_last(true); - } -} - -void add_to_padding_length_(uint32_t indx, int delta) -{ - FLAC::Metadata::Padding *padding = dynamic_cast(our_metadata_.blocks[indx]); - FLAC__ASSERT(0 != padding); - padding->set_length((uint32_t)((int)padding->get_length() + delta)); -} - -/* - * This wad of functions supports filename- and callback-based chain reading/writing. - * Everything up to set_file_stats_() is copied from libFLAC/metadata_iterators.c - */ -bool open_tempfile_(const char *filename, FILE **tempfile, char **tempfilename) -{ - static const char *tempfile_suffix = ".metadata_edit"; - size_t destlen = strlen(filename) + strlen(tempfile_suffix) + 1; - - *tempfilename = (char*)malloc(destlen); - if (*tempfilename == 0) - return false; - flac_snprintf(*tempfilename, destlen, "%s%s", filename, tempfile_suffix); - - *tempfile = flac_fopen(*tempfilename, "wb"); - if (*tempfile == 0) - return false; - - return true; -} - -void cleanup_tempfile_(FILE **tempfile, char **tempfilename) -{ - if (*tempfile != 0) { - (void)fclose(*tempfile); - *tempfile = 0; - } - - if (*tempfilename != 0) { - (void)flac_unlink(*tempfilename); - free(*tempfilename); - *tempfilename = 0; - } -} - -bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename) -{ - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != tempfile); - FLAC__ASSERT(0 != tempfilename); - FLAC__ASSERT(0 != *tempfilename); - - if(0 != *tempfile) { - (void)fclose(*tempfile); - *tempfile = 0; - } - -#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ - /* on some flavors of windows, flac_rename() will fail if the destination already exists */ - if(flac_unlink(filename) < 0) { - cleanup_tempfile_(tempfile, tempfilename); - return false; - } -#endif - - if(0 != flac_rename(*tempfilename, filename)) { - cleanup_tempfile_(tempfile, tempfilename); - return false; - } - - cleanup_tempfile_(tempfile, tempfilename); - - return true; -} - -bool get_file_stats_(const char *filename, struct flac_stat_s *stats) -{ - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != stats); - return (0 == flac_stat(filename, stats)); -} - -void set_file_stats_(const char *filename, struct flac_stat_s *stats) -{ - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != stats); - -#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) - struct timespec srctime[2] = {}; - srctime[0].tv_sec = stats->st_atime; - srctime[1].tv_sec = stats->st_mtime; -#else - struct utimbuf srctime; - srctime.actime = stats->st_atime; - srctime.modtime = stats->st_mtime; -#endif - (void)flac_chmod(filename, stats->st_mode); - (void)flac_utime(filename, &srctime); -#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__ - FLAC_CHECK_RETURN(chown(filename, stats->st_uid, (gid_t)(-1))); - FLAC_CHECK_RETURN(chown(filename, (uid_t)(-1), stats->st_gid)); -#endif -} - -#ifdef FLAC__VALGRIND_TESTING -static size_t chain_write_cb_(const void *ptr, size_t size, size_t nmemb, ::FLAC__IOHandle handle) -{ - FILE *stream = (FILE*)handle; - size_t ret = fwrite(ptr, size, nmemb, stream); - if(!ferror(stream)) - fflush(stream); - return ret; -} -#endif - -static int chain_seek_cb_(::FLAC__IOHandle handle, FLAC__int64 offset, int whence) -{ - FLAC__off_t o = (FLAC__off_t)offset; - FLAC__ASSERT(offset == o); - return fseeko((FILE*)handle, o, whence); -} - -static FLAC__int64 chain_tell_cb_(::FLAC__IOHandle handle) -{ - return ftello((FILE*)handle); -} - -static int chain_eof_cb_(::FLAC__IOHandle handle) -{ - return feof((FILE*)handle); -} - -static bool write_chain_(FLAC::Metadata::Chain &chain, bool use_padding, bool preserve_file_stats, bool filename_based, const char *filename) -{ - if(filename_based) - return chain.write(use_padding, preserve_file_stats); - else { - ::FLAC__IOCallbacks callbacks; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.read = (::FLAC__IOCallback_Read)fread; -#ifdef FLAC__VALGRIND_TESTING - callbacks.write = chain_write_cb_; -#else - callbacks.write = (::FLAC__IOCallback_Write)fwrite; -#endif - callbacks.seek = chain_seek_cb_; - callbacks.eof = chain_eof_cb_; - - if(chain.check_if_tempfile_needed(use_padding)) { - struct flac_stat_s stats; - FILE *file, *tempfile; - char *tempfilename; - if(preserve_file_stats) { - if(!get_file_stats_(filename, &stats)) - return false; - } - if(0 == (file = flac_fopen(filename, "rb"))) - return false; /*@@@@ chain status still says OK though */ - if(!open_tempfile_(filename, &tempfile, &tempfilename)) { - fclose(file); - cleanup_tempfile_(&tempfile, &tempfilename); - return false; /*@@@@ chain status still says OK though */ - } - if(!chain.write(use_padding, (::FLAC__IOHandle)file, callbacks, (::FLAC__IOHandle)tempfile, callbacks)) { - fclose(file); - fclose(tempfile); - return false; - } - fclose(file); - fclose(tempfile); - file = tempfile = 0; - if(!transport_tempfile_(filename, &tempfile, &tempfilename)) - return false; - if(preserve_file_stats) - set_file_stats_(filename, &stats); - } - else { - FILE *file = flac_fopen(filename, "r+b"); - if(0 == file) - return false; /*@@@@ chain status still says OK though */ - if(!chain.write(use_padding, (::FLAC__IOHandle)file, callbacks)) { - fclose(file); - return false; - } - fclose(file); - } - } - - return true; -} - -static bool read_chain_(FLAC::Metadata::Chain &chain, const char *filename, bool filename_based, bool is_ogg) -{ - if(filename_based) - return chain.read(filename, is_ogg); - else { - ::FLAC__IOCallbacks callbacks; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.read = (::FLAC__IOCallback_Read)fread; - callbacks.seek = chain_seek_cb_; - callbacks.tell = chain_tell_cb_; - - { - bool ret; - FILE *file = flac_fopen(filename, "rb"); - if(0 == file) - return false; /*@@@@ chain status still says OK though */ - ret = chain.read((::FLAC__IOHandle)file, callbacks, is_ogg); - fclose(file); - return ret; - } - } -} - -/* function for comparing our metadata to a FLAC::Metadata::Chain */ - -static bool compare_chain_(FLAC::Metadata::Chain &chain, uint32_t current_position, FLAC::Metadata::Prototype *current_block) -{ - uint32_t i; - FLAC::Metadata::Iterator iterator; - bool next_ok = true; - - printf("\tcomparing chain... "); - fflush(stdout); - - if(!iterator.is_valid()) - return die_("allocating memory for iterator"); - - iterator.init(chain); - - i = 0; - do { - FLAC::Metadata::Prototype *block; - - printf("%u... ", i); - fflush(stdout); - - if(0 == (block = iterator.get_block())) - return die_("getting block from iterator"); - - if(*block != *our_metadata_.blocks[i]) - return die_("metadata block mismatch"); - - delete block; - i++; - next_ok = iterator.next(); - } while(i < our_metadata_.num_blocks && next_ok); - - if(next_ok) - return die_("chain has more blocks than expected"); - - if(i < our_metadata_.num_blocks) - return die_("short block count in chain"); - - if(0 != current_block) { - printf("CURRENT_POSITION... "); - fflush(stdout); - - if(*current_block != *our_metadata_.blocks[current_position]) - return die_("metadata block mismatch"); - } - - printf("PASSED\n"); - - return true; -} - -::FLAC__StreamDecoderWriteStatus OurFileDecoder::write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) -{ - (void)buffer; - - if( - (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER && frame->header.number.frame_number == 0) || - (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER && frame->header.number.sample_number == 0) - ) { - printf("content... "); - fflush(stdout); - } - - return ::FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -void OurFileDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) -{ - /* don't bother checking if we've already hit an error */ - if(error_occurred_) - return; - - printf("%u... ", mc_our_block_number_); - fflush(stdout); - - if(!ignore_metadata_) { - if(mc_our_block_number_ >= our_metadata_.num_blocks) { - (void)die_("got more metadata blocks than expected"); - error_occurred_ = true; - } - else { - if(*our_metadata_.blocks[mc_our_block_number_] != metadata) { - (void)die_("metadata block mismatch"); - error_occurred_ = true; - } - } - } - - mc_our_block_number_++; -} - -void OurFileDecoder::error_callback(::FLAC__StreamDecoderErrorStatus status) -{ - error_occurred_ = true; - printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (uint32_t)status); -} - -static bool generate_file_(bool include_extras, bool is_ogg) -{ - ::FLAC__StreamMetadata streaminfo, vorbiscomment, *cuesheet, picture, padding; - ::FLAC__StreamMetadata *metadata[4]; - uint32_t i = 0, n = 0; - - printf("generating %sFLAC file for test\n", is_ogg? "Ogg " : ""); - - while(our_metadata_.num_blocks > 0) - delete_from_our_metadata_(0); - - streaminfo.is_last = false; - streaminfo.type = ::FLAC__METADATA_TYPE_STREAMINFO; - streaminfo.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; - streaminfo.data.stream_info.min_blocksize = 576; - streaminfo.data.stream_info.max_blocksize = 576; - streaminfo.data.stream_info.min_framesize = 0; - streaminfo.data.stream_info.max_framesize = 0; - streaminfo.data.stream_info.sample_rate = 44100; - streaminfo.data.stream_info.channels = 1; - streaminfo.data.stream_info.bits_per_sample = 8; - streaminfo.data.stream_info.total_samples = 0; - memset(streaminfo.data.stream_info.md5sum, 0, 16); - - { - const uint32_t vendor_string_length = (uint32_t)strlen(FLAC__VENDOR_STRING); - vorbiscomment.is_last = false; - vorbiscomment.type = ::FLAC__METADATA_TYPE_VORBIS_COMMENT; - vorbiscomment.length = (4 + vendor_string_length) + 4; - vorbiscomment.data.vorbis_comment.vendor_string.length = vendor_string_length; - vorbiscomment.data.vorbis_comment.vendor_string.entry = (FLAC__byte*)malloc_or_die_(vendor_string_length+1); - memcpy(vorbiscomment.data.vorbis_comment.vendor_string.entry, FLAC__VENDOR_STRING, vendor_string_length+1); - vorbiscomment.data.vorbis_comment.num_comments = 0; - vorbiscomment.data.vorbis_comment.comments = 0; - } - - { - if (0 == (cuesheet = ::FLAC__metadata_object_new(::FLAC__METADATA_TYPE_CUESHEET))) - return die_("priming our metadata"); - cuesheet->is_last = false; - safe_strncpy(cuesheet->data.cue_sheet.media_catalog_number, "bogo-MCN", sizeof(cuesheet->data.cue_sheet.media_catalog_number)); - cuesheet->data.cue_sheet.lead_in = 123; - cuesheet->data.cue_sheet.is_cd = false; - if (!FLAC__metadata_object_cuesheet_insert_blank_track(cuesheet, 0)) - return die_("priming our metadata"); - cuesheet->data.cue_sheet.tracks[0].number = 1; - if (!FLAC__metadata_object_cuesheet_track_insert_blank_index(cuesheet, 0, 0)) - return die_("priming our metadata"); - } - - { - picture.is_last = false; - picture.type = ::FLAC__METADATA_TYPE_PICTURE; - picture.length = - ( - FLAC__STREAM_METADATA_PICTURE_TYPE_LEN + - FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN + /* will add the length for the string later */ - FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN + /* will add the length for the string later */ - FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN + - FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN + - FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN + - FLAC__STREAM_METADATA_PICTURE_COLORS_LEN + - FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN /* will add the length for the data later */ - ) / 8 - ; - picture.data.picture.type = ::FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER; - picture.data.picture.mime_type = strdup_or_die_("image/jpeg"); - picture.length += strlen(picture.data.picture.mime_type); - picture.data.picture.description = (FLAC__byte*)strdup_or_die_("desc"); - picture.length += strlen((const char *)picture.data.picture.description); - picture.data.picture.width = 300; - picture.data.picture.height = 300; - picture.data.picture.depth = 24; - picture.data.picture.colors = 0; - picture.data.picture.data = (FLAC__byte*)strdup_or_die_("SOMEJPEGDATA"); - picture.data.picture.data_length = strlen((const char *)picture.data.picture.data); - picture.length += picture.data.picture.data_length; - } - - padding.is_last = true; - padding.type = ::FLAC__METADATA_TYPE_PADDING; - padding.length = 1234; - - metadata[n++] = &vorbiscomment; - if(include_extras) { - metadata[n++] = cuesheet; - metadata[n++] = &picture; - } - metadata[n++] = &padding; - - FLAC::Metadata::StreamInfo s(&streaminfo); - FLAC::Metadata::VorbisComment v(&vorbiscomment); - FLAC::Metadata::CueSheet c(cuesheet, /*copy=*/false); - FLAC::Metadata::Picture pi(&picture); - FLAC::Metadata::Padding p(&padding); - if( - !insert_to_our_metadata_(&s, i++, /*copy=*/true) || - !insert_to_our_metadata_(&v, i++, /*copy=*/true) || - (include_extras && !insert_to_our_metadata_(&c, i++, /*copy=*/true)) || - (include_extras && !insert_to_our_metadata_(&pi, i++, /*copy=*/true)) || - !insert_to_our_metadata_(&p, i++, /*copy=*/true) - ) - return die_("priming our metadata"); - - if(!file_utils__generate_flacfile(is_ogg, flacfilename(is_ogg), 0, 512 * 1024, &streaminfo, metadata, n)) - return die_("creating the encoded file"); - - free(vorbiscomment.data.vorbis_comment.vendor_string.entry); - free(picture.data.picture.mime_type); - free(picture.data.picture.description); - free(picture.data.picture.data); - - return true; -} - -static bool test_file_(bool is_ogg, bool ignore_metadata) -{ - const char *filename = flacfilename(is_ogg); - OurFileDecoder decoder(ignore_metadata); - - mc_our_block_number_ = 0; - decoder.error_occurred_ = false; - - printf("\ttesting '%s'... ", filename); - fflush(stdout); - - if(!decoder.is_valid()) - return die_("couldn't allocate decoder instance"); - - decoder.set_md5_checking(true); - decoder.set_metadata_respond_all(); - if((is_ogg? decoder.init_ogg(filename) : decoder.init(filename)) != ::FLAC__STREAM_DECODER_INIT_STATUS_OK) { - (void)decoder.finish(); - return die_("initializing decoder\n"); - } - if(!decoder.process_until_end_of_stream()) { - (void)decoder.finish(); - return die_("decoding file\n"); - } - - (void)decoder.finish(); - - if(decoder.error_occurred_) - return false; - - if(mc_our_block_number_ != our_metadata_.num_blocks) - return die_("short metadata block count"); - - printf("PASSED\n"); - return true; -} - -static bool change_stats_(const char *filename, bool read_only) -{ - if(!grabbag__file_change_stats(filename, read_only)) - return die_("during grabbag__file_change_stats()"); - - return true; -} - -static bool remove_file_(const char *filename) -{ - while(our_metadata_.num_blocks > 0) - delete_from_our_metadata_(0); - - if(!grabbag__file_remove_file(filename)) - return die_("removing file"); - - return true; -} - -static bool test_level_0_() -{ - FLAC::Metadata::StreamInfo streaminfo; - - printf("\n\n++++++ testing level 0 interface\n"); - - if(!generate_file_(/*include_extras=*/true, /*is_ogg=*/false)) - return false; - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/true)) - return false; - - printf("testing FLAC::Metadata::get_streaminfo()... "); - - if(!FLAC::Metadata::get_streaminfo(flacfilename(/*is_ogg=*/false), streaminfo)) - return die_("during FLAC::Metadata::get_streaminfo()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(streaminfo.get_channels() != 1) - return die_("mismatch in streaminfo.get_channels()"); - if(streaminfo.get_bits_per_sample() != 8) - return die_("mismatch in streaminfo.get_bits_per_sample()"); - if(streaminfo.get_sample_rate() != 44100) - return die_("mismatch in streaminfo.get_sample_rate()"); - if(streaminfo.get_min_blocksize() != 576) - return die_("mismatch in streaminfo.get_min_blocksize()"); - if(streaminfo.get_max_blocksize() != 576) - return die_("mismatch in streaminfo.get_max_blocksize()"); - - printf("OK\n"); - - { - printf("testing FLAC::Metadata::get_tags(VorbisComment *&)... "); - - FLAC::Metadata::VorbisComment *tags = 0; - - if(!FLAC::Metadata::get_tags(flacfilename(/*is_ogg=*/false), tags)) - return die_("during FLAC::Metadata::get_tags()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(tags->get_num_comments() != 0) - return die_("mismatch in tags->get_num_comments()"); - - printf("OK\n"); - - delete tags; - } - - { - printf("testing FLAC::Metadata::get_tags(VorbisComment &)... "); - - FLAC::Metadata::VorbisComment tags; - - if(!FLAC::Metadata::get_tags(flacfilename(/*is_ogg=*/false), tags)) - return die_("during FLAC::Metadata::get_tags()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(tags.get_num_comments() != 0) - return die_("mismatch in tags.get_num_comments()"); - - printf("OK\n"); - } - - { - printf("testing FLAC::Metadata::get_cuesheet(CueSheet *&)... "); - - FLAC::Metadata::CueSheet *cuesheet = 0; - - if(!FLAC::Metadata::get_cuesheet(flacfilename(/*is_ogg=*/false), cuesheet)) - return die_("during FLAC::Metadata::get_cuesheet()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(cuesheet->get_lead_in() != 123) - return die_("mismatch in cuesheet->get_lead_in()"); - - printf("OK\n"); - - delete cuesheet; - } - - { - printf("testing FLAC::Metadata::get_cuesheet(CueSheet &)... "); - - FLAC::Metadata::CueSheet cuesheet; - - if(!FLAC::Metadata::get_cuesheet(flacfilename(/*is_ogg=*/false), cuesheet)) - return die_("during FLAC::Metadata::get_cuesheet()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(cuesheet.get_lead_in() != 123) - return die_("mismatch in cuesheet.get_lead_in()"); - - printf("OK\n"); - } - - { - printf("testing FLAC::Metadata::get_picture(Picture *&)... "); - - FLAC::Metadata::Picture *picture = 0; - - if(!FLAC::Metadata::get_picture(flacfilename(/*is_ogg=*/false), picture, /*type=*/(::FLAC__StreamMetadata_Picture_Type)(-1), /*mime_type=*/0, /*description=*/0, /*max_width=*/(uint32_t)(-1), /*max_height=*/(uint32_t)(-1), /*max_depth=*/(uint32_t)(-1), /*max_colors=*/(uint32_t)(-1))) - return die_("during FLAC::Metadata::get_picture()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(picture->get_type () != ::FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER) - return die_("mismatch in picture->get_type ()"); - - printf("OK\n"); - - delete picture; - } - - { - printf("testing FLAC::Metadata::get_picture(Picture &)... "); - - FLAC::Metadata::Picture picture; - - if(!FLAC::Metadata::get_picture(flacfilename(/*is_ogg=*/false), picture, /*type=*/(::FLAC__StreamMetadata_Picture_Type)(-1), /*mime_type=*/0, /*description=*/0, /*max_width=*/(uint32_t)(-1), /*max_height=*/(uint32_t)(-1), /*max_depth=*/(uint32_t)(-1), /*max_colors=*/(uint32_t)(-1))) - return die_("during FLAC::Metadata::get_picture()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(picture.get_type () != ::FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER) - return die_("mismatch in picture->get_type ()"); - - printf("OK\n"); - } - - if(!remove_file_(flacfilename(/*is_ogg=*/false))) - return false; - - return true; -} - -static bool test_level_1_() -{ - FLAC::Metadata::Prototype *block; - FLAC::Metadata::StreamInfo *streaminfo; - FLAC::Metadata::Padding *padding; - FLAC::Metadata::Application *app; - FLAC__byte data[1000]; - uint32_t our_current_position = 0; - - // initialize 'data' to avoid Valgrind errors - memset(data, 0, sizeof(data)); - - printf("\n\n++++++ testing level 1 interface\n"); - - /************************************************************/ - { - printf("simple iterator on read-only file\n"); - - if(!generate_file_(/*include_extras=*/false, /*is_ogg=*/false)) - return false; - - if(!change_stats_(flacfilename(/*is_ogg=*/false), /*read_only=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/true)) - return false; - - FLAC::Metadata::SimpleIterator iterator; - - if(!iterator.is_valid()) - return die_("iterator.is_valid() returned false"); - - if(!iterator.init(flacfilename(/*is_ogg=*/false), /*read_only=*/false, /*preserve_file_stats=*/false)) - return die_("iterator.init() returned false"); - - printf("is writable = %u\n", (uint32_t)iterator.is_writable()); - if(iterator.is_writable()) - return die_("iterator claims file is writable when tester thinks it should not be; are you running as root?\n"); - - printf("iterate forwards\n"); - - if(iterator.get_block_type() != ::FLAC__METADATA_TYPE_STREAMINFO) - return die_("expected STREAMINFO type from iterator.get_block_type()"); - if(0 == (block = iterator.get_block())) - return die_("getting block 0"); - if(block->get_type() != ::FLAC__METADATA_TYPE_STREAMINFO) - return die_("expected STREAMINFO type"); - if(block->get_is_last()) - return die_("expected is_last to be false"); - if(block->get_length() != FLAC__STREAM_METADATA_STREAMINFO_LENGTH) - return die_("bad STREAMINFO length"); - /* check to see if some basic data matches (c.f. generate_file_()) */ - streaminfo = dynamic_cast(block); - FLAC__ASSERT(0 != streaminfo); - if(streaminfo->get_channels() != 1) - return die_("mismatch in channels"); - if(streaminfo->get_bits_per_sample() != 8) - return die_("mismatch in bits_per_sample"); - if(streaminfo->get_sample_rate() != 44100) - return die_("mismatch in sample_rate"); - if(streaminfo->get_min_blocksize() != 576) - return die_("mismatch in min_blocksize"); - if(streaminfo->get_max_blocksize() != 576) - return die_("mismatch in max_blocksize"); - // we will delete streaminfo a little later when we're really done with it... - - if(!iterator.next()) - return die_("forward iterator ended early"); - our_current_position++; - - if(!iterator.next()) - return die_("forward iterator ended early"); - our_current_position++; - - if(iterator.get_block_type() != ::FLAC__METADATA_TYPE_PADDING) - return die_("expected PADDING type from iterator.get_block_type()"); - if(0 == (block = iterator.get_block())) - return die_("getting block 1"); - if(block->get_type() != ::FLAC__METADATA_TYPE_PADDING) - return die_("expected PADDING type"); - if(!block->get_is_last()) - return die_("expected is_last to be true"); - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(block->get_length() != 1234) - return die_("bad PADDING length"); - delete block; - - if(iterator.next()) - return die_("forward iterator returned true but should have returned false"); - - printf("iterate backwards\n"); - if(!iterator.prev()) - return die_("reverse iterator ended early"); - if(!iterator.prev()) - return die_("reverse iterator ended early"); - if(iterator.prev()) - return die_("reverse iterator returned true but should have returned false"); - - printf("testing iterator.set_block() on read-only file...\n"); - - if(!iterator.set_block(streaminfo, false)) - printf("PASSED. iterator.set_block() returned false like it should\n"); - else - return die_("iterator.set_block() returned true but shouldn't have"); - delete streaminfo; - } - - /************************************************************/ - { - printf("simple iterator on writable file\n"); - - if(!change_stats_(flacfilename(/*is_ogg=*/false), /*read-only=*/false)) - return false; - - printf("creating APPLICATION block\n"); - - if(0 == (app = new FLAC::Metadata::Application())) - return die_("new FLAC::Metadata::Application()"); - app->set_id((const uint8_t *)"duh"); - - printf("creating PADDING block\n"); - - if(0 == (padding = new FLAC::Metadata::Padding())) { - delete app; - return die_("new FLAC::Metadata::Padding()"); - } - padding->set_length(20); - - FLAC::Metadata::SimpleIterator iterator; - - if(!iterator.is_valid()) { - delete app; - delete padding; - return die_("iterator.is_valid() returned false"); - } - - if(!iterator.init(flacfilename(/*is_ogg=*/false), /*read_only=*/false, /*preserve_file_stats=*/false)) { - delete app; - delete padding; - return die_("iterator.init() returned false"); - } - our_current_position = 0; - - printf("is writable = %u\n", (uint32_t)iterator.is_writable()); - - printf("[S]VP\ttry to write over STREAMINFO block...\n"); - if(!iterator.set_block(app, false)) - printf("\titerator.set_block() returned false like it should\n"); - else { - delete app; - delete padding; - return die_("iterator.set_block() returned true but shouldn't have"); - } - - printf("[S]VP\tnext\n"); - if(!iterator.next()) { - delete app; - delete padding; - return die_("iterator ended early\n"); - } - our_current_position++; - - printf("S[V]P\tnext\n"); - if(!iterator.next()) { - delete app; - delete padding; - return die_("iterator ended early\n"); - } - our_current_position++; - - printf("SV[P]\tinsert PADDING after, don't expand into padding\n"); - padding->set_length(25); - if(!iterator.insert_block_after(padding, false)) - return die_ss_("iterator.insert_block_after(padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - printf("SVP[P]\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SV[P]P\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]PP\tinsert PADDING after, don't expand into padding\n"); - padding->set_length(30); - if(!iterator.insert_block_after(padding, false)) - return die_ss_("iterator.insert_block_after(padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[P]PP\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]PPP\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("[S]VPPP\tdelete (STREAMINFO block), must fail\n"); - if(iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false) should have returned false", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("[S]VPPP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]PPP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]PP\tdelete (middle block), replace with padding\n"); - if(!iterator.delete_block(true)) - return die_ss_("iterator.delete_block(true)", iterator); - our_current_position--; - - printf("S[V]PPP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]PP\tdelete (middle block), don't replace with padding\n"); - if(!iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("S[V]PP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]P\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVP[P]\tdelete (last block), replace with padding\n"); - if(!iterator.delete_block(true)) - return die_ss_("iterator.delete_block(false)", iterator); - our_current_position--; - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[P]P\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVP[P]\tdelete (last block), don't replace with padding\n"); - if(!iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[P]\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]P\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("[S]VP\tset STREAMINFO (change sample rate)\n"); - FLAC__ASSERT(our_current_position == 0); - block = iterator.get_block(); - streaminfo = dynamic_cast(block); - FLAC__ASSERT(0 != streaminfo); - streaminfo->set_sample_rate(32000); - if(!replace_in_our_metadata_(block, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(block, false)) - return die_ss_("iterator.set_block(block, false)", iterator); - delete block; - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("[S]VP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]P\tinsert APPLICATION after, expand into padding of exceeding size\n"); - app->set_id((const uint8_t *)"euh"); /* twiddle the id so that our comparison doesn't miss transposition */ - if(!iterator.insert_block_after(app, true)) - return die_ss_("iterator.insert_block_after(app, true)", iterator); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return false; - add_to_padding_length_(our_current_position+1, -((int)(FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + (int)app->get_length())); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]P\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVA[P]\tset APPLICATION, expand into padding of exceeding size\n"); - app->set_id((const uint8_t *)"fuh"); /* twiddle the id */ - if(!iterator.set_block(app, true)) - return die_ss_("iterator.set_block(app, true)", iterator); - if(!insert_to_our_metadata_(app, our_current_position, /*copy=*/true)) - return false; - add_to_padding_length_(our_current_position+1, -((int)(FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + (int)app->get_length())); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVA[A]P\tset APPLICATION (grow), don't expand into padding\n"); - app->set_id((const uint8_t *)"guh"); /* twiddle the id */ - if(!app->set_data(data, sizeof(data), true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app, false)) - return die_ss_("iterator.set_block(app, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVA[A]P\tset APPLICATION (shrink), don't fill in with padding\n"); - app->set_id((const uint8_t *)"huh"); /* twiddle the id */ - if(!app->set_data(data, 12, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app, false)) - return die_ss_("iterator.set_block(app, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVA[A]P\tset APPLICATION (grow), expand into padding of exceeding size\n"); - app->set_id((const uint8_t *)"iuh"); /* twiddle the id */ - if(!app->set_data(data, sizeof(data), true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - add_to_padding_length_(our_current_position+1, -((int)sizeof(data) - 12)); - if(!iterator.set_block(app, true)) - return die_ss_("iterator.set_block(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVA[A]P\tset APPLICATION (shrink), fill in with padding\n"); - app->set_id((const uint8_t *)"juh"); /* twiddle the id */ - if(!app->set_data(data, 23, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!insert_to_our_metadata_(padding, our_current_position+1, /*copy=*/true)) - return die_("copying object"); - dynamic_cast(our_metadata_.blocks[our_current_position+1])->set_length(sizeof(data) - 23 - FLAC__STREAM_METADATA_HEADER_LENGTH); - if(!iterator.set_block(app, true)) - return die_ss_("iterator.set_block(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVA[A]PP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVAA[P]P\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVAAP[P]\tset PADDING (shrink), don't fill in with padding\n"); - padding->set_length(5); - if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(padding, false)) - return die_ss_("iterator.set_block(padding, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVAAP[P]\tset APPLICATION (grow)\n"); - app->set_id((const uint8_t *)"kuh"); /* twiddle the id */ - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app, false)) - return die_ss_("iterator.set_block(app, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVAAP[A]\tset PADDING (equal)\n"); - padding->set_length(27); - if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(padding, false)) - return die_ss_("iterator.set_block(padding, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVAAP[P]\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SVAA[P]P\tdelete (middle block), don't replace with padding\n"); - if(!iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVA[A]P\tdelete (middle block), don't replace with padding\n"); - if(!iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]P\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVA[P]\tinsert PADDING after\n"); - padding->set_length(5); - if(!iterator.insert_block_after(padding, false)) - return die_ss_("iterator.insert_block_after(padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVAP[P]\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SVA[P]P\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SV[A]PP\tset APPLICATION (grow), try to expand into padding which is too small\n"); - if(!app->set_data(data, 32, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app, true)) - return die_ss_("iterator.set_block(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]PP\tset APPLICATION (grow), try to expand into padding which is 'close' but still too small\n"); - if(!app->set_data(data, 60, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app, true)) - return die_ss_("iterator.set_block(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]PP\tset APPLICATION (grow), expand into padding which will leave 0-length pad\n"); - if(!app->set_data(data, 87, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - dynamic_cast(our_metadata_.blocks[our_current_position+1])->set_length(0); - if(!iterator.set_block(app, true)) - return die_ss_("iterator.set_block(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]PP\tset APPLICATION (grow), expand into padding which is exactly consumed\n"); - if(!app->set_data(data, 91, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - if(!iterator.set_block(app, true)) - return die_ss_("iterator.set_block(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]P\tset APPLICATION (grow), expand into padding which is exactly consumed\n"); - if(!app->set_data(data, 100, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - our_metadata_.blocks[our_current_position]->set_is_last(true); - if(!iterator.set_block(app, true)) - return die_ss_("iterator.set_block(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]\tset PADDING (equal size)\n"); - padding->set_length(app->get_length()); - if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(padding, true)) - return die_ss_("iterator.set_block(padding, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[P]\tinsert PADDING after\n"); - if(!iterator.insert_block_after(padding, false)) - return die_ss_("iterator.insert_block_after(padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVP[P]\tinsert PADDING after\n"); - padding->set_length(5); - if(!iterator.insert_block_after(padding, false)) - return die_ss_("iterator.insert_block_after(padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SVPP[P]\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SVP[P]P\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SV[P]PP\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]PPP\tinsert APPLICATION after, try to expand into padding which is too small\n"); - if(!app->set_data(data, 101, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.insert_block_after(app, true)) - return die_ss_("iterator.insert_block_after(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]PPP\tdelete (middle block), don't replace with padding\n"); - if(!iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("S[V]PPP\tinsert APPLICATION after, try to expand into padding which is 'close' but still too small\n"); - if(!app->set_data(data, 97, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.insert_block_after(app, true)) - return die_ss_("iterator.insert_block_after(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]PPP\tdelete (middle block), don't replace with padding\n"); - if(!iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("S[V]PPP\tinsert APPLICATION after, expand into padding which is exactly consumed\n"); - if(!app->set_data(data, 100, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - if(!iterator.insert_block_after(app, true)) - return die_ss_("iterator.insert_block_after(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]PP\tdelete (middle block), don't replace with padding\n"); - if(!iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("S[V]PP\tinsert APPLICATION after, expand into padding which will leave 0-length pad\n"); - if(!app->set_data(data, 96, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - dynamic_cast(our_metadata_.blocks[our_current_position+1])->set_length(0); - if(!iterator.insert_block_after(app, true)) - return die_ss_("iterator.insert_block_after(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]PP\tdelete (middle block), don't replace with padding\n"); - if(!iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("S[V]PP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]P\tdelete (middle block), don't replace with padding\n"); - if(!iterator.delete_block(false)) - return die_ss_("iterator.delete_block(false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - - printf("S[V]P\tinsert APPLICATION after, expand into padding which is exactly consumed\n"); - if(!app->set_data(data, 1, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - if(!iterator.insert_block_after(app, true)) - return die_ss_("iterator.insert_block_after(app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) - return false; - } - - delete app; - delete padding; - - if(!remove_file_(flacfilename(/*is_ogg=*/false))) - return false; - - return true; -} - -static bool test_level_2_(bool filename_based, bool is_ogg) -{ - FLAC::Metadata::Prototype *block; - FLAC::Metadata::StreamInfo *streaminfo; - FLAC::Metadata::Application *app; - FLAC::Metadata::Padding *padding; - FLAC__byte data[2000]; - uint32_t our_current_position; - - // initialize 'data' to avoid Valgrind errors - memset(data, 0, sizeof(data)); - - printf("\n\n++++++ testing level 2 interface (%s-based, %s FLAC)\n", filename_based? "filename":"callback", is_ogg? "Ogg":"native"); - - printf("generate read-only file\n"); - - if(!generate_file_(/*include_extras=*/false, is_ogg)) - return false; - - if(!change_stats_(flacfilename(is_ogg), /*read_only=*/true)) - return false; - - printf("create chain\n"); - FLAC::Metadata::Chain chain; - if(!chain.is_valid()) - return die_("allocating memory for chain"); - - printf("read chain\n"); - - if(!read_chain_(chain, flacfilename(is_ogg), filename_based, is_ogg)) - return die_c_("reading chain", chain.status()); - - printf("[S]VP\ttest initial metadata\n"); - - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - if(is_ogg) - goto end; - - printf("switch file to read-write\n"); - - if(!change_stats_(flacfilename(is_ogg), /*read-only=*/false)) - return false; - - printf("create iterator\n"); - { - FLAC::Metadata::Iterator iterator; - if(!iterator.is_valid()) - return die_("allocating memory for iterator"); - - our_current_position = 0; - - iterator.init(chain); - - if(0 == (block = iterator.get_block())) - return die_("getting block from iterator"); - - FLAC__ASSERT(block->get_type() == FLAC__METADATA_TYPE_STREAMINFO); - - printf("[S]VP\tmodify STREAMINFO, write\n"); - - streaminfo = dynamic_cast(block); - FLAC__ASSERT(0 != streaminfo); - streaminfo->set_sample_rate(32000); - if(!replace_in_our_metadata_(block, our_current_position, /*copy=*/true)) - return die_("copying object"); - delete block; - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/true, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(false, true)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("[S]VP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]P\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]\treplace PADDING with identical-size APPLICATION\n"); - if(0 == (block = iterator.get_block())) - return die_("getting block from iterator"); - if(0 == (app = new FLAC::Metadata::Application())) - return die_("new FLAC::Metadata::Application()"); - app->set_id((const uint8_t *)"duh"); - if(!app->set_data(data, block->get_length()-(FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), true)) - return die_("setting APPLICATION data"); - delete block; - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(false, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]\tshrink APPLICATION, don't use padding\n"); - if(0 == (app = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("copying object"); - if(!app->set_data(data, 26, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(false, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]\tgrow APPLICATION, don't use padding\n"); - if(0 == (app = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("copying object"); - if(!app->set_data(data, 28, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(false, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]\tgrow APPLICATION, use padding, but last block is not padding\n"); - if(0 == (app = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("copying object"); - if(!app->set_data(data, 36, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(false, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]\tshrink APPLICATION, use padding, last block is not padding, but delta is too small for new PADDING block\n"); - if(0 == (app = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("copying object"); - if(!app->set_data(data, 33, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(true, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]\tshrink APPLICATION, use padding, last block is not padding, delta is enough for new PADDING block\n"); - if(0 == (padding = new FLAC::Metadata::Padding())) - return die_("creating PADDING block"); - if(0 == (app = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("copying object"); - if(!app->set_data(data, 29, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - padding->set_length(0); - if(!insert_to_our_metadata_(padding, our_current_position+1, /*copy=*/false)) - return die_("internal error"); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(true, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]P\tshrink APPLICATION, use padding, last block is padding\n"); - if(0 == (app = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("copying object"); - if(!app->set_data(data, 16, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - dynamic_cast(our_metadata_.blocks[our_current_position+1])->set_length(13); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(true, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]P\tgrow APPLICATION, use padding, last block is padding, but delta is too small\n"); - if(0 == (app = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("copying object"); - if(!app->set_data(data, 50, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(true, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]P\tgrow APPLICATION, use padding, last block is padding of exceeding size\n"); - if(0 == (app = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("copying object"); - if(!app->set_data(data, 56, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - add_to_padding_length_(our_current_position+1, -(56 - 50)); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(true, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]P\tgrow APPLICATION, use padding, last block is padding of exact size\n"); - if(0 == (app = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("copying object"); - if(!app->set_data(data, 67, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - if(!iterator.set_block(app)) - return die_c_("iterator.set_block(app)", chain.status()); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(true, false)", chain.status()); - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV[A]\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]A\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("[S]VA\tinsert PADDING before STREAMINFO (should fail)\n"); - if(0 == (padding = new FLAC::Metadata::Padding())) - return die_("creating PADDING block"); - padding->set_length(30); - if(!iterator.insert_block_before(padding)) - printf("\titerator.insert_block_before() returned false like it should\n"); - else - return die_("iterator.insert_block_before() should have returned false"); - - printf("[S]VA\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]A\tinsert PADDING after\n"); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!iterator.insert_block_after(padding)) - return die_("iterator.insert_block_after(padding)"); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - printf("SV[P]A\tinsert PADDING before\n"); - if(0 == (padding = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("creating PADDING block"); - padding->set_length(17); - if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!iterator.insert_block_before(padding)) - return die_("iterator.insert_block_before(padding)"); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - printf("SV[P]PA\tinsert PADDING before\n"); - if(0 == (padding = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[our_current_position])))) - return die_("creating PADDING block"); - padding->set_length(0); - if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!iterator.insert_block_before(padding)) - return die_("iterator.insert_block_before(padding)"); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - printf("SV[P]PPA\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVP[P]PA\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVPP[P]A\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVPPP[A]\tinsert PADDING after\n"); - if(0 == (padding = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[2])))) - return die_("creating PADDING block"); - padding->set_length(57); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!iterator.insert_block_after(padding)) - return die_("iterator.insert_block_after(padding)"); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - printf("SVPPPA[P]\tinsert PADDING before\n"); - if(0 == (padding = dynamic_cast(FLAC::Metadata::clone(our_metadata_.blocks[2])))) - return die_("creating PADDING block"); - padding->set_length(99); - if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!iterator.insert_block_before(padding)) - return die_("iterator.insert_block_before(padding)"); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - } - our_current_position = 0; - - printf("SVPPPAPP\tmerge padding\n"); - chain.merge_padding(); - add_to_padding_length_(2, FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[3]->get_length()); - add_to_padding_length_(2, FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[4]->get_length()); - add_to_padding_length_(6, FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[7]->get_length()); - delete_from_our_metadata_(7); - delete_from_our_metadata_(4); - delete_from_our_metadata_(3); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(true, false)", chain.status()); - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SVPAP\tsort padding\n"); - chain.sort_padding(); - add_to_padding_length_(4, FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[2]->get_length()); - delete_from_our_metadata_(2); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(true, false)", chain.status()); - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("create iterator\n"); - { - FLAC::Metadata::Iterator iterator; - if(!iterator.is_valid()) - return die_("allocating memory for iterator"); - - our_current_position = 0; - - iterator.init(chain); - - printf("[S]VAP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]AP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[A]P\tdelete middle block, replace with padding\n"); - if(0 == (padding = new FLAC::Metadata::Padding())) - return die_("creating PADDING block"); - padding->set_length(71); - if(!replace_in_our_metadata_(padding, our_current_position--, /*copy=*/false)) - return die_("copying object"); - if(!iterator.delete_block(/*replace_with_padding=*/true)) - return die_c_("iterator.delete_block(true)", chain.status()); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - printf("S[V]PP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]P\tdelete middle block, don't replace with padding\n"); - delete_from_our_metadata_(our_current_position--); - if(!iterator.delete_block(/*replace_with_padding=*/false)) - return die_c_("iterator.delete_block(false)", chain.status()); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - printf("S[V]P\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]\tdelete last block, replace with padding\n"); - if(0 == (padding = new FLAC::Metadata::Padding())) - return die_("creating PADDING block"); - padding->set_length(219); - if(!replace_in_our_metadata_(padding, our_current_position--, /*copy=*/false)) - return die_("copying object"); - if(!iterator.delete_block(/*replace_with_padding=*/true)) - return die_c_("iterator.delete_block(true)", chain.status()); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - printf("S[V]P\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]\tdelete last block, don't replace with padding\n"); - delete_from_our_metadata_(our_current_position--); - if(!iterator.delete_block(/*replace_with_padding=*/false)) - return die_c_("iterator.delete_block(false)", chain.status()); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - printf("S[V]\tprev\n"); - if(!iterator.prev()) - return die_("iterator ended early\n"); - our_current_position--; - - printf("[S]V\tdelete STREAMINFO block, should fail\n"); - if(iterator.delete_block(/*replace_with_padding=*/false)) - return die_("iterator.delete_block() on STREAMINFO should have failed but didn't"); - - block = iterator.get_block(); - if(!compare_chain_(chain, our_current_position, block)) - return false; - delete block; - - } // delete iterator - our_current_position = 0; - - printf("SV\tmerge padding\n"); - chain.merge_padding(); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(false, false)", chain.status()); - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - - printf("SV\tsort padding\n"); - chain.sort_padding(); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during chain.write(false, false)", chain.status()); - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, /*ignore_metadata=*/false)) - return false; - -end: - if(!remove_file_(flacfilename(is_ogg))) - return false; - - return true; -} - -static bool test_level_2_misc_(bool is_ogg) -{ - ::FLAC__IOCallbacks callbacks; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.read = (::FLAC__IOCallback_Read)fread; -#ifdef FLAC__VALGRIND_TESTING - callbacks.write = chain_write_cb_; -#else - callbacks.write = (::FLAC__IOCallback_Write)fwrite; -#endif - callbacks.seek = chain_seek_cb_; - callbacks.tell = chain_tell_cb_; - callbacks.eof = chain_eof_cb_; - - printf("\n\n++++++ testing level 2 interface (mismatched read/write protections)\n"); - - printf("generate file\n"); - - if(!generate_file_(/*include_extras=*/false, is_ogg)) - return false; - - printf("create chain\n"); - FLAC::Metadata::Chain chain; - if(!chain.is_valid()) - return die_("allocating chain"); - - printf("read chain (filename-based)\n"); - - if(!chain.read(flacfilename(is_ogg))) - return die_c_("reading chain", chain.status()); - - printf("write chain with wrong method Chain::write(with callbacks)\n"); - { - if(chain.write(/*use_padding=*/false, 0, callbacks)) - return die_c_("mismatched write should have failed", chain.status()); - if(chain.status() != ::FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH", chain.status()); - printf(" OK: Chain::write(with callbacks) returned false,FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH like it should\n"); - } - - printf("read chain (filename-based)\n"); - - if(!chain.read(flacfilename(is_ogg))) - return die_c_("reading chain", chain.status()); - - printf("write chain with wrong method Chain::write(with callbacks and tempfile)\n"); - { - if(chain.write(/*use_padding=*/false, 0, callbacks, 0, callbacks)) - return die_c_("mismatched write should have failed", chain.status()); - if(chain.status() != ::FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH", chain.status()); - printf(" OK: Chain::write(with callbacks and tempfile) returned false,FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH like it should\n"); - } - - printf("read chain (callback-based)\n"); - { - FILE *file = flac_fopen(flacfilename(is_ogg), "rb"); - if(0 == file) - return die_("opening file"); - if(!chain.read((::FLAC__IOHandle)file, callbacks)) { - fclose(file); - return die_c_("reading chain", chain.status()); - } - fclose(file); - } - - printf("write chain with wrong method write()\n"); - { - if(chain.write(/*use_padding=*/false, /*preserve_file_stats=*/false)) - return die_c_("mismatched write should have failed", chain.status()); - if(chain.status() != ::FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH", chain.status()); - printf(" OK: write() returned false,FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH like it should\n"); - } - - printf("read chain (callback-based)\n"); - { - FILE *file = flac_fopen(flacfilename(is_ogg), "rb"); - if(0 == file) - return die_("opening file"); - if(!chain.read((::FLAC__IOHandle)file, callbacks)) { - fclose(file); - return die_c_("reading chain", chain.status()); - } - fclose(file); - } - - printf("testing Chain::check_if_tempfile_needed()... "); - - if(!chain.check_if_tempfile_needed(/*use_padding=*/false)) - printf("OK: Chain::check_if_tempfile_needed() returned false like it should\n"); - else - return die_("Chain::check_if_tempfile_needed() returned true but shouldn't have"); - - printf("write chain with wrong method Chain::write(with callbacks and tempfile)\n"); - { - if(chain.write(/*use_padding=*/false, 0, callbacks, 0, callbacks)) - return die_c_("mismatched write should have failed", chain.status()); - if(chain.status() != ::FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL", chain.status()); - printf(" OK: Chain::write(with callbacks and tempfile) returned false,FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL like it should\n"); - } - - printf("read chain (callback-based)\n"); - { - FILE *file = flac_fopen(flacfilename(is_ogg), "rb"); - if(0 == file) - return die_("opening file"); - if(!chain.read((::FLAC__IOHandle)file, callbacks)) { - fclose(file); - return die_c_("reading chain", chain.status()); - } - fclose(file); - } - - printf("create iterator\n"); - { - FLAC::Metadata::Iterator iterator; - if(!iterator.is_valid()) - return die_("allocating memory for iterator"); - - iterator.init(chain); - - printf("[S]VP\tnext\n"); - if(!iterator.next()) - return die_("iterator ended early\n"); - - printf("S[V]P\tdelete VORBIS_COMMENT, write\n"); - if(!iterator.delete_block(/*replace_with_padding=*/false)) - return die_c_("block delete failed\n", chain.status()); - - printf("testing Chain::check_if_tempfile_needed()... "); - - if(chain.check_if_tempfile_needed(/*use_padding=*/false)) - printf("OK: Chain::check_if_tempfile_needed() returned true like it should\n"); - else - return die_("Chain::check_if_tempfile_needed() returned false but shouldn't have"); - - printf("write chain with wrong method Chain::write(with callbacks)\n"); - { - if(chain.write(/*use_padding=*/false, 0, callbacks)) - return die_c_("mismatched write should have failed", chain.status()); - if(chain.status() != ::FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL", chain.status()); - printf(" OK: Chain::write(with callbacks) returned false,FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL like it should\n"); - } - - } // delete iterator - - if(!remove_file_(flacfilename(is_ogg))) - return false; - - return true; -} - -bool test_metadata_file_manipulation() -{ - printf("\n+++ libFLAC++ unit test: metadata manipulation\n\n"); - - our_metadata_.num_blocks = 0; - - if(!test_level_0_()) - return false; - - if(!test_level_1_()) - return false; - - if(!test_level_2_(/*filename_based=*/true, /*is_ogg=*/false)) /* filename-based */ - return false; - if(!test_level_2_(/*filename_based=*/false, /*is_ogg=*/false)) /* callback-based */ - return false; - if(!test_level_2_misc_(/*is_ogg=*/false)) - return false; - - if(FLAC_API_SUPPORTS_OGG_FLAC) { - if(!test_level_2_(/*filename_based=*/true, /*is_ogg=*/true)) /* filename-based */ - return false; - if(!test_level_2_(/*filename_based=*/false, /*is_ogg=*/true)) /* callback-based */ - return false; -#if 0 - /* when ogg flac write is supported, will have to add this: */ - if(!test_level_2_misc_(/*is_ogg=*/true)) - return false; -#endif - } - - return true; -} diff --git a/src/test_libFLAC++/metadata_object.cpp b/src/test_libFLAC++/metadata_object.cpp deleted file mode 100644 index d46c1c20..00000000 --- a/src/test_libFLAC++/metadata_object.cpp +++ /dev/null @@ -1,2099 +0,0 @@ -/* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include /* for malloc() */ -#include /* for memcmp() */ -#include "FLAC/assert.h" -#include "FLAC++/metadata.h" -#include "share/safe_str.h" - -static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application_, vorbiscomment_, cuesheet_, picture_; - -static bool die_(const char *msg) -{ - printf("FAILED, %s\n", msg); - return false; -} - -static void *malloc_or_die_(size_t size) -{ - void *x = malloc(size); - if(0 == x) { - fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size); - exit(1); - } - return x; -} - -static char *strdup_or_die_(const char *s) -{ - char *x = strdup(s); - if(0 == x) { - fprintf(stderr, "ERROR: out of memory copying string \"%s\"\n", s); - exit(1); - } - return x; -} - -static bool index_is_equal_(const ::FLAC__StreamMetadata_CueSheet_Index &indx, const ::FLAC__StreamMetadata_CueSheet_Index &indxcopy) -{ - if(indxcopy.offset != indx.offset) - return false; - if(indxcopy.number != indx.number) - return false; - return true; -} - -static bool track_is_equal_(const ::FLAC__StreamMetadata_CueSheet_Track *track, const ::FLAC__StreamMetadata_CueSheet_Track *trackcopy) -{ - uint32_t i; - - if(trackcopy->offset != track->offset) - return false; - if(trackcopy->number != track->number) - return false; - if(0 != strcmp(trackcopy->isrc, track->isrc)) - return false; - if(trackcopy->type != track->type) - return false; - if(trackcopy->pre_emphasis != track->pre_emphasis) - return false; - if(trackcopy->num_indices != track->num_indices) - return false; - if(0 == track->indices || 0 == trackcopy->indices) { - if(track->indices != trackcopy->indices) - return false; - } - else { - for(i = 0; i < track->num_indices; i++) { - if(!index_is_equal_(trackcopy->indices[i], track->indices[i])) - return false; - } - } - return true; -} - -static void init_metadata_blocks_() -{ - streaminfo_.is_last = false; - streaminfo_.type = ::FLAC__METADATA_TYPE_STREAMINFO; - streaminfo_.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; - streaminfo_.data.stream_info.min_blocksize = 576; - streaminfo_.data.stream_info.max_blocksize = 576; - streaminfo_.data.stream_info.min_framesize = 0; - streaminfo_.data.stream_info.max_framesize = 0; - streaminfo_.data.stream_info.sample_rate = 44100; - streaminfo_.data.stream_info.channels = 1; - streaminfo_.data.stream_info.bits_per_sample = 8; - streaminfo_.data.stream_info.total_samples = 0; - memset(streaminfo_.data.stream_info.md5sum, 0, 16); - - padding_.is_last = false; - padding_.type = ::FLAC__METADATA_TYPE_PADDING; - padding_.length = 1234; - - seektable_.is_last = false; - seektable_.type = ::FLAC__METADATA_TYPE_SEEKTABLE; - seektable_.data.seek_table.num_points = 2; - seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; - seektable_.data.seek_table.points = (::FLAC__StreamMetadata_SeekPoint*)malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(::FLAC__StreamMetadata_SeekPoint)); - seektable_.data.seek_table.points[0].sample_number = 0; - seektable_.data.seek_table.points[0].stream_offset = 0; - seektable_.data.seek_table.points[0].frame_samples = streaminfo_.data.stream_info.min_blocksize; - seektable_.data.seek_table.points[1].sample_number = ::FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; - seektable_.data.seek_table.points[1].stream_offset = 1000; - seektable_.data.seek_table.points[1].frame_samples = streaminfo_.data.stream_info.min_blocksize; - - application_.is_last = false; - application_.type = ::FLAC__METADATA_TYPE_APPLICATION; - application_.length = 8; - memcpy(application_.data.application.id, "\xfe\xdc\xba\x98", 4); - application_.data.application.data = (FLAC__byte*)malloc_or_die_(4); - memcpy(application_.data.application.data, "\xf0\xe1\xd2\xc3", 4); - - vorbiscomment_.is_last = false; - vorbiscomment_.type = ::FLAC__METADATA_TYPE_VORBIS_COMMENT; - vorbiscomment_.length = (4 + 5) + 4 + (4 + 12) + (4 + 12); - vorbiscomment_.data.vorbis_comment.vendor_string.length = 5; - vorbiscomment_.data.vorbis_comment.vendor_string.entry = (FLAC__byte*)malloc_or_die_(5+1); - memcpy(vorbiscomment_.data.vorbis_comment.vendor_string.entry, "name0", 5+1); - vorbiscomment_.data.vorbis_comment.num_comments = 2; - vorbiscomment_.data.vorbis_comment.comments = (::FLAC__StreamMetadata_VorbisComment_Entry*)malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(::FLAC__StreamMetadata_VorbisComment_Entry)); - vorbiscomment_.data.vorbis_comment.comments[0].length = 12; - vorbiscomment_.data.vorbis_comment.comments[0].entry = (FLAC__byte*)malloc_or_die_(12+1); - memcpy(vorbiscomment_.data.vorbis_comment.comments[0].entry, "name2=value2", 12+1); - vorbiscomment_.data.vorbis_comment.comments[1].length = 12; - vorbiscomment_.data.vorbis_comment.comments[1].entry = (FLAC__byte*)malloc_or_die_(12+1); - memcpy(vorbiscomment_.data.vorbis_comment.comments[1].entry, "name3=value3", 12+1); - - cuesheet_.is_last = false; - cuesheet_.type = ::FLAC__METADATA_TYPE_CUESHEET; - cuesheet_.length = - /* cuesheet guts */ - ( - FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN + - FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + - FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN + - FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN - ) / 8 + - /* 2 tracks */ - 2 * ( - FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN - ) / 8 + - /* 3 index points */ - 3 * ( - FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN + - FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN - ) / 8 - ; - memset(cuesheet_.data.cue_sheet.media_catalog_number, 0, sizeof(cuesheet_.data.cue_sheet.media_catalog_number)); - cuesheet_.data.cue_sheet.media_catalog_number[0] = 'j'; - cuesheet_.data.cue_sheet.media_catalog_number[1] = 'C'; - cuesheet_.data.cue_sheet.lead_in = 159; - cuesheet_.data.cue_sheet.is_cd = true; - cuesheet_.data.cue_sheet.num_tracks = 2; - cuesheet_.data.cue_sheet.tracks = (FLAC__StreamMetadata_CueSheet_Track*)malloc_or_die_(cuesheet_.data.cue_sheet.num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track)); - cuesheet_.data.cue_sheet.tracks[0].offset = 1; - cuesheet_.data.cue_sheet.tracks[0].number = 1; - memcpy(cuesheet_.data.cue_sheet.tracks[0].isrc, "ACBDE1234567", sizeof(cuesheet_.data.cue_sheet.tracks[0].isrc)); - cuesheet_.data.cue_sheet.tracks[0].type = 0; - cuesheet_.data.cue_sheet.tracks[0].pre_emphasis = 1; - cuesheet_.data.cue_sheet.tracks[0].num_indices = 2; - cuesheet_.data.cue_sheet.tracks[0].indices = (FLAC__StreamMetadata_CueSheet_Index*)malloc_or_die_(cuesheet_.data.cue_sheet.tracks[0].num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index)); - cuesheet_.data.cue_sheet.tracks[0].indices[0].offset = 0; - cuesheet_.data.cue_sheet.tracks[0].indices[0].number = 0; - cuesheet_.data.cue_sheet.tracks[0].indices[1].offset = 1234567890; - cuesheet_.data.cue_sheet.tracks[0].indices[1].number = 1; - cuesheet_.data.cue_sheet.tracks[1].offset = 2345678901u; - cuesheet_.data.cue_sheet.tracks[1].number = 2; - memcpy(cuesheet_.data.cue_sheet.tracks[1].isrc, "ACBDE7654321", sizeof(cuesheet_.data.cue_sheet.tracks[1].isrc)); - cuesheet_.data.cue_sheet.tracks[1].type = 1; - cuesheet_.data.cue_sheet.tracks[1].pre_emphasis = 0; - cuesheet_.data.cue_sheet.tracks[1].num_indices = 1; - cuesheet_.data.cue_sheet.tracks[1].indices = (FLAC__StreamMetadata_CueSheet_Index*)malloc_or_die_(cuesheet_.data.cue_sheet.tracks[1].num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index)); - cuesheet_.data.cue_sheet.tracks[1].indices[0].offset = 0; - cuesheet_.data.cue_sheet.tracks[1].indices[0].number = 1; - - picture_.is_last = true; - picture_.type = FLAC__METADATA_TYPE_PICTURE; - picture_.length = - ( - FLAC__STREAM_METADATA_PICTURE_TYPE_LEN + - FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN + /* will add the length for the string later */ - FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN + /* will add the length for the string later */ - FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN + - FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN + - FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN + - FLAC__STREAM_METADATA_PICTURE_COLORS_LEN + - FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN /* will add the length for the data later */ - ) / 8 - ; - picture_.data.picture.type = FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER; - picture_.data.picture.mime_type = strdup_or_die_("image/jpeg"); - picture_.length += strlen(picture_.data.picture.mime_type); - picture_.data.picture.description = (FLAC__byte*)strdup_or_die_("desc"); - picture_.length += strlen((const char *)picture_.data.picture.description); - picture_.data.picture.width = 300; - picture_.data.picture.height = 300; - picture_.data.picture.depth = 24; - picture_.data.picture.colors = 0; - picture_.data.picture.data = (FLAC__byte*)strdup_or_die_("SOMEJPEGDATA"); - picture_.data.picture.data_length = strlen((const char *)picture_.data.picture.data); - picture_.length += picture_.data.picture.data_length; -} - -static void free_metadata_blocks_() -{ - free(seektable_.data.seek_table.points); - free(application_.data.application.data); - free(vorbiscomment_.data.vorbis_comment.vendor_string.entry); - free(vorbiscomment_.data.vorbis_comment.comments[0].entry); - free(vorbiscomment_.data.vorbis_comment.comments[1].entry); - free(vorbiscomment_.data.vorbis_comment.comments); - free(cuesheet_.data.cue_sheet.tracks[0].indices); - free(cuesheet_.data.cue_sheet.tracks[1].indices); - free(cuesheet_.data.cue_sheet.tracks); - free(picture_.data.picture.mime_type); - free(picture_.data.picture.description); - free(picture_.data.picture.data); -} - -bool test_metadata_object_streaminfo() -{ - uint32_t expected_length; - - printf("testing class FLAC::Metadata::StreamInfo\n"); - - printf("testing StreamInfo::StreamInfo()... "); - FLAC::Metadata::StreamInfo block; - if(!block.is_valid()) - return die_("!block.is_valid()"); - expected_length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; - if(block.get_length() != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); - return false; - } - printf("OK\n"); - - printf("testing StreamInfo::StreamInfo(const StreamInfo &)... +\n"); - printf(" StreamInfo::operator!=(const StreamInfo &)... "); - { - FLAC::Metadata::StreamInfo blockcopy(block); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != block) - return die_("copy is not identical to original"); - printf("OK\n"); - - printf("testing StreamInfo::~StreamInfo()... "); - } - printf("OK\n"); - - printf("testing StreamInfo::StreamInfo(const ::FLAC__StreamMetadata &)... +\n"); - printf(" StreamInfo::operator!=(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::StreamInfo blockcopy(streaminfo_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != streaminfo_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing StreamInfo::StreamInfo(const ::FLAC__StreamMetadata *)... +\n"); - printf(" StreamInfo::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::StreamInfo blockcopy(&streaminfo_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != streaminfo_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing StreamInfo::StreamInfo(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" StreamInfo::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::StreamInfo blockcopy(&streaminfo_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != streaminfo_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing StreamInfo::StreamInfo(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" StreamInfo::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&streaminfo_); - FLAC::Metadata::StreamInfo blockcopy(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != streaminfo_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing StreamInfo::assign(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" StreamInfo::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::StreamInfo blockcopy; - blockcopy.assign(&streaminfo_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != streaminfo_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing StreamInfo::assign(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" StreamInfo::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&streaminfo_); - FLAC::Metadata::StreamInfo blockcopy; - blockcopy.assign(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != streaminfo_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing StreamInfo::operator=(const StreamInfo &)... +\n"); - printf(" StreamInfo::operator==(const StreamInfo &)... "); - { - FLAC::Metadata::StreamInfo blockcopy = block; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == block)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing StreamInfo::operator=(const ::FLAC__StreamMetadata &)... +\n"); - printf(" StreamInfo::operator==(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::StreamInfo blockcopy = streaminfo_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == streaminfo_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing StreamInfo::operator=(const ::FLAC__StreamMetadata *)... +\n"); - printf(" StreamInfo::operator==(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::StreamInfo blockcopy = &streaminfo_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == streaminfo_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing StreamInfo::set_min_blocksize()... "); - block.set_min_blocksize(streaminfo_.data.stream_info.min_blocksize); - printf("OK\n"); - - printf("testing StreamInfo::set_max_blocksize()... "); - block.set_max_blocksize(streaminfo_.data.stream_info.max_blocksize); - printf("OK\n"); - - printf("testing StreamInfo::set_min_framesize()... "); - block.set_min_framesize(streaminfo_.data.stream_info.min_framesize); - printf("OK\n"); - - printf("testing StreamInfo::set_max_framesize()... "); - block.set_max_framesize(streaminfo_.data.stream_info.max_framesize); - printf("OK\n"); - - printf("testing StreamInfo::set_sample_rate()... "); - block.set_sample_rate(streaminfo_.data.stream_info.sample_rate); - printf("OK\n"); - - printf("testing StreamInfo::set_channels()... "); - block.set_channels(streaminfo_.data.stream_info.channels); - printf("OK\n"); - - printf("testing StreamInfo::set_bits_per_sample()... "); - block.set_bits_per_sample(streaminfo_.data.stream_info.bits_per_sample); - printf("OK\n"); - - printf("testing StreamInfo::set_total_samples()... "); - block.set_total_samples(streaminfo_.data.stream_info.total_samples); - printf("OK\n"); - - printf("testing StreamInfo::set_md5sum()... "); - block.set_md5sum(streaminfo_.data.stream_info.md5sum); - printf("OK\n"); - - printf("testing StreamInfo::get_min_blocksize()... "); - if(block.get_min_blocksize() != streaminfo_.data.stream_info.min_blocksize) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing StreamInfo::get_max_blocksize()... "); - if(block.get_max_blocksize() != streaminfo_.data.stream_info.max_blocksize) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing StreamInfo::get_min_framesize()... "); - if(block.get_min_framesize() != streaminfo_.data.stream_info.min_framesize) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing StreamInfo::get_max_framesize()... "); - if(block.get_max_framesize() != streaminfo_.data.stream_info.max_framesize) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing StreamInfo::get_sample_rate()... "); - if(block.get_sample_rate() != streaminfo_.data.stream_info.sample_rate) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing StreamInfo::get_channels()... "); - if(block.get_channels() != streaminfo_.data.stream_info.channels) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing StreamInfo::get_bits_per_sample()... "); - if(block.get_bits_per_sample() != streaminfo_.data.stream_info.bits_per_sample) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing StreamInfo::get_total_samples()... "); - if(block.get_total_samples() != streaminfo_.data.stream_info.total_samples) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing StreamInfo::get_md5sum()... "); - if(0 != memcmp(block.get_md5sum(), streaminfo_.data.stream_info.md5sum, 16)) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); - FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block); - if(0 == clone_) - return die_("returned NULL"); - if(0 == dynamic_cast(clone_)) - return die_("downcast is NULL"); - if(*dynamic_cast(clone_) != block) - return die_("clone is not identical"); - printf("OK\n"); - printf("testing StreamInfo::~StreamInfo()... "); - delete clone_; - printf("OK\n"); - - - printf("PASSED\n\n"); - return true; -} - -bool test_metadata_object_padding() -{ - uint32_t expected_length; - - printf("testing class FLAC::Metadata::Padding\n"); - - printf("testing Padding::Padding()... "); - FLAC::Metadata::Padding block; - if(!block.is_valid()) - return die_("!block.is_valid()"); - expected_length = 0; - if(block.get_length() != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); - return false; - } - printf("OK\n"); - - printf("testing Padding::Padding(const Padding &)... +\n"); - printf(" Padding::operator!=(const Padding &)... "); - { - FLAC::Metadata::Padding blockcopy(block); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != block) - return die_("copy is not identical to original"); - printf("OK\n"); - - printf("testing Padding::~Padding()... "); - } - printf("OK\n"); - - printf("testing Padding::Padding(const ::FLAC__StreamMetadata &)... +\n"); - printf(" Padding::operator!=(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::Padding blockcopy(padding_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != padding_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Padding::Padding(const ::FLAC__StreamMetadata *)... +\n"); - printf(" Padding::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Padding blockcopy(&padding_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != padding_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Padding::Padding(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" Padding::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Padding blockcopy(&padding_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != padding_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Padding::Padding(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" Padding::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&padding_); - FLAC::Metadata::Padding blockcopy(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != padding_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Padding::assign(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" Padding::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Padding blockcopy; - blockcopy.assign(&padding_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != padding_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Padding::assign(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" Padding::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&padding_); - FLAC::Metadata::Padding blockcopy; - blockcopy.assign(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != padding_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Padding::operator=(const Padding &)... +\n"); - printf(" Padding::operator==(const Padding &)... "); - { - FLAC::Metadata::Padding blockcopy = block; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == block)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Padding::operator=(const ::FLAC__StreamMetadata &)... +\n"); - printf(" Padding::operator==(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::Padding blockcopy = padding_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == padding_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Padding::operator=(const ::FLAC__StreamMetadata *)... +\n"); - printf(" Padding::operator==(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Padding blockcopy = &padding_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == padding_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Padding::set_length()... "); - block.set_length(padding_.length); - printf("OK\n"); - - printf("testing Prototype::get_length()... "); - if(block.get_length() != padding_.length) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); - FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block); - if(0 == clone_) - return die_("returned NULL"); - if(0 == dynamic_cast(clone_)) - return die_("downcast is NULL"); - if(*dynamic_cast(clone_) != block) - return die_("clone is not identical"); - printf("OK\n"); - printf("testing Padding::~Padding()... "); - delete clone_; - printf("OK\n"); - - - printf("PASSED\n\n"); - return true; -} - -bool test_metadata_object_application() -{ - uint32_t expected_length; - - printf("testing class FLAC::Metadata::Application\n"); - - printf("testing Application::Application()... "); - FLAC::Metadata::Application block; - if(!block.is_valid()) - return die_("!block.is_valid()"); - expected_length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; - if(block.get_length() != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); - return false; - } - printf("OK\n"); - - printf("testing Application::Application(const Application &)... +\n"); - printf(" Application::operator!=(const Application &)... "); - { - FLAC::Metadata::Application blockcopy(block); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != block) - return die_("copy is not identical to original"); - printf("OK\n"); - - printf("testing Application::~Application()... "); - } - printf("OK\n"); - - printf("testing Application::Application(const ::FLAC__StreamMetadata &)... +\n"); - printf(" Application::operator!=(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::Application blockcopy(application_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != application_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Application::Application(const ::FLAC__StreamMetadata *)... +\n"); - printf(" Application::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Application blockcopy(&application_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != application_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Application::Application(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" Application::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Application blockcopy(&application_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != application_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Application::Application(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" Application::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&application_); - FLAC::Metadata::Application blockcopy(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != application_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Application::assign(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" Application::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Application blockcopy; - blockcopy.assign(&application_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != application_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Application::assign(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" Application::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&application_); - FLAC::Metadata::Application blockcopy; - blockcopy.assign(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != application_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Application::operator=(const Application &)... +\n"); - printf(" Application::operator==(const Application &)... "); - { - FLAC::Metadata::Application blockcopy = block; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == block)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Application::operator=(const ::FLAC__StreamMetadata &)... +\n"); - printf(" Application::operator==(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::Application blockcopy = application_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == application_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Application::operator=(const ::FLAC__StreamMetadata *)... +\n"); - printf(" Application::operator==(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Application blockcopy = &application_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == application_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Application::set_id()... "); - block.set_id(application_.data.application.id); - printf("OK\n"); - - printf("testing Application::set_data()... "); - block.set_data(application_.data.application.data, application_.length - sizeof(application_.data.application.id), /*copy=*/true); - printf("OK\n"); - - printf("testing Application::get_id()... "); - if(0 != memcmp(block.get_id(), application_.data.application.id, sizeof(application_.data.application.id))) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing Application::get_data()... "); - if(0 != memcmp(block.get_data(), application_.data.application.data, application_.length - sizeof(application_.data.application.id))) - return die_("value mismatch, doesn't match previously set value"); - printf("OK\n"); - - printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); - FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block); - if(0 == clone_) - return die_("returned NULL"); - if(0 == dynamic_cast(clone_)) - return die_("downcast is NULL"); - if(*dynamic_cast(clone_) != block) - return die_("clone is not identical"); - printf("OK\n"); - printf("testing Application::~Application()... "); - delete clone_; - printf("OK\n"); - - - printf("PASSED\n\n"); - return true; -} - -bool test_metadata_object_seektable() -{ - uint32_t expected_length; - - printf("testing class FLAC::Metadata::SeekTable\n"); - - printf("testing SeekTable::SeekTable()... "); - FLAC::Metadata::SeekTable block; - if(!block.is_valid()) - return die_("!block.is_valid()"); - expected_length = 0; - if(block.get_length() != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); - return false; - } - printf("OK\n"); - - printf("testing SeekTable::SeekTable(const SeekTable &)... +\n"); - printf(" SeekTable::operator!=(const SeekTable &)... "); - { - FLAC::Metadata::SeekTable blockcopy(block); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != block) - return die_("copy is not identical to original"); - printf("OK\n"); - - printf("testing SeekTable::~SeekTable()... "); - } - printf("OK\n"); - - printf("testing SeekTable::SeekTable(const ::FLAC__StreamMetadata &)... +\n"); - printf(" SeekTable::operator!=(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::SeekTable blockcopy(seektable_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != seektable_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing SeekTable::SeekTable(const ::FLAC__StreamMetadata *)... +\n"); - printf(" SeekTable::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::SeekTable blockcopy(&seektable_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != seektable_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing SeekTable::SeekTable(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" SeekTable::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::SeekTable blockcopy(&seektable_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != seektable_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing SeekTable::SeekTable(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" SeekTable::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&seektable_); - FLAC::Metadata::SeekTable blockcopy(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != seektable_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing SeekTable::assign(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" SeekTable::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::SeekTable blockcopy; - blockcopy.assign(&seektable_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != seektable_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing SeekTable::assign(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" SeekTable::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&seektable_); - FLAC::Metadata::SeekTable blockcopy; - blockcopy.assign(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != seektable_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing SeekTable::operator=(const SeekTable &)... +\n"); - printf(" SeekTable::operator==(const SeekTable &)... "); - { - FLAC::Metadata::SeekTable blockcopy = block; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == block)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing SeekTable::operator=(const ::FLAC__StreamMetadata &)... +\n"); - printf(" SeekTable::operator==(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::SeekTable blockcopy = seektable_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == seektable_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing SeekTable::operator=(const ::FLAC__StreamMetadata *)... +\n"); - printf(" SeekTable::operator==(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::SeekTable blockcopy = &seektable_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == seektable_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing SeekTable::insert_point() x 3... "); - if(!block.insert_point(0, seektable_.data.seek_table.points[1])) - return die_("returned false"); - if(!block.insert_point(0, seektable_.data.seek_table.points[1])) - return die_("returned false"); - if(!block.insert_point(1, seektable_.data.seek_table.points[0])) - return die_("returned false"); - printf("OK\n"); - - printf("testing SeekTable::is_legal()... "); - if(block.is_legal()) - return die_("returned true"); - printf("OK\n"); - - printf("testing SeekTable::set_point()... "); - block.set_point(0, seektable_.data.seek_table.points[0]); - printf("OK\n"); - - printf("testing SeekTable::delete_point()... "); - if(!block.delete_point(0)) - return die_("returned false"); - printf("OK\n"); - - printf("testing SeekTable::is_legal()... "); - if(!block.is_legal()) - return die_("returned false"); - printf("OK\n"); - - printf("testing SeekTable::get_num_points()... "); - if(block.get_num_points() != seektable_.data.seek_table.num_points) - return die_("number mismatch"); - printf("OK\n"); - - printf("testing SeekTable::operator!=(const ::FLAC__StreamMetadata &)... "); - if(block != seektable_) - return die_("data mismatch"); - printf("OK\n"); - - printf("testing SeekTable::get_point()... "); - if( - block.get_point(1).sample_number != seektable_.data.seek_table.points[1].sample_number || - block.get_point(1).stream_offset != seektable_.data.seek_table.points[1].stream_offset || - block.get_point(1).frame_samples != seektable_.data.seek_table.points[1].frame_samples - ) - return die_("point mismatch"); - printf("OK\n"); - - printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); - FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block); - if(0 == clone_) - return die_("returned NULL"); - if(0 == dynamic_cast(clone_)) - return die_("downcast is NULL"); - if(*dynamic_cast(clone_) != block) - return die_("clone is not identical"); - printf("OK\n"); - printf("testing SeekTable::~SeekTable()... "); - delete clone_; - printf("OK\n"); - - - printf("PASSED\n\n"); - return true; -} - -bool test_metadata_object_vorbiscomment() -{ - uint32_t expected_length; - - printf("testing class FLAC::Metadata::VorbisComment::Entry\n"); - - printf("testing Entry::Entry()... "); - { - FLAC::Metadata::VorbisComment::Entry entry1; - if(!entry1.is_valid()) - return die_("!is_valid()"); - printf("OK\n"); - - printf("testing Entry::~Entry()... "); - } - printf("OK\n"); - - printf("testing Entry::Entry(const char *field, uint32_t field_length)... "); - FLAC::Metadata::VorbisComment::Entry entry2("name2=value2", strlen("name2=value2")); - if(!entry2.is_valid()) - return die_("!is_valid()"); - printf("OK\n"); - - { - printf("testing Entry::Entry(const char *field)... "); - FLAC::Metadata::VorbisComment::Entry entry2z("name2=value2"); - if(!entry2z.is_valid()) - return die_("!is_valid()"); - if(strcmp(entry2.get_field(), entry2z.get_field())) - return die_("bad value"); - printf("OK\n"); - } - - printf("testing Entry::Entry(const char *field_name, const char *field_value, uint32_t field_value_length)... "); - FLAC::Metadata::VorbisComment::Entry entry3("name3", "value3", strlen("value3")); - if(!entry3.is_valid()) - return die_("!is_valid()"); - printf("OK\n"); - - { - printf("testing Entry::Entry(const char *field_name, const char *field_value)... "); - FLAC::Metadata::VorbisComment::Entry entry3z("name3", "value3"); - if(!entry3z.is_valid()) - return die_("!is_valid()"); - if(strcmp(entry3.get_field(), entry3z.get_field())) - return die_("bad value"); - printf("OK\n"); - } - - printf("testing Entry::Entry(const Entry &entry)... "); - { - FLAC::Metadata::VorbisComment::Entry entry2copy(entry2); - if(!entry2copy.is_valid()) - return die_("!is_valid()"); - printf("OK\n"); - - printf("testing Entry::~Entry()... "); - } - printf("OK\n"); - - printf("testing Entry::operator=(const Entry &entry)... "); - FLAC::Metadata::VorbisComment::Entry entry1 = entry2; - if(!entry2.is_valid()) - return die_("!is_valid()"); - printf("OK\n"); - - printf("testing Entry::get_field_length()... "); - if(entry1.get_field_length() != strlen("name2=value2")) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Entry::get_field_name_length()... "); - if(entry1.get_field_name_length() != strlen("name2")) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Entry::get_field_value_length()... "); - if(entry1.get_field_value_length() != strlen("value2")) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Entry::get_entry()... "); - { - ::FLAC__StreamMetadata_VorbisComment_Entry entry = entry1.get_entry(); - if(entry.length != strlen("name2=value2")) - return die_("entry length mismatch"); - if(0 != memcmp(entry.entry, "name2=value2", entry.length)) - return die_("entry value mismatch"); - } - printf("OK\n"); - - printf("testing Entry::get_field()... "); - if(0 != memcmp(entry1.get_field(), "name2=value2", strlen("name2=value2"))) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Entry::get_field_name()... "); - if(0 != memcmp(entry1.get_field_name(), "name2", strlen("name2"))) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Entry::get_field_value()... "); - if(0 != memcmp(entry1.get_field_value(), "value2", strlen("value2"))) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Entry::set_field_name()... "); - if(!entry1.set_field_name("name1")) - return die_("returned false"); - if(0 != memcmp(entry1.get_field_name(), "name1", strlen("name1"))) - return die_("value mismatch"); - if(0 != memcmp(entry1.get_field(), "name1=value2", strlen("name1=value2"))) - return die_("entry mismatch"); - printf("OK\n"); - - printf("testing Entry::set_field_value(const char *field_value, uint32_t field_value_length)... "); - if(!entry1.set_field_value("value1", strlen("value1"))) - return die_("returned false"); - if(0 != memcmp(entry1.get_field_value(), "value1", strlen("value1"))) - return die_("value mismatch"); - if(0 != memcmp(entry1.get_field(), "name1=value1", strlen("name1=value1"))) - return die_("entry mismatch"); - printf("OK\n"); - - printf("testing Entry::set_field_value(const char *field_value)... "); - if(!entry1.set_field_value("value1")) - return die_("returned false"); - if(0 != memcmp(entry1.get_field_value(), "value1", strlen("value1"))) - return die_("value mismatch"); - if(0 != memcmp(entry1.get_field(), "name1=value1", strlen("name1=value1"))) - return die_("entry mismatch"); - printf("OK\n"); - - printf("testing Entry::set_field(const char *field, uint32_t field_length)... "); - if(!entry1.set_field("name0=value0", strlen("name0=value0"))) - return die_("returned false"); - if(0 != memcmp(entry1.get_field_name(), "name0", strlen("name0"))) - return die_("value mismatch"); - if(0 != memcmp(entry1.get_field_value(), "value0", strlen("value0"))) - return die_("value mismatch"); - if(0 != memcmp(entry1.get_field(), "name0=value0", strlen("name0=value0"))) - return die_("entry mismatch"); - printf("OK\n"); - - printf("testing Entry::set_field(const char *field)... "); - if(!entry1.set_field("name0=value0")) - return die_("returned false"); - if(0 != memcmp(entry1.get_field_name(), "name0", strlen("name0"))) - return die_("value mismatch"); - if(0 != memcmp(entry1.get_field_value(), "value0", strlen("value0"))) - return die_("value mismatch"); - if(0 != memcmp(entry1.get_field(), "name0=value0", strlen("name0=value0"))) - return die_("entry mismatch"); - printf("OK\n"); - - printf("PASSED\n\n"); - - - printf("testing class FLAC::Metadata::VorbisComment\n"); - - printf("testing VorbisComment::VorbisComment()... "); - FLAC::Metadata::VorbisComment block; - if(!block.is_valid()) - return die_("!block.is_valid()"); - expected_length = (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + strlen(::FLAC__VENDOR_STRING) + FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN/8); - if(block.get_length() != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); - return false; - } - printf("OK\n"); - - printf("testing VorbisComment::VorbisComment(const VorbisComment &)... +\n"); - printf(" VorbisComment::operator!=(const VorbisComment &)... "); - { - FLAC::Metadata::VorbisComment blockcopy(block); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != block) - return die_("copy is not identical to original"); - printf("OK\n"); - - printf("testing VorbisComment::~VorbisComment()... "); - } - printf("OK\n"); - - printf("testing VorbisComment::VorbisComment(const ::FLAC__StreamMetadata &)... +\n"); - printf(" VorbisComment::operator!=(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::VorbisComment blockcopy(vorbiscomment_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != vorbiscomment_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing VorbisComment::VorbisComment(const ::FLAC__StreamMetadata *)... +\n"); - printf(" VorbisComment::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::VorbisComment blockcopy(&vorbiscomment_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != vorbiscomment_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing VorbisComment::VorbisComment(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" VorbisComment::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::VorbisComment blockcopy(&vorbiscomment_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != vorbiscomment_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing VorbisComment::VorbisComment(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" VorbisComment::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&vorbiscomment_); - FLAC::Metadata::VorbisComment blockcopy(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != vorbiscomment_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing VorbisComment::assign(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" VorbisComment::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::VorbisComment blockcopy; - blockcopy.assign(&vorbiscomment_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != vorbiscomment_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing VorbisComment::assign(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" VorbisComment::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&vorbiscomment_); - FLAC::Metadata::VorbisComment blockcopy; - blockcopy.assign(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != vorbiscomment_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing VorbisComment::operator=(const VorbisComment &)... +\n"); - printf(" VorbisComment::operator==(const VorbisComment &)... "); - { - FLAC::Metadata::VorbisComment blockcopy = block; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == block)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing VorbisComment::operator=(const ::FLAC__StreamMetadata &)... +\n"); - printf(" VorbisComment::operator==(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::VorbisComment blockcopy = vorbiscomment_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == vorbiscomment_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing VorbisComment::operator=(const ::FLAC__StreamMetadata *)... +\n"); - printf(" VorbisComment::operator==(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::VorbisComment blockcopy = &vorbiscomment_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == vorbiscomment_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing VorbisComment::get_num_comments()... "); - if(block.get_num_comments() != 0) - return die_("value mismatch, expected 0"); - printf("OK\n"); - - printf("testing VorbisComment::set_vendor_string()... "); - if(!block.set_vendor_string((const FLAC__byte *)"mame0")) - return die_("returned false"); - printf("OK\n"); - vorbiscomment_.data.vorbis_comment.vendor_string.entry[0] = 'm'; - - printf("testing VorbisComment::get_vendor_string()... "); - if(strlen((const char *)block.get_vendor_string()) != vorbiscomment_.data.vorbis_comment.vendor_string.length) - return die_("length mismatch"); - if(0 != memcmp(block.get_vendor_string(), vorbiscomment_.data.vorbis_comment.vendor_string.entry, vorbiscomment_.data.vorbis_comment.vendor_string.length)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing VorbisComment::append_comment()... +\n"); - printf(" VorbisComment::get_comment()... "); - if(!block.append_comment(entry3)) - return die_("returned false"); - if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[1].length) - return die_("length mismatch"); - if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[1].entry, vorbiscomment_.data.vorbis_comment.comments[1].length)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing VorbisComment::append_comment()... +\n"); - printf(" VorbisComment::get_comment()... "); - if(!block.append_comment(entry2)) - return die_("returned false"); - if(block.get_comment(1).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[0].length) - return die_("length mismatch"); - if(0 != memcmp(block.get_comment(1).get_field(), vorbiscomment_.data.vorbis_comment.comments[0].entry, vorbiscomment_.data.vorbis_comment.comments[0].length)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing VorbisComment::delete_comment()... +\n"); - printf(" VorbisComment::get_comment()... "); - if(!block.delete_comment(0)) - return die_("returned false"); - if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[0].length) - return die_("length[0] mismatch"); - if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[0].entry, vorbiscomment_.data.vorbis_comment.comments[0].length)) - return die_("value[0] mismatch"); - printf("OK\n"); - - printf("testing VorbisComment::delete_comment()... +\n"); - printf(" VorbisComment::get_comment()... "); - if(!block.delete_comment(0)) - return die_("returned false"); - if(block.get_num_comments() != 0) - return die_("block mismatch, expected num_comments = 0"); - printf("OK\n"); - - printf("testing VorbisComment::insert_comment()... +\n"); - printf(" VorbisComment::get_comment()... "); - if(!block.insert_comment(0, entry3)) - return die_("returned false"); - if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[1].length) - return die_("length mismatch"); - if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[1].entry, vorbiscomment_.data.vorbis_comment.comments[1].length)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing VorbisComment::insert_comment()... +\n"); - printf(" VorbisComment::get_comment()... "); - if(!block.insert_comment(0, entry3)) - return die_("returned false"); - if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[1].length) - return die_("length mismatch"); - if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[1].entry, vorbiscomment_.data.vorbis_comment.comments[1].length)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing VorbisComment::insert_comment()... +\n"); - printf(" VorbisComment::get_comment()... "); - if(!block.insert_comment(1, entry2)) - return die_("returned false"); - if(block.get_comment(1).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[0].length) - return die_("length mismatch"); - if(0 != memcmp(block.get_comment(1).get_field(), vorbiscomment_.data.vorbis_comment.comments[0].entry, vorbiscomment_.data.vorbis_comment.comments[0].length)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing VorbisComment::set_comment()... +\n"); - printf(" VorbisComment::get_comment()... "); - if(!block.set_comment(0, entry2)) - return die_("returned false"); - if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[0].length) - return die_("length mismatch"); - if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[0].entry, vorbiscomment_.data.vorbis_comment.comments[0].length)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing VorbisComment::delete_comment()... +\n"); - printf(" VorbisComment::get_comment()... "); - if(!block.delete_comment(0)) - return die_("returned false"); - if(block.get_comment(0).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[0].length) - return die_("length[0] mismatch"); - if(0 != memcmp(block.get_comment(0).get_field(), vorbiscomment_.data.vorbis_comment.comments[0].entry, vorbiscomment_.data.vorbis_comment.comments[0].length)) - return die_("value[0] mismatch"); - if(block.get_comment(1).get_field_length() != vorbiscomment_.data.vorbis_comment.comments[1].length) - return die_("length[1] mismatch"); - if(0 != memcmp(block.get_comment(1).get_field(), vorbiscomment_.data.vorbis_comment.comments[1].entry, vorbiscomment_.data.vorbis_comment.comments[1].length)) - return die_("value[0] mismatch"); - printf("OK\n"); - - printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); - FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block); - if(0 == clone_) - return die_("returned NULL"); - if(0 == dynamic_cast(clone_)) - return die_("downcast is NULL"); - if(*dynamic_cast(clone_) != block) - return die_("clone is not identical"); - printf("OK\n"); - printf("testing VorbisComment::~VorbisComment()... "); - delete clone_; - printf("OK\n"); - - - printf("PASSED\n\n"); - return true; -} - -bool test_metadata_object_cuesheet() -{ - uint32_t expected_length; - - printf("testing class FLAC::Metadata::CueSheet::Track\n"); - - printf("testing Track::Track()... "); - FLAC::Metadata::CueSheet::Track track0; - if(!track0.is_valid()) - return die_("!is_valid()"); - printf("OK\n"); - - { - printf("testing Track::get_track()... "); - const ::FLAC__StreamMetadata_CueSheet_Track *trackp = track0.get_track(); - if(0 == trackp) - return die_("returned pointer is NULL"); - printf("OK\n"); - - printf("testing Track::Track(const ::FLAC__StreamMetadata_CueSheet_Track*)... "); - FLAC::Metadata::CueSheet::Track track2(trackp); - if(!track2.is_valid()) - return die_("!is_valid()"); - if(!track_is_equal_(track2.get_track(), trackp)) - return die_("copy is not equal"); - printf("OK\n"); - - printf("testing Track::~Track()... "); - } - printf("OK\n"); - - printf("testing Track::Track(const Track &track)... "); - { - FLAC::Metadata::CueSheet::Track track0copy(track0); - if(!track0copy.is_valid()) - return die_("!is_valid()"); - if(!track_is_equal_(track0copy.get_track(), track0.get_track())) - return die_("copy is not equal"); - printf("OK\n"); - - printf("testing Track::~Track()... "); - } - printf("OK\n"); - - printf("testing Track::operator=(const Track &track)... "); - FLAC::Metadata::CueSheet::Track track1 = track0; - if(!track0.is_valid()) - return die_("!is_valid()"); - if(!track_is_equal_(track1.get_track(), track0.get_track())) - return die_("copy is not equal"); - printf("OK\n"); - - printf("testing Track::get_offset()... "); - if(track1.get_offset() != 0) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::get_number()... "); - if(track1.get_number() != 0) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::get_isrc()... "); - if(0 != memcmp(track1.get_isrc(), "\0\0\0\0\0\0\0\0\0\0\0\0\0", 13)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::get_type()... "); - if(track1.get_type() != 0) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::get_pre_emphasis()... "); - if(track1.get_pre_emphasis() != 0) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::get_num_indices()... "); - if(track1.get_num_indices() != 0) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::set_offset()... "); - track1.set_offset(588); - if(track1.get_offset() != 588) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::set_number()... "); - track1.set_number(1); - if(track1.get_number() != 1) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::set_isrc()... "); - track1.set_isrc("ABCDE1234567"); - if(0 != memcmp(track1.get_isrc(), "ABCDE1234567", 13)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::set_type()... "); - track1.set_type(1); - if(track1.get_type() != 1) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Track::set_pre_emphasis()... "); - track1.set_pre_emphasis(1); - if(track1.get_pre_emphasis() != 1) - return die_("value mismatch"); - printf("OK\n"); - - printf("PASSED\n\n"); - - printf("testing class FLAC::Metadata::CueSheet\n"); - - printf("testing CueSheet::CueSheet()... "); - FLAC::Metadata::CueSheet block; - if(!block.is_valid()) - return die_("!block.is_valid()"); - expected_length = ( - FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN + - FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + - FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN + - FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN - ) / 8; - if(block.get_length() != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); - return false; - } - printf("OK\n"); - - printf("testing CueSheet::CueSheet(const CueSheet &)... +\n"); - printf(" CueSheet::operator!=(const CueSheet &)... "); - { - FLAC::Metadata::CueSheet blockcopy(block); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != block) - return die_("copy is not identical to original"); - printf("OK\n"); - - printf("testing CueSheet::~CueSheet()... "); - } - printf("OK\n"); - - printf("testing CueSheet::CueSheet(const ::FLAC__StreamMetadata &)... +\n"); - printf(" CueSheet::operator!=(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::CueSheet blockcopy(cuesheet_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != cuesheet_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing CueSheet::CueSheet(const ::FLAC__StreamMetadata *)... +\n"); - printf(" CueSheet::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::CueSheet blockcopy(&cuesheet_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != cuesheet_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing CueSheet::CueSheet(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" CueSheet::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::CueSheet blockcopy(&cuesheet_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != cuesheet_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing CueSheet::CueSheet(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" CueSheet::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&cuesheet_); - FLAC::Metadata::CueSheet blockcopy(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != cuesheet_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing CueSheet::assign(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" CueSheet::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::CueSheet blockcopy; - blockcopy.assign(&cuesheet_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != cuesheet_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing CueSheet::assign(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" CueSheet::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&cuesheet_); - FLAC::Metadata::CueSheet blockcopy; - blockcopy.assign(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != cuesheet_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing CueSheet::operator=(const CueSheet &)... +\n"); - printf(" CueSheet::operator==(const CueSheet &)... "); - { - FLAC::Metadata::CueSheet blockcopy = block; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == block)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing CueSheet::operator=(const ::FLAC__StreamMetadata &)... +\n"); - printf(" CueSheet::operator==(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::CueSheet blockcopy = cuesheet_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == cuesheet_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing CueSheet::operator=(const ::FLAC__StreamMetadata *)... +\n"); - printf(" CueSheet::operator==(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::CueSheet blockcopy = &cuesheet_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == cuesheet_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing CueSheet::get_media_catalog_number()... "); - if(0 != strcmp(block.get_media_catalog_number(), "")) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing CueSheet::get_lead_in()... "); - if(block.get_lead_in() != 0) - return die_("value mismatch, expected 0"); - printf("OK\n"); - - printf("testing CueSheet::get_is_cd()... "); - if(block.get_is_cd()) - return die_("value mismatch, expected false"); - printf("OK\n"); - - printf("testing CueSheet::get_num_tracks()... "); - if(block.get_num_tracks() != 0) - return die_("value mismatch, expected 0"); - printf("OK\n"); - - printf("testing CueSheet::set_media_catalog_number()... "); - { - char mcn[129]; - memset(mcn, 0, sizeof(mcn)); - safe_strncpy(mcn, "1234567890123", sizeof(mcn)); - block.set_media_catalog_number(mcn); - if(0 != memcmp(block.get_media_catalog_number(), mcn, sizeof(mcn))) - return die_("value mismatch"); - } - printf("OK\n"); - - printf("testing CueSheet::set_lead_in()... "); - block.set_lead_in(588); - if(block.get_lead_in() != 588) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing CueSheet::set_is_cd()... "); - block.set_is_cd(true); - if(!block.get_is_cd()) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing CueSheet::insert_track()... +\n"); - printf(" CueSheet::get_track()... "); - if(!block.insert_track(0, track0)) - return die_("returned false"); - if(!track_is_equal_(block.get_track(0).get_track(), track0.get_track())) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing CueSheet::insert_track()... +\n"); - printf(" CueSheet::get_track()... "); - if(!block.insert_track(1, track1)) - return die_("returned false"); - if(!track_is_equal_(block.get_track(1).get_track(), track1.get_track())) - return die_("value mismatch"); - printf("OK\n"); - - ::FLAC__StreamMetadata_CueSheet_Index index0; - index0.offset = 588*4; - index0.number = 1; - - printf("testing CueSheet::insert_index(0)... +\n"); - printf(" CueSheet::get_track()... +\n"); - printf(" CueSheet::Track::get_index()... "); - if(!block.insert_index(0, 0, index0)) - return die_("returned false"); - if(!index_is_equal_(block.get_track(0).get_index(0), index0)) - return die_("value mismatch"); - printf("OK\n"); - - index0.offset = 588*5; - printf("testing CueSheet::Track::set_index()... "); - { - FLAC::Metadata::CueSheet::Track track_ = block.get_track(0); - track_.set_index(0, index0); - if(!index_is_equal_(track_.get_index(0), index0)) - return die_("value mismatch"); - } - printf("OK\n"); - - index0.offset = 588*6; - printf("testing CueSheet::set_index()... "); - block.set_index(0, 0, index0); - if(!index_is_equal_(block.get_track(0).get_index(0), index0)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing CueSheet::delete_index()... "); - if(!block.delete_index(0, 0)) - return die_("returned false"); - if(block.get_track(0).get_num_indices() != 0) - return die_("num_indices mismatch"); - printf("OK\n"); - - - printf("testing CueSheet::set_track()... +\n"); - printf(" CueSheet::get_track()... "); - if(!block.set_track(0, track1)) - return die_("returned false"); - if(!track_is_equal_(block.get_track(0).get_track(), track1.get_track())) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing CueSheet::delete_track()... "); - if(!block.delete_track(0)) - return die_("returned false"); - if(block.get_num_tracks() != 1) - return die_("num_tracks mismatch"); - printf("OK\n"); - - printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); - FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block); - if(0 == clone_) - return die_("returned NULL"); - if(0 == dynamic_cast(clone_)) - return die_("downcast is NULL"); - if(*dynamic_cast(clone_) != block) - return die_("clone is not identical"); - printf("OK\n"); - printf("testing CueSheet::~CueSheet()... "); - delete clone_; - printf("OK\n"); - - printf("PASSED\n\n"); - return true; -} - -bool test_metadata_object_picture() -{ - uint32_t expected_length; - - printf("testing class FLAC::Metadata::Picture\n"); - - printf("testing Picture::Picture()... "); - FLAC::Metadata::Picture block; - if(!block.is_valid()) - return die_("!block.is_valid()"); - expected_length = ( - FLAC__STREAM_METADATA_PICTURE_TYPE_LEN + - FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN + - FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN + - FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN + - FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN + - FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN + - FLAC__STREAM_METADATA_PICTURE_COLORS_LEN + - FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN - ) / 8; - if(block.get_length() != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block.get_length()); - return false; - } - printf("OK\n"); - - printf("testing Picture::Picture(const Picture &)... +\n"); - printf(" Picture::operator!=(const Picture &)... "); - { - FLAC::Metadata::Picture blockcopy(block); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != block) - return die_("copy is not identical to original"); - printf("OK\n"); - - printf("testing Picture::~Picture()... "); - } - printf("OK\n"); - - printf("testing Picture::Picture(const ::FLAC__StreamMetadata &)... +\n"); - printf(" Picture::operator!=(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::Picture blockcopy(picture_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != picture_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Picture::Picture(const ::FLAC__StreamMetadata *)... +\n"); - printf(" Picture::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Picture blockcopy(&picture_); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != picture_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Picture::Picture(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" Picture::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Picture blockcopy(&picture_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != picture_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Picture::Picture(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" Picture::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&picture_); - FLAC::Metadata::Picture blockcopy(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != picture_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Picture::assign(const ::FLAC__StreamMetadata *, copy=true)... +\n"); - printf(" Picture::operator!=(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Picture blockcopy; - blockcopy.assign(&picture_, /*copy=*/true); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != picture_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Picture::assign(const ::FLAC__StreamMetadata *, copy=false)... +\n"); - printf(" Picture::operator!=(const ::FLAC__StreamMetadata *)... "); - { - ::FLAC__StreamMetadata *copy = ::FLAC__metadata_object_clone(&picture_); - FLAC::Metadata::Picture blockcopy; - blockcopy.assign(copy, /*copy=*/false); - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(blockcopy != picture_) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Picture::operator=(const Picture &)... +\n"); - printf(" Picture::operator==(const Picture &)... "); - { - FLAC::Metadata::Picture blockcopy = block; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == block)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Picture::operator=(const ::FLAC__StreamMetadata &)... +\n"); - printf(" Picture::operator==(const ::FLAC__StreamMetadata &)... "); - { - FLAC::Metadata::Picture blockcopy = picture_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == picture_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Picture::operator=(const ::FLAC__StreamMetadata *)... +\n"); - printf(" Picture::operator==(const ::FLAC__StreamMetadata *)... "); - { - FLAC::Metadata::Picture blockcopy = &picture_; - if(!blockcopy.is_valid()) - return die_("!blockcopy.is_valid()"); - if(!(blockcopy == picture_)) - return die_("copy is not identical to original"); - printf("OK\n"); - } - - printf("testing Picture::get_type()... "); - if(block.get_type() != ::FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER) - return die_("value mismatch, expected ::FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER"); - printf("OK\n"); - - printf("testing Picture::set_type()... +\n"); - printf(" Picture::get_type()... "); - block.set_type(::FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA); - if(block.get_type() != ::FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA) - return die_("value mismatch, expected ::FLAC__STREAM_METADATA_PICTURE_TYPE_MEDIA"); - printf("OK\n"); - - printf("testing Picture::set_mime_type()... "); - if(!block.set_mime_type("qmage/jpeg")) - return die_("returned false"); - printf("OK\n"); - picture_.data.picture.mime_type[0] = 'q'; - - printf("testing Picture::get_mime_type()... "); - if(0 != strcmp(block.get_mime_type(), picture_.data.picture.mime_type)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Picture::set_description()... "); - if(!block.set_description((const FLAC__byte*)"qesc")) - return die_("returned false"); - printf("OK\n"); - picture_.data.picture.description[0] = 'q'; - - printf("testing Picture::get_description()... "); - if(0 != strcmp((const char *)block.get_description(), (const char *)picture_.data.picture.description)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing Picture::get_width()... "); - if(block.get_width() != 0) - return die_("value mismatch, expected 0"); - printf("OK\n"); - - printf("testing Picture::set_width()... +\n"); - printf(" Picture::get_width()... "); - block.set_width(400); - if(block.get_width() != 400) - return die_("value mismatch, expected 400"); - printf("OK\n"); - - printf("testing Picture::get_height()... "); - if(block.get_height() != 0) - return die_("value mismatch, expected 0"); - printf("OK\n"); - - printf("testing Picture::set_height()... +\n"); - printf(" Picture::get_height()... "); - block.set_height(200); - if(block.get_height() != 200) - return die_("value mismatch, expected 200"); - printf("OK\n"); - - printf("testing Picture::get_depth()... "); - if(block.get_depth() != 0) - return die_("value mismatch, expected 0"); - printf("OK\n"); - - printf("testing Picture::set_depth()... +\n"); - printf(" Picture::get_depth()... "); - block.set_depth(16); - if(block.get_depth() != 16) - return die_("value mismatch, expected 16"); - printf("OK\n"); - - printf("testing Picture::get_colors()... "); - if(block.get_colors() != 0) - return die_("value mismatch, expected 0"); - printf("OK\n"); - - printf("testing Picture::set_colors()... +\n"); - printf(" Picture::get_colors()... "); - block.set_colors(1u>16); - if(block.get_colors() != (1u>16)) - return die_("value mismatch, expected 2^16"); - printf("OK\n"); - - printf("testing Picture::get_data_length()... "); - if(block.get_data_length() != 0) - return die_("value mismatch, expected 0"); - printf("OK\n"); - - printf("testing Picture::set_data()... "); - if(!block.set_data((const FLAC__byte*)"qOMEJPEGDATA", strlen("qOMEJPEGDATA"))) - return die_("returned false"); - printf("OK\n"); - picture_.data.picture.data[0] = 'q'; - - printf("testing Picture::get_data()... "); - if(block.get_data_length() != picture_.data.picture.data_length) - return die_("length mismatch"); - if(0 != memcmp(block.get_data(), picture_.data.picture.data, picture_.data.picture.data_length)) - return die_("value mismatch"); - printf("OK\n"); - - printf("testing FLAC::Metadata::clone(const FLAC::Metadata::Prototype *)... "); - FLAC::Metadata::Prototype *clone_ = FLAC::Metadata::clone(&block); - if(0 == clone_) - return die_("returned NULL"); - if(0 == dynamic_cast(clone_)) - return die_("downcast is NULL"); - if(*dynamic_cast(clone_) != block) - return die_("clone is not identical"); - printf("OK\n"); - printf("testing Picture::~Picture()... "); - delete clone_; - printf("OK\n"); - - - printf("PASSED\n\n"); - return true; -} - -bool test_metadata_object() -{ - printf("\n+++ libFLAC++ unit test: metadata objects\n\n"); - - init_metadata_blocks_(); - - if(!test_metadata_object_streaminfo()) - return false; - - if(!test_metadata_object_padding()) - return false; - - if(!test_metadata_object_application()) - return false; - - if(!test_metadata_object_seektable()) - return false; - - if(!test_metadata_object_vorbiscomment()) - return false; - - if(!test_metadata_object_cuesheet()) - return false; - - if(!test_metadata_object_picture()) - return false; - - free_metadata_blocks_(); - - return true; -} diff --git a/src/test_libFLAC++/test_libFLAC++.vcproj b/src/test_libFLAC++/test_libFLAC++.vcproj deleted file mode 100644 index b9152c52..00000000 --- a/src/test_libFLAC++/test_libFLAC++.vcproj +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test_libFLAC++/test_libFLAC++.vcxproj b/src/test_libFLAC++/test_libFLAC++.vcxproj deleted file mode 100644 index c356e626..00000000 --- a/src/test_libFLAC++/test_libFLAC++.vcxproj +++ /dev/null @@ -1,196 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc8d-c215-11db-8314-0800200c9a66} - test_libFLAC++ - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - - {4cefbc86-c215-11db-8314-0800200c9a66} - false - - - {4cefbc84-c215-11db-8314-0800200c9a66} - - - {4cefbc81-c215-11db-8314-0800200c9a66} - false - - - {4cefbc8e-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/test_libFLAC++/test_libFLAC++.vcxproj.filters b/src/test_libFLAC++/test_libFLAC++.vcxproj.filters deleted file mode 100644 index f11af8d6..00000000 --- a/src/test_libFLAC++/test_libFLAC++.vcxproj.filters +++ /dev/null @@ -1,44 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/src/test_libFLAC/CMakeLists.txt b/src/test_libFLAC/CMakeLists.txt deleted file mode 100644 index 36a58200..00000000 --- a/src/test_libFLAC/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -add_executable(test_libFLAC - bitreader.c - bitwriter.c - crc.c - decoders.c - encoders.c - endswap.c - format.c - main.c - metadata.c - metadata_manip.c - metadata_object.c - md5.c - "$/bitreader.c" - "$/bitwriter.c" - "$/crc.c" - "$/md5.c" - $<$:../../include/share/win_utf8_io.h> - $<$:../share/win_utf8_io/win_utf8_io.c>) - -target_compile_definitions(test_libFLAC PRIVATE - $<$:ENABLE_64_BIT_WORDS>) -target_include_directories(test_libFLAC PRIVATE - "$/include") -target_link_libraries(test_libFLAC FLAC grabbag test_libs_common) diff --git a/src/test_libFLAC/Makefile.am b/src/test_libFLAC/Makefile.am deleted file mode 100644 index 1a361a1b..00000000 --- a/src/test_libFLAC/Makefile.am +++ /dev/null @@ -1,66 +0,0 @@ -# test_libFLAC - Unit tester for libFLAC -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2018 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - test_libFLAC.vcproj \ - test_libFLAC.vcxproj \ - test_libFLAC.vcxproj.filters - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -I$(top_srcdir)/src/libFLAC/include - -check_PROGRAMS = test_libFLAC - -if OS_IS_WINDOWS -win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la -endif - -test_libFLAC_LDADD = \ - $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/test_libs_common/libtest_libs_common.la \ - $(top_builddir)/src/libFLAC/libFLAC-static.la \ - $(win_utf8_lib) \ - @OGG_LIBS@ \ - -lm - -test_libFLAC_SOURCES = \ - bitreader.c \ - bitwriter.c \ - crc.c \ - decoders.c \ - encoders.c \ - endswap.c \ - format.c \ - main.c \ - metadata.c \ - metadata_manip.c \ - metadata_object.c \ - md5.c \ - bitreader.h \ - bitwriter.h \ - crc.h \ - decoders.h \ - encoders.h \ - endswap.h \ - format.h \ - metadata.h \ - md5.h - -CLEANFILES = test_libFLAC.exe diff --git a/src/test_libFLAC/Makefile.lite b/src/test_libFLAC/Makefile.lite deleted file mode 100644 index a9c9ac13..00000000 --- a/src/test_libFLAC/Makefile.lite +++ /dev/null @@ -1,58 +0,0 @@ -# test_libFLAC - Unit tester for libFLAC -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2018 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. - -# -# GNU makefile -# - -topdir = ../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = test_libFLAC - -INCLUDES = -I../libFLAC/include -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else -ifeq ($(findstring Windows,$(OS)),Windows) - LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC -lwin_utf8_io $(OGG_LIBS) -lm -else - LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC $(OGG_LIBS) -lm -endif -endif - -SRCS_C = \ - bitreader.c \ - bitwriter.c \ - crc.c \ - decoders.c \ - encoders.c \ - endswap.c \ - format.c \ - main.c \ - md5.c \ - metadata.c \ - metadata_manip.c \ - metadata_object.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/test_libFLAC/bitreader.c b/src/test_libFLAC/bitreader.c deleted file mode 100644 index 63eae692..00000000 --- a/src/test_libFLAC/bitreader.c +++ /dev/null @@ -1,322 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2018 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "FLAC/assert.h" -#include "share/compat.h" -#include "private/bitreader.h" /* from the libFLAC private include area */ -#include "bitreader.h" -#include -#include /* for memcpy() */ - -/* - * WATCHOUT! Since FLAC__BitReader is a private structure, we use a copy of - * the definition here to get at the internals. Make sure this is kept up - * to date with what is in ../libFLAC/bitreader.c - */ -#if (ENABLE_64_BIT_WORDS == 0) - -typedef FLAC__uint32 brword; -#define FLAC__BYTES_PER_WORD 4 -#define FLAC__BITS_PER_WORD 32 - -#else - -typedef FLAC__uint64 brword; -#define FLAC__BYTES_PER_WORD 8 -#define FLAC__BITS_PER_WORD 64 - -#endif - -struct FLAC__BitReader { - /* any partially-consumed word at the head will stay right-justified as bits are consumed from the left */ - /* any incomplete word at the tail will be left-justified, and bytes from the read callback are added on the right */ - brword *buffer; - uint32_t capacity; /* in words */ - uint32_t words; /* # of completed words in buffer */ - uint32_t bytes; /* # of bytes in incomplete word at buffer[words] */ - uint32_t consumed_words; /* #words ... */ - uint32_t consumed_bits; /* ... + (#bits of head word) already consumed from the front of buffer */ - uint32_t read_crc16; /* the running frame CRC */ - uint32_t crc16_offset; /* the number of words in the current buffer that should not be CRC'd */ - uint32_t crc16_align; /* the number of bits in the current consumed word that should not be CRC'd */ - FLAC__BitReaderReadCallback read_callback; - void *client_data; -}; - -static FLAC__bool read_callback(FLAC__byte buffer[], size_t *bytes, void *data); - -FLAC__bool test_bitreader(void) -{ - FLAC__BitReader *br; - FLAC__bool ok; - uint32_t i; - uint32_t words, bits; /* what we think br->consumed_words and br->consumed_bits should be */ - - FLAC__uint16 crc,expected_crcs[4] = { 0x5e4c, 0x7f6b, 0x2272, 0x42bf }; - FLAC__byte data[32]; - - FLAC__uint32 val_uint32; - FLAC__uint64 val_uint64; - - for (i = 0; i < 32; i++) - data[i] = i * 8 + 7; - - printf("\n+++ libFLAC unit test: bitreader\n\n"); - - /* - * test new -> delete - */ - printf("testing new... "); - br = FLAC__bitreader_new(); - if(0 == br) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing delete... "); - FLAC__bitreader_delete(br); - printf("OK\n"); - - /* - * test new -> init -> delete - */ - printf("testing new... "); - br = FLAC__bitreader_new(); - if(0 == br) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing init... "); - if(!FLAC__bitreader_init(br, read_callback, data)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing delete... "); - FLAC__bitreader_delete(br); - printf("OK\n"); - - /* - * test new -> init -> clear -> delete - */ - printf("testing new... "); - br = FLAC__bitreader_new(); - if(0 == br) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing init... "); - if(!FLAC__bitreader_init(br, read_callback, data)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing clear... "); - if(!FLAC__bitreader_clear(br)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing delete... "); - FLAC__bitreader_delete(br); - printf("OK\n"); - - /* - * test normal usage - */ - printf("testing new... "); - br = FLAC__bitreader_new(); - if(0 == br) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing init... "); - if(!FLAC__bitreader_init(br, read_callback, data)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing clear... "); - if(!FLAC__bitreader_clear(br)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - words = bits = 0; - - printf("capacity = %u\n", br->capacity); - - printf("testing raw reads... "); - ok = - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 1) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 2) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 5) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 8) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 10) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 4) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 32) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 4) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 2) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 8) && - FLAC__bitreader_read_raw_uint64(br, &val_uint64, 64) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 12) - ; - if(!ok) { - printf("FAILED\n"); - FLAC__bitreader_dump(br, stdout); - return false; - } - /* we read 152 bits (=19 bytes) from the bitreader */ - words = 152 / FLAC__BITS_PER_WORD; - bits = 152 - words*FLAC__BITS_PER_WORD; - - if(br->consumed_words != words) { - printf("FAILED word count %u != %u\n", br->consumed_words, words); - FLAC__bitreader_dump(br, stdout); - return false; - } - if(br->consumed_bits != bits) { - printf("FAILED bit count %u != %u\n", br->consumed_bits, bits); - FLAC__bitreader_dump(br, stdout); - return false; - } - crc = FLAC__bitreader_get_read_crc16(br); - if(crc != expected_crcs[0]) { - printf("FAILED reported CRC 0x%04x does not match expected 0x%04x\n", crc, expected_crcs[0]); - FLAC__bitreader_dump(br, stdout); - return false; - } - printf("OK\n"); - FLAC__bitreader_dump(br, stdout); - - printf("testing CRC reset... "); - FLAC__bitreader_clear(br); - FLAC__bitreader_reset_read_crc16(br, 0xFFFF); - crc = FLAC__bitreader_get_read_crc16(br); - if(crc != 0xFFFF) { - printf("FAILED reported CRC 0x%04x does not match expected 0xFFFF\n", crc); - FLAC__bitreader_dump(br, stdout); - return false; - } - FLAC__bitreader_reset_read_crc16(br, 0); - crc = FLAC__bitreader_get_read_crc16(br); - if(crc != 0) { - printf("FAILED reported CRC 0x%04x does not match expected 0x0000\n", crc); - FLAC__bitreader_dump(br, stdout); - return false; - } - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 16); - FLAC__bitreader_reset_read_crc16(br, 0); - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 32); - crc = FLAC__bitreader_get_read_crc16(br); - if(crc != expected_crcs[1]) { - printf("FAILED reported CRC 0x%04x does not match expected 0x%04x\n", crc, expected_crcs[1]); - FLAC__bitreader_dump(br, stdout); - return false; - } - printf("OK\n"); - - printf("testing unaligned < 32 bit reads... "); - FLAC__bitreader_clear(br); - FLAC__bitreader_skip_bits_no_crc(br, 8); - FLAC__bitreader_reset_read_crc16(br, 0); - ok = - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 1) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 2) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 5) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 8) - ; - if(!ok) { - printf("FAILED\n"); - FLAC__bitreader_dump(br, stdout); - return false; - } - crc = FLAC__bitreader_get_read_crc16(br); - if(crc != expected_crcs[2]) { - printf("FAILED reported CRC 0x%04x does not match expected 0x%04x\n", crc, expected_crcs[2]); - FLAC__bitreader_dump(br, stdout); - return false; - } - printf("OK\n"); - FLAC__bitreader_dump(br, stdout); - - printf("testing unaligned < 64 bit reads... "); - FLAC__bitreader_clear(br); - FLAC__bitreader_skip_bits_no_crc(br, 8); - FLAC__bitreader_reset_read_crc16(br, 0); - ok = - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 1) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 2) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 5) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 8) && - FLAC__bitreader_read_raw_uint32(br, &val_uint32, 32) - ; - if(!ok) { - printf("FAILED\n"); - FLAC__bitreader_dump(br, stdout); - return false; - } - crc = FLAC__bitreader_get_read_crc16(br); - if(crc != expected_crcs[3]) { - printf("FAILED reported CRC 0x%04x does not match expected 0x%04x\n", crc, expected_crcs[3]); - FLAC__bitreader_dump(br, stdout); - return false; - } - printf("OK\n"); - FLAC__bitreader_dump(br, stdout); - - printf("testing free... "); - FLAC__bitreader_free(br); - printf("OK\n"); - - printf("testing delete... "); - FLAC__bitreader_delete(br); - printf("OK\n"); - - printf("\nPASSED!\n"); - return true; -} - -/*----------------------------------------------------------------------------*/ - -static FLAC__bool read_callback(FLAC__byte buffer[], size_t *bytes, void *data) -{ - if (*bytes > 32) - *bytes = 32; - - memcpy(buffer, data, *bytes); - - return true; -} diff --git a/src/test_libFLAC/bitreader.h b/src/test_libFLAC/bitreader.h deleted file mode 100644 index b4e02c0b..00000000 --- a/src/test_libFLAC/bitreader.h +++ /dev/null @@ -1,27 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2018 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLAC_BITREADER_H -#define FLAC__TEST_LIBFLAC_BITREADER_H - -#include "FLAC/ordinals.h" - -FLAC__bool test_bitreader(void); - -#endif diff --git a/src/test_libFLAC/bitwriter.c b/src/test_libFLAC/bitwriter.c deleted file mode 100644 index b779ae5d..00000000 --- a/src/test_libFLAC/bitwriter.c +++ /dev/null @@ -1,665 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2018 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "FLAC/assert.h" -#include "share/compat.h" -#include "private/bitwriter.h" /* from the libFLAC private include area */ -#include "bitwriter.h" -#include -#include /* for memcmp() */ - -/* - * WATCHOUT! Since FLAC__BitWriter is a private structure, we use a copy of - * the definition here to get at the internals. Make sure this is kept up - * to date with what is in ../libFLAC/bitwriter.c - */ -#if (ENABLE_64_BIT_WORDS == 0) - -typedef FLAC__uint32 bwword; -#define FLAC__BYTES_PER_WORD 4 -#define FLAC__BITS_PER_WORD 32 -#define PRI_BWWORD "08x" - -#else - -typedef FLAC__uint64 bwword; -#define FLAC__BYTES_PER_WORD 8 -#define FLAC__BITS_PER_WORD 64 -#define PRI_BWWORD "016" PRIx64 - -#endif - -struct FLAC__BitWriter { - bwword *buffer; - bwword accum; /* accumulator; bits are right-justified; when full, accum is appended to buffer */ - uint32_t capacity; /* capacity of buffer in words */ - uint32_t words; /* # of complete words in buffer */ - uint32_t bits; /* # of used bits in accum */ -}; - -#define WORDS_TO_BITS(words) ((words) * FLAC__BITS_PER_WORD) -#define TOTAL_BITS(bw) (WORDS_TO_BITS((bw)->words) + (bw)->bits) - - -FLAC__bool test_bitwriter(void) -{ - FLAC__BitWriter *bw; - FLAC__bool ok; - uint32_t i, j; -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - static bwword test_pattern1[5] = { 0xaaf0aabe, 0xaaaaaaa8, 0x300aaaaa, 0xaaadeadb, 0x00eeface }; -#else - static bwword test_pattern1[5] = { 0xbeaaf0aa, 0xa8aaaaaa, 0xaaaa0a30, 0xdbeaadaa, 0x00eeface }; -#endif -#elif FLAC__BYTES_PER_WORD == 8 -#if WORDS_BIGENDIAN - static bwword test_pattern1[3] = { FLAC__U64L(0xaaf0aabeaaaaaaa8), FLAC__U64L(0x300aaaaaaaadeadb), FLAC__U64L(0x0000000000eeface) }; -#else - static bwword test_pattern1[3] = { FLAC__U64L(0xa8aaaaaabeaaf0aa), FLAC__U64L(0xdbeaadaaaaaa0a30), FLAC__U64L(0x0000000000eeface) }; -#endif -#else -#error FLAC__BYTES_PER_WORD is neither 4 nor 8 -- not implemented -#endif - uint32_t words, bits; /* what we think bw->words and bw->bits should be */ - - printf("\n+++ libFLAC unit test: bitwriter\n\n"); - - /* - * test new -> delete - */ - printf("testing new... "); - bw = FLAC__bitwriter_new(); - if(0 == bw) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing delete... "); - FLAC__bitwriter_delete(bw); - printf("OK\n"); - - /* - * test new -> init -> delete - */ - printf("testing new... "); - bw = FLAC__bitwriter_new(); - if(0 == bw) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing init... "); - if(!FLAC__bitwriter_init(bw)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing delete... "); - FLAC__bitwriter_delete(bw); - printf("OK\n"); - - /* - * test new -> init -> clear -> delete - */ - printf("testing new... "); - bw = FLAC__bitwriter_new(); - if(0 == bw) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing init... "); - if(!FLAC__bitwriter_init(bw)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing clear... "); - FLAC__bitwriter_clear(bw); - printf("OK\n"); - - printf("testing delete... "); - FLAC__bitwriter_delete(bw); - printf("OK\n"); - - /* - * test normal usage - */ - printf("testing new... "); - bw = FLAC__bitwriter_new(); - if(0 == bw) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing init... "); - if(!FLAC__bitwriter_init(bw)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing clear... "); - FLAC__bitwriter_clear(bw); - printf("OK\n"); - - words = bits = 0; - - printf("capacity = %u\n", bw->capacity); - - printf("testing zeroes, raw_uint32*... "); - ok = - FLAC__bitwriter_write_raw_uint32(bw, 0x1, 1) && - FLAC__bitwriter_write_raw_uint32(bw, 0x1, 2) && - FLAC__bitwriter_write_raw_uint32(bw, 0xa, 5) && - FLAC__bitwriter_write_raw_uint32(bw, 0xf0, 8) && - FLAC__bitwriter_write_raw_uint32(bw, 0x2aa, 10) && - FLAC__bitwriter_write_raw_uint32(bw, 0xf, 4) && - FLAC__bitwriter_write_raw_uint32(bw, 0xaaaaaaaa, 32) && - FLAC__bitwriter_write_zeroes(bw, 4) && - FLAC__bitwriter_write_raw_uint32(bw, 0x3, 2) && - FLAC__bitwriter_write_zeroes(bw, 8) && - FLAC__bitwriter_write_raw_uint64(bw, FLAC__U64L(0xaaaaaaaadeadbeef), 64) && - FLAC__bitwriter_write_raw_uint32(bw, 0xace, 12) - ; - if(!ok) { - printf("FAILED\n"); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - /* we wrote 152 bits (=19 bytes) to the bitwriter */ - words = 152 / FLAC__BITS_PER_WORD; - bits = 152 - words*FLAC__BITS_PER_WORD; - - if(bw->words != words) { - printf("FAILED word count %u != %u\n", bw->words, words); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - if(bw->bits != bits) { - printf("FAILED bit count %u != %u\n", bw->bits, bits); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - if(memcmp(bw->buffer, test_pattern1, sizeof(bwword)*words) != 0) { - printf("FAILED pattern match (buffer)\n"); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - if((bw->accum & 0x00ffffff) != test_pattern1[words]) { - printf("FAILED pattern match (bw->accum=%" PRI_BWWORD " != %" PRI_BWWORD ")\n", bw->accum&0x00ffffff, test_pattern1[words]); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - printf("OK\n"); - FLAC__bitwriter_dump(bw, stdout); - - printf("testing raw_uint32 some more... "); - ok = FLAC__bitwriter_write_raw_uint32(bw, 0x3d, 6); - if(!ok) { - printf("FAILED\n"); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - bits += 6; - test_pattern1[words] <<= 6; - test_pattern1[words] |= 0x3d; - if(bw->words != words) { - printf("FAILED word count %u != %u\n", bw->words, words); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - if(bw->bits != bits) { - printf("FAILED bit count %u != %u\n", bw->bits, bits); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - if(memcmp(bw->buffer, test_pattern1, sizeof(bwword)*words) != 0) { - printf("FAILED pattern match (buffer)\n"); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - if((bw->accum & 0x3fffffff) != test_pattern1[words]) { - printf("FAILED pattern match (bw->accum=%" PRI_BWWORD " != %" PRI_BWWORD ")\n", bw->accum&0x3fffffff, test_pattern1[words]); - FLAC__bitwriter_dump(bw, stdout); - return false; - } - printf("OK\n"); - FLAC__bitwriter_dump(bw, stdout); - - printf("testing utf8_uint32(0x00000000)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x00000000); - ok = TOTAL_BITS(bw) == 8 && (bw->accum & 0xff) == 0; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x0000007F)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x0000007F); - ok = TOTAL_BITS(bw) == 8 && (bw->accum & 0xff) == 0x7F; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x00000080)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x00000080); - ok = TOTAL_BITS(bw) == 16 && (bw->accum & 0xffff) == 0xC280; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x000007FF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x000007FF); - ok = TOTAL_BITS(bw) == 16 && (bw->accum & 0xffff) == 0xDFBF; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x00000800)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x00000800); - ok = TOTAL_BITS(bw) == 24 && (bw->accum & 0xffffff) == 0xE0A080; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x0000FFFF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x0000FFFF); - ok = TOTAL_BITS(bw) == 24 && (bw->accum & 0xffffff) == 0xEFBFBF; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x00010000)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x00010000); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xF0908080; -#else - ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0x808090F0; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 32 && (bw->accum & 0xffffffff) == 0xF0908080; -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x001FFFFF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x001FFFFF); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xF7BFBFBF; -#else - ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xBFBFBFF7; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 32 && (bw->accum & 0xffffffff) == 0xF7BFBFBF; -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x00200000)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x00200000); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xF8888080 && (bw->accum & 0xff) == 0x80; -#else - ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0x808088F8 && (bw->accum & 0xff) == 0x80; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 40 && (bw->accum & FLAC__U64L(0xffffffffff)) == FLAC__U64L(0xF888808080); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x03FFFFFF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x03FFFFFF); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xFBBFBFBF && (bw->accum & 0xff) == 0xBF; -#else - ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xBFBFBFFB && (bw->accum & 0xff) == 0xBF; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 40 && (bw->accum & FLAC__U64L(0xffffffffff)) == FLAC__U64L(0xFBBFBFBFBF); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x04000000)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x04000000); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xFC848080 && (bw->accum & 0xffff) == 0x8080; -#else - ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0x808084FC && (bw->accum & 0xffff) == 0x8080; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 48 && (bw->accum & FLAC__U64L(0xffffffffffff)) == FLAC__U64L(0xFC8480808080); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint32(0x7FFFFFFF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint32(bw, 0x7FFFFFFF); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xFDBFBFBF && (bw->accum & 0xffff) == 0xBFBF; -#else - ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xBFBFBFFD && (bw->accum & 0xffff) == 0xBFBF; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 48 && (bw->accum & FLAC__U64L(0xffffffffffff)) == FLAC__U64L(0xFDBFBFBFBFBF); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x0000000000000000)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000000000000)); - ok = TOTAL_BITS(bw) == 8 && (bw->accum & 0xff) == 0; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x000000000000007F)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x000000000000007F)); - ok = TOTAL_BITS(bw) == 8 && (bw->accum & 0xff) == 0x7F; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x0000000000000080)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000000000080)); - ok = TOTAL_BITS(bw) == 16 && (bw->accum & 0xffff) == 0xC280; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x00000000000007FF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x00000000000007FF)); - ok = TOTAL_BITS(bw) == 16 && (bw->accum & 0xffff) == 0xDFBF; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x0000000000000800)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000000000800)); - ok = TOTAL_BITS(bw) == 24 && (bw->accum & 0xffffff) == 0xE0A080; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x000000000000FFFF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x000000000000FFFF)); - ok = TOTAL_BITS(bw) == 24 && (bw->accum & 0xffffff) == 0xEFBFBF; - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x0000000000010000)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000000010000)); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xF0908080; -#else - ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0x808090F0; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 32 && (bw->accum & 0xffffffff) == 0xF0908080; -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x00000000001FFFFF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x00000000001FFFFF)); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xF7BFBFBF; -#else - ok = TOTAL_BITS(bw) == 32 && bw->buffer[0] == 0xBFBFBFF7; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 32 && (bw->accum & 0xffffffff) == 0xF7BFBFBF; -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x0000000000200000)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000000200000)); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xF8888080 && (bw->accum & 0xff) == 0x80; -#else - ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0x808088F8 && (bw->accum & 0xff) == 0x80; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 40 && (bw->accum & FLAC__U64L(0xffffffffff)) == FLAC__U64L(0xF888808080); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x0000000003FFFFFF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000003FFFFFF)); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xFBBFBFBF && (bw->accum & 0xff) == 0xBF; -#else - ok = TOTAL_BITS(bw) == 40 && bw->buffer[0] == 0xBFBFBFFB && (bw->accum & 0xff) == 0xBF; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 40 && (bw->accum & FLAC__U64L(0xffffffffff)) == FLAC__U64L(0xFBBFBFBFBF); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x0000000004000000)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000004000000)); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xFC848080 && (bw->accum & 0xffff) == 0x8080; -#else - ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0x808084FC && (bw->accum & 0xffff) == 0x8080; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 48 && (bw->accum & FLAC__U64L(0xffffffffffff)) == FLAC__U64L(0xFC8480808080); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x000000007FFFFFFF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x000000007FFFFFFF)); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xFDBFBFBF && (bw->accum & 0xffff) == 0xBFBF; -#else - ok = TOTAL_BITS(bw) == 48 && bw->buffer[0] == 0xBFBFBFFD && (bw->accum & 0xffff) == 0xBFBF; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 48 && (bw->accum & FLAC__U64L(0xffffffffffff)) == FLAC__U64L(0xFDBFBFBFBFBF); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x0000000080000000)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000080000000)); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 56 && bw->buffer[0] == 0xFE828080 && (bw->accum & 0xffffff) == 0x808080; -#else - ok = TOTAL_BITS(bw) == 56 && bw->buffer[0] == 0x808082FE && (bw->accum & 0xffffff) == 0x808080; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 56 && (bw->accum & FLAC__U64L(0xffffffffffffff)) == FLAC__U64L(0xFE828080808080); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing utf8_uint64(0x0000000FFFFFFFFF)... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, FLAC__U64L(0x0000000FFFFFFFFF)); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == 56 && bw->buffer[0] == 0xFEBFBFBF && (bw->accum & 0xffffff) == 0xBFBFBF; -#else - ok = TOTAL_BITS(bw) == 56 && bw->buffer[0] == 0xBFBFBFFE && (bw->accum & 0xffffff) == 0xBFBFBF; -#endif -#elif FLAC__BYTES_PER_WORD == 8 - ok = TOTAL_BITS(bw) == 56 && (bw->accum & FLAC__U64L(0xffffffffffffff)) == FLAC__U64L(0xFEBFBFBFBFBFBF); -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - - printf("testing grow... "); - FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_raw_uint32(bw, 0x5, 4); - j = bw->capacity; - for(i = 0; i < j; i++) - FLAC__bitwriter_write_raw_uint32(bw, 0xaaaaaaaa, 32); -#if FLAC__BYTES_PER_WORD == 4 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == i*32+4 && bw->buffer[0] == 0x5aaaaaaa && (bw->accum & 0xf) == 0xa; -#else - ok = TOTAL_BITS(bw) == i*32+4 && bw->buffer[0] == 0xaaaaaa5a && (bw->accum & 0xf) == 0xa; -#endif -#elif FLAC__BYTES_PER_WORD == 8 -#if WORDS_BIGENDIAN - ok = TOTAL_BITS(bw) == i*32+4 && bw->buffer[0] == FLAC__U64L(0x5aaaaaaaaaaaaaaa) && (bw->accum & 0xf) == 0xa; -#else - ok = TOTAL_BITS(bw) == i*32+4 && bw->buffer[0] == FLAC__U64L(0xaaaaaaaaaaaaaa5a) && (bw->accum & 0xf) == 0xa; -#endif -#endif - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) { - FLAC__bitwriter_dump(bw, stdout); - return false; - } - printf("capacity = %u\n", bw->capacity); - - printf("testing free... "); - FLAC__bitwriter_free(bw); - printf("OK\n"); - - printf("testing delete... "); - FLAC__bitwriter_delete(bw); - printf("OK\n"); - - printf("\nPASSED!\n"); - return true; -} diff --git a/src/test_libFLAC/bitwriter.h b/src/test_libFLAC/bitwriter.h deleted file mode 100644 index 29cbf896..00000000 --- a/src/test_libFLAC/bitwriter.h +++ /dev/null @@ -1,27 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLAC_BITBUFFER_H -#define FLAC__TEST_LIBFLAC_BITBUFFER_H - -#include "FLAC/ordinals.h" - -FLAC__bool test_bitwriter(void); - -#endif diff --git a/src/test_libFLAC/crc.c b/src/test_libFLAC/crc.c deleted file mode 100644 index 55f78a7e..00000000 --- a/src/test_libFLAC/crc.c +++ /dev/null @@ -1,274 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2014-2018 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -#include "FLAC/assert.h" -#include "share/compat.h" -#include "private/crc.h" -#include "crc.h" - -static FLAC__uint8 crc8_update_ref(FLAC__byte byte, FLAC__uint8 crc); -static FLAC__uint16 crc16_update_ref(FLAC__byte byte, FLAC__uint16 crc); - -static FLAC__bool test_crc8(const FLAC__byte *data, size_t size); -static FLAC__bool test_crc16(const FLAC__byte *data, size_t size); -static FLAC__bool test_crc16_update(const FLAC__byte *data, size_t size); -static FLAC__bool test_crc16_32bit_words(const FLAC__uint32 *words, size_t size); -static FLAC__bool test_crc16_64bit_words(const FLAC__uint64 *words, size_t size); - -#define DATA_SIZE 32768 - -FLAC__bool test_crc(void) -{ - uint32_t i; - FLAC__byte data[DATA_SIZE] = { 0 }; - - /* Initialize data reproducibly with pseudo-random values. */ - for (i = 1; i < DATA_SIZE; i++) - data[i] = crc8_update_ref(i % 256, data[i - 1]); - - printf("\n+++ libFLAC unit test: crc\n\n"); - - if (! test_crc8(data, DATA_SIZE)) - return false; - - if (! test_crc16(data, DATA_SIZE)) - return false; - - if (! test_crc16_update(data, DATA_SIZE)) - return false; - - if (! test_crc16_32bit_words((FLAC__uint32 *)data, DATA_SIZE / 4)) - return false; - - if (! test_crc16_64bit_words((FLAC__uint64 *)data, DATA_SIZE / 8)) - return false; - - printf("\nPASSED!\n"); - return true; -} - -/*----------------------------------------------------------------------------*/ - -/* Reference implementations of CRC-8 and CRC-16 to check against. */ - -#define CRC8_POLYNOMIAL 0x07 - -static FLAC__uint8 crc8_update_ref(FLAC__byte byte, FLAC__uint8 crc) -{ - uint32_t i; - - crc ^= byte; - - for (i = 0; i < 8; i++) { - crc = (crc << 1) ^ ((crc >> 7) ? CRC8_POLYNOMIAL : 0); - } - - return crc; -} - -#define CRC16_POLYNOMIAL 0x8005 - -static FLAC__uint16 crc16_update_ref(FLAC__byte byte, FLAC__uint16 crc) -{ - uint32_t i; - - crc ^= byte << 8; - - for (i = 0; i < 8; i++) { - crc = (crc << 1) ^ ((crc >> 15) ? CRC16_POLYNOMIAL : 0); - } - - return crc; -} - -/*----------------------------------------------------------------------------*/ - -static FLAC__bool test_crc8(const FLAC__byte *data, size_t size) -{ - uint32_t i; - FLAC__uint8 crc0,crc1; - - printf("testing FLAC__crc8 ... "); - - crc0 = 0; - crc1 = FLAC__crc8(data, 0); - - if (crc1 != crc0) { - printf("FAILED, FLAC__crc8 returned non-zero CRC for zero bytes of data\n"); - return false; - } - - for (i = 0; i < size; i++) { - crc0 = crc8_update_ref(data[i], crc0); - crc1 = FLAC__crc8(data, i + 1); - - if (crc1 != crc0) { - printf("FAILED, FLAC__crc8 result did not match reference CRC for %u bytes of test data\n", i + 1); - return false; - } - } - - printf("OK\n"); - - return true; -} - -static FLAC__bool test_crc16(const FLAC__byte *data, size_t size) -{ - uint32_t i; - FLAC__uint16 crc0,crc1; - - printf("testing FLAC__crc16 ... "); - - crc0 = 0; - crc1 = FLAC__crc16(data, 0); - - if (crc1 != crc0) { - printf("FAILED, FLAC__crc16 returned non-zero CRC for zero bytes of data\n"); - return false; - } - - for (i = 0; i < size; i++) { - crc0 = crc16_update_ref(data[i], crc0); - crc1 = FLAC__crc16(data, i + 1); - - if (crc1 != crc0) { - printf("FAILED, FLAC__crc16 result did not match reference CRC for %u bytes of test data\n", i + 1); - return false; - } - } - - printf("OK\n"); - - return true; -} - -static FLAC__bool test_crc16_update(const FLAC__byte *data, size_t size) -{ - uint32_t i; - FLAC__uint16 crc0,crc1; - - printf("testing FLAC__CRC16_UPDATE macro ... "); - - crc0 = 0; - crc1 = 0; - - for (i = 0; i < size; i++) { - crc0 = crc16_update_ref(data[i], crc0); - crc1 = FLAC__CRC16_UPDATE(data[i], crc1); - - if (crc1 != crc0) { - printf("FAILED, FLAC__CRC16_UPDATE result did not match reference CRC after %u bytes of test data\n", i + 1); - return false; - } - } - - printf("OK\n"); - - return true; -} - -static FLAC__bool test_crc16_32bit_words(const FLAC__uint32 *words, size_t size) -{ - uint32_t n,i,k; - FLAC__uint16 crc0,crc1; - - for (n = 1; n <= 16; n++) { - printf("testing FLAC__crc16_update_words32 (length=%i) ... ", n); - - crc0 = 0; - crc1 = 0; - - for (i = 0; i <= size - n; i += n) { - for (k = 0; k < n; k++) { - crc0 = crc16_update_ref( words[i + k] >> 24, crc0); - crc0 = crc16_update_ref((words[i + k] >> 16) & 0xFF, crc0); - crc0 = crc16_update_ref((words[i + k] >> 8) & 0xFF, crc0); - crc0 = crc16_update_ref( words[i + k] & 0xFF, crc0); - } - - crc1 = FLAC__crc16_update_words32(words + i, n, crc1); - - if (crc1 != crc0) { - printf("FAILED, FLAC__crc16_update_words32 result did not match reference CRC after %u words of test data\n", i + n); - return false; - } - } - - crc1 = FLAC__crc16_update_words32(words, 0, crc1); - - if (crc1 != crc0) { - printf("FAILED, FLAC__crc16_update_words32 called with zero bytes changed CRC value\n"); - return false; - } - - printf("OK\n"); - } - - return true; -} - -static FLAC__bool test_crc16_64bit_words(const FLAC__uint64 *words, size_t size) -{ - uint32_t n,i,k; - FLAC__uint16 crc0,crc1; - - for (n = 1; n <= 16; n++) { - printf("testing FLAC__crc16_update_words64 (length=%i) ... ", n); - - crc0 = 0; - crc1 = 0; - - for (i = 0; i <= size - n; i += n) { - for (k = 0; k < n; k++) { - crc0 = crc16_update_ref( words[i + k] >> 56, crc0); - crc0 = crc16_update_ref((words[i + k] >> 48) & 0xFF, crc0); - crc0 = crc16_update_ref((words[i + k] >> 40) & 0xFF, crc0); - crc0 = crc16_update_ref((words[i + k] >> 32) & 0xFF, crc0); - crc0 = crc16_update_ref((words[i + k] >> 24) & 0xFF, crc0); - crc0 = crc16_update_ref((words[i + k] >> 16) & 0xFF, crc0); - crc0 = crc16_update_ref((words[i + k] >> 8) & 0xFF, crc0); - crc0 = crc16_update_ref( words[i + k] & 0xFF, crc0); - } - - crc1 = FLAC__crc16_update_words64(words + i, n, crc1); - - if (crc1 != crc0) { - printf("FAILED, FLAC__crc16_update_words64 result did not match reference CRC after %u words of test data\n", i + n); - return false; - } - } - - crc1 = FLAC__crc16_update_words64(words, 0, crc1); - - if (crc1 != crc0) { - printf("FAILED, FLAC__crc16_update_words64 called with zero bytes changed CRC value\n"); - return false; - } - - printf("OK\n"); - } - - return true; -} diff --git a/src/test_libFLAC/crc.h b/src/test_libFLAC/crc.h deleted file mode 100644 index bac055db..00000000 --- a/src/test_libFLAC/crc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2014-2018 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLAC_CRC_H -#define FLAC__TEST_LIBFLAC_CRC_H - -#include "FLAC/ordinals.h" - -FLAC__bool test_crc(void); - -#endif diff --git a/src/test_libFLAC/decoders.c b/src/test_libFLAC/decoders.c deleted file mode 100644 index e9d52e95..00000000 --- a/src/test_libFLAC/decoders.c +++ /dev/null @@ -1,1058 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include "decoders.h" -#include "FLAC/assert.h" -#include "FLAC/stream_decoder.h" -#include "share/grabbag.h" -#include "share/compat.h" -#include "share/safe_str.h" -#include "test_libs_common/file_utils_flac.h" -#include "test_libs_common/metadata_utils.h" - -typedef enum { - LAYER_STREAM = 0, /* FLAC__stream_decoder_init_[ogg_]stream() without seeking */ - LAYER_SEEKABLE_STREAM, /* FLAC__stream_decoder_init_[ogg_]stream() with seeking */ - LAYER_FILE, /* FLAC__stream_decoder_init_[ogg_]FILE() */ - LAYER_FILENAME /* FLAC__stream_decoder_init_[ogg_]file() */ -} Layer; - -static const char * const LayerString[] = { - "Stream", - "Seekable Stream", - "FILE*", - "Filename" -}; - -typedef struct { - Layer layer; - FILE *file; - char filename[512]; - uint32_t current_metadata_number; - FLAC__bool ignore_errors; - FLAC__bool error_occurred; -} StreamDecoderClientData; - -static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, picture_, unknown_; -static FLAC__StreamMetadata *expected_metadata_sequence_[9]; -static uint32_t num_expected_; -static FLAC__off_t flacfilesize_; - -static const char *flacfilename(FLAC__bool is_ogg) -{ - return is_ogg? "metadata.oga" : "metadata.flac"; -} - -static FLAC__bool die_(const char *msg) -{ - printf("ERROR: %s\n", msg); - return false; -} - -static FLAC__bool die_s_(const char *msg, const FLAC__StreamDecoder *decoder) -{ - FLAC__StreamDecoderState state = FLAC__stream_decoder_get_state(decoder); - - if(msg) - printf("FAILED, %s", msg); - else - printf("FAILED"); - - printf(", state = %u (%s)\n", (uint32_t)state, FLAC__StreamDecoderStateString[state]); - - return false; -} - -static void open_test_file(StreamDecoderClientData * pdcd, int is_ogg, const char * mode) -{ - pdcd->file = flac_fopen(flacfilename(is_ogg), mode); - safe_strncpy(pdcd->filename, flacfilename(is_ogg), sizeof (pdcd->filename)); -} - -static void init_metadata_blocks_(void) -{ - mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &picture_, &unknown_); -} - -static void free_metadata_blocks_(void) -{ - mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &picture_, &unknown_); -} - -static FLAC__bool generate_file_(FLAC__bool is_ogg) -{ - printf("\n\ngenerating %sFLAC file for decoder tests...\n", is_ogg? "Ogg ":""); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - /* WATCHOUT: for Ogg FLAC the encoder should move the VORBIS_COMMENT block to the front, right after STREAMINFO */ - - if(!file_utils__generate_flacfile(is_ogg, flacfilename(is_ogg), &flacfilesize_, 512 * 1024, &streaminfo_, expected_metadata_sequence_, num_expected_)) - return die_("creating the encoded file"); - - return true; -} - -static FLAC__StreamDecoderReadStatus stream_decoder_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) -{ - StreamDecoderClientData *dcd = (StreamDecoderClientData*)client_data; - const size_t requested_bytes = *bytes; - - (void)decoder; - - if(0 == dcd) { - printf("ERROR: client_data in read callback is NULL\n"); - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - } - - if(dcd->error_occurred) - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - - if(feof(dcd->file)) { - *bytes = 0; - return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - } - else if(requested_bytes > 0) { - *bytes = fread(buffer, 1, requested_bytes, dcd->file); - if(*bytes == 0) { - if(feof(dcd->file)) - return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - else - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; - } - else { - return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; - } - } - else - return FLAC__STREAM_DECODER_READ_STATUS_ABORT; /* abort to avoid a deadlock */ -} - -static FLAC__StreamDecoderSeekStatus stream_decoder_seek_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) -{ - StreamDecoderClientData *dcd = (StreamDecoderClientData*)client_data; - - (void)decoder; - - if(0 == dcd) { - printf("ERROR: client_data in seek callback is NULL\n"); - return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - } - - if(dcd->error_occurred) - return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - - if(fseeko(dcd->file, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0) { - dcd->error_occurred = true; - return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - } - - return FLAC__STREAM_DECODER_SEEK_STATUS_OK; -} - -static FLAC__StreamDecoderTellStatus stream_decoder_tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) -{ - StreamDecoderClientData *dcd = (StreamDecoderClientData*)client_data; - FLAC__off_t offset; - - (void)decoder; - - if(0 == dcd) { - printf("ERROR: client_data in tell callback is NULL\n"); - return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - } - - if(dcd->error_occurred) - return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - - offset = ftello(dcd->file); - *absolute_byte_offset = (FLAC__uint64)offset; - - if(offset < 0) { - dcd->error_occurred = true; - return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - } - - return FLAC__STREAM_DECODER_TELL_STATUS_OK; -} - -static FLAC__StreamDecoderLengthStatus stream_decoder_length_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) -{ - StreamDecoderClientData *dcd = (StreamDecoderClientData*)client_data; - - (void)decoder; - - if(0 == dcd) { - printf("ERROR: client_data in length callback is NULL\n"); - return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; - } - - if(dcd->error_occurred) - return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; - - *stream_length = (FLAC__uint64)flacfilesize_; - return FLAC__STREAM_DECODER_LENGTH_STATUS_OK; -} - -static FLAC__bool stream_decoder_eof_callback_(const FLAC__StreamDecoder *decoder, void *client_data) -{ - StreamDecoderClientData *dcd = (StreamDecoderClientData*)client_data; - - (void)decoder; - - if(0 == dcd) { - printf("ERROR: client_data in eof callback is NULL\n"); - return true; - } - - if(dcd->error_occurred) - return true; - - return feof(dcd->file); -} - -static FLAC__StreamDecoderWriteStatus stream_decoder_write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - StreamDecoderClientData *dcd = (StreamDecoderClientData*)client_data; - - (void)decoder, (void)buffer; - - if(0 == dcd) { - printf("ERROR: client_data in write callback is NULL\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - - if(dcd->error_occurred) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - - if( - (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER && frame->header.number.frame_number == 0) || - (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER && frame->header.number.sample_number == 0) - ) { - printf("content... "); - fflush(stdout); - } - - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -static void stream_decoder_metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - StreamDecoderClientData *dcd = (StreamDecoderClientData*)client_data; - - (void)decoder; - - if(0 == dcd) { - printf("ERROR: client_data in metadata callback is NULL\n"); - return; - } - - if(dcd->error_occurred) - return; - - if (metadata->type == FLAC__METADATA_TYPE_APPLICATION) { - printf ("%u ('%c%c%c%c')... ", dcd->current_metadata_number, metadata->data.application.id [0], metadata->data.application.id [1], metadata->data.application.id [2], metadata->data.application.id [3]); - } - else { - printf("%u... ", dcd->current_metadata_number); - } - fflush(stdout); - - - if(dcd->current_metadata_number >= num_expected_) { - (void)die_("got more metadata blocks than expected"); - dcd->error_occurred = true; - } - else { - if(!mutils__compare_block(expected_metadata_sequence_[dcd->current_metadata_number], metadata)) { - (void)die_("metadata block mismatch"); - dcd->error_occurred = true; - } - } - dcd->current_metadata_number++; -} - -static void stream_decoder_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - StreamDecoderClientData *dcd = (StreamDecoderClientData*)client_data; - - (void)decoder; - - if(0 == dcd) { - printf("ERROR: client_data in error callback is NULL\n"); - return; - } - - if(!dcd->ignore_errors) { - printf("ERROR: got error callback: err = %u (%s)\n", (uint32_t)status, FLAC__StreamDecoderErrorStatusString[status]); - dcd->error_occurred = true; - } -} - -static FLAC__bool stream_decoder_test_respond_(FLAC__StreamDecoder *decoder, StreamDecoderClientData *dcd, FLAC__bool is_ogg) -{ - FLAC__StreamDecoderInitStatus init_status; - - if(!FLAC__stream_decoder_set_md5_checking(decoder, true)) - return die_s_("at FLAC__stream_decoder_set_md5_checking(), returned false", decoder); - - /* for FLAC__stream_encoder_init_FILE(), the FLAC__stream_encoder_finish() closes the file so we have to keep re-opening: */ - if(dcd->layer == LAYER_FILE) { - printf("opening %sFLAC file... ", is_ogg? "Ogg ":""); - open_test_file(dcd, is_ogg, "rb"); - if(0 == dcd->file) { - printf("ERROR (%s)\n", strerror(errno)); - return false; - } - printf("OK\n"); - } - - switch(dcd->layer) { - case LAYER_STREAM: - printf("testing FLAC__stream_decoder_init_%sstream()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_stream(decoder, stream_decoder_read_callback_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, dcd) : - FLAC__stream_decoder_init_stream(decoder, stream_decoder_read_callback_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, dcd) - ; - break; - case LAYER_SEEKABLE_STREAM: - printf("testing FLAC__stream_decoder_init_%sstream()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_stream(decoder, stream_decoder_read_callback_, stream_decoder_seek_callback_, stream_decoder_tell_callback_, stream_decoder_length_callback_, stream_decoder_eof_callback_, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, dcd) : - FLAC__stream_decoder_init_stream(decoder, stream_decoder_read_callback_, stream_decoder_seek_callback_, stream_decoder_tell_callback_, stream_decoder_length_callback_, stream_decoder_eof_callback_, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, dcd); - break; - case LAYER_FILE: - printf("testing FLAC__stream_decoder_init_%sFILE()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_FILE(decoder, dcd->file, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, dcd) : - FLAC__stream_decoder_init_FILE(decoder, dcd->file, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, dcd); - break; - case LAYER_FILENAME: - printf("testing FLAC__stream_decoder_init_%sfile()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_file(decoder, flacfilename(is_ogg), stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, dcd) : - FLAC__stream_decoder_init_file(decoder, flacfilename(is_ogg), stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, dcd); - break; - default: - die_("internal error 000"); - return false; - } - if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) - return die_s_(0, decoder); - printf("OK\n"); - - dcd->current_metadata_number = 0; - - if(dcd->layer < LAYER_FILE && fseeko(dcd->file, 0, SEEK_SET) < 0) { - printf("FAILED rewinding input, errno = %d\n", errno); - return false; - } - - printf("testing FLAC__stream_decoder_process_until_end_of_stream()... "); - if(!FLAC__stream_decoder_process_until_end_of_stream(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_finish()... "); - if(!FLAC__stream_decoder_finish(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - return true; -} - -static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) -{ - FLAC__StreamDecoder *decoder; - FLAC__StreamDecoderInitStatus init_status; - FLAC__StreamDecoderState state; - StreamDecoderClientData decoder_client_data; - FLAC__bool expect; - - decoder_client_data.layer = layer; - - printf("\n+++ libFLAC unit test: FLAC__StreamDecoder (layer: %s, format: %s)\n\n", LayerString[layer], is_ogg? "Ogg FLAC" : "FLAC"); - - printf("testing FLAC__stream_decoder_new()... "); - decoder = FLAC__stream_decoder_new(); - if(0 == decoder) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_decoder_delete()... "); - FLAC__stream_decoder_delete(decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_new()... "); - decoder = FLAC__stream_decoder_new(); - if(0 == decoder) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - switch(layer) { - case LAYER_STREAM: - case LAYER_SEEKABLE_STREAM: - printf("testing FLAC__stream_decoder_init_%sstream()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_stream(decoder, 0, 0, 0, 0, 0, 0, 0, 0, 0) : - FLAC__stream_decoder_init_stream(decoder, 0, 0, 0, 0, 0, 0, 0, 0, 0); - break; - case LAYER_FILE: - printf("testing FLAC__stream_decoder_init_%sFILE()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_FILE(decoder, stdin, 0, 0, 0, 0) : - FLAC__stream_decoder_init_FILE(decoder, stdin, 0, 0, 0, 0); - break; - case LAYER_FILENAME: - printf("testing FLAC__stream_decoder_init_%sfile()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_file(decoder, flacfilename(is_ogg), 0, 0, 0, 0) : - FLAC__stream_decoder_init_file(decoder, flacfilename(is_ogg), 0, 0, 0, 0); - break; - default: - die_("internal error 003"); - return false; - } - if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS) - return die_s_(0, decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_delete()... "); - FLAC__stream_decoder_delete(decoder); - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - - printf("testing FLAC__stream_decoder_new()... "); - decoder = FLAC__stream_decoder_new(); - if(0 == decoder) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - if(is_ogg) { - printf("testing FLAC__stream_decoder_set_ogg_serial_number()... "); - if(!FLAC__stream_decoder_set_ogg_serial_number(decoder, file_utils__ogg_serial_number)) - return die_s_("returned false", decoder); - printf("OK\n"); - } - - printf("testing FLAC__stream_decoder_set_md5_checking()... "); - if(!FLAC__stream_decoder_set_md5_checking(decoder, true)) - return die_s_("returned false", decoder); - printf("OK\n"); - - if(layer < LAYER_FILENAME) { - printf("opening %sFLAC file... ", is_ogg? "Ogg ":""); - open_test_file(&decoder_client_data, is_ogg, "rb"); - if(0 == decoder_client_data.file) { - printf("ERROR (%s)\n", strerror(errno)); - return false; - } - printf("OK\n"); - } - - switch(layer) { - case LAYER_STREAM: - printf("testing FLAC__stream_decoder_init_%sstream()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_stream(decoder, stream_decoder_read_callback_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, &decoder_client_data) : - FLAC__stream_decoder_init_stream(decoder, stream_decoder_read_callback_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, &decoder_client_data); - break; - case LAYER_SEEKABLE_STREAM: - printf("testing FLAC__stream_decoder_init_%sstream()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_stream(decoder, stream_decoder_read_callback_, stream_decoder_seek_callback_, stream_decoder_tell_callback_, stream_decoder_length_callback_, stream_decoder_eof_callback_, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, &decoder_client_data) : - FLAC__stream_decoder_init_stream(decoder, stream_decoder_read_callback_, stream_decoder_seek_callback_, stream_decoder_tell_callback_, stream_decoder_length_callback_, stream_decoder_eof_callback_, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, &decoder_client_data); - break; - case LAYER_FILE: - printf("testing FLAC__stream_decoder_init_%sFILE()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_FILE(decoder, decoder_client_data.file, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, &decoder_client_data) : - FLAC__stream_decoder_init_FILE(decoder, decoder_client_data.file, stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, &decoder_client_data); - break; - case LAYER_FILENAME: - printf("testing FLAC__stream_decoder_init_%sfile()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_decoder_init_ogg_file(decoder, flacfilename(is_ogg), stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, &decoder_client_data) : - FLAC__stream_decoder_init_file(decoder, flacfilename(is_ogg), stream_decoder_write_callback_, stream_decoder_metadata_callback_, stream_decoder_error_callback_, &decoder_client_data); - break; - default: - die_("internal error 009"); - return false; - } - if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK) - return die_s_(0, decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_get_state()... "); - state = FLAC__stream_decoder_get_state(decoder); - printf("returned state = %u (%s)... OK\n", state, FLAC__StreamDecoderStateString[state]); - - decoder_client_data.current_metadata_number = 0; - decoder_client_data.ignore_errors = false; - decoder_client_data.error_occurred = false; - - printf("testing FLAC__stream_decoder_get_md5_checking()... "); - if(!FLAC__stream_decoder_get_md5_checking(decoder)) { - printf("FAILED, returned false, expected true\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_decoder_process_until_end_of_metadata()... "); - if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_process_single()... "); - if(!FLAC__stream_decoder_process_single(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_skip_single_frame()... "); - if(!FLAC__stream_decoder_skip_single_frame(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - if(layer < LAYER_FILE) { - printf("testing FLAC__stream_decoder_flush()... "); - if(!FLAC__stream_decoder_flush(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - decoder_client_data.ignore_errors = true; - printf("testing FLAC__stream_decoder_process_single()... "); - if(!FLAC__stream_decoder_process_single(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - decoder_client_data.ignore_errors = false; - } - - expect = (layer != LAYER_STREAM); - printf("testing FLAC__stream_decoder_seek_absolute()... "); - if(FLAC__stream_decoder_seek_absolute(decoder, 0) != expect) - return die_s_(expect? "returned false" : "returned true", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_process_until_end_of_stream()... "); - if(!FLAC__stream_decoder_process_until_end_of_stream(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - expect = (layer != LAYER_STREAM); - printf("testing FLAC__stream_decoder_seek_absolute()... "); - if(FLAC__stream_decoder_seek_absolute(decoder, 0) != expect) - return die_s_(expect? "returned false" : "returned true", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_get_channels()... "); - { - uint32_t channels = FLAC__stream_decoder_get_channels(decoder); - if(channels != streaminfo_.data.stream_info.channels) { - printf("FAILED, returned %u, expected %u\n", channels, streaminfo_.data.stream_info.channels); - return false; - } - } - printf("OK\n"); - - printf("testing FLAC__stream_decoder_get_bits_per_sample()... "); - { - uint32_t bits_per_sample = FLAC__stream_decoder_get_bits_per_sample(decoder); - if(bits_per_sample != streaminfo_.data.stream_info.bits_per_sample) { - printf("FAILED, returned %u, expected %u\n", bits_per_sample, streaminfo_.data.stream_info.bits_per_sample); - return false; - } - } - printf("OK\n"); - - printf("testing FLAC__stream_decoder_get_sample_rate()... "); - { - uint32_t sample_rate = FLAC__stream_decoder_get_sample_rate(decoder); - if(sample_rate != streaminfo_.data.stream_info.sample_rate) { - printf("FAILED, returned %u, expected %u\n", sample_rate, streaminfo_.data.stream_info.sample_rate); - return false; - } - } - printf("OK\n"); - - printf("testing FLAC__stream_decoder_get_blocksize()... "); - { - uint32_t blocksize = FLAC__stream_decoder_get_blocksize(decoder); - /* value could be anything since we're at the last block, so accept any reasonable answer */ - printf("returned %u... %s\n", blocksize, blocksize>0? "OK" : "FAILED"); - if(blocksize == 0) - return false; - } - - printf("testing FLAC__stream_decoder_get_channel_assignment()... "); - { - FLAC__ChannelAssignment ca = FLAC__stream_decoder_get_channel_assignment(decoder); - printf("returned %u (%s)... OK\n", (uint32_t)ca, FLAC__ChannelAssignmentString[ca]); - } - - if(layer < LAYER_FILE) { - printf("testing FLAC__stream_decoder_reset()... "); - if(!FLAC__stream_decoder_reset(decoder)) { - state = FLAC__stream_decoder_get_state(decoder); - printf("FAILED, returned false, state = %u (%s)\n", state, FLAC__StreamDecoderStateString[state]); - return false; - } - printf("OK\n"); - - if(layer == LAYER_STREAM) { - /* after a reset() we have to rewind the input ourselves */ - printf("rewinding input... "); - if(fseeko(decoder_client_data.file, 0, SEEK_SET) < 0) { - printf("FAILED, errno = %d\n", errno); - return false; - } - printf("OK\n"); - } - - decoder_client_data.current_metadata_number = 0; - - printf("testing FLAC__stream_decoder_process_until_end_of_stream()... "); - if(!FLAC__stream_decoder_process_until_end_of_stream(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - } - - printf("testing FLAC__stream_decoder_finish()... "); - if(!FLAC__stream_decoder_finish(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - /* - * respond all - */ - - printf("testing FLAC__stream_decoder_set_metadata_respond_all()... "); - if(!FLAC__stream_decoder_set_metadata_respond_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * ignore all - */ - - printf("testing FLAC__stream_decoder_set_metadata_ignore_all()... "); - if(!FLAC__stream_decoder_set_metadata_ignore_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * respond all, ignore VORBIS_COMMENT - */ - - printf("testing FLAC__stream_decoder_set_metadata_respond_all()... "); - if(!FLAC__stream_decoder_set_metadata_respond_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_ignore(VORBIS_COMMENT)... "); - if(!FLAC__stream_decoder_set_metadata_ignore(decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * respond all, ignore APPLICATION - */ - - printf("testing FLAC__stream_decoder_set_metadata_respond_all()... "); - if(!FLAC__stream_decoder_set_metadata_respond_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_ignore(APPLICATION)... "); - if(!FLAC__stream_decoder_set_metadata_ignore(decoder, FLAC__METADATA_TYPE_APPLICATION)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * respond all, ignore APPLICATION id of app#1 - */ - - printf("testing FLAC__stream_decoder_set_metadata_respond_all()... "); - if(!FLAC__stream_decoder_set_metadata_respond_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_ignore_application(of app block #1)... "); - if(!FLAC__stream_decoder_set_metadata_ignore_application(decoder, application1_.data.application.id)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application2_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * respond all, ignore APPLICATION id of app#1 & app#2 - */ - - printf("testing FLAC__stream_decoder_set_metadata_respond_all()... "); - if(!FLAC__stream_decoder_set_metadata_respond_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_ignore_application(of app block #1)... "); - if(!FLAC__stream_decoder_set_metadata_ignore_application(decoder, application1_.data.application.id)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_ignore_application(of app block #2)... "); - if(!FLAC__stream_decoder_set_metadata_ignore_application(decoder, application2_.data.application.id)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * ignore all, respond VORBIS_COMMENT - */ - - printf("testing FLAC__stream_decoder_set_metadata_ignore_all()... "); - if(!FLAC__stream_decoder_set_metadata_ignore_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_respond(VORBIS_COMMENT)... "); - if(!FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * ignore all, respond APPLICATION - */ - - printf("testing FLAC__stream_decoder_set_metadata_ignore_all()... "); - if(!FLAC__stream_decoder_set_metadata_ignore_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_respond(APPLICATION)... "); - if(!FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_APPLICATION)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * ignore all, respond APPLICATION id of app#1 - */ - - printf("testing FLAC__stream_decoder_set_metadata_ignore_all()... "); - if(!FLAC__stream_decoder_set_metadata_ignore_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_respond_application(of app block #1)... "); - if(!FLAC__stream_decoder_set_metadata_respond_application(decoder, application1_.data.application.id)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &application1_; - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * ignore all, respond APPLICATION id of app#1 & app#2 - */ - - printf("testing FLAC__stream_decoder_set_metadata_ignore_all()... "); - if(!FLAC__stream_decoder_set_metadata_ignore_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_respond_application(of app block #1)... "); - if(!FLAC__stream_decoder_set_metadata_respond_application(decoder, application1_.data.application.id)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_respond_application(of app block #2)... "); - if(!FLAC__stream_decoder_set_metadata_respond_application(decoder, application2_.data.application.id)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &application2_; - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * respond all, ignore APPLICATION, respond APPLICATION id of app#1 - */ - - printf("testing FLAC__stream_decoder_set_metadata_respond_all()... "); - if(!FLAC__stream_decoder_set_metadata_respond_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_ignore(APPLICATION)... "); - if(!FLAC__stream_decoder_set_metadata_ignore(decoder, FLAC__METADATA_TYPE_APPLICATION)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_respond_application(of app block #1)... "); - if(!FLAC__stream_decoder_set_metadata_respond_application(decoder, application1_.data.application.id)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - else { - expected_metadata_sequence_[num_expected_++] = &streaminfo_; - expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; - expected_metadata_sequence_[num_expected_++] = &application1_; - expected_metadata_sequence_[num_expected_++] = &vorbiscomment_; - expected_metadata_sequence_[num_expected_++] = &cuesheet_; - expected_metadata_sequence_[num_expected_++] = &picture_; - expected_metadata_sequence_[num_expected_++] = &unknown_; - } - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - /* - * ignore all, respond APPLICATION, ignore APPLICATION id of app#1 - */ - - printf("testing FLAC__stream_decoder_set_metadata_ignore_all()... "); - if(!FLAC__stream_decoder_set_metadata_ignore_all(decoder)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_respond(APPLICATION)... "); - if(!FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_APPLICATION)) - return die_s_("returned false", decoder); - printf("OK\n"); - - printf("testing FLAC__stream_decoder_set_metadata_ignore_application(of app block #1)... "); - if(!FLAC__stream_decoder_set_metadata_ignore_application(decoder, application1_.data.application.id)) - return die_s_("returned false", decoder); - printf("OK\n"); - - num_expected_ = 0; - expected_metadata_sequence_[num_expected_++] = &application2_; - - if(!stream_decoder_test_respond_(decoder, &decoder_client_data, is_ogg)) - return false; - - if(layer < LAYER_FILE) /* for LAYER_FILE, FLAC__stream_decoder_finish() closes the file */ - fclose(decoder_client_data.file); - - printf("testing FLAC__stream_decoder_delete()... "); - FLAC__stream_decoder_delete(decoder); - printf("OK\n"); - - printf("\nPASSED!\n"); - - return true; -} - -FLAC__bool test_decoders(void) -{ - FLAC__bool is_ogg = false; - - while(1) { - init_metadata_blocks_(); - - if(!generate_file_(is_ogg)) - return false; - - if(!test_stream_decoder(LAYER_STREAM, is_ogg)) - return false; - - if(!test_stream_decoder(LAYER_SEEKABLE_STREAM, is_ogg)) - return false; - - if(!test_stream_decoder(LAYER_FILE, is_ogg)) - return false; - - if(!test_stream_decoder(LAYER_FILENAME, is_ogg)) - return false; - - (void) grabbag__file_remove_file(flacfilename(is_ogg)); - - free_metadata_blocks_(); - - if(!FLAC_API_SUPPORTS_OGG_FLAC || is_ogg) - break; - is_ogg = true; - } - - return true; -} diff --git a/src/test_libFLAC/decoders.h b/src/test_libFLAC/decoders.h deleted file mode 100644 index 5fb2ae5d..00000000 --- a/src/test_libFLAC/decoders.h +++ /dev/null @@ -1,27 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLAC_DECODERS_H -#define FLAC__TEST_LIBFLAC_DECODERS_H - -#include "FLAC/ordinals.h" - -FLAC__bool test_decoders(void); - -#endif diff --git a/src/test_libFLAC/encoders.c b/src/test_libFLAC/encoders.c deleted file mode 100644 index 7aefe79b..00000000 --- a/src/test_libFLAC/encoders.c +++ /dev/null @@ -1,519 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include "encoders.h" -#include "FLAC/assert.h" -#include "FLAC/stream_encoder.h" -#include "share/grabbag.h" -#include "share/compat.h" -#include "test_libs_common/file_utils_flac.h" -#include "test_libs_common/metadata_utils.h" - -typedef enum { - LAYER_STREAM = 0, /* FLAC__stream_encoder_init_[ogg_]stream() without seeking */ - LAYER_SEEKABLE_STREAM, /* FLAC__stream_encoder_init_[ogg_]stream() with seeking */ - LAYER_FILE, /* FLAC__stream_encoder_init_[ogg_]FILE() */ - LAYER_FILENAME /* FLAC__stream_encoder_init_[ogg_]file() */ -} Layer; - -static const char * const LayerString[] = { - "Stream", - "Seekable Stream", - "FILE*", - "Filename" -}; - -static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, picture_, unknown_; -static FLAC__StreamMetadata *metadata_sequence_[] = { &vorbiscomment_, &padding_, &seektable_, &application1_, &application2_, &cuesheet_, &picture_, &unknown_ }; -static const uint32_t num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]); - -static const char *flacfilename(FLAC__bool is_ogg) -{ - return is_ogg? "metadata.oga" : "metadata.flac"; -} - -static FLAC__bool die_(const char *msg) -{ - printf("ERROR: %s\n", msg); - return false; -} - -static FLAC__bool die_s_(const char *msg, const FLAC__StreamEncoder *encoder) -{ - FLAC__StreamEncoderState state = FLAC__stream_encoder_get_state(encoder); - - if(msg) - printf("FAILED, %s", msg); - else - printf("FAILED"); - - printf(", state = %u (%s)\n", (uint32_t)state, FLAC__StreamEncoderStateString[state]); - if(state == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { - FLAC__StreamDecoderState dstate = FLAC__stream_encoder_get_verify_decoder_state(encoder); - printf(" verify decoder state = %u (%s)\n", (uint32_t)dstate, FLAC__StreamDecoderStateString[dstate]); - } - - return false; -} - -static void init_metadata_blocks_(void) -{ - mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &picture_, &unknown_); -} - -static void free_metadata_blocks_(void) -{ - mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &picture_, &unknown_); -} - -static FLAC__StreamEncoderReadStatus stream_encoder_read_callback_(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data) -{ - FILE *f = (FILE*)client_data; - (void)encoder; - if(*bytes > 0) { - *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, f); - if(ferror(f)) - return FLAC__STREAM_ENCODER_READ_STATUS_ABORT; - else if(*bytes == 0) - return FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM; - else - return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE; - } - else - return FLAC__STREAM_ENCODER_READ_STATUS_ABORT; -} - -static FLAC__StreamEncoderWriteStatus stream_encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data) -{ - FILE *f = (FILE*)client_data; - (void)encoder, (void)samples, (void)current_frame; - if(fwrite(buffer, 1, bytes, f) != bytes) - return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; - else - return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; -} - -static FLAC__StreamEncoderSeekStatus stream_encoder_seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) -{ - FILE *f = (FILE*)client_data; - (void)encoder; - if(fseeko(f, (long)absolute_byte_offset, SEEK_SET) < 0) - return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR; - else - return FLAC__STREAM_ENCODER_SEEK_STATUS_OK; -} - -static FLAC__StreamEncoderTellStatus stream_encoder_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) -{ - FILE *f = (FILE*)client_data; - FLAC__off_t pos; - (void)encoder; - if((pos = ftello(f)) < 0) - return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR; - else { - *absolute_byte_offset = (FLAC__uint64)pos; - return FLAC__STREAM_ENCODER_TELL_STATUS_OK; - } -} - -static void stream_encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - (void)encoder, (void)metadata, (void)client_data; -} - -static void stream_encoder_progress_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, uint32_t frames_written, uint32_t total_frames_estimate, void *client_data) -{ - (void)encoder, (void)bytes_written, (void)samples_written, (void)frames_written, (void)total_frames_estimate, (void)client_data; -} - -static FLAC__bool test_stream_encoder(Layer layer, FLAC__bool is_ogg) -{ - FLAC__StreamEncoder *encoder; - FLAC__StreamEncoderInitStatus init_status; - FLAC__StreamEncoderState state; - FLAC__StreamDecoderState dstate; - FILE *file = 0; - FLAC__int32 samples[1024]; - FLAC__int32 *samples_array[1]; - uint32_t i; - - samples_array[0] = samples; - - printf("\n+++ libFLAC unit test: FLAC__StreamEncoder (layer: %s, format: %s)\n\n", LayerString[layer], is_ogg? "Ogg FLAC":"FLAC"); - - printf("testing FLAC__stream_encoder_new()... "); - encoder = FLAC__stream_encoder_new(); - if(0 == encoder) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - if(is_ogg) { - printf("testing FLAC__stream_encoder_set_ogg_serial_number()... "); - if(!FLAC__stream_encoder_set_ogg_serial_number(encoder, file_utils__ogg_serial_number)) - return die_s_("returned false", encoder); - printf("OK\n"); - } - - printf("testing FLAC__stream_encoder_set_verify()... "); - if(!FLAC__stream_encoder_set_verify(encoder, true)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_streamable_subset()... "); - if(!FLAC__stream_encoder_set_streamable_subset(encoder, true)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_channels()... "); - if(!FLAC__stream_encoder_set_channels(encoder, streaminfo_.data.stream_info.channels)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_bits_per_sample()... "); - if(!FLAC__stream_encoder_set_bits_per_sample(encoder, streaminfo_.data.stream_info.bits_per_sample)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_sample_rate()... "); - if(!FLAC__stream_encoder_set_sample_rate(encoder, streaminfo_.data.stream_info.sample_rate)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_compression_level()... "); - if(!FLAC__stream_encoder_set_compression_level(encoder, (uint32_t)(-1))) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_blocksize()... "); - if(!FLAC__stream_encoder_set_blocksize(encoder, streaminfo_.data.stream_info.min_blocksize)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_do_mid_side_stereo()... "); - if(!FLAC__stream_encoder_set_do_mid_side_stereo(encoder, false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_loose_mid_side_stereo()... "); - if(!FLAC__stream_encoder_set_loose_mid_side_stereo(encoder, false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_max_lpc_order()... "); - if(!FLAC__stream_encoder_set_max_lpc_order(encoder, 0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_qlp_coeff_precision()... "); - if(!FLAC__stream_encoder_set_qlp_coeff_precision(encoder, 0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_do_qlp_coeff_prec_search()... "); - if(!FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder, false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_do_escape_coding()... "); - if(!FLAC__stream_encoder_set_do_escape_coding(encoder, false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_do_exhaustive_model_search()... "); - if(!FLAC__stream_encoder_set_do_exhaustive_model_search(encoder, false)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_min_residual_partition_order()... "); - if(!FLAC__stream_encoder_set_min_residual_partition_order(encoder, 0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_max_residual_partition_order()... "); - if(!FLAC__stream_encoder_set_max_residual_partition_order(encoder, 0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_rice_parameter_search_dist()... "); - if(!FLAC__stream_encoder_set_rice_parameter_search_dist(encoder, 0)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_total_samples_estimate()... "); - if(!FLAC__stream_encoder_set_total_samples_estimate(encoder, streaminfo_.data.stream_info.total_samples)) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_set_metadata()... "); - if(!FLAC__stream_encoder_set_metadata(encoder, metadata_sequence_, num_metadata_)) - return die_s_("returned false", encoder); - printf("OK\n"); - - if(layer < LAYER_FILENAME) { - printf("opening file for FLAC output... "); - file = flac_fopen(flacfilename(is_ogg), "w+b"); - if(0 == file) { - printf("ERROR (%s)\n", strerror(errno)); - return false; - } - printf("OK\n"); - } - - switch(layer) { - case LAYER_STREAM: - printf("testing FLAC__stream_encoder_init_%sstream()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_encoder_init_ogg_stream(encoder, /*read_callback=*/0, stream_encoder_write_callback_, /*seek_callback=*/0, /*tell_callback=*/0, stream_encoder_metadata_callback_, /*client_data=*/file) : - FLAC__stream_encoder_init_stream(encoder, stream_encoder_write_callback_, /*seek_callback=*/0, /*tell_callback=*/0, stream_encoder_metadata_callback_, /*client_data=*/file); - break; - case LAYER_SEEKABLE_STREAM: - printf("testing FLAC__stream_encoder_init_%sstream()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_encoder_init_ogg_stream(encoder, stream_encoder_read_callback_, stream_encoder_write_callback_, stream_encoder_seek_callback_, stream_encoder_tell_callback_, /*metadata_callback=*/0, /*client_data=*/file) : - FLAC__stream_encoder_init_stream(encoder, stream_encoder_write_callback_, stream_encoder_seek_callback_, stream_encoder_tell_callback_, /*metadata_callback=*/0, /*client_data=*/file); - break; - case LAYER_FILE: - printf("testing FLAC__stream_encoder_init_%sFILE()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_encoder_init_ogg_FILE(encoder, file, stream_encoder_progress_callback_, /*client_data=*/0) : - FLAC__stream_encoder_init_FILE(encoder, file, stream_encoder_progress_callback_, /*client_data=*/0); - break; - case LAYER_FILENAME: - printf("testing FLAC__stream_encoder_init_%sfile()... ", is_ogg? "ogg_":""); - init_status = is_ogg? - FLAC__stream_encoder_init_ogg_file(encoder, flacfilename(is_ogg), stream_encoder_progress_callback_, /*client_data=*/0) : - FLAC__stream_encoder_init_file(encoder, flacfilename(is_ogg), stream_encoder_progress_callback_, /*client_data=*/0); - break; - default: - die_("internal error 001"); - return false; - } - if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) - return die_s_(0, encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_state()... "); - state = FLAC__stream_encoder_get_state(encoder); - printf("returned state = %u (%s)... OK\n", (uint32_t)state, FLAC__StreamEncoderStateString[state]); - - printf("testing FLAC__stream_encoder_get_verify_decoder_state()... "); - dstate = FLAC__stream_encoder_get_verify_decoder_state(encoder); - printf("returned state = %u (%s)... OK\n", (uint32_t)dstate, FLAC__StreamDecoderStateString[dstate]); - - { - FLAC__uint64 absolute_sample; - uint32_t frame_number; - uint32_t channel; - uint32_t sample; - FLAC__int32 expected; - FLAC__int32 got; - - printf("testing FLAC__stream_encoder_get_verify_decoder_error_stats()... "); - FLAC__stream_encoder_get_verify_decoder_error_stats(encoder, &absolute_sample, &frame_number, &channel, &sample, &expected, &got); - printf("OK\n"); - } - - printf("testing FLAC__stream_encoder_get_verify()... "); - if(FLAC__stream_encoder_get_verify(encoder) != true) { - printf("FAILED, expected true, got false\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_streamable_subset()... "); - if(FLAC__stream_encoder_get_streamable_subset(encoder) != true) { - printf("FAILED, expected true, got false\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_do_mid_side_stereo()... "); - if(FLAC__stream_encoder_get_do_mid_side_stereo(encoder) != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_loose_mid_side_stereo()... "); - if(FLAC__stream_encoder_get_loose_mid_side_stereo(encoder) != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_channels()... "); - if(FLAC__stream_encoder_get_channels(encoder) != streaminfo_.data.stream_info.channels) { - printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.channels, FLAC__stream_encoder_get_channels(encoder)); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_bits_per_sample()... "); - if(FLAC__stream_encoder_get_bits_per_sample(encoder) != streaminfo_.data.stream_info.bits_per_sample) { - printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.bits_per_sample, FLAC__stream_encoder_get_bits_per_sample(encoder)); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_sample_rate()... "); - if(FLAC__stream_encoder_get_sample_rate(encoder) != streaminfo_.data.stream_info.sample_rate) { - printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.sample_rate, FLAC__stream_encoder_get_sample_rate(encoder)); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_blocksize()... "); - if(FLAC__stream_encoder_get_blocksize(encoder) != streaminfo_.data.stream_info.min_blocksize) { - printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.min_blocksize, FLAC__stream_encoder_get_blocksize(encoder)); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_max_lpc_order()... "); - if(FLAC__stream_encoder_get_max_lpc_order(encoder) != 0) { - printf("FAILED, expected %d, got %u\n", 0, FLAC__stream_encoder_get_max_lpc_order(encoder)); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_qlp_coeff_precision()... "); - (void)FLAC__stream_encoder_get_qlp_coeff_precision(encoder); - /* we asked the encoder to auto select this so we accept anything */ - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_do_qlp_coeff_prec_search()... "); - if(FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder) != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_do_escape_coding()... "); - if(FLAC__stream_encoder_get_do_escape_coding(encoder) != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_do_exhaustive_model_search()... "); - if(FLAC__stream_encoder_get_do_exhaustive_model_search(encoder) != false) { - printf("FAILED, expected false, got true\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_min_residual_partition_order()... "); - if(FLAC__stream_encoder_get_min_residual_partition_order(encoder) != 0) { - printf("FAILED, expected %d, got %u\n", 0, FLAC__stream_encoder_get_min_residual_partition_order(encoder)); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_max_residual_partition_order()... "); - if(FLAC__stream_encoder_get_max_residual_partition_order(encoder) != 0) { - printf("FAILED, expected %d, got %u\n", 0, FLAC__stream_encoder_get_max_residual_partition_order(encoder)); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_rice_parameter_search_dist()... "); - if(FLAC__stream_encoder_get_rice_parameter_search_dist(encoder) != 0) { - printf("FAILED, expected %d, got %u\n", 0, FLAC__stream_encoder_get_rice_parameter_search_dist(encoder)); - return false; - } - printf("OK\n"); - - printf("testing FLAC__stream_encoder_get_total_samples_estimate()... "); - if(FLAC__stream_encoder_get_total_samples_estimate(encoder) != streaminfo_.data.stream_info.total_samples) { - printf("FAILED, expected %" PRIu64 ", got %" PRIu64 "\n", streaminfo_.data.stream_info.total_samples, FLAC__stream_encoder_get_total_samples_estimate(encoder)); - return false; - } - printf("OK\n"); - - /* init the dummy sample buffer */ - for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++) - samples[i] = i & 7; - - printf("testing FLAC__stream_encoder_process()... "); - if(!FLAC__stream_encoder_process(encoder, (const FLAC__int32 * const *)samples_array, sizeof(samples) / sizeof(FLAC__int32))) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_process_interleaved()... "); - if(!FLAC__stream_encoder_process_interleaved(encoder, samples, sizeof(samples) / sizeof(FLAC__int32))) - return die_s_("returned false", encoder); - printf("OK\n"); - - printf("testing FLAC__stream_encoder_finish()... "); - if(!FLAC__stream_encoder_finish(encoder)) - return die_s_("returned false", encoder); - printf("OK\n"); - - if(layer < LAYER_FILE) - fclose(file); - - printf("testing FLAC__stream_encoder_delete()... "); - FLAC__stream_encoder_delete(encoder); - printf("OK\n"); - - printf("\nPASSED!\n"); - - return true; -} - -FLAC__bool test_encoders(void) -{ - FLAC__bool is_ogg = false; - - while(1) { - init_metadata_blocks_(); - - if(!test_stream_encoder(LAYER_STREAM, is_ogg)) - return false; - - if(!test_stream_encoder(LAYER_SEEKABLE_STREAM, is_ogg)) - return false; - - if(!test_stream_encoder(LAYER_FILE, is_ogg)) - return false; - - if(!test_stream_encoder(LAYER_FILENAME, is_ogg)) - return false; - - (void) grabbag__file_remove_file(flacfilename(is_ogg)); - - free_metadata_blocks_(); - - if(!FLAC_API_SUPPORTS_OGG_FLAC || is_ogg) - break; - is_ogg = true; - } - - return true; -} diff --git a/src/test_libFLAC/encoders.h b/src/test_libFLAC/encoders.h deleted file mode 100644 index a2ca5570..00000000 --- a/src/test_libFLAC/encoders.h +++ /dev/null @@ -1,27 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLAC_ENCODERS_H -#define FLAC__TEST_LIBFLAC_ENCODERS_H - -#include "FLAC/ordinals.h" - -FLAC__bool test_encoders(void); - -#endif diff --git a/src/test_libFLAC/endswap.c b/src/test_libFLAC/endswap.c deleted file mode 100644 index b10dc3eb..00000000 --- a/src/test_libFLAC/endswap.c +++ /dev/null @@ -1,111 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2014-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include "share/compat.h" -#include "FLAC/assert.h" -#include "share/endswap.h" -#include "private/md5.h" -#include "endswap.h" - - -FLAC__bool test_endswap(void) -{ - int16_t i16 = 0x1234; - uint16_t u16 = 0xabcd; - int32_t i32 = 0x12345678; - uint32_t u32 = 0xabcdef01; - - union { - uint8_t bytes[4]; - uint16_t u16; - uint32_t u32; - } data; - - printf("\n+++ libFLAC unit test: endswap (%s endian host)\n\n", CPU_IS_LITTLE_ENDIAN ? "little" : "big"); - - printf("testing ENDSWAP_16 on int16_t ... "); - if (((int16_t) ENDSWAP_16(i16)) == i16) { - printf("\nFAILED, ENDSWAP_16(0x%04x) -> 0x%04x == 0x%04x\n", i16, ENDSWAP_16(i16), i16); - return false; - } - if (((int16_t) ENDSWAP_16(ENDSWAP_16(i16))) != i16) { - printf("\nFAILED, ENDSWAP_16(ENDSWAP_16(0x%04x)) -> 0x%04x != 0x%04x\n", i16, ENDSWAP_16(ENDSWAP_16(i16)), i16); - return false; - } - puts("OK"); - - printf("testing ENDSWAP_16 on uint16_t ... "); - if (((uint16_t) ENDSWAP_16(u16)) == u16) { - printf("\nFAILED, ENDSWAP_16(0x%04x) -> 0x%04x == 0x%04x\n", u16, ENDSWAP_16(u16), u16); - return false; - } - if (((uint16_t) ENDSWAP_16(ENDSWAP_16(u16))) != u16) { - printf("\nFAILED, ENDSWAP_16(ENDSWAP_16(0x%04x)) -> 0x%04x != 0x%04x\n", u16, ENDSWAP_16(ENDSWAP_16(u16)), u16); - return false; - } - puts("OK"); - - printf("testing ENDSWAP_32 on int32_t ... "); - if (((int32_t) ENDSWAP_32 (i32)) == i32) { - printf("\nFAILED, ENDSWAP_32(0x%08x) -> 0x%08x == 0x%08x\n", i32, (uint32_t) ENDSWAP_32 (i32), i32); - return false; - } - if (((int32_t) ENDSWAP_32 (ENDSWAP_32 (i32))) != i32) { - printf("\nFAILED, ENDSWAP_32(ENDSWAP_32(0x%08x)) -> 0x%08x != 0x%08x\n", i32, (uint32_t) ENDSWAP_32(ENDSWAP_32 (i32)), i32); - return false; - } - puts("OK"); - - printf("testing ENDSWAP_32 on uint32_t ... "); - if (((uint32_t) ENDSWAP_32(u32)) == u32) { - printf("\nFAILED, ENDSWAP_32(0x%08x) -> 0x%08x == 0x%08x\n", u32, (uint32_t) ENDSWAP_32(u32), u32); - return false; - } - if (((uint32_t) ENDSWAP_32 (ENDSWAP_32(u32))) != u32) { - printf("\nFAILED, ENDSWAP_32(ENDSWAP_32(0x%08x)) -> 0x%08x != 0%08x\n", u32, (uint32_t) ENDSWAP_32(ENDSWAP_32(u32)), u32); - return false; - } - puts("OK"); - - printf("testing H2LE_16 on uint16_t ... "); - data.u16 = H2LE_16(0x1234); - if (data.bytes [0] != 0x34 || data.bytes [1] != 0x12) { - printf("\nFAILED, H2LE_16(0x%04x) -> { 0x%02x, 0x%02x }\n", data.u16, data.bytes [0] & 0xff, data.bytes [1] & 0xff); - return false; - } - puts("OK"); - - printf("testing H2LE_32 on uint32_t ... "); - data.u32 = H2LE_32(0x12345678); - if (data.bytes [0] != 0x78 || data.bytes [1] != 0x56 || data.bytes [2] != 0x34 || data.bytes [3] != 0x12) { - printf("\nFAILED, H2LE_32(0x%08x) -> { 0x%02x, 0x%02x, 0x%02x, 0x%02x }\n", - data.u32, data.bytes [0] & 0xff, data.bytes [1] & 0xff, data.bytes [2] & 0xff, data.bytes [3] & 0xff); - return false; - } - puts("OK"); - - printf("\nPASSED!\n"); - return true; -} diff --git a/src/test_libFLAC/endswap.h b/src/test_libFLAC/endswap.h deleted file mode 100644 index bdd2e74d..00000000 --- a/src/test_libFLAC/endswap.h +++ /dev/null @@ -1,26 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2014-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLAC_ENDSWAP_H -#define FLAC__TEST_LIBFLAC_ENDSWAP_H - -#include "FLAC/ordinals.h" - -FLAC__bool test_endswap(void); - -#endif diff --git a/src/test_libFLAC/format.c b/src/test_libFLAC/format.c deleted file mode 100644 index d57c11df..00000000 --- a/src/test_libFLAC/format.c +++ /dev/null @@ -1,257 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2004-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "FLAC/assert.h" -#include "FLAC/format.h" -#include "format.h" -#include - -static const char *true_false_string_[2] = { "false", "true" }; - -static struct { - uint32_t rate; - FLAC__bool valid; - FLAC__bool subset; -} SAMPLE_RATES[] = { - { 0 , false, false }, - { 1 , true , true }, - { 9 , true , true }, - { 10 , true , true }, - { 4000 , true , true }, - { 8000 , true , true }, - { 11025 , true , true }, - { 12000 , true , true }, - { 16000 , true , true }, - { 22050 , true , true }, - { 24000 , true , true }, - { 32000 , true , true }, - { 32768 , true , true }, - { 44100 , true , true }, - { 48000 , true , true }, - { 65000 , true , true }, - { 65535 , true , true }, - { 65536 , true , false }, - { 65540 , true , true }, - { 65550 , true , true }, - { 65555 , true , false }, - { 66000 , true , true }, - { 66001 , true , false }, - { 96000 , true , true }, - { 100000 , true , true }, - { 100001 , true , false }, - { 192000 , true , true }, - { 500000 , true , true }, - { 500001 , true , false }, - { 500010 , true , true }, - { 655349 , true , false }, - { 655350 , true , true }, - { 655351 , false, false }, - { 655360 , false, false }, - { 700000 , false, false }, - { 700010 , false, false }, - { 1000000, false, false }, - { 1100000, false, false } -}; - -static struct { - const char *string; - FLAC__bool valid; -} VCENTRY_NAMES[] = { - { "" , true }, - { "a" , true }, - { "=" , false }, - { "a=" , false }, - { "\x01", false }, - { "\x1f", false }, - { "\x7d", true }, - { "\x7e", false }, - { "\xff", false } -}; - -static struct { - uint32_t length; - const FLAC__byte *string; - FLAC__bool valid; -} VCENTRY_VALUES[] = { - { 0, (const FLAC__byte*)"" , true }, - { 1, (const FLAC__byte*)"" , true }, - { 1, (const FLAC__byte*)"\x01" , true }, - { 1, (const FLAC__byte*)"\x7f" , true }, - { 1, (const FLAC__byte*)"\x80" , false }, - { 1, (const FLAC__byte*)"\x81" , false }, - { 1, (const FLAC__byte*)"\xc0" , false }, - { 1, (const FLAC__byte*)"\xe0" , false }, - { 1, (const FLAC__byte*)"\xf0" , false }, - { 2, (const FLAC__byte*)"\xc0\x41" , false }, - { 2, (const FLAC__byte*)"\xc1\x41" , false }, - { 2, (const FLAC__byte*)"\xc0\x85" , false }, /* non-shortest form */ - { 2, (const FLAC__byte*)"\xc1\x85" , false }, /* non-shortest form */ - { 2, (const FLAC__byte*)"\xc2\x85" , true }, - { 2, (const FLAC__byte*)"\xe0\x41" , false }, - { 2, (const FLAC__byte*)"\xe1\x41" , false }, - { 2, (const FLAC__byte*)"\xe0\x85" , false }, - { 2, (const FLAC__byte*)"\xe1\x85" , false }, - { 3, (const FLAC__byte*)"\xe0\x85\x41", false }, - { 3, (const FLAC__byte*)"\xe1\x85\x41", false }, - { 3, (const FLAC__byte*)"\xe0\x85\x80", false }, /* non-shortest form */ - { 3, (const FLAC__byte*)"\xe0\x95\x80", false }, /* non-shortest form */ - { 3, (const FLAC__byte*)"\xe0\xa5\x80", true }, - { 3, (const FLAC__byte*)"\xe1\x85\x80", true }, - { 3, (const FLAC__byte*)"\xe1\x95\x80", true }, - { 3, (const FLAC__byte*)"\xe1\xa5\x80", true } -}; - -static struct { - const FLAC__byte *string; - FLAC__bool valid; -} VCENTRY_VALUES_NT[] = { - { (const FLAC__byte*)"" , true }, - { (const FLAC__byte*)"\x01" , true }, - { (const FLAC__byte*)"\x7f" , true }, - { (const FLAC__byte*)"\x80" , false }, - { (const FLAC__byte*)"\x81" , false }, - { (const FLAC__byte*)"\xc0" , false }, - { (const FLAC__byte*)"\xe0" , false }, - { (const FLAC__byte*)"\xf0" , false }, - { (const FLAC__byte*)"\xc0\x41" , false }, - { (const FLAC__byte*)"\xc1\x41" , false }, - { (const FLAC__byte*)"\xc0\x85" , false }, /* non-shortest form */ - { (const FLAC__byte*)"\xc1\x85" , false }, /* non-shortest form */ - { (const FLAC__byte*)"\xc2\x85" , true }, - { (const FLAC__byte*)"\xe0\x41" , false }, - { (const FLAC__byte*)"\xe1\x41" , false }, - { (const FLAC__byte*)"\xe0\x85" , false }, - { (const FLAC__byte*)"\xe1\x85" , false }, - { (const FLAC__byte*)"\xe0\x85\x41", false }, - { (const FLAC__byte*)"\xe1\x85\x41", false }, - { (const FLAC__byte*)"\xe0\x85\x80", false }, /* non-shortest form */ - { (const FLAC__byte*)"\xe0\x95\x80", false }, /* non-shortest form */ - { (const FLAC__byte*)"\xe0\xa5\x80", true }, - { (const FLAC__byte*)"\xe1\x85\x80", true }, - { (const FLAC__byte*)"\xe1\x95\x80", true }, - { (const FLAC__byte*)"\xe1\xa5\x80", true } -}; - -static struct { - uint32_t length; - const FLAC__byte *string; - FLAC__bool valid; -} VCENTRIES[] = { - { 0, (const FLAC__byte*)"" , false }, - { 1, (const FLAC__byte*)"a" , false }, - { 1, (const FLAC__byte*)"=" , true }, - { 2, (const FLAC__byte*)"a=" , true }, - { 2, (const FLAC__byte*)"\x01=" , false }, - { 2, (const FLAC__byte*)"\x1f=" , false }, - { 2, (const FLAC__byte*)"\x7d=" , true }, - { 2, (const FLAC__byte*)"\x7e=" , false }, - { 2, (const FLAC__byte*)"\xff=" , false }, - { 3, (const FLAC__byte*)"a=\x01" , true }, - { 3, (const FLAC__byte*)"a=\x7f" , true }, - { 3, (const FLAC__byte*)"a=\x80" , false }, - { 3, (const FLAC__byte*)"a=\x81" , false }, - { 3, (const FLAC__byte*)"a=\xc0" , false }, - { 3, (const FLAC__byte*)"a=\xe0" , false }, - { 3, (const FLAC__byte*)"a=\xf0" , false }, - { 4, (const FLAC__byte*)"a=\xc0\x41" , false }, - { 4, (const FLAC__byte*)"a=\xc1\x41" , false }, - { 4, (const FLAC__byte*)"a=\xc0\x85" , false }, /* non-shortest form */ - { 4, (const FLAC__byte*)"a=\xc1\x85" , false }, /* non-shortest form */ - { 4, (const FLAC__byte*)"a=\xc2\x85" , true }, - { 4, (const FLAC__byte*)"a=\xe0\x41" , false }, - { 4, (const FLAC__byte*)"a=\xe1\x41" , false }, - { 4, (const FLAC__byte*)"a=\xe0\x85" , false }, - { 4, (const FLAC__byte*)"a=\xe1\x85" , false }, - { 5, (const FLAC__byte*)"a=\xe0\x85\x41", false }, - { 5, (const FLAC__byte*)"a=\xe1\x85\x41", false }, - { 5, (const FLAC__byte*)"a=\xe0\x85\x80", false }, /* non-shortest form */ - { 5, (const FLAC__byte*)"a=\xe0\x95\x80", false }, /* non-shortest form */ - { 5, (const FLAC__byte*)"a=\xe0\xa5\x80", true }, - { 5, (const FLAC__byte*)"a=\xe1\x85\x80", true }, - { 5, (const FLAC__byte*)"a=\xe1\x95\x80", true }, - { 5, (const FLAC__byte*)"a=\xe1\xa5\x80", true } -}; - -FLAC__bool test_format(void) -{ - uint32_t i; - - printf("\n+++ libFLAC unit test: format\n\n"); - - for(i = 0; i < sizeof(SAMPLE_RATES)/sizeof(SAMPLE_RATES[0]); i++) { - printf("testing FLAC__format_sample_rate_is_valid(%u)... ", SAMPLE_RATES[i].rate); - if(FLAC__format_sample_rate_is_valid(SAMPLE_RATES[i].rate) != SAMPLE_RATES[i].valid) { - printf("FAILED, expected %s, got %s\n", true_false_string_[SAMPLE_RATES[i].valid], true_false_string_[!SAMPLE_RATES[i].valid]); - return false; - } - printf("OK\n"); - } - - for(i = 0; i < sizeof(SAMPLE_RATES)/sizeof(SAMPLE_RATES[0]); i++) { - printf("testing FLAC__format_sample_rate_is_subset(%u)... ", SAMPLE_RATES[i].rate); - if(FLAC__format_sample_rate_is_subset(SAMPLE_RATES[i].rate) != SAMPLE_RATES[i].subset) { - printf("FAILED, expected %s, got %s\n", true_false_string_[SAMPLE_RATES[i].subset], true_false_string_[!SAMPLE_RATES[i].subset]); - return false; - } - printf("OK\n"); - } - - for(i = 0; i < sizeof(VCENTRY_NAMES)/sizeof(VCENTRY_NAMES[0]); i++) { - printf("testing FLAC__format_vorbiscomment_entry_name_is_legal(\"%s\")... ", VCENTRY_NAMES[i].string); - if(FLAC__format_vorbiscomment_entry_name_is_legal(VCENTRY_NAMES[i].string) != VCENTRY_NAMES[i].valid) { - printf("FAILED, expected %s, got %s\n", true_false_string_[VCENTRY_NAMES[i].valid], true_false_string_[!VCENTRY_NAMES[i].valid]); - return false; - } - printf("OK\n"); - } - - for(i = 0; i < sizeof(VCENTRY_VALUES)/sizeof(VCENTRY_VALUES[0]); i++) { - printf("testing FLAC__format_vorbiscomment_entry_value_is_legal(\"%s\", %u)... ", VCENTRY_VALUES[i].string, VCENTRY_VALUES[i].length); - if(FLAC__format_vorbiscomment_entry_value_is_legal(VCENTRY_VALUES[i].string, VCENTRY_VALUES[i].length) != VCENTRY_VALUES[i].valid) { - printf("FAILED, expected %s, got %s\n", true_false_string_[VCENTRY_VALUES[i].valid], true_false_string_[!VCENTRY_VALUES[i].valid]); - return false; - } - printf("OK\n"); - } - - for(i = 0; i < sizeof(VCENTRY_VALUES_NT)/sizeof(VCENTRY_VALUES_NT[0]); i++) { - printf("testing FLAC__format_vorbiscomment_entry_value_is_legal(\"%s\", -1)... ", VCENTRY_VALUES_NT[i].string); - if(FLAC__format_vorbiscomment_entry_value_is_legal(VCENTRY_VALUES_NT[i].string, (uint32_t)(-1)) != VCENTRY_VALUES_NT[i].valid) { - printf("FAILED, expected %s, got %s\n", true_false_string_[VCENTRY_VALUES_NT[i].valid], true_false_string_[!VCENTRY_VALUES_NT[i].valid]); - return false; - } - printf("OK\n"); - } - - for(i = 0; i < sizeof(VCENTRIES)/sizeof(VCENTRIES[0]); i++) { - printf("testing FLAC__format_vorbiscomment_entry_is_legal(\"%s\", %u)... ", VCENTRIES[i].string, VCENTRIES[i].length); - if(FLAC__format_vorbiscomment_entry_is_legal(VCENTRIES[i].string, VCENTRIES[i].length) != VCENTRIES[i].valid) { - printf("FAILED, expected %s, got %s\n", true_false_string_[VCENTRIES[i].valid], true_false_string_[!VCENTRIES[i].valid]); - return false; - } - printf("OK\n"); - } - - printf("\nPASSED!\n"); - return true; -} diff --git a/src/test_libFLAC/format.h b/src/test_libFLAC/format.h deleted file mode 100644 index a71d1cd8..00000000 --- a/src/test_libFLAC/format.h +++ /dev/null @@ -1,27 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2004-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLAC_FORMAT_H -#define FLAC__TEST_LIBFLAC_FORMAT_H - -#include "FLAC/ordinals.h" - -FLAC__bool test_format(void); - -#endif diff --git a/src/test_libFLAC/main.c b/src/test_libFLAC/main.c deleted file mode 100644 index e627b86a..00000000 --- a/src/test_libFLAC/main.c +++ /dev/null @@ -1,64 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2018 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "bitreader.h" -#include "bitwriter.h" -#include "crc.h" -#include "decoders.h" -#include "encoders.h" -#include "endswap.h" -#include "format.h" -#include "metadata.h" -#include "md5.h" - -int main(void) -{ - if(!test_endswap()) - return 1; - - if(!test_crc()) - return 1; - - if(!test_md5()) - return 1; - - if(!test_bitreader()) - return 1; - - if(!test_bitwriter()) - return 1; - - if(!test_format()) - return 1; - - if(!test_encoders()) - return 1; - - if(!test_decoders()) - return 1; - - if(!test_metadata()) - return 1; - - return 0; -} diff --git a/src/test_libFLAC/matrix b/src/test_libFLAC/matrix deleted file mode 100644 index a78ecf3a..00000000 --- a/src/test_libFLAC/matrix +++ /dev/null @@ -1,69 +0,0 @@ -#if 0 -level 1 - -4 delete middle block nopad -1 delete middle block pad -1 delete last block nopad -1 delete last block pad -1 insert middle block nopad -1 insert middle block equalpad -1 insert middle block smallpad -1 insert middle block smallpad+1 -1 insert middle block biggerpad -1 insert last block X -1 set middle block smaller nopad -1 set middle block smaller pad -1 set last block smaller nopad -1 set last block smaller pad -1 set middle block bigger nopad -1 set middle block bigger equalpad -1 set middle block bigger smallpad -1 set middle block bigger smallpad+1 -1 set middle block bigger biggerpad -1 set last block bigger nopad -1 set middle block equal X -2 set last block equal X - -level 2 - -FLAC__bool FLAC__metadata_chain_write() - -1 newsize==oldsize - newsize>oldsize -b no use_padding -c use_padding, last block is not padding -g use_padding, last block is padding of insufficient length -h use_padding, last block is padding, but padding header straddles border (can't do it) -j use_padding, last block is padding of exact sufficient length (padding totally consumed) -i use_padding, last block is padding of abundant length (padding is reduced) - newsize= 4 -f use_padding, last block is padding - -void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain); -void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain); - -S:34 A:1234 -a:shrink A->30 write nopad -S:34 A:30 -b:grow A->32 write nopad -S:34 A:32 -c:grow A->40 write pad -S:34 A:40 -d:shrink A->37 write pad -S:34 A:37 -e:shrink A->33 write pad -S:34 A:33 P:0 -f:shrink A->20 write pad -S:34 A:20 P:13 -g:grow A->40 write pad -S:34 A:40 P:13 -h:grow A->54 write pad -S:34 A:54 P:13 -i:grow A->60 write pad -S:34 A:60 P:7 -j:grow A->71 write pad -S:34 A:71 -#endif diff --git a/src/test_libFLAC/md5.c b/src/test_libFLAC/md5.c deleted file mode 100644 index 147a76c8..00000000 --- a/src/test_libFLAC/md5.c +++ /dev/null @@ -1,221 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2014-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include - -#include "FLAC/assert.h" -#include "share/compat.h" -#include "private/md5.h" -#include "md5.h" - - -static FLAC__bool test_md5_clear_context(void); -static FLAC__bool test_md5_codec(void); -static FLAC__bool test_md5_accumulate(const FLAC__int32 * const * signal,uint32_t channels, uint32_t samples, uint32_t bytes_per_sample, const FLAC__byte target_digest [16]); - -FLAC__bool test_md5(void) -{ - printf("\n+++ libFLAC unit test: md5\n\n"); - - if (! test_md5_clear_context()) - return false; - - if (! test_md5_codec()) - return false; - - printf("\nPASSED!\n"); - return true; -} - -/*----------------------------------------------------------------------------*/ - -static FLAC__bool test_md5_clear_context(void) -{ - FLAC__MD5Context ctx; - FLAC__byte digest[16]; - FLAC__byte target[16] = { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e }; - uint32_t k ; - char * cptr; - - printf("testing FLAC__MD5Init ... "); - FLAC__MD5Init (&ctx); - if (ctx.buf[0] != 0x67452301) { - printf("FAILED!\n"); - return false; - } - printf("OK\n"); - - printf("testing that FLAC__MD5Final clears the MD5Context ... "); - FLAC__MD5Final(digest, &ctx); - cptr = (char*) &ctx ; - for (k = 0 ; k < sizeof (ctx) ; k++) { - if (cptr [k]) { - printf("FAILED, MD5 ctx has not been cleared after FLAC__MD5Final\n"); - return false; - } - } - printf("OK\n"); - - printf("testing digest correct for zero data ... "); - if (memcmp(digest, target, sizeof (digest))) { - printf("\nFAILED, expected MD5 sum "); - for (k = 0 ; k < 16 ; k++) - printf("%02x", (target [k] & 0xff)); - printf (" but got "); - for (k = 0 ; k < 16 ; k++) - printf("%02x", (digest [k] & 0xff)); - puts("\n"); - return false; - } - puts("OK"); - - return true; -} - -static FLAC__byte target_digests [8][4][16] = -{ /* 1 channel */ - { /* 1 byte per sample */ - { 0xc1, 0x9a, 0x5b, 0xeb, 0x57, 0x8f, 0x26, 0xeb, 0xfb, 0x34, 0x7c, 0xef, 0x04, 0x31, 0x6d, 0x7d }, - /* 2 bytes per sample */ - { 0xd4, 0x78, 0x90, 0xd3, 0xa9, 0x17, 0x4e, 0x76, 0xca, 0x4d, 0x27, 0x20, 0x98, 0x36, 0x8b, 0x2e }, - /* 3 bytes per sample */ - { 0x5a, 0x4b, 0xd6, 0xac, 0xa1, 0x70, 0x84, 0x19, 0x7c, 0x0d, 0xfb, 0x5b, 0xa9, 0x7b, 0xcb, 0x54 }, - /* 4 bytes per sample */ - { 0x79, 0xd5, 0x7a, 0x32, 0x06, 0x0b, 0xfe, 0x46, 0xa3, 0xe7, 0xba, 0xc5, 0xf7, 0x48, 0x6f, 0x50 } - }, - - /* 2 channels */ - { - { 0x89, 0xac, 0xcf, 0x91, 0xf1, 0x8c, 0xea, 0xab, 0x46, 0x12, 0x74, 0xbc, 0x4e, 0x82, 0xbe, 0x7d }, - { 0xb9, 0x17, 0x16, 0x5b, 0xd8, 0x1c, 0xc8, 0x4e, 0x5a, 0x28, 0xfb, 0xba, 0x87, 0x74, 0x76, 0x44 }, - { 0xec, 0x63, 0x92, 0xca, 0x4f, 0x6b, 0x9e, 0xb1, 0x9f, 0xec, 0x3b, 0x2c, 0x15, 0x30, 0xfd, 0x2a }, - { 0x05, 0x4d, 0xfd, 0xb8, 0x9d, 0x8a, 0xa2, 0xdd, 0x26, 0x47, 0xc6, 0xfb, 0x4f, 0x23, 0x67, 0x6d } - }, - - /* 3 channels */ - { - { 0xad, 0x05, 0xda, 0xf3, 0x7a, 0xa1, 0x94, 0xdb, 0x0c, 0x61, 0x06, 0xb2, 0x94, 0x39, 0x6c, 0xa9 }, - { 0x8b, 0xcc, 0x41, 0x4d, 0xe9, 0xe3, 0xc2, 0x61, 0x61, 0x8a, 0x8b, 0x22, 0xc6, 0x4e, 0xac, 0xa7 }, - { 0x8a, 0xce, 0x97, 0xc1, 0x86, 0xae, 0xbc, 0x73, 0x88, 0x8b, 0x35, 0x5a, 0x37, 0x33, 0xf9, 0xcf }, - { 0x69, 0x59, 0xe8, 0x38, 0x29, 0x80, 0x80, 0x21, 0xb1, 0xd2, 0xba, 0xf6, 0x28, 0xd6, 0x6a, 0x83 } - }, - - /* 4 channels */ - { - { 0x61, 0x40, 0x75, 0xef, 0x22, 0xf1, 0x0f, 0xa6, 0x08, 0x6c, 0x88, 0xff, 0x2c, 0x4e, 0x98, 0x0b }, - { 0xa0, 0x77, 0x3a, 0x59, 0x4a, 0xbf, 0xd0, 0x5c, 0xcc, 0xe3, 0xb9, 0x83, 0x2b, 0xf3, 0xdf, 0x1a }, - { 0xdb, 0xd7, 0xf1, 0x82, 0x13, 0x60, 0x42, 0x7c, 0x84, 0xe6, 0xcf, 0x30, 0xab, 0xa2, 0x64, 0xf1 }, - { 0x4a, 0x9a, 0xad, 0x53, 0x05, 0x74, 0xb1, 0x1c, 0xb8, 0xd4, 0xae, 0x78, 0x13, 0xf6, 0x2a, 0x11 } - }, - - /* 5 channels */ - { - { 0xcc, 0xca, 0x44, 0xc0, 0x54, 0xe2, 0xc9, 0xba, 0x99, 0x32, 0xc9, 0x65, 0xf3, 0x3e, 0x44, 0x34}, - { 0x40, 0x38, 0x6a, 0xdd, 0xde, 0x89, 0x10, 0x3c, 0x8e, 0xec, 0xdf, 0x15, 0x53, 0x4c, 0x2c, 0x92 }, - { 0xc8, 0x95, 0x0a, 0x7c, 0x17, 0x30, 0xc0, 0xac, 0x8e, 0x34, 0xdb, 0x79, 0x76, 0x64, 0x7c, 0x6e }, - { 0x3f, 0x06, 0x11, 0x8a, 0x8d, 0x80, 0xb5, 0x4f, 0x8b, 0xb5, 0x8e, 0xb3, 0x27, 0x3e, 0x41, 0xe8 } - }, - - /* 6 channels */ - { - { 0x61, 0xe4, 0xbd, 0xb1, 0xc0, 0x2f, 0xf4, 0x4c, 0x6e, 0x09, 0x5a, 0xbd, 0x90, 0x18, 0x8b, 0x62 }, - { 0x47, 0xe7, 0x6e, 0x3b, 0x18, 0x86, 0x60, 0x1b, 0x09, 0x62, 0xc6, 0xc9, 0x7c, 0x4c, 0x03, 0xb5 }, - { 0x70, 0x57, 0xbf, 0x67, 0x66, 0x0f, 0xe3, 0x0a, 0x6c, 0xd2, 0x97, 0x66, 0xa2, 0xd2, 0xe4, 0x79 }, - { 0xaa, 0x3f, 0xc7, 0xf5, 0x7a, 0xa5, 0x46, 0xf7, 0xea, 0xe3, 0xd5, 0x1a, 0xa4, 0x62, 0xbe, 0xfa } - }, - - /* 7 channels */ - { - { 0x7c, 0x8d, 0xd2, 0x8c, 0xfd, 0x91, 0xbb, 0x77, 0x6f, 0x0e, 0xf0, 0x39, 0x1f, 0x39, 0xc4, 0xac }, - { 0xfb, 0xab, 0x18, 0x3f, 0x1e, 0x1d, 0xa5, 0x77, 0xe0, 0x5c, 0xea, 0x45, 0x6f, 0x64, 0xa4, 0x64 }, - { 0xe3, 0xac, 0x33, 0x50, 0xc1, 0xb1, 0x93, 0xfb, 0xca, 0x4b, 0x15, 0xcb, 0x2d, 0xcd, 0xd5, 0xef }, - { 0x10, 0xfb, 0x02, 0x83, 0x76, 0x0d, 0xe5, 0xd2, 0x3b, 0xb1, 0x4c, 0x78, 0x3b, 0x73, 0xf7, 0x1a } - }, - - /* 8 channels */ - { - { 0x65, 0x7b, 0xe5, 0x92, 0xe2, 0x1c, 0x95, 0x3e, 0xd7, 0x2f, 0x64, 0xa0, 0x86, 0xec, 0x1a, 0xed }, - { 0x9d, 0x04, 0x8f, 0xa4, 0xea, 0x10, 0xec, 0xb8, 0xa3, 0x88, 0xe2, 0x5d, 0x3c, 0xe2, 0xfb, 0x94 }, - { 0x5a, 0xd3, 0xd2, 0x75, 0x6a, 0xfa, 0xa7, 0x42, 0xf3, 0xbf, 0x0e, 0xbc, 0x90, 0x2a, 0xf8, 0x5f }, - { 0x76, 0xe1, 0xe5, 0xf6, 0xe3, 0x44, 0x08, 0x29, 0xae, 0x79, 0x19, 0xeb, 0xa8, 0x57, 0x16, 0x2a } - } -}; - -#define MAX_CHANNEL_COUNT 8 -#define MD5_SAMPLE_COUNT 64 - -static FLAC__bool test_md5_codec(void) -{ - FLAC__int32 arrays[MAX_CHANNEL_COUNT][MD5_SAMPLE_COUNT], *pointer[MAX_CHANNEL_COUNT], **signal; - uint32_t chan, byte_size, seed = 0x12345679; - - /* Set up signal data using a trivial Linear Congruent PRNG. */ - signal = &pointer[0]; - for (chan = 0 ; chan < MAX_CHANNEL_COUNT ; chan ++) { - uint32_t k; - pointer[chan] = arrays [chan]; - for (k = 0 ; k < MD5_SAMPLE_COUNT ; k++) { - seed = seed * 1103515245 + 12345; - arrays[chan][k] = seed; - } - } - - for (chan = 1 ; chan <= MAX_CHANNEL_COUNT ; chan ++) { - for (byte_size = 1 ; byte_size <= 4 ; byte_size ++) { - if (! test_md5_accumulate((const FLAC__int32 * const *) signal, chan, MD5_SAMPLE_COUNT, byte_size, target_digests[chan-1][byte_size-1])) - return false; - } - } - - return true; -} - -static FLAC__bool test_md5_accumulate(const FLAC__int32 * const * signal, uint32_t channels, uint32_t samples, uint32_t bytes_per_sample, const FLAC__byte target_digest [16]) -{ - FLAC__MD5Context ctx; - FLAC__byte digest[16]; - - memset(&ctx, 0, sizeof (ctx)); - - printf("testing FLAC__MD5Accumulate (samples=%u, channels=%u, bytes_per_sample=%u) ... ", samples, channels, bytes_per_sample); - - FLAC__MD5Init(&ctx); - FLAC__MD5Accumulate(&ctx, signal, channels, samples, bytes_per_sample); - FLAC__MD5Final(digest, &ctx); - - if (memcmp(digest, target_digest, sizeof (digest))) { - int k ; - - printf("\nFAILED, expected MD5 sum "); - for (k = 0 ; k < 16 ; k++) - printf("%02x", (target_digest [k] & 0xff)); - printf (" but got "); - for (k = 0 ; k < 16 ; k++) - printf("%02x", (digest [k] & 0xff)); - puts("\n"); - return false; - } - - printf("OK\n"); - return true; -} diff --git a/src/test_libFLAC/md5.h b/src/test_libFLAC/md5.h deleted file mode 100644 index dc9e8ffd..00000000 --- a/src/test_libFLAC/md5.h +++ /dev/null @@ -1,26 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2014-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLAC_MD5_H -#define FLAC__TEST_LIBFLAC_MD5_H - -#include "FLAC/ordinals.h" - -FLAC__bool test_md5(void); - -#endif diff --git a/src/test_libFLAC/metadata.c b/src/test_libFLAC/metadata.c deleted file mode 100644 index 771ea654..00000000 --- a/src/test_libFLAC/metadata.c +++ /dev/null @@ -1,41 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "metadata.h" -#include - -extern FLAC__bool test_metadata_object(void); -extern FLAC__bool test_metadata_file_manipulation(void); - -FLAC__bool test_metadata(void) -{ - if(!test_metadata_object()) - return false; - - if(!test_metadata_file_manipulation()) - return false; - - printf("\nPASSED!\n"); - - return true; -} diff --git a/src/test_libFLAC/metadata.h b/src/test_libFLAC/metadata.h deleted file mode 100644 index f6cae820..00000000 --- a/src/test_libFLAC/metadata.h +++ /dev/null @@ -1,29 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 Xiph.Org Foundation - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef FLAC__TEST_LIBFLAC_METADATA_H -#define FLAC__TEST_LIBFLAC_METADATA_H - -#include "FLAC/ordinals.h" - -FLAC__bool test_metadata(void); -FLAC__bool test_metadata_file_manipulation(void); -FLAC__bool test_metadata_object(void); - -#endif diff --git a/src/test_libFLAC/metadata_manip.c b/src/test_libFLAC/metadata_manip.c deleted file mode 100644 index 4f74f7c7..00000000 --- a/src/test_libFLAC/metadata_manip.c +++ /dev/null @@ -1,2140 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include /* for malloc() */ -#include /* for memcpy()/memset() */ -#if defined _MSC_VER || defined __MINGW32__ -#include /* for utime() */ -#include /* for chmod() */ -#else -#include /* some flavors of BSD (like OS X) require this to get time_t */ -#include /* for chown(), unlink() */ -#endif -#include /* for stat(), maybe chmod() */ -#include "FLAC/assert.h" -#include "FLAC/stream_decoder.h" -#include "FLAC/metadata.h" -#include "share/grabbag.h" -#include "share/compat.h" -#include "share/macros.h" -#include "share/safe_str.h" -#include "test_libs_common/file_utils_flac.h" -#include "test_libs_common/metadata_utils.h" -#include "metadata.h" - - -/****************************************************************************** - The general strategy of these tests (for interface levels 1 and 2) is - to create a dummy FLAC file with a known set of initial metadata - blocks, then keep a mirror locally of what we expect the metadata to be - after each operation. Then testing becomes a simple matter of running - a FLAC__StreamDecoder over the dummy file after each operation, comparing - the decoded metadata to what's in our local copy. If there are any - differences in the metadata, or the actual audio data is corrupted, we - will catch it while decoding. -******************************************************************************/ - -typedef struct { - FLAC__bool error_occurred; -} decoder_client_struct; - -typedef struct { - FLAC__StreamMetadata *blocks[64]; - uint32_t num_blocks; -} our_metadata_struct; - -/* our copy of the metadata in flacfilename() */ -static our_metadata_struct our_metadata_; - -/* the current block number that corresponds to the position of the iterator we are testing */ -static uint32_t mc_our_block_number_ = 0; - -static const char *flacfilename(FLAC__bool is_ogg) -{ - return is_ogg? "metadata.oga" : "metadata.flac"; -} - -static FLAC__bool die_(const char *msg) -{ - printf("ERROR: %s\n", msg); - return false; -} - -static FLAC__bool die_c_(const char *msg, FLAC__Metadata_ChainStatus status) -{ - printf("ERROR: %s\n", msg); - printf(" status=%s\n", FLAC__Metadata_ChainStatusString[status]); - return false; -} - -static FLAC__bool die_ss_(const char *msg, FLAC__Metadata_SimpleIterator *iterator) -{ - printf("ERROR: %s\n", msg); - printf(" status=%s\n", FLAC__Metadata_SimpleIteratorStatusString[FLAC__metadata_simple_iterator_status(iterator)]); - return false; -} - -static void *malloc_or_die_(size_t size) -{ - void *x = malloc(size); - if(0 == x) { - fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size); - exit(1); - } - return x; -} - -static char *strdup_or_die_(const char *s) -{ - char *x = strdup(s); - if(0 == x) { - fprintf(stderr, "ERROR: out of memory copying string \"%s\"\n", s); - exit(1); - } - return x; -} - -/* functions for working with our metadata copy */ - -static FLAC__bool replace_in_our_metadata_(FLAC__StreamMetadata *block, uint32_t position, FLAC__bool copy) -{ - uint32_t i; - FLAC__StreamMetadata *obj = block; - FLAC__ASSERT(position < our_metadata_.num_blocks); - if(copy) { - if(0 == (obj = FLAC__metadata_object_clone(block))) - return die_("during FLAC__metadata_object_clone()"); - } - FLAC__metadata_object_delete(our_metadata_.blocks[position]); - our_metadata_.blocks[position] = obj; - - /* set the is_last flags */ - for(i = 0; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i]->is_last = false; - our_metadata_.blocks[i]->is_last = true; - - return true; -} - -static FLAC__bool insert_to_our_metadata_(FLAC__StreamMetadata *block, uint32_t position, FLAC__bool copy) -{ - uint32_t i; - FLAC__StreamMetadata *obj = block; - if(copy) { - if(0 == (obj = FLAC__metadata_object_clone(block))) - return die_("during FLAC__metadata_object_clone()"); - } - if(position > our_metadata_.num_blocks) { - position = our_metadata_.num_blocks; - } - else { - for(i = our_metadata_.num_blocks; i > position; i--) - our_metadata_.blocks[i] = our_metadata_.blocks[i-1]; - } - our_metadata_.blocks[position] = obj; - our_metadata_.num_blocks++; - - /* set the is_last flags */ - for(i = 0; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i]->is_last = false; - our_metadata_.blocks[i]->is_last = true; - - return true; -} - -static void delete_from_our_metadata_(uint32_t position) -{ - uint32_t i; - FLAC__ASSERT(position < our_metadata_.num_blocks); - FLAC__metadata_object_delete(our_metadata_.blocks[position]); - for(i = position; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i] = our_metadata_.blocks[i+1]; - our_metadata_.num_blocks--; - - /* set the is_last flags */ - if(our_metadata_.num_blocks > 0) { - for(i = 0; i < our_metadata_.num_blocks - 1; i++) - our_metadata_.blocks[i]->is_last = false; - our_metadata_.blocks[i]->is_last = true; - } -} - -/* - * This wad of functions supports filename- and callback-based chain reading/writing. - * Everything up to set_file_stats_() is copied from libFLAC/metadata_iterators.c - */ -static FLAC__bool open_tempfile_(const char *filename, FILE **tempfile, char **tempfilename) -{ - static const char *tempfile_suffix = ".metadata_edit"; - size_t dest_len = strlen(filename) + strlen(tempfile_suffix) + 1; - - *tempfilename = malloc(dest_len); - if (*tempfilename == NULL) - return false; - safe_strncpy(*tempfilename, filename, dest_len); - safe_strncat(*tempfilename, tempfile_suffix, dest_len); - - *tempfile = flac_fopen(*tempfilename, "wb"); - if (*tempfile == NULL) - return false; - - return true; -} - -static void cleanup_tempfile_(FILE **tempfile, char **tempfilename) -{ - if (*tempfile != NULL) { - (void)fclose(*tempfile); - *tempfile = 0; - } - - if (*tempfilename != NULL) { - (void)flac_unlink(*tempfilename); - free(*tempfilename); - *tempfilename = 0; - } -} - -static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename) -{ - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != tempfile); - FLAC__ASSERT(0 != tempfilename); - FLAC__ASSERT(0 != *tempfilename); - - if(0 != *tempfile) { - (void)fclose(*tempfile); - *tempfile = 0; - } - -#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ - /* on some flavors of windows, flac_rename() will fail if the destination already exists */ - if(flac_unlink(filename) < 0) { - cleanup_tempfile_(tempfile, tempfilename); - return false; - } -#endif - - if(0 != flac_rename(*tempfilename, filename)) { - cleanup_tempfile_(tempfile, tempfilename); - return false; - } - - cleanup_tempfile_(tempfile, tempfilename); - - return true; -} - -static FLAC__bool get_file_stats_(const char *filename, struct flac_stat_s *stats) -{ - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != stats); - return (0 == flac_stat(filename, stats)); -} - -static void set_file_stats_(const char *filename, struct flac_stat_s *stats) -{ -#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) - struct timespec srctime[2] = {}; - srctime[0].tv_sec = stats->st_atime; - srctime[1].tv_sec = stats->st_mtime; -#else - struct utimbuf srctime; - srctime.actime = stats->st_atime; - srctime.modtime = stats->st_mtime; -#endif - FLAC__ASSERT(0 != filename); - FLAC__ASSERT(0 != stats); - - (void)flac_chmod(filename, stats->st_mode); - (void)flac_utime(filename, &srctime); -#if !defined _MSC_VER && !defined __MINGW32__ - FLAC_CHECK_RETURN(chown(filename, stats->st_uid, -1)); - FLAC_CHECK_RETURN(chown(filename, -1, stats->st_gid)); -#endif -} - -#ifdef FLAC__VALGRIND_TESTING -static size_t chain_write_cb_(const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle) -{ - FILE *stream = (FILE*)handle; - size_t ret = fwrite(ptr, size, nmemb, stream); - if(!ferror(stream)) - fflush(stream); - return ret; -} -#endif - -static int chain_seek_cb_(FLAC__IOHandle handle, FLAC__int64 offset, int whence) -{ - FLAC__off_t o = (FLAC__off_t)offset; - FLAC__ASSERT(offset == o); - return fseeko((FILE*)handle, o, whence); -} - -static FLAC__int64 chain_tell_cb_(FLAC__IOHandle handle) -{ - return ftello((FILE*)handle); -} - -static int chain_eof_cb_(FLAC__IOHandle handle) -{ - return feof((FILE*)handle); -} - -static FLAC__bool write_chain_(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats, FLAC__bool filename_based, const char *filename) -{ - if(filename_based) - return FLAC__metadata_chain_write(chain, use_padding, preserve_file_stats); - else { - FLAC__IOCallbacks callbacks; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.read = (FLAC__IOCallback_Read)fread; -#ifdef FLAC__VALGRIND_TESTING - callbacks.write = chain_write_cb_; -#else - callbacks.write = (FLAC__IOCallback_Write)fwrite; -#endif - callbacks.seek = chain_seek_cb_; - callbacks.eof = chain_eof_cb_; - - if(FLAC__metadata_chain_check_if_tempfile_needed(chain, use_padding)) { - struct flac_stat_s stats; - FILE *file, *tempfile = 0; - char *tempfilename; - if(preserve_file_stats) { - if(!get_file_stats_(filename, &stats)) - return false; - } - if(0 == (file = flac_fopen(filename, "rb"))) - return false; /*@@@@ chain status still says OK though */ - if(!open_tempfile_(filename, &tempfile, &tempfilename)) { - fclose(file); - cleanup_tempfile_(&tempfile, &tempfilename); - return false; /*@@@@ chain status still says OK though */ - } - if(!FLAC__metadata_chain_write_with_callbacks_and_tempfile(chain, use_padding, (FLAC__IOHandle)file, callbacks, (FLAC__IOHandle)tempfile, callbacks)) { - fclose(file); - fclose(tempfile); - return false; - } - fclose(file); - fclose(tempfile); - file = tempfile = 0; - if(!transport_tempfile_(filename, &tempfile, &tempfilename)) - return false; - if(preserve_file_stats) - set_file_stats_(filename, &stats); - } - else { - FILE *file = flac_fopen(filename, "r+b"); - if(0 == file) - return false; /*@@@@ chain status still says OK though */ - if(!FLAC__metadata_chain_write_with_callbacks(chain, use_padding, (FLAC__IOHandle)file, callbacks)) - return false; - fclose(file); - } - } - - return true; -} - -static FLAC__bool read_chain_(FLAC__Metadata_Chain *chain, const char *filename, FLAC__bool filename_based, FLAC__bool is_ogg) -{ - if(filename_based) - return is_ogg? - FLAC__metadata_chain_read_ogg(chain, flacfilename(is_ogg)) : - FLAC__metadata_chain_read(chain, flacfilename(is_ogg)) - ; - else { - FLAC__IOCallbacks callbacks; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.read = (FLAC__IOCallback_Read)fread; - callbacks.seek = chain_seek_cb_; - callbacks.tell = chain_tell_cb_; - - { - FLAC__bool ret; - FILE *file = flac_fopen(filename, "rb"); - if(0 == file) - return false; /*@@@@ chain status still says OK though */ - ret = is_ogg? - FLAC__metadata_chain_read_ogg_with_callbacks(chain, (FLAC__IOHandle)file, callbacks) : - FLAC__metadata_chain_read_with_callbacks(chain, (FLAC__IOHandle)file, callbacks) - ; - fclose(file); - return ret; - } - } -} - -/* function for comparing our metadata to a FLAC__Metadata_Chain */ - -static FLAC__bool compare_chain_(FLAC__Metadata_Chain *chain, uint32_t current_position, FLAC__StreamMetadata *current_block) -{ - uint32_t i; - FLAC__Metadata_Iterator *iterator; - FLAC__StreamMetadata *block; - FLAC__bool next_ok = true; - - FLAC__ASSERT(0 != chain); - - printf("\tcomparing chain... "); - fflush(stdout); - - if(0 == (iterator = FLAC__metadata_iterator_new())) - return die_("allocating memory for iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - i = 0; - do { - printf("%u... ", i); - fflush(stdout); - - if(0 == (block = FLAC__metadata_iterator_get_block(iterator))) { - FLAC__metadata_iterator_delete(iterator); - return die_("getting block from iterator"); - } - - if(!mutils__compare_block(our_metadata_.blocks[i], block)) { - FLAC__metadata_iterator_delete(iterator); - return die_("metadata block mismatch"); - } - - i++; - next_ok = FLAC__metadata_iterator_next(iterator); - } while(i < our_metadata_.num_blocks && next_ok); - - FLAC__metadata_iterator_delete(iterator); - - if(next_ok) - return die_("chain has more blocks than expected"); - - if(i < our_metadata_.num_blocks) - return die_("short block count in chain"); - - if(0 != current_block) { - printf("CURRENT_POSITION... "); - fflush(stdout); - - if(!mutils__compare_block(our_metadata_.blocks[current_position], current_block)) - return die_("metadata block mismatch"); - } - - printf("PASSED\n"); - - return true; -} - -/* decoder callbacks for checking the file */ - -static FLAC__StreamDecoderWriteStatus decoder_write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - (void)decoder, (void)buffer, (void)client_data; - - if( - (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER && frame->header.number.frame_number == 0) || - (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER && frame->header.number.sample_number == 0) - ) { - printf("content... "); - fflush(stdout); - } - - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -/* this version pays no attention to the metadata */ -static void decoder_metadata_callback_null_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - (void)decoder, (void)metadata, (void)client_data; - - printf("%u... ", mc_our_block_number_); - fflush(stdout); - - mc_our_block_number_++; -} - -/* this version is used when we want to compare to our metadata copy */ -static void decoder_metadata_callback_compare_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - decoder_client_struct *dcd = (decoder_client_struct*)client_data; - - (void)decoder; - - /* don't bother checking if we've already hit an error */ - if(dcd->error_occurred) - return; - - printf("%u... ", mc_our_block_number_); - fflush(stdout); - - if(mc_our_block_number_ >= our_metadata_.num_blocks) { - (void)die_("got more metadata blocks than expected"); - dcd->error_occurred = true; - } - else { - if(!mutils__compare_block(our_metadata_.blocks[mc_our_block_number_], metadata)) { - (void)die_("metadata block mismatch"); - dcd->error_occurred = true; - } - } - mc_our_block_number_++; -} - -static void decoder_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - decoder_client_struct *dcd = (decoder_client_struct*)client_data; - (void)decoder; - - dcd->error_occurred = true; - printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (uint32_t)status); -} - -static FLAC__bool generate_file_(FLAC__bool include_extras, FLAC__bool is_ogg) -{ - FLAC__StreamMetadata streaminfo, vorbiscomment, *cuesheet, picture, padding; - FLAC__StreamMetadata *metadata[4]; - uint32_t i = 0, n = 0; - - printf("generating %sFLAC file for test\n", is_ogg? "Ogg " : ""); - - while(our_metadata_.num_blocks > 0) - delete_from_our_metadata_(0); - - streaminfo.is_last = false; - streaminfo.type = FLAC__METADATA_TYPE_STREAMINFO; - streaminfo.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; - streaminfo.data.stream_info.min_blocksize = 576; - streaminfo.data.stream_info.max_blocksize = 576; - streaminfo.data.stream_info.min_framesize = 0; - streaminfo.data.stream_info.max_framesize = 0; - streaminfo.data.stream_info.sample_rate = 44100; - streaminfo.data.stream_info.channels = 1; - streaminfo.data.stream_info.bits_per_sample = 8; - streaminfo.data.stream_info.total_samples = 0; - memset(streaminfo.data.stream_info.md5sum, 0, 16); - - { - const uint32_t vendor_string_length = (uint32_t)strlen(FLAC__VENDOR_STRING); - vorbiscomment.is_last = false; - vorbiscomment.type = FLAC__METADATA_TYPE_VORBIS_COMMENT; - vorbiscomment.length = (4 + vendor_string_length) + 4; - vorbiscomment.data.vorbis_comment.vendor_string.length = vendor_string_length; - vorbiscomment.data.vorbis_comment.vendor_string.entry = malloc_or_die_(vendor_string_length+1); - memcpy(vorbiscomment.data.vorbis_comment.vendor_string.entry, FLAC__VENDOR_STRING, vendor_string_length+1); - vorbiscomment.data.vorbis_comment.num_comments = 0; - vorbiscomment.data.vorbis_comment.comments = 0; - } - - { - if (0 == (cuesheet = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET))) - return die_("priming our metadata"); - cuesheet->is_last = false; - safe_strncpy(cuesheet->data.cue_sheet.media_catalog_number, "bogo-MCN", sizeof(cuesheet->data.cue_sheet.media_catalog_number)); - cuesheet->data.cue_sheet.lead_in = 123; - cuesheet->data.cue_sheet.is_cd = false; - if (!FLAC__metadata_object_cuesheet_insert_blank_track(cuesheet, 0)) - return die_("priming our metadata"); - cuesheet->data.cue_sheet.tracks[0].number = 1; - if (!FLAC__metadata_object_cuesheet_track_insert_blank_index(cuesheet, 0, 0)) - return die_("priming our metadata"); - } - - { - picture.is_last = false; - picture.type = FLAC__METADATA_TYPE_PICTURE; - picture.length = - ( - FLAC__STREAM_METADATA_PICTURE_TYPE_LEN + - FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN + /* will add the length for the string later */ - FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN + /* will add the length for the string later */ - FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN + - FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN + - FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN + - FLAC__STREAM_METADATA_PICTURE_COLORS_LEN + - FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN /* will add the length for the data later */ - ) / 8 - ; - picture.data.picture.type = FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER; - picture.data.picture.mime_type = strdup_or_die_("image/jpeg"); - picture.length += strlen(picture.data.picture.mime_type); - picture.data.picture.description = (FLAC__byte*)strdup_or_die_("desc"); - picture.length += strlen((const char *)picture.data.picture.description); - picture.data.picture.width = 300; - picture.data.picture.height = 300; - picture.data.picture.depth = 24; - picture.data.picture.colors = 0; - picture.data.picture.data = (FLAC__byte*)strdup_or_die_("SOMEJPEGDATA"); - picture.data.picture.data_length = strlen((const char *)picture.data.picture.data); - picture.length += picture.data.picture.data_length; - } - - padding.is_last = true; - padding.type = FLAC__METADATA_TYPE_PADDING; - padding.length = 1234; - - metadata[n++] = &vorbiscomment; - if(include_extras) { - metadata[n++] = cuesheet; - metadata[n++] = &picture; - } - metadata[n++] = &padding; - - if( - !insert_to_our_metadata_(&streaminfo, i++, /*copy=*/true) || - !insert_to_our_metadata_(&vorbiscomment, i++, /*copy=*/true) || - (include_extras && !insert_to_our_metadata_(cuesheet, i++, /*copy=*/false)) || - (include_extras && !insert_to_our_metadata_(&picture, i++, /*copy=*/true)) || - !insert_to_our_metadata_(&padding, i++, /*copy=*/true) - ) - return die_("priming our metadata"); - - if(!file_utils__generate_flacfile(is_ogg, flacfilename(is_ogg), 0, 512 * 1024, &streaminfo, metadata, n)) - return die_("creating the encoded file"); - - free(vorbiscomment.data.vorbis_comment.vendor_string.entry); - free(picture.data.picture.mime_type); - free(picture.data.picture.description); - free(picture.data.picture.data); - if(!include_extras) - FLAC__metadata_object_delete(cuesheet); - - return true; -} - -static FLAC__bool test_file_(FLAC__bool is_ogg, FLAC__StreamDecoderMetadataCallback metadata_callback) -{ - const char *filename = flacfilename(is_ogg); - FLAC__StreamDecoder *decoder; - decoder_client_struct decoder_client_data; - - FLAC__ASSERT(0 != metadata_callback); - - mc_our_block_number_ = 0; - decoder_client_data.error_occurred = false; - - printf("\ttesting '%s'... ", filename); - fflush(stdout); - - if(0 == (decoder = FLAC__stream_decoder_new())) - return die_("couldn't allocate decoder instance"); - - FLAC__stream_decoder_set_md5_checking(decoder, true); - FLAC__stream_decoder_set_metadata_respond_all(decoder); - if( - (is_ogg? - FLAC__stream_decoder_init_ogg_file(decoder, filename, decoder_write_callback_, metadata_callback, decoder_error_callback_, &decoder_client_data) : - FLAC__stream_decoder_init_file(decoder, filename, decoder_write_callback_, metadata_callback, decoder_error_callback_, &decoder_client_data) - ) != FLAC__STREAM_DECODER_INIT_STATUS_OK - ) { - (void)FLAC__stream_decoder_finish(decoder); - FLAC__stream_decoder_delete(decoder); - return die_("initializing decoder\n"); - } - if(!FLAC__stream_decoder_process_until_end_of_stream(decoder)) { - (void)FLAC__stream_decoder_finish(decoder); - FLAC__stream_decoder_delete(decoder); - return die_("decoding file\n"); - } - - (void)FLAC__stream_decoder_finish(decoder); - FLAC__stream_decoder_delete(decoder); - - if(decoder_client_data.error_occurred) - return false; - - if(mc_our_block_number_ != our_metadata_.num_blocks) - return die_("short metadata block count"); - - printf("PASSED\n"); - return true; -} - -static FLAC__bool change_stats_(const char *filename, FLAC__bool read_only) -{ - if(!grabbag__file_change_stats(filename, read_only)) - return die_("during grabbag__file_change_stats()"); - - return true; -} - -static FLAC__bool remove_file_(const char *filename) -{ - while(our_metadata_.num_blocks > 0) - delete_from_our_metadata_(0); - - if(!grabbag__file_remove_file(filename)) - return die_("removing file"); - - return true; -} - -static FLAC__bool test_level_0_(void) -{ - FLAC__StreamMetadata streaminfo; - FLAC__StreamMetadata *tags = 0; - FLAC__StreamMetadata *cuesheet = 0; - FLAC__StreamMetadata *picture = 0; - - printf("\n\n++++++ testing level 0 interface\n"); - - if(!generate_file_(/*include_extras=*/true, /*is_ogg=*/false)) - return false; - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_null_)) - return false; - - printf("testing FLAC__metadata_get_streaminfo()... "); - - if(!FLAC__metadata_get_streaminfo(flacfilename(/*is_ogg=*/false), &streaminfo)) - return die_("during FLAC__metadata_get_streaminfo()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(streaminfo.data.stream_info.channels != 1) - return die_("mismatch in streaminfo.data.stream_info.channels"); - if(streaminfo.data.stream_info.bits_per_sample != 8) - return die_("mismatch in streaminfo.data.stream_info.bits_per_sample"); - if(streaminfo.data.stream_info.sample_rate != 44100) - return die_("mismatch in streaminfo.data.stream_info.sample_rate"); - if(streaminfo.data.stream_info.min_blocksize != 576) - return die_("mismatch in streaminfo.data.stream_info.min_blocksize"); - if(streaminfo.data.stream_info.max_blocksize != 576) - return die_("mismatch in streaminfo.data.stream_info.max_blocksize"); - - printf("OK\n"); - - printf("testing FLAC__metadata_get_tags()... "); - - if(!FLAC__metadata_get_tags(flacfilename(/*is_ogg=*/false), &tags)) - return die_("during FLAC__metadata_get_tags()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(tags->data.vorbis_comment.num_comments != 0) - return die_("mismatch in tags->data.vorbis_comment.num_comments"); - - printf("OK\n"); - - FLAC__metadata_object_delete(tags); - - printf("testing FLAC__metadata_get_cuesheet()... "); - - if(!FLAC__metadata_get_cuesheet(flacfilename(/*is_ogg=*/false), &cuesheet)) - return die_("during FLAC__metadata_get_cuesheet()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(cuesheet->data.cue_sheet.lead_in != 123) - return die_("mismatch in cuesheet->data.cue_sheet.lead_in"); - - printf("OK\n"); - - FLAC__metadata_object_delete(cuesheet); - - printf("testing FLAC__metadata_get_picture()... "); - - if(!FLAC__metadata_get_picture(flacfilename(/*is_ogg=*/false), &picture, /*type=*/(FLAC__StreamMetadata_Picture_Type)(-1), /*mime_type=*/0, /*description=*/0, /*max_width=*/(uint32_t)(-1), /*max_height=*/(uint32_t)(-1), /*max_depth=*/(uint32_t)(-1), /*max_colors=*/(uint32_t)(-1))) - return die_("during FLAC__metadata_get_picture()"); - - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(picture->data.picture.type != FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER) - return die_("mismatch in picture->data.picture.type"); - - printf("OK\n"); - - FLAC__metadata_object_delete(picture); - - if(!remove_file_(flacfilename(/*is_ogg=*/false))) - return false; - - return true; -} - -static FLAC__bool test_level_1_(void) -{ - FLAC__Metadata_SimpleIterator *iterator; - FLAC__StreamMetadata *block, *app, *padding; - FLAC__byte data[1000]; - uint32_t our_current_position = 0; - - /* initialize 'data' to avoid Valgrind errors */ - memset(data, 0, sizeof(data)); - - printf("\n\n++++++ testing level 1 interface\n"); - - /************************************************************/ - - printf("simple iterator on read-only file\n"); - - if(!generate_file_(/*include_extras=*/false, /*is_ogg=*/false)) - return false; - - if(!change_stats_(flacfilename(/*is_ogg=*/false), /*read_only=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_null_)) - return false; - - if(0 == (iterator = FLAC__metadata_simple_iterator_new())) - return die_("FLAC__metadata_simple_iterator_new()"); - - if(!FLAC__metadata_simple_iterator_init(iterator, flacfilename(/*is_ogg=*/false), /*read_only=*/false, /*preserve_file_stats=*/false)) - return die_("FLAC__metadata_simple_iterator_init() returned false"); - - printf("is writable = %u\n", (uint32_t)FLAC__metadata_simple_iterator_is_writable(iterator)); - if(FLAC__metadata_simple_iterator_is_writable(iterator)) - return die_("iterator claims file is writable when tester thinks it should not be; are you running as root?\n"); - - printf("iterate forwards\n"); - - if(FLAC__metadata_simple_iterator_get_block_type(iterator) != FLAC__METADATA_TYPE_STREAMINFO) - return die_("expected STREAMINFO type from FLAC__metadata_simple_iterator_get_block_type()"); - if(0 == (block = FLAC__metadata_simple_iterator_get_block(iterator))) - return die_("getting block 0"); - if(block->type != FLAC__METADATA_TYPE_STREAMINFO) - return die_("expected STREAMINFO type"); - if(block->is_last) - return die_("expected is_last to be false"); - if(block->length != FLAC__STREAM_METADATA_STREAMINFO_LENGTH) - return die_("bad STREAMINFO length"); - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(block->data.stream_info.channels != 1) - return die_("mismatch in channels"); - if(block->data.stream_info.bits_per_sample != 8) - return die_("mismatch in bits_per_sample"); - if(block->data.stream_info.sample_rate != 44100) - return die_("mismatch in sample_rate"); - if(block->data.stream_info.min_blocksize != 576) - return die_("mismatch in min_blocksize"); - if(block->data.stream_info.max_blocksize != 576) - return die_("mismatch in max_blocksize"); - FLAC__metadata_object_delete(block); - - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("forward iterator ended early"); - our_current_position++; - - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("forward iterator ended early"); - our_current_position++; - - if(FLAC__metadata_simple_iterator_get_block_type(iterator) != FLAC__METADATA_TYPE_PADDING) - return die_("expected PADDING type from FLAC__metadata_simple_iterator_get_block_type()"); - if(0 == (block = FLAC__metadata_simple_iterator_get_block(iterator))) - return die_("getting block 2"); - if(block->type != FLAC__METADATA_TYPE_PADDING) - return die_("expected PADDING type"); - if(!block->is_last) - return die_("expected is_last to be true"); - /* check to see if some basic data matches (c.f. generate_file_()) */ - if(block->length != 1234) - return die_("bad PADDING length"); - FLAC__metadata_object_delete(block); - - if(FLAC__metadata_simple_iterator_next(iterator)) - return die_("forward iterator returned true but should have returned false"); - - printf("iterate backwards\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("reverse iterator ended early"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("reverse iterator ended early"); - if(FLAC__metadata_simple_iterator_prev(iterator)) - return die_("reverse iterator returned true but should have returned false"); - - printf("testing FLAC__metadata_simple_iterator_set_block() on read-only file...\n"); - - if(!FLAC__metadata_simple_iterator_set_block(iterator, (FLAC__StreamMetadata*)99, false)) - printf("OK: FLAC__metadata_simple_iterator_set_block() returned false like it should\n"); - else - return die_("FLAC__metadata_simple_iterator_set_block() returned true but shouldn't have"); - - FLAC__metadata_simple_iterator_delete(iterator); - - /************************************************************/ - - printf("simple iterator on writable file\n"); - - if(!change_stats_(flacfilename(/*is_ogg=*/false), /*read-only=*/false)) - return false; - - printf("creating APPLICATION block\n"); - - if(0 == (app = FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION))) - return die_("FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION)"); - memcpy(app->data.application.id, "duh", (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)); - - printf("creating PADDING block\n"); - - if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) - return die_("FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING)"); - padding->length = 20; - - if(0 == (iterator = FLAC__metadata_simple_iterator_new())) - return die_("FLAC__metadata_simple_iterator_new()"); - - if(!FLAC__metadata_simple_iterator_init(iterator, flacfilename(/*is_ogg=*/false), /*read_only=*/false, /*preserve_file_stats=*/false)) - return die_("FLAC__metadata_simple_iterator_init() returned false"); - our_current_position = 0; - - printf("is writable = %u\n", (uint32_t)FLAC__metadata_simple_iterator_is_writable(iterator)); - - printf("[S]VP\ttry to write over STREAMINFO block...\n"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, false)) - printf("\tFLAC__metadata_simple_iterator_set_block() returned false like it should\n"); - else - return die_("FLAC__metadata_simple_iterator_set_block() returned true but shouldn't have"); - - printf("[S]VP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]\tinsert PADDING after, don't expand into padding\n"); - padding->length = 25; - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - printf("SVP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SV[P]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]PP\tinsert PADDING after, don't expand into padding\n"); - padding->length = 30; - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[P]PP\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]PPP\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("[S]VPPP\tdelete (STREAMINFO block), must fail\n"); - if(FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false) should have returned false", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("[S]VPPP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]PPP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]PP\tdelete (middle block), replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, true)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, true)", iterator); - our_current_position--; - - printf("S[V]PPP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]PP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("S[V]PP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVP[P]\tdelete (last block), replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, true)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - our_current_position--; - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[P]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVP[P]\tdelete (last block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("[S]VP\tset STREAMINFO (change sample rate)\n"); - FLAC__ASSERT(our_current_position == 0); - block = FLAC__metadata_simple_iterator_get_block(iterator); - block->data.stream_info.sample_rate = 32000; - if(!replace_in_our_metadata_(block, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, block, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, block, false)", iterator); - FLAC__metadata_object_delete(block); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("[S]VP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]P\tinsert APPLICATION after, expand into padding of exceeding size\n"); - app->data.application.id[0] = 'e'; /* twiddle the id so that our comparison doesn't miss transposition */ - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return false; - our_metadata_.blocks[our_current_position+1]->length -= (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + app->length; - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVA[P]\tset APPLICATION, expand into padding of exceeding size\n"); - app->data.application.id[0] = 'f'; /* twiddle the id */ - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); - if(!insert_to_our_metadata_(app, our_current_position, /*copy=*/true)) - return false; - our_metadata_.blocks[our_current_position+1]->length -= (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) + app->length; - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVA[A]P\tset APPLICATION (grow), don't expand into padding\n"); - app->data.application.id[0] = 'g'; /* twiddle the id */ - if(!FLAC__metadata_object_application_set_data(app, data, sizeof(data), true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVA[A]P\tset APPLICATION (shrink), don't fill in with padding\n"); - app->data.application.id[0] = 'h'; /* twiddle the id */ - if(!FLAC__metadata_object_application_set_data(app, data, 12, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVA[A]P\tset APPLICATION (grow), expand into padding of exceeding size\n"); - app->data.application.id[0] = 'i'; /* twiddle the id */ - if(!FLAC__metadata_object_application_set_data(app, data, sizeof(data), true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - our_metadata_.blocks[our_current_position+1]->length -= (sizeof(data) - 12); - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVA[A]P\tset APPLICATION (shrink), fill in with padding\n"); - app->data.application.id[0] = 'j'; /* twiddle the id */ - if(!FLAC__metadata_object_application_set_data(app, data, 23, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!insert_to_our_metadata_(padding, our_current_position+1, /*copy=*/true)) - return die_("copying object"); - our_metadata_.blocks[our_current_position+1]->length = sizeof(data) - 23 - FLAC__STREAM_METADATA_HEADER_LENGTH; - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVA[A]PP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVAA[P]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVAAP[P]\tset PADDING (shrink), don't fill in with padding\n"); - padding->length = 5; - if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, padding, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVAAP[P]\tset APPLICATION (grow)\n"); - app->data.application.id[0] = 'k'; /* twiddle the id */ - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVAAP[A]\tset PADDING (equal)\n"); - padding->length = 27; - if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, padding, false)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVAAP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SVAA[P]P\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVA[A]P\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]P\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVA[P]\tinsert PADDING after\n"); - padding->length = 5; - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVAP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SVA[P]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SV[A]PP\tset APPLICATION (grow), try to expand into padding which is too small\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 32, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]PP\tset APPLICATION (grow), try to expand into padding which is 'close' but still too small\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 60, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]PP\tset APPLICATION (grow), expand into padding which will leave 0-length pad\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 87, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - our_metadata_.blocks[our_current_position+1]->length = 0; - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]PP\tset APPLICATION (grow), expand into padding which is exactly consumed\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 91, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]P\tset APPLICATION (grow), expand into padding which is exactly consumed\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 100, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - our_metadata_.blocks[our_current_position]->is_last = true; - if(!FLAC__metadata_simple_iterator_set_block(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]\tset PADDING (equal size)\n"); - padding->length = app->length; - if(!replace_in_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_set_block(iterator, padding, true)) - return die_ss_("FLAC__metadata_simple_iterator_set_block(iterator, padding, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[P]\tinsert PADDING after\n"); - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVP[P]\tinsert PADDING after\n"); - padding->length = 5; - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, padding, false)", iterator); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return false; - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SVPP[P]\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SVP[P]P\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("SV[P]PP\tprev\n"); - if(!FLAC__metadata_simple_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]PPP\tinsert APPLICATION after, try to expand into padding which is too small\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 101, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]PPP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("S[V]PPP\tinsert APPLICATION after, try to expand into padding which is 'close' but still too small\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 97, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]PPP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("S[V]PPP\tinsert APPLICATION after, expand into padding which is exactly consumed\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 100, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]PP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("S[V]PP\tinsert APPLICATION after, expand into padding which will leave 0-length pad\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 96, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - our_metadata_.blocks[our_current_position+1]->length = 0; - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]PP\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("S[V]PP\tnext\n"); - if(!FLAC__metadata_simple_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]P\tdelete (middle block), don't replace with padding\n"); - if(!FLAC__metadata_simple_iterator_delete_block(iterator, false)) - return die_ss_("FLAC__metadata_simple_iterator_delete_block(iterator, false)", iterator); - delete_from_our_metadata_(our_current_position--); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("S[V]P\tinsert APPLICATION after, expand into padding which is exactly consumed\n"); - if(!FLAC__metadata_object_application_set_data(app, data, 1, true)) - return die_("setting APPLICATION data"); - if(!insert_to_our_metadata_(app, ++our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)) - return die_ss_("FLAC__metadata_simple_iterator_insert_block_after(iterator, app, true)", iterator); - - if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) - return false; - - printf("delete simple iterator\n"); - - FLAC__metadata_simple_iterator_delete(iterator); - - FLAC__metadata_object_delete(app); - FLAC__metadata_object_delete(padding); - - if(!remove_file_(flacfilename(/*is_ogg=*/false))) - return false; - - return true; -} - -static FLAC__bool test_level_2_(FLAC__bool filename_based, FLAC__bool is_ogg) -{ - FLAC__Metadata_Iterator *iterator; - FLAC__Metadata_Chain *chain; - FLAC__StreamMetadata *block, *app, *padding; - FLAC__byte data[2000]; - uint32_t our_current_position; - - /* initialize 'data' to avoid Valgrind errors */ - memset(data, 0, sizeof(data)); - - printf("\n\n++++++ testing level 2 interface (%s-based, %s FLAC)\n", filename_based? "filename":"callback", is_ogg? "Ogg":"native"); - - printf("generate read-only file\n"); - - if(!generate_file_(/*include_extras=*/false, is_ogg)) - return false; - - if(!change_stats_(flacfilename(is_ogg), /*read_only=*/true)) - return false; - - printf("create chain\n"); - - if(0 == (chain = FLAC__metadata_chain_new())) - return die_("allocating chain"); - - printf("read chain\n"); - - if(!read_chain_(chain, flacfilename(is_ogg), filename_based, is_ogg)) - return die_c_("reading chain", FLAC__metadata_chain_status(chain)); - - printf("[S]VP\ttest initial metadata\n"); - - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - if(is_ogg) - goto end; - - printf("switch file to read-write\n"); - - if(!change_stats_(flacfilename(is_ogg), /*read-only=*/false)) - return false; - - printf("create iterator\n"); - if(0 == (iterator = FLAC__metadata_iterator_new())) - return die_("allocating memory for iterator"); - - our_current_position = 0; - - FLAC__metadata_iterator_init(iterator, chain); - - if(0 == (block = FLAC__metadata_iterator_get_block(iterator))) - return die_("getting block from iterator"); - - FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_STREAMINFO); - - printf("[S]VP\tmodify STREAMINFO, write\n"); - - block->data.stream_info.sample_rate = 32000; - if(!replace_in_our_metadata_(block, our_current_position, /*copy=*/true)) - return die_("copying object"); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/true, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, false, true)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("[S]VP\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]P\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]\treplace PADDING with identical-size APPLICATION\n"); - if(0 == (block = FLAC__metadata_iterator_get_block(iterator))) - return die_("getting block from iterator"); - if(0 == (app = FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION))) - return die_("FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION)"); - memcpy(app->data.application.id, "duh", (FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)); - if(!FLAC__metadata_object_application_set_data(app, data, block->length-(FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8), true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]\tshrink APPLICATION, don't use padding\n"); - if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("copying object"); - if(!FLAC__metadata_object_application_set_data(app, data, 26, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]\tgrow APPLICATION, don't use padding\n"); - if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("copying object"); - if(!FLAC__metadata_object_application_set_data(app, data, 28, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]\tgrow APPLICATION, use padding, but last block is not padding\n"); - if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("copying object"); - if(!FLAC__metadata_object_application_set_data(app, data, 36, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]\tshrink APPLICATION, use padding, last block is not padding, but delta is too small for new PADDING block\n"); - if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("copying object"); - if(!FLAC__metadata_object_application_set_data(app, data, 33, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]\tshrink APPLICATION, use padding, last block is not padding, delta is enough for new PADDING block\n"); - if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) - return die_("creating PADDING block"); - if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("copying object"); - if(!FLAC__metadata_object_application_set_data(app, data, 29, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - padding->length = 0; - if(!insert_to_our_metadata_(padding, our_current_position+1, /*copy=*/false)) - return die_("internal error"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]P\tshrink APPLICATION, use padding, last block is padding\n"); - if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("copying object"); - if(!FLAC__metadata_object_application_set_data(app, data, 16, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - our_metadata_.blocks[our_current_position+1]->length = 13; - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]P\tgrow APPLICATION, use padding, last block is padding, but delta is too small\n"); - if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("copying object"); - if(!FLAC__metadata_object_application_set_data(app, data, 50, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]P\tgrow APPLICATION, use padding, last block is padding of exceeding size\n"); - if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("copying object"); - if(!FLAC__metadata_object_application_set_data(app, data, 56, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - our_metadata_.blocks[our_current_position+1]->length -= (56 - 50); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]P\tgrow APPLICATION, use padding, last block is padding of exact size\n"); - if(0 == (app = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("copying object"); - if(!FLAC__metadata_object_application_set_data(app, data, 67, true)) - return die_("setting APPLICATION data"); - if(!replace_in_our_metadata_(app, our_current_position, /*copy=*/true)) - return die_("copying object"); - delete_from_our_metadata_(our_current_position+1); - if(!FLAC__metadata_iterator_set_block(iterator, app)) - return die_c_("FLAC__metadata_iterator_set_block(iterator, app)", FLAC__metadata_chain_status(chain)); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV[A]\tprev\n"); - if(!FLAC__metadata_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("S[V]A\tprev\n"); - if(!FLAC__metadata_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("[S]VA\tinsert PADDING before STREAMINFO (should fail)\n"); - if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) - return die_("creating PADDING block"); - padding->length = 30; - if(!FLAC__metadata_iterator_insert_block_before(iterator, padding)) - printf("\tFLAC__metadata_iterator_insert_block_before() returned false like it should\n"); - else - return die_("FLAC__metadata_iterator_insert_block_before() should have returned false"); - - printf("[S]VP\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]A\tinsert PADDING after\n"); - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_after(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_after(iterator, padding)"); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("SV[P]A\tinsert PADDING before\n"); - if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("creating PADDING block"); - padding->length = 17; - if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_before(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_before(iterator, padding)"); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("SV[P]PA\tinsert PADDING before\n"); - if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[our_current_position]))) - return die_("creating PADDING block"); - padding->length = 0; - if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_before(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_before(iterator, padding)"); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("SV[P]PPA\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVP[P]PA\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVPP[P]A\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SVPPP[A]\tinsert PADDING after\n"); - if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[2]))) - return die_("creating PADDING block"); - padding->length = 57; - if(!insert_to_our_metadata_(padding, ++our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_after(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_after(iterator, padding)"); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("SVPPPA[P]\tinsert PADDING before\n"); - if(0 == (padding = FLAC__metadata_object_clone(our_metadata_.blocks[2]))) - return die_("creating PADDING block"); - padding->length = 99; - if(!insert_to_our_metadata_(padding, our_current_position, /*copy=*/true)) - return die_("copying metadata"); - if(!FLAC__metadata_iterator_insert_block_before(iterator, padding)) - return die_("FLAC__metadata_iterator_insert_block_before(iterator, padding)"); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("delete iterator\n"); - FLAC__metadata_iterator_delete(iterator); - our_current_position = 0; - - printf("SVPPPAPP\tmerge padding\n"); - FLAC__metadata_chain_merge_padding(chain); - our_metadata_.blocks[2]->length += (FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[3]->length); - our_metadata_.blocks[2]->length += (FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[4]->length); - our_metadata_.blocks[6]->length += (FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[7]->length); - delete_from_our_metadata_(7); - delete_from_our_metadata_(4); - delete_from_our_metadata_(3); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SVPAP\tsort padding\n"); - FLAC__metadata_chain_sort_padding(chain); - our_metadata_.blocks[4]->length += (FLAC__STREAM_METADATA_HEADER_LENGTH + our_metadata_.blocks[2]->length); - delete_from_our_metadata_(2); - - if(!write_chain_(chain, /*use_padding=*/true, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, true, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("create iterator\n"); - if(0 == (iterator = FLAC__metadata_iterator_new())) - return die_("allocating memory for iterator"); - - our_current_position = 0; - - FLAC__metadata_iterator_init(iterator, chain); - - printf("[S]VAP\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("S[V]AP\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[A]P\tdelete middle block, replace with padding\n"); - if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) - return die_("creating PADDING block"); - padding->length = 71; - if(!replace_in_our_metadata_(padding, our_current_position--, /*copy=*/false)) - return die_("copying object"); - if(!FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/true)) - return die_c_("FLAC__metadata_iterator_delete_block(iterator, true)", FLAC__metadata_chain_status(chain)); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("S[V]PP\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]P\tdelete middle block, don't replace with padding\n"); - delete_from_our_metadata_(our_current_position--); - if(!FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/false)) - return die_c_("FLAC__metadata_iterator_delete_block(iterator, false)", FLAC__metadata_chain_status(chain)); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("S[V]P\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]\tdelete last block, replace with padding\n"); - if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) - return die_("creating PADDING block"); - padding->length = 219; - if(!replace_in_our_metadata_(padding, our_current_position--, /*copy=*/false)) - return die_("copying object"); - if(!FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/true)) - return die_c_("FLAC__metadata_iterator_delete_block(iterator, true)", FLAC__metadata_chain_status(chain)); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("S[V]P\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - our_current_position++; - - printf("SV[P]\tdelete last block, don't replace with padding\n"); - delete_from_our_metadata_(our_current_position--); - if(!FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/false)) - return die_c_("FLAC__metadata_iterator_delete_block(iterator, false)", FLAC__metadata_chain_status(chain)); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("S[V]\tprev\n"); - if(!FLAC__metadata_iterator_prev(iterator)) - return die_("iterator ended early\n"); - our_current_position--; - - printf("[S]V\tdelete STREAMINFO block, should fail\n"); - if(FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/false)) - return die_("FLAC__metadata_iterator_delete_block() on STREAMINFO should have failed but didn't"); - - if(!compare_chain_(chain, our_current_position, FLAC__metadata_iterator_get_block(iterator))) - return false; - - printf("delete iterator\n"); - FLAC__metadata_iterator_delete(iterator); - our_current_position = 0; - - printf("SV\tmerge padding\n"); - FLAC__metadata_chain_merge_padding(chain); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - - printf("SV\tsort padding\n"); - FLAC__metadata_chain_sort_padding(chain); - - if(!write_chain_(chain, /*use_padding=*/false, /*preserve_file_stats=*/false, filename_based, flacfilename(is_ogg))) - return die_c_("during FLAC__metadata_chain_write(chain, false, false)", FLAC__metadata_chain_status(chain)); - if(!compare_chain_(chain, 0, 0)) - return false; - if(!test_file_(is_ogg, decoder_metadata_callback_compare_)) - return false; - -end: - printf("delete chain\n"); - - FLAC__metadata_chain_delete(chain); - - if(!remove_file_(flacfilename(is_ogg))) - return false; - - return true; -} - -static FLAC__bool test_level_2_misc_(FLAC__bool is_ogg) -{ - FLAC__Metadata_Iterator *iterator; - FLAC__Metadata_Chain *chain; - FLAC__IOCallbacks callbacks; - - memset(&callbacks, 0, sizeof(callbacks)); - callbacks.read = (FLAC__IOCallback_Read)fread; -#ifdef FLAC__VALGRIND_TESTING - callbacks.write = chain_write_cb_; -#else - callbacks.write = (FLAC__IOCallback_Write)fwrite; -#endif - callbacks.seek = chain_seek_cb_; - callbacks.tell = chain_tell_cb_; - callbacks.eof = chain_eof_cb_; - - printf("\n\n++++++ testing level 2 interface (mismatched read/write protections)\n"); - - printf("generate file\n"); - - if(!generate_file_(/*include_extras=*/false, is_ogg)) - return false; - - printf("create chain\n"); - - if(0 == (chain = FLAC__metadata_chain_new())) - return die_("allocating chain"); - - printf("read chain (filename-based)\n"); - - if(!FLAC__metadata_chain_read(chain, flacfilename(is_ogg))) - return die_c_("reading chain", FLAC__metadata_chain_status(chain)); - - printf("write chain with wrong method FLAC__metadata_chain_write_with_callbacks()\n"); - { - if(FLAC__metadata_chain_write_with_callbacks(chain, /*use_padding=*/false, 0, callbacks)) - return die_c_("mismatched write should have failed", FLAC__metadata_chain_status(chain)); - if(FLAC__metadata_chain_status(chain) != FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH", FLAC__metadata_chain_status(chain)); - printf(" OK: FLAC__metadata_chain_write_with_callbacks() returned false,FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH like it should\n"); - } - - printf("read chain (filename-based)\n"); - - if(!FLAC__metadata_chain_read(chain, flacfilename(is_ogg))) - return die_c_("reading chain", FLAC__metadata_chain_status(chain)); - - printf("write chain with wrong method FLAC__metadata_chain_write_with_callbacks_and_tempfile()\n"); - { - if(FLAC__metadata_chain_write_with_callbacks_and_tempfile(chain, /*use_padding=*/false, 0, callbacks, 0, callbacks)) - return die_c_("mismatched write should have failed", FLAC__metadata_chain_status(chain)); - if(FLAC__metadata_chain_status(chain) != FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH", FLAC__metadata_chain_status(chain)); - printf(" OK: FLAC__metadata_chain_write_with_callbacks_and_tempfile() returned false,FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH like it should\n"); - } - - printf("read chain (callback-based)\n"); - { - FILE *file = flac_fopen(flacfilename(is_ogg), "rb"); - if(0 == file) - return die_("opening file"); - if(!FLAC__metadata_chain_read_with_callbacks(chain, (FLAC__IOHandle)file, callbacks)) { - fclose(file); - return die_c_("reading chain", FLAC__metadata_chain_status(chain)); - } - fclose(file); - } - - printf("write chain with wrong method FLAC__metadata_chain_write()\n"); - { - if(FLAC__metadata_chain_write(chain, /*use_padding=*/false, /*preserve_file_stats=*/false)) - return die_c_("mismatched write should have failed", FLAC__metadata_chain_status(chain)); - if(FLAC__metadata_chain_status(chain) != FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH", FLAC__metadata_chain_status(chain)); - printf(" OK: FLAC__metadata_chain_write() returned false,FLAC__METADATA_CHAIN_STATUS_READ_WRITE_MISMATCH like it should\n"); - } - - printf("read chain (callback-based)\n"); - { - FILE *file = flac_fopen(flacfilename(is_ogg), "rb"); - if(0 == file) - return die_("opening file"); - if(!FLAC__metadata_chain_read_with_callbacks(chain, (FLAC__IOHandle)file, callbacks)) { - fclose(file); - return die_c_("reading chain", FLAC__metadata_chain_status(chain)); - } - fclose(file); - } - - printf("testing FLAC__metadata_chain_check_if_tempfile_needed()... "); - - if(!FLAC__metadata_chain_check_if_tempfile_needed(chain, /*use_padding=*/false)) - printf("OK: FLAC__metadata_chain_check_if_tempfile_needed() returned false like it should\n"); - else - return die_("FLAC__metadata_chain_check_if_tempfile_needed() returned true but shouldn't have"); - - printf("write chain with wrong method FLAC__metadata_chain_write_with_callbacks_and_tempfile()\n"); - { - if(FLAC__metadata_chain_write_with_callbacks_and_tempfile(chain, /*use_padding=*/false, 0, callbacks, 0, callbacks)) - return die_c_("mismatched write should have failed", FLAC__metadata_chain_status(chain)); - if(FLAC__metadata_chain_status(chain) != FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL", FLAC__metadata_chain_status(chain)); - printf(" OK: FLAC__metadata_chain_write_with_callbacks_and_tempfile() returned false,FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL like it should\n"); - } - - printf("read chain (callback-based)\n"); - { - FILE *file = flac_fopen(flacfilename(is_ogg), "rb"); - if(0 == file) - return die_("opening file"); - if(!FLAC__metadata_chain_read_with_callbacks(chain, (FLAC__IOHandle)file, callbacks)) { - fclose(file); - return die_c_("reading chain", FLAC__metadata_chain_status(chain)); - } - fclose(file); - } - - printf("create iterator\n"); - if(0 == (iterator = FLAC__metadata_iterator_new())) - return die_("allocating memory for iterator"); - - FLAC__metadata_iterator_init(iterator, chain); - - printf("[S]VP\tnext\n"); - if(!FLAC__metadata_iterator_next(iterator)) - return die_("iterator ended early\n"); - - printf("S[V]P\tdelete VORBIS_COMMENT, write\n"); - if(!FLAC__metadata_iterator_delete_block(iterator, /*replace_with_padding=*/false)) - return die_c_("block delete failed\n", FLAC__metadata_chain_status(chain)); - - printf("testing FLAC__metadata_chain_check_if_tempfile_needed()... "); - - if(FLAC__metadata_chain_check_if_tempfile_needed(chain, /*use_padding=*/false)) - printf("OK: FLAC__metadata_chain_check_if_tempfile_needed() returned true like it should\n"); - else - return die_("FLAC__metadata_chain_check_if_tempfile_needed() returned false but shouldn't have"); - - printf("write chain with wrong method FLAC__metadata_chain_write_with_callbacks()\n"); - { - if(FLAC__metadata_chain_write_with_callbacks(chain, /*use_padding=*/false, 0, callbacks)) - return die_c_("mismatched write should have failed", FLAC__metadata_chain_status(chain)); - if(FLAC__metadata_chain_status(chain) != FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL) - return die_c_("expected FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL", FLAC__metadata_chain_status(chain)); - printf(" OK: FLAC__metadata_chain_write_with_callbacks() returned false,FLAC__METADATA_CHAIN_STATUS_WRONG_WRITE_CALL like it should\n"); - } - - printf("delete iterator\n"); - - FLAC__metadata_iterator_delete(iterator); - - printf("delete chain\n"); - - FLAC__metadata_chain_delete(chain); - - if(!remove_file_(flacfilename(is_ogg))) - return false; - - return true; -} - -FLAC__bool test_metadata_file_manipulation(void) -{ - printf("\n+++ libFLAC unit test: metadata manipulation\n\n"); - - our_metadata_.num_blocks = 0; - - if(!test_level_0_()) - return false; - - if(!test_level_1_()) - return false; - - if(!test_level_2_(/*filename_based=*/true, /*is_ogg=*/false)) /* filename-based */ - return false; - if(!test_level_2_(/*filename_based=*/false, /*is_ogg=*/false)) /* callback-based */ - return false; - if(!test_level_2_misc_(/*is_ogg=*/false)) - return false; - - if(FLAC_API_SUPPORTS_OGG_FLAC) { - if(!test_level_2_(/*filename_based=*/true, /*is_ogg=*/true)) /* filename-based */ - return false; - if(!test_level_2_(/*filename_based=*/false, /*is_ogg=*/true)) /* callback-based */ - return false; -#if 0 - /* when ogg flac write is supported, will have to add this: */ - if(!test_level_2_misc_(/*is_ogg=*/true)) - return false; -#endif - } - - return true; -} diff --git a/src/test_libFLAC/metadata_object.c b/src/test_libFLAC/metadata_object.c deleted file mode 100644 index b52b923d..00000000 --- a/src/test_libFLAC/metadata_object.c +++ /dev/null @@ -1,2285 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "FLAC/assert.h" -#include "FLAC/metadata.h" -#include "test_libs_common/metadata_utils.h" -#include "share/compat.h" -#include "metadata.h" -#include -#include /* for malloc() */ -#include /* for memcmp() */ - -static FLAC__byte *make_dummydata_(FLAC__byte *dummydata, uint32_t len) -{ - FLAC__byte *ret; - - if(0 == (ret = malloc(len))) { - printf("FAILED, malloc error\n"); - exit(1); - } - else - memcpy(ret, dummydata, len); - - return ret; -} - -static FLAC__bool compare_track_(const FLAC__StreamMetadata_CueSheet_Track *from, const FLAC__StreamMetadata_CueSheet_Track *to) -{ - uint32_t i; - - if(from->offset != to->offset) { - printf("FAILED, track offset mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", to->offset, from->offset); - return false; - } - if(from->number != to->number) { - printf("FAILED, track number mismatch, expected %u, got %u\n", (uint32_t)to->number, (uint32_t)from->number); - return false; - } - if(0 != strcmp(from->isrc, to->isrc)) { - printf("FAILED, track number mismatch, expected %s, got %s\n", to->isrc, from->isrc); - return false; - } - if(from->type != to->type) { - printf("FAILED, track type mismatch, expected %u, got %u\n", (uint32_t)to->type, (uint32_t)from->type); - return false; - } - if(from->pre_emphasis != to->pre_emphasis) { - printf("FAILED, track pre_emphasis mismatch, expected %u, got %u\n", (uint32_t)to->pre_emphasis, (uint32_t)from->pre_emphasis); - return false; - } - if(from->num_indices != to->num_indices) { - printf("FAILED, track num_indices mismatch, expected %u, got %u\n", (uint32_t)to->num_indices, (uint32_t)from->num_indices); - return false; - } - if(0 == to->indices || 0 == from->indices) { - if(to->indices != from->indices) { - printf("FAILED, track indices mismatch\n"); - return false; - } - } - else { - for(i = 0; i < to->num_indices; i++) { - if(from->indices[i].offset != to->indices[i].offset) { - printf("FAILED, track indices[%u].offset mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", i, to->indices[i].offset, from->indices[i].offset); - return false; - } - if(from->indices[i].number != to->indices[i].number) { - printf("FAILED, track indices[%u].number mismatch, expected %u, got %u\n", i, (uint32_t)to->indices[i].number, (uint32_t)from->indices[i].number); - return false; - } - } - } - - return true; -} - -static FLAC__bool compare_seekpoint_array_(const FLAC__StreamMetadata_SeekPoint *from, const FLAC__StreamMetadata_SeekPoint *to, uint32_t n) -{ - uint32_t i; - - FLAC__ASSERT(0 != from); - FLAC__ASSERT(0 != to); - - for(i = 0; i < n; i++) { - if(from[i].sample_number != to[i].sample_number) { - printf("FAILED, point[%u].sample_number mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", i, to[i].sample_number, from[i].sample_number); - return false; - } - if(from[i].stream_offset != to[i].stream_offset) { - printf("FAILED, point[%u].stream_offset mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", i, to[i].stream_offset, from[i].stream_offset); - return false; - } - if(from[i].frame_samples != to[i].frame_samples) { - printf("FAILED, point[%u].frame_samples mismatch, expected %u, got %u\n", i, to[i].frame_samples, from[i].frame_samples); - return false; - } - } - - return true; -} - -static FLAC__bool check_seektable_(const FLAC__StreamMetadata *block, uint32_t num_points, const FLAC__StreamMetadata_SeekPoint *array) -{ - const uint32_t expected_length = num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; - - if(block->length != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length); - return false; - } - if(block->data.seek_table.num_points != num_points) { - printf("FAILED, expected %u point, got %u\n", num_points, block->data.seek_table.num_points); - return false; - } - if(0 == array) { - if(0 != block->data.seek_table.points) { - printf("FAILED, 'points' pointer is not null\n"); - return false; - } - } - else { - if(!compare_seekpoint_array_(block->data.seek_table.points, array, num_points)) - return false; - } - printf("OK\n"); - - return true; -} - -static void entry_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field) -{ - entry->length = strlen(field); - entry->entry = malloc(entry->length+1); - FLAC__ASSERT(0 != entry->entry); - memcpy(entry->entry, field, entry->length); - entry->entry[entry->length] = '\0'; -} - -static void entry_clone_(FLAC__StreamMetadata_VorbisComment_Entry *entry) -{ - FLAC__byte *x = malloc(entry->length+1); - FLAC__ASSERT(0 != x); - memcpy(x, entry->entry, entry->length); - x[entry->length] = '\0'; - entry->entry = x; -} - -static void vc_calc_len_(FLAC__StreamMetadata *block) -{ - const FLAC__StreamMetadata_VorbisComment *vc = &block->data.vorbis_comment; - uint32_t i; - - block->length = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; - block->length += vc->vendor_string.length; - block->length += FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; - for(i = 0; i < vc->num_comments; i++) { - block->length += FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; - block->length += vc->comments[i].length; - } -} - -static void vc_resize_(FLAC__StreamMetadata *block, uint32_t num) -{ - FLAC__StreamMetadata_VorbisComment *vc = &block->data.vorbis_comment; - - if(vc->num_comments != 0) { - FLAC__ASSERT(0 != vc->comments); - if(num < vc->num_comments) { - uint32_t i; - for(i = num; i < vc->num_comments; i++) { - if(0 != vc->comments[i].entry) - free(vc->comments[i].entry); - } - } - } - if(num == 0) { - if(0 != vc->comments) { - free(vc->comments); - vc->comments = 0; - } - } - else { - vc->comments = realloc(vc->comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*num); - FLAC__ASSERT(0 != vc->comments); - if(num > vc->num_comments) - memset(vc->comments+vc->num_comments, 0, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(num-vc->num_comments)); - } - - vc->num_comments = num; - vc_calc_len_(block); -} - -static int vc_find_from_(FLAC__StreamMetadata *block, const char *name, uint32_t start) -{ - const uint32_t n = strlen(name); - uint32_t i; - for(i = start; i < block->data.vorbis_comment.num_comments; i++) { - const FLAC__StreamMetadata_VorbisComment_Entry *entry = &block->data.vorbis_comment.comments[i]; - if(entry->length > n && 0 == strncmp((const char *)entry->entry, name, n) && entry->entry[n] == '=') - return (int)i; - } - return -1; -} - -static void vc_set_vs_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, const char *field) -{ - if(0 != block->data.vorbis_comment.vendor_string.entry) - free(block->data.vorbis_comment.vendor_string.entry); - entry_new_(entry, field); - block->data.vorbis_comment.vendor_string = *entry; - vc_calc_len_(block); -} - -static void vc_set_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, uint32_t pos, const char *field) -{ - if(0 != block->data.vorbis_comment.comments[pos].entry) - free(block->data.vorbis_comment.comments[pos].entry); - entry_new_(entry, field); - block->data.vorbis_comment.comments[pos] = *entry; - vc_calc_len_(block); -} - -static void vc_insert_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, uint32_t pos, const char *field) -{ - vc_resize_(block, block->data.vorbis_comment.num_comments+1); - memmove(&block->data.vorbis_comment.comments[pos+1], &block->data.vorbis_comment.comments[pos], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(block->data.vorbis_comment.num_comments-1-pos)); - memset(&block->data.vorbis_comment.comments[pos], 0, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); - vc_set_new_(entry, block, pos, field); - vc_calc_len_(block); -} - -static void vc_delete_(FLAC__StreamMetadata *block, uint32_t pos) -{ - if(0 != block->data.vorbis_comment.comments[pos].entry) - free(block->data.vorbis_comment.comments[pos].entry); - memmove(&block->data.vorbis_comment.comments[pos], &block->data.vorbis_comment.comments[pos+1], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(block->data.vorbis_comment.num_comments-pos-1)); - block->data.vorbis_comment.comments[block->data.vorbis_comment.num_comments-1].entry = 0; - block->data.vorbis_comment.comments[block->data.vorbis_comment.num_comments-1].length = 0; - vc_resize_(block, block->data.vorbis_comment.num_comments-1); - vc_calc_len_(block); -} - -static void vc_replace_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, const char *field, FLAC__bool all) -{ - int indx; - char field_name[256]; - const char *eq = strchr(field, '='); - FLAC__ASSERT(eq>field && (uint32_t)(eq-field) < sizeof(field_name)); - memcpy(field_name, field, eq-field); - field_name[eq-field]='\0'; - - indx = vc_find_from_(block, field_name, 0); - if(indx < 0) - vc_insert_new_(entry, block, block->data.vorbis_comment.num_comments, field); - else { - vc_set_new_(entry, block, (uint32_t)indx, field); - if(all) { - for(indx = indx+1; indx >= 0 && (uint32_t)indx < block->data.vorbis_comment.num_comments; ) - if((indx = vc_find_from_(block, field_name, (uint32_t)indx)) >= 0) - vc_delete_(block, (uint32_t)indx); - } - } - - vc_calc_len_(block); -} - -static void track_new_(FLAC__StreamMetadata_CueSheet_Track *track, FLAC__uint64 offset, FLAC__byte number, const char *isrc, FLAC__bool data, FLAC__bool pre_em) -{ - track->offset = offset; - track->number = number; - memcpy(track->isrc, isrc, sizeof(track->isrc)); - track->type = data; - track->pre_emphasis = pre_em; - track->num_indices = 0; - track->indices = 0; -} - -static void track_clone_(FLAC__StreamMetadata_CueSheet_Track *track) -{ - if(track->num_indices > 0) { - size_t bytes = sizeof(FLAC__StreamMetadata_CueSheet_Index) * track->num_indices; - FLAC__StreamMetadata_CueSheet_Index *x = malloc(bytes); - FLAC__ASSERT(0 != x); - memcpy(x, track->indices, bytes); - track->indices = x; - } -} - -static void cs_calc_len_(FLAC__StreamMetadata *block) -{ - const FLAC__StreamMetadata_CueSheet *cs = &block->data.cue_sheet; - uint32_t i; - - block->length = ( - FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN + - FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + - FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN + - FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN - ) / 8; - block->length += cs->num_tracks * ( - FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN - ) / 8; - for(i = 0; i < cs->num_tracks; i++) { - block->length += cs->tracks[i].num_indices * ( - FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN + - FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN - ) / 8; - } -} - -static void tr_resize_(FLAC__StreamMetadata *block, uint32_t track_num, uint32_t num) -{ - FLAC__StreamMetadata_CueSheet_Track *tr; - - FLAC__ASSERT(track_num < block->data.cue_sheet.num_tracks); - - tr = &block->data.cue_sheet.tracks[track_num]; - - if(tr->num_indices != 0) { - FLAC__ASSERT(0 != tr->indices); - } - if(num == 0) { - if(0 != tr->indices) { - free(tr->indices); - tr->indices = 0; - } - } - else { - tr->indices = realloc(tr->indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)*num); - FLAC__ASSERT(0 != tr->indices); - if(num > tr->num_indices) - memset(tr->indices+tr->num_indices, 0, sizeof(FLAC__StreamMetadata_CueSheet_Index)*(num-tr->num_indices)); - } - - tr->num_indices = num; - cs_calc_len_(block); -} - -static void tr_set_new_(FLAC__StreamMetadata *block, uint32_t track_num, uint32_t pos, FLAC__StreamMetadata_CueSheet_Index indx) -{ - FLAC__StreamMetadata_CueSheet_Track *tr; - - FLAC__ASSERT(track_num < block->data.cue_sheet.num_tracks); - - tr = &block->data.cue_sheet.tracks[track_num]; - - FLAC__ASSERT(pos < tr->num_indices); - - tr->indices[pos] = indx; - - cs_calc_len_(block); -} - -static void tr_insert_new_(FLAC__StreamMetadata *block, uint32_t track_num, uint32_t pos, FLAC__StreamMetadata_CueSheet_Index indx) -{ - FLAC__StreamMetadata_CueSheet_Track *tr; - - FLAC__ASSERT(track_num < block->data.cue_sheet.num_tracks); - - tr = &block->data.cue_sheet.tracks[track_num]; - - FLAC__ASSERT(pos <= tr->num_indices); - - tr_resize_(block, track_num, tr->num_indices+1); - memmove(&tr->indices[pos+1], &tr->indices[pos], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(tr->num_indices-1-pos)); - tr_set_new_(block, track_num, pos, indx); - cs_calc_len_(block); -} - -static void tr_delete_(FLAC__StreamMetadata *block, uint32_t track_num, uint32_t pos) -{ - FLAC__StreamMetadata_CueSheet_Track *tr; - - FLAC__ASSERT(track_num < block->data.cue_sheet.num_tracks); - - tr = &block->data.cue_sheet.tracks[track_num]; - - FLAC__ASSERT(pos <= tr->num_indices); - - memmove(&tr->indices[pos], &tr->indices[pos+1], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(tr->num_indices-pos-1)); - tr_resize_(block, track_num, tr->num_indices-1); - cs_calc_len_(block); -} - -static void cs_resize_(FLAC__StreamMetadata *block, uint32_t num) -{ - FLAC__StreamMetadata_CueSheet *cs = &block->data.cue_sheet; - - if(cs->num_tracks != 0) { - FLAC__ASSERT(0 != cs->tracks); - if(num < cs->num_tracks) { - uint32_t i; - for(i = num; i < cs->num_tracks; i++) { - if(0 != cs->tracks[i].indices) - free(cs->tracks[i].indices); - } - } - } - if(num == 0) { - if(0 != cs->tracks) { - free(cs->tracks); - cs->tracks = 0; - } - } - else { - cs->tracks = realloc(cs->tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)*num); - FLAC__ASSERT(0 != cs->tracks); - if(num > cs->num_tracks) - memset(cs->tracks+cs->num_tracks, 0, sizeof(FLAC__StreamMetadata_CueSheet_Track)*(num-cs->num_tracks)); - } - - cs->num_tracks = num; - cs_calc_len_(block); -} - -static void cs_set_new_(FLAC__StreamMetadata_CueSheet_Track *track, FLAC__StreamMetadata *block, uint32_t pos, FLAC__uint64 offset, FLAC__byte number, const char *isrc, FLAC__bool data, FLAC__bool pre_em) -{ - track_new_(track, offset, number, isrc, data, pre_em); - block->data.cue_sheet.tracks[pos] = *track; - cs_calc_len_(block); -} - -static void cs_insert_new_(FLAC__StreamMetadata_CueSheet_Track *track, FLAC__StreamMetadata *block, uint32_t pos, FLAC__uint64 offset, FLAC__byte number, const char *isrc, FLAC__bool data, FLAC__bool pre_em) -{ - cs_resize_(block, block->data.cue_sheet.num_tracks+1); - memmove(&block->data.cue_sheet.tracks[pos+1], &block->data.cue_sheet.tracks[pos], sizeof(FLAC__StreamMetadata_CueSheet_Track)*(block->data.cue_sheet.num_tracks-1-pos)); - cs_set_new_(track, block, pos, offset, number, isrc, data, pre_em); - cs_calc_len_(block); -} - -static void cs_delete_(FLAC__StreamMetadata *block, uint32_t pos) -{ - if(0 != block->data.cue_sheet.tracks[pos].indices) - free(block->data.cue_sheet.tracks[pos].indices); - memmove(&block->data.cue_sheet.tracks[pos], &block->data.cue_sheet.tracks[pos+1], sizeof(FLAC__StreamMetadata_CueSheet_Track)*(block->data.cue_sheet.num_tracks-pos-1)); - block->data.cue_sheet.tracks[block->data.cue_sheet.num_tracks-1].indices = 0; - block->data.cue_sheet.tracks[block->data.cue_sheet.num_tracks-1].num_indices = 0; - cs_resize_(block, block->data.cue_sheet.num_tracks-1); - cs_calc_len_(block); -} - -static void pi_set_mime_type(FLAC__StreamMetadata *block, const char *s) -{ - if(block->data.picture.mime_type) { - block->length -= strlen(block->data.picture.mime_type); - free(block->data.picture.mime_type); - } - block->data.picture.mime_type = strdup(s); - FLAC__ASSERT(block->data.picture.mime_type); - block->length += strlen(block->data.picture.mime_type); -} - -static void pi_set_description(FLAC__StreamMetadata *block, const FLAC__byte *s) -{ - if(block->data.picture.description) { - block->length -= strlen((const char *)block->data.picture.description); - free(block->data.picture.description); - } - block->data.picture.description = (FLAC__byte*)strdup((const char *)s); - FLAC__ASSERT(block->data.picture.description); - block->length += strlen((const char *)block->data.picture.description); -} - -static void pi_set_data(FLAC__StreamMetadata *block, const FLAC__byte *data, FLAC__uint32 len) -{ - if(block->data.picture.data) { - block->length -= block->data.picture.data_length; - free(block->data.picture.data); - } - block->data.picture.data = (FLAC__byte*)strdup((const char *)data); - FLAC__ASSERT(block->data.picture.data); - block->data.picture.data_length = len; - block->length += len; -} - -FLAC__bool test_metadata_object(void) -{ - FLAC__StreamMetadata *block, *blockcopy, *vorbiscomment, *cuesheet, *picture; - FLAC__StreamMetadata_SeekPoint seekpoint_array[14]; - FLAC__StreamMetadata_VorbisComment_Entry entry; - FLAC__StreamMetadata_CueSheet_Index indx; - FLAC__StreamMetadata_CueSheet_Track track; - uint32_t i, expected_length, seekpoints; - int j; - static FLAC__byte dummydata[4] = { 'a', 'b', 'c', 'd' }; - - printf("\n+++ libFLAC unit test: metadata objects\n\n"); - - - printf("testing STREAMINFO\n"); - - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_STREAMINFO); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - expected_length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; - if(block->length != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - - printf("testing PADDING\n"); - - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - expected_length = 0; - if(block->length != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - - printf("testing APPLICATION\n"); - - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - expected_length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; - if(block->length != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - printf("OK\n"); - - printf("testing FLAC__metadata_object_application_set_data(copy)... "); - if(!FLAC__metadata_object_application_set_data(block, dummydata, sizeof(dummydata), true/*copy*/)) { - printf("FAILED, returned false\n"); - return false; - } - expected_length = (FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) + sizeof(dummydata); - if(block->length != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length); - return false; - } - if(0 != memcmp(block->data.application.data, dummydata, sizeof(dummydata))) { - printf("FAILED, data mismatch\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - printf("OK\n"); - - printf("testing FLAC__metadata_object_application_set_data(own)... "); - if(!FLAC__metadata_object_application_set_data(block, make_dummydata_(dummydata, sizeof(dummydata)), sizeof(dummydata), false/*own*/)) { - printf("FAILED, returned false\n"); - return false; - } - expected_length = (FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) + sizeof(dummydata); - if(block->length != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length); - return false; - } - if(0 != memcmp(block->data.application.data, dummydata, sizeof(dummydata))) { - printf("FAILED, data mismatch\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - - printf("testing SEEKTABLE\n"); - - for(i = 0; i < sizeof(seekpoint_array) / sizeof(FLAC__StreamMetadata_SeekPoint); i++) { - seekpoint_array[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; - seekpoint_array[i].stream_offset = 0; - seekpoint_array[i].frame_samples = 0; - } - - seekpoints = 0; - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!check_seektable_(block, seekpoints, 0)) - return false; - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - printf("OK\n"); - - seekpoints = 2; - printf("testing FLAC__metadata_object_seektable_resize_points(grow to %u)...", seekpoints); - if(!FLAC__metadata_object_seektable_resize_points(block, seekpoints)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoints = 1; - printf("testing FLAC__metadata_object_seektable_resize_points(shrink to %u)...", seekpoints); - if(!FLAC__metadata_object_seektable_resize_points(block, seekpoints)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - printf("testing FLAC__metadata_object_seektable_is_legal()..."); - if(!FLAC__metadata_object_seektable_is_legal(block)) { - printf("FAILED, returned false\n"); - return false; - } - printf("OK\n"); - - seekpoints = 0; - printf("testing FLAC__metadata_object_seektable_resize_points(shrink to %u)...", seekpoints); - if(!FLAC__metadata_object_seektable_resize_points(block, seekpoints)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, 0)) - return false; - - seekpoints++; - printf("testing FLAC__metadata_object_seektable_insert_point() on empty array..."); - if(!FLAC__metadata_object_seektable_insert_point(block, 0, seekpoint_array[0])) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoint_array[0].sample_number = 1; - seekpoints++; - printf("testing FLAC__metadata_object_seektable_insert_point() on beginning of non-empty array..."); - if(!FLAC__metadata_object_seektable_insert_point(block, 0, seekpoint_array[0])) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoint_array[1].sample_number = 2; - seekpoints++; - printf("testing FLAC__metadata_object_seektable_insert_point() on middle of non-empty array..."); - if(!FLAC__metadata_object_seektable_insert_point(block, 1, seekpoint_array[1])) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoint_array[3].sample_number = 3; - seekpoints++; - printf("testing FLAC__metadata_object_seektable_insert_point() on end of non-empty array..."); - if(!FLAC__metadata_object_seektable_insert_point(block, 3, seekpoint_array[3])) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - printf("OK\n"); - - seekpoint_array[2].sample_number = seekpoint_array[3].sample_number; - seekpoints--; - printf("testing FLAC__metadata_object_seektable_delete_point() on middle of array..."); - if(!FLAC__metadata_object_seektable_delete_point(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoints--; - printf("testing FLAC__metadata_object_seektable_delete_point() on end of array..."); - if(!FLAC__metadata_object_seektable_delete_point(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoints--; - printf("testing FLAC__metadata_object_seektable_delete_point() on beginning of array..."); - if(!FLAC__metadata_object_seektable_delete_point(block, 0)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array+1)) - return false; - - printf("testing FLAC__metadata_object_seektable_set_point()..."); - FLAC__metadata_object_seektable_set_point(block, 0, seekpoint_array[0]); - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - /* seektable template functions */ - - for(i = 0; i < sizeof(seekpoint_array) / sizeof(FLAC__StreamMetadata_SeekPoint); i++) { - seekpoint_array[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; - seekpoint_array[i].stream_offset = 0; - seekpoint_array[i].frame_samples = 0; - } - - seekpoints = 0; - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!check_seektable_(block, seekpoints, 0)) - return false; - - seekpoints += 2; - printf("testing FLAC__metadata_object_seekpoint_template_append_placeholders()... "); - if(!FLAC__metadata_object_seektable_template_append_placeholders(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoint_array[seekpoints++].sample_number = 7; - printf("testing FLAC__metadata_object_seekpoint_template_append_point()... "); - if(!FLAC__metadata_object_seektable_template_append_point(block, 7)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - { - FLAC__uint64 nums[2] = { 3, 7 }; - seekpoint_array[seekpoints++].sample_number = nums[0]; - seekpoint_array[seekpoints++].sample_number = nums[1]; - printf("testing FLAC__metadata_object_seekpoint_template_append_points()... "); - if(!FLAC__metadata_object_seektable_template_append_points(block, nums, sizeof(nums)/sizeof(FLAC__uint64))) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - } - - seekpoint_array[seekpoints++].sample_number = 0; - seekpoint_array[seekpoints++].sample_number = 10; - seekpoint_array[seekpoints++].sample_number = 20; - printf("testing FLAC__metadata_object_seekpoint_template_append_spaced_points()... "); - if(!FLAC__metadata_object_seektable_template_append_spaced_points(block, 3, 30)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoints--; - seekpoint_array[0].sample_number = 0; - seekpoint_array[1].sample_number = 3; - seekpoint_array[2].sample_number = 7; - seekpoint_array[3].sample_number = 10; - seekpoint_array[4].sample_number = 20; - seekpoint_array[5].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; - seekpoint_array[6].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; - printf("testing FLAC__metadata_object_seekpoint_template_sort(compact=true)... "); - if(!FLAC__metadata_object_seektable_template_sort(block, /*compact=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!FLAC__metadata_object_seektable_is_legal(block)) { - printf("FAILED, seek table is illegal\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - printf("testing FLAC__metadata_object_seekpoint_template_sort(compact=false)... "); - if(!FLAC__metadata_object_seektable_template_sort(block, /*compact=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!FLAC__metadata_object_seektable_is_legal(block)) { - printf("FAILED, seek table is illegal\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoint_array[seekpoints++].sample_number = 0; - seekpoint_array[seekpoints++].sample_number = 10; - seekpoint_array[seekpoints++].sample_number = 20; - printf("testing FLAC__metadata_object_seekpoint_template_append_spaced_points_by_samples()... "); - if(!FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(block, 10, 30)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - seekpoint_array[seekpoints++].sample_number = 0; - seekpoint_array[seekpoints++].sample_number = 11; - seekpoint_array[seekpoints++].sample_number = 22; - printf("testing FLAC__metadata_object_seekpoint_template_append_spaced_points_by_samples()... "); - if(!FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(block, 11, 30)) { - printf("FAILED, returned false\n"); - return false; - } - if(!check_seektable_(block, seekpoints, seekpoint_array)) - return false; - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - - printf("testing VORBIS_COMMENT\n"); - - { - FLAC__StreamMetadata_VorbisComment_Entry entry_; - char *field_name, *field_value; - - printf("testing FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair()... "); - if(!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry_, "name", "value")) { - printf("FAILED, returned false\n"); - return false; - } - if(strcmp((const char *)entry_.entry, "name=value")) { - printf("FAILED, field mismatch\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair()... "); - if(!FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair(entry_, &field_name, &field_value)) { - printf("FAILED, returned false\n"); - return false; - } - if(strcmp(field_name, "name")) { - printf("FAILED, field name mismatch\n"); - return false; - } - if(strcmp(field_value, "value")) { - printf("FAILED, field value mismatch\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_entry_matches()... "); - if(!FLAC__metadata_object_vorbiscomment_entry_matches(entry_, field_name, strlen(field_name))) { - printf("FAILED, expected true, returned false\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_entry_matches()... "); - if(FLAC__metadata_object_vorbiscomment_entry_matches(entry_, "blah", strlen("blah"))) { - printf("FAILED, expected false, returned true\n"); - return false; - } - printf("OK\n"); - - free(entry_.entry); - free(field_name); - free(field_value); - } - - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - expected_length = (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN/8 + strlen(FLAC__VENDOR_STRING) + FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN/8); - if(block->length != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - vorbiscomment = FLAC__metadata_object_clone(block); - if(0 == vorbiscomment) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - vc_resize_(vorbiscomment, 2); - printf("testing FLAC__metadata_object_vorbiscomment_resize_comments(grow to %u)...", vorbiscomment->data.vorbis_comment.num_comments); - if(!FLAC__metadata_object_vorbiscomment_resize_comments(block, vorbiscomment->data.vorbis_comment.num_comments)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - vc_resize_(vorbiscomment, 1); - printf("testing FLAC__metadata_object_vorbiscomment_resize_comments(shrink to %u)...", vorbiscomment->data.vorbis_comment.num_comments); - if(!FLAC__metadata_object_vorbiscomment_resize_comments(block, vorbiscomment->data.vorbis_comment.num_comments)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - vc_resize_(vorbiscomment, 0); - printf("testing FLAC__metadata_object_vorbiscomment_resize_comments(shrink to %u)...", vorbiscomment->data.vorbis_comment.num_comments); - if(!FLAC__metadata_object_vorbiscomment_resize_comments(block, vorbiscomment->data.vorbis_comment.num_comments)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_append_comment(copy) on empty array..."); - vc_insert_new_(&entry, vorbiscomment, 0, "name1=field1"); - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_append_comment(copy) on non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 1, "name2=field2"); - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - vc_resize_(vorbiscomment, 0); - printf("testing FLAC__metadata_object_vorbiscomment_resize_comments(shrink to %u)...", vorbiscomment->data.vorbis_comment.num_comments); - if(!FLAC__metadata_object_vorbiscomment_resize_comments(block, vorbiscomment->data.vorbis_comment.num_comments)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(copy) on empty array..."); - vc_insert_new_(&entry, vorbiscomment, 0, "name1=field1"); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 0, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(copy) on beginning of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 0, "name2=field2"); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 0, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(copy) on middle of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 1, "name3=field3"); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 1, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(copy) on end of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 3, "name4=field4"); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 3, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(copy) on end of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 4, "name3=field3dup1"); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 4, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(copy) on end of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 5, "name3=field3dup1"); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 5, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_find_entry_from()..."); - if((j = FLAC__metadata_object_vorbiscomment_find_entry_from(block, 0, "name3")) != 1) { - printf("FAILED, expected 1, got %d\n", j); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_find_entry_from()..."); - if((j = FLAC__metadata_object_vorbiscomment_find_entry_from(block, j+1, "name3")) != 4) { - printf("FAILED, expected 4, got %d\n", j); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_find_entry_from()..."); - if((j = FLAC__metadata_object_vorbiscomment_find_entry_from(block, j+1, "name3")) != 5) { - printf("FAILED, expected 5, got %d\n", j); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_find_entry_from()..."); - if((j = FLAC__metadata_object_vorbiscomment_find_entry_from(block, 0, "name2")) != 0) { - printf("FAILED, expected 0, got %d\n", j); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_find_entry_from()..."); - if((j = FLAC__metadata_object_vorbiscomment_find_entry_from(block, j+1, "name2")) != -1) { - printf("FAILED, expected -1, got %d\n", j); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_find_entry_from()..."); - if((j = FLAC__metadata_object_vorbiscomment_find_entry_from(block, 0, "blah")) != -1) { - printf("FAILED, expected -1, got %d\n", j); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_replace_comment(first, copy)..."); - vc_replace_new_(&entry, vorbiscomment, "name3=field3new1", /*all=*/false); - if(!FLAC__metadata_object_vorbiscomment_replace_comment(block, entry, /*all=*/false, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - if(block->data.vorbis_comment.num_comments != 6) { - printf("FAILED, expected 6 comments, got %u\n", block->data.vorbis_comment.num_comments); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_replace_comment(all, copy)..."); - vc_replace_new_(&entry, vorbiscomment, "name3=field3new2", /*all=*/true); - if(!FLAC__metadata_object_vorbiscomment_replace_comment(block, entry, /*all=*/true, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - if(block->data.vorbis_comment.num_comments != 4) { - printf("FAILED, expected 4 comments, got %u\n", block->data.vorbis_comment.num_comments); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on middle of array..."); - vc_delete_(vorbiscomment, 2); - if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on end of array..."); - vc_delete_(vorbiscomment, 2); - if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on beginning of array..."); - vc_delete_(vorbiscomment, 0); - if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 0)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_append_comment(copy) on non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 1, "rem0=val0"); - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_append_comment(copy) on non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 2, "rem0=val1"); - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_append_comment(copy) on non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 3, "rem0=val2"); - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_remove_entry_matching(\"blah\")..."); - if((j = FLAC__metadata_object_vorbiscomment_remove_entry_matching(block, "blah")) != 0) { - printf("FAILED, expected 0, got %d\n", j); - return false; - } - if(block->data.vorbis_comment.num_comments != 4) { - printf("FAILED, expected 4 comments, got %u\n", block->data.vorbis_comment.num_comments); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_remove_entry_matching(\"rem0\")..."); - vc_delete_(vorbiscomment, 1); - if((j = FLAC__metadata_object_vorbiscomment_remove_entry_matching(block, "rem0")) != 1) { - printf("FAILED, expected 1, got %d\n", j); - return false; - } - if(block->data.vorbis_comment.num_comments != 3) { - printf("FAILED, expected 3 comments, got %u\n", block->data.vorbis_comment.num_comments); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_remove_entries_matching(\"blah\")..."); - if((j = FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, "blah")) != 0) { - printf("FAILED, expected 0, got %d\n", j); - return false; - } - if(block->data.vorbis_comment.num_comments != 3) { - printf("FAILED, expected 3 comments, got %u\n", block->data.vorbis_comment.num_comments); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_remove_entries_matching(\"rem0\")..."); - vc_delete_(vorbiscomment, 1); - vc_delete_(vorbiscomment, 1); - if((j = FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, "rem0")) != 2) { - printf("FAILED, expected 2, got %d\n", j); - return false; - } - if(block->data.vorbis_comment.num_comments != 1) { - printf("FAILED, expected 1 comments, got %u\n", block->data.vorbis_comment.num_comments); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_set_comment(copy)..."); - vc_set_new_(&entry, vorbiscomment, 0, "name5=field5"); - FLAC__metadata_object_vorbiscomment_set_comment(block, 0, entry, /*copy=*/true); - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_set_vendor_string(copy)..."); - vc_set_vs_new_(&entry, vorbiscomment, "name6=field6"); - FLAC__metadata_object_vorbiscomment_set_vendor_string(block, entry, /*copy=*/true); - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(vorbiscomment); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - vorbiscomment = FLAC__metadata_object_clone(block); - if(0 == vorbiscomment) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_append_comment(own) on empty array..."); - vc_insert_new_(&entry, vorbiscomment, 0, "name1=field1"); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_append_comment(own) on non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 1, "name2=field2"); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(vorbiscomment); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - vorbiscomment = FLAC__metadata_object_clone(block); - if(0 == vorbiscomment) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on empty array..."); - vc_insert_new_(&entry, vorbiscomment, 0, "name1=field1"); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 0, entry, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on beginning of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 0, "name2=field2"); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 0, entry, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on middle of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 1, "name3=field3"); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 1, entry, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on end of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 3, "name4=field4"); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 3, entry, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on end of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 4, "name3=field3dup1"); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 4, entry, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_insert_comment(own) on end of non-empty array..."); - vc_insert_new_(&entry, vorbiscomment, 5, "name3=field3dup1"); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_insert_comment(block, 5, entry, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_replace_comment(first, own)..."); - vc_replace_new_(&entry, vorbiscomment, "name3=field3new1", /*all=*/false); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_replace_comment(block, entry, /*all=*/false, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - if(block->data.vorbis_comment.num_comments != 6) { - printf("FAILED, expected 6 comments, got %u\n", block->data.vorbis_comment.num_comments); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_replace_comment(all, own)..."); - vc_replace_new_(&entry, vorbiscomment, "name3=field3new2", /*all=*/true); - entry_clone_(&entry); - if(!FLAC__metadata_object_vorbiscomment_replace_comment(block, entry, /*all=*/true, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - if(block->data.vorbis_comment.num_comments != 4) { - printf("FAILED, expected 4 comments, got %u\n", block->data.vorbis_comment.num_comments); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on middle of array..."); - vc_delete_(vorbiscomment, 2); - if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on end of array..."); - vc_delete_(vorbiscomment, 2); - if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_delete_comment() on beginning of array..."); - vc_delete_(vorbiscomment, 0); - if(!FLAC__metadata_object_vorbiscomment_delete_comment(block, 0)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_set_comment(own)..."); - vc_set_new_(&entry, vorbiscomment, 0, "name5=field5"); - entry_clone_(&entry); - FLAC__metadata_object_vorbiscomment_set_comment(block, 0, entry, /*copy=*/false); - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_vorbiscomment_set_vendor_string(own)..."); - vc_set_vs_new_(&entry, vorbiscomment, "name6=field6"); - entry_clone_(&entry); - FLAC__metadata_object_vorbiscomment_set_vendor_string(block, entry, /*copy=*/false); - if(!mutils__compare_block(vorbiscomment, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(vorbiscomment); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - - printf("testing CUESHEET\n"); - - { - FLAC__StreamMetadata_CueSheet_Track *track_, *trackcopy_; - - printf("testing FLAC__metadata_object_cuesheet_track_new()... "); - track_ = FLAC__metadata_object_cuesheet_track_new(); - if(0 == track_) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_track_clone()... "); - trackcopy_ = FLAC__metadata_object_cuesheet_track_clone(track_); - if(0 == trackcopy_) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!compare_track_(trackcopy_, track_)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_track_delete()... "); - FLAC__metadata_object_cuesheet_track_delete(trackcopy_); - FLAC__metadata_object_cuesheet_track_delete(track_); - printf("OK\n"); - } - - - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - expected_length = ( - FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN + - FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + - FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN + - FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN - ) / 8; - if(block->length != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - cuesheet = FLAC__metadata_object_clone(block); - if(0 == cuesheet) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - cs_resize_(cuesheet, 2); - printf("testing FLAC__metadata_object_cuesheet_resize_tracks(grow to %u)...", cuesheet->data.cue_sheet.num_tracks); - if(!FLAC__metadata_object_cuesheet_resize_tracks(block, cuesheet->data.cue_sheet.num_tracks)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - cs_resize_(cuesheet, 1); - printf("testing FLAC__metadata_object_cuesheet_resize_tracks(shrink to %u)...", cuesheet->data.cue_sheet.num_tracks); - if(!FLAC__metadata_object_cuesheet_resize_tracks(block, cuesheet->data.cue_sheet.num_tracks)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - cs_resize_(cuesheet, 0); - printf("testing FLAC__metadata_object_cuesheet_resize_tracks(shrink to %u)...", cuesheet->data.cue_sheet.num_tracks); - if(!FLAC__metadata_object_cuesheet_resize_tracks(block, cuesheet->data.cue_sheet.num_tracks)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_insert_track(copy) on empty array..."); - cs_insert_new_(&track, cuesheet, 0, 0, 1, "ABCDE1234567", false, false); - if(!FLAC__metadata_object_cuesheet_insert_track(block, 0, &track, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_insert_track(copy) on beginning of non-empty array..."); - cs_insert_new_(&track, cuesheet, 0, 10, 2, "BBCDE1234567", false, false); - if(!FLAC__metadata_object_cuesheet_insert_track(block, 0, &track, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_insert_track(copy) on middle of non-empty array..."); - cs_insert_new_(&track, cuesheet, 1, 20, 3, "CBCDE1234567", false, false); - if(!FLAC__metadata_object_cuesheet_insert_track(block, 1, &track, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_insert_track(copy) on end of non-empty array..."); - cs_insert_new_(&track, cuesheet, 3, 30, 4, "DBCDE1234567", false, false); - if(!FLAC__metadata_object_cuesheet_insert_track(block, 3, &track, /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_insert_blank_track() on end of non-empty array..."); - cs_insert_new_(&track, cuesheet, 4, 0, 0, "\0\0\0\0\0\0\0\0\0\0\0\0", false, false); - if(!FLAC__metadata_object_cuesheet_insert_blank_track(block, 4)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_delete_track() on end of array..."); - cs_delete_(cuesheet, 4); - if(!FLAC__metadata_object_cuesheet_delete_track(block, 4)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_delete_track() on middle of array..."); - cs_delete_(cuesheet, 2); - if(!FLAC__metadata_object_cuesheet_delete_track(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_delete_track() on end of array..."); - cs_delete_(cuesheet, 2); - if(!FLAC__metadata_object_cuesheet_delete_track(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_delete_track() on beginning of array..."); - cs_delete_(cuesheet, 0); - if(!FLAC__metadata_object_cuesheet_delete_track(block, 0)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_set_track(copy)..."); - cs_set_new_(&track, cuesheet, 0, 40, 5, "EBCDE1234567", false, false); - FLAC__metadata_object_cuesheet_set_track(block, 0, &track, /*copy=*/true); - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - tr_resize_(cuesheet, 0, 2); - printf("testing FLAC__metadata_object_cuesheet_track_resize_indices(grow to %u)...", cuesheet->data.cue_sheet.tracks[0].num_indices); - if(!FLAC__metadata_object_cuesheet_track_resize_indices(block, 0, cuesheet->data.cue_sheet.tracks[0].num_indices)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - tr_resize_(cuesheet, 0, 1); - printf("testing FLAC__metadata_object_cuesheet_track_resize_indices(shrink to %u)...", cuesheet->data.cue_sheet.tracks[0].num_indices); - if(!FLAC__metadata_object_cuesheet_track_resize_indices(block, 0, cuesheet->data.cue_sheet.tracks[0].num_indices)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - tr_resize_(cuesheet, 0, 0); - printf("testing FLAC__metadata_object_cuesheet_track_resize_indices(shrink to %u)...", cuesheet->data.cue_sheet.tracks[0].num_indices); - if(!FLAC__metadata_object_cuesheet_track_resize_indices(block, 0, cuesheet->data.cue_sheet.tracks[0].num_indices)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - indx.offset = 0; - indx.number = 1; - printf("testing FLAC__metadata_object_cuesheet_track_insert_index() on empty array..."); - tr_insert_new_(cuesheet, 0, 0, indx); - if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 0, indx)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - indx.offset = 10; - indx.number = 2; - printf("testing FLAC__metadata_object_cuesheet_track_insert_index() on beginning of non-empty array..."); - tr_insert_new_(cuesheet, 0, 0, indx); - if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 0, indx)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - indx.offset = 20; - indx.number = 3; - printf("testing FLAC__metadata_object_cuesheet_track_insert_index() on middle of non-empty array..."); - tr_insert_new_(cuesheet, 0, 1, indx); - if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 1, indx)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - indx.offset = 30; - indx.number = 4; - printf("testing FLAC__metadata_object_cuesheet_track_insert_index() on end of non-empty array..."); - tr_insert_new_(cuesheet, 0, 3, indx); - if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 3, indx)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - indx.offset = 0; - indx.number = 0; - printf("testing FLAC__metadata_object_cuesheet_track_insert_blank_index() on end of non-empty array..."); - tr_insert_new_(cuesheet, 0, 4, indx); - if(!FLAC__metadata_object_cuesheet_track_insert_blank_index(block, 0, 4)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_track_delete_index() on end of array..."); - tr_delete_(cuesheet, 0, 4); - if(!FLAC__metadata_object_cuesheet_track_delete_index(block, 0, 4)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_track_delete_index() on middle of array..."); - tr_delete_(cuesheet, 0, 2); - if(!FLAC__metadata_object_cuesheet_track_delete_index(block, 0, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_track_delete_index() on end of array..."); - tr_delete_(cuesheet, 0, 2); - if(!FLAC__metadata_object_cuesheet_track_delete_index(block, 0, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_track_delete_index() on beginning of array..."); - tr_delete_(cuesheet, 0, 0); - if(!FLAC__metadata_object_cuesheet_track_delete_index(block, 0, 0)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(cuesheet); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - cuesheet = FLAC__metadata_object_clone(block); - if(0 == cuesheet) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_insert_track(own) on empty array..."); - cs_insert_new_(&track, cuesheet, 0, 60, 7, "GBCDE1234567", false, false); - track_clone_(&track); - if(!FLAC__metadata_object_cuesheet_insert_track(block, 0, &track, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_insert_track(own) on beginning of non-empty array..."); - cs_insert_new_(&track, cuesheet, 0, 70, 8, "HBCDE1234567", false, false); - track_clone_(&track); - if(!FLAC__metadata_object_cuesheet_insert_track(block, 0, &track, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_insert_track(own) on middle of non-empty array..."); - cs_insert_new_(&track, cuesheet, 1, 80, 9, "IBCDE1234567", false, false); - track_clone_(&track); - if(!FLAC__metadata_object_cuesheet_insert_track(block, 1, &track, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_insert_track(own) on end of non-empty array..."); - cs_insert_new_(&track, cuesheet, 3, 90, 10, "JBCDE1234567", false, false); - track_clone_(&track); - if(!FLAC__metadata_object_cuesheet_insert_track(block, 3, &track, /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_delete_track() on middle of array..."); - cs_delete_(cuesheet, 2); - if(!FLAC__metadata_object_cuesheet_delete_track(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_delete_track() on end of array..."); - cs_delete_(cuesheet, 2); - if(!FLAC__metadata_object_cuesheet_delete_track(block, 2)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_delete_track() on beginning of array..."); - cs_delete_(cuesheet, 0); - if(!FLAC__metadata_object_cuesheet_delete_track(block, 0)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_set_track(own)..."); - cs_set_new_(&track, cuesheet, 0, 100, 11, "KBCDE1234567", false, false); - track_clone_(&track); - FLAC__metadata_object_cuesheet_set_track(block, 0, &track, /*copy=*/false); - if(!mutils__compare_block(cuesheet, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_cuesheet_is_legal()..."); - { - const char *violation; - if(FLAC__metadata_object_cuesheet_is_legal(block, /*check_cd_da_subset=*/true, &violation)) { - printf("FAILED, returned true when expecting false\n"); - return false; - } - printf("returned false as expected, violation=\"%s\" OK\n", violation); - } - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(cuesheet); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - - printf("testing PICTURE\n"); - - printf("testing FLAC__metadata_object_new()... "); - block = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PICTURE); - if(0 == block) { - printf("FAILED, returned NULL\n"); - return false; - } - expected_length = ( - FLAC__STREAM_METADATA_PICTURE_TYPE_LEN + - FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN + - FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN + - FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN + - FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN + - FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN + - FLAC__STREAM_METADATA_PICTURE_COLORS_LEN + - FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN - ) / 8; - if(block->length != expected_length) { - printf("FAILED, bad length, expected %u, got %u\n", expected_length, block->length); - return false; - } - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - picture = FLAC__metadata_object_clone(block); - if(0 == picture) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - pi_set_mime_type(picture, "image/png\t"); - printf("testing FLAC__metadata_object_picture_set_mime_type(copy)..."); - if(!FLAC__metadata_object_picture_set_mime_type(block, "image/png\t", /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_picture_is_legal()..."); - { - const char *violation; - if(FLAC__metadata_object_picture_is_legal(block, &violation)) { - printf("FAILED, returned true when expecting false\n"); - return false; - } - printf("returned false as expected, violation=\"%s\" OK\n", violation); - } - - pi_set_mime_type(picture, "image/png"); - printf("testing FLAC__metadata_object_picture_set_mime_type(copy)..."); - if(!FLAC__metadata_object_picture_set_mime_type(block, "image/png", /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_picture_is_legal()..."); - { - const char *violation; - if(!FLAC__metadata_object_picture_is_legal(block, &violation)) { - printf("FAILED, returned false, violation=\"%s\"\n", violation); - return false; - } - printf("OK\n"); - } - - pi_set_description(picture, (const FLAC__byte *)"DESCRIPTION\xff"); - printf("testing FLAC__metadata_object_picture_set_description(copy)..."); - if(!FLAC__metadata_object_picture_set_description(block, (FLAC__byte *)"DESCRIPTION\xff", /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_picture_is_legal()..."); - { - const char *violation; - if(FLAC__metadata_object_picture_is_legal(block, &violation)) { - printf("FAILED, returned true when expecting false\n"); - return false; - } - printf("returned false as expected, violation=\"%s\" OK\n", violation); - } - - pi_set_description(picture, (const FLAC__byte *)"DESCRIPTION"); - printf("testing FLAC__metadata_object_picture_set_description(copy)..."); - if(!FLAC__metadata_object_picture_set_description(block, (FLAC__byte *)"DESCRIPTION", /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_picture_is_legal()..."); - { - const char *violation; - if(!FLAC__metadata_object_picture_is_legal(block, &violation)) { - printf("FAILED, returned false, violation=\"%s\"\n", violation); - return false; - } - printf("OK\n"); - } - - - pi_set_data(picture, (const FLAC__byte*)"PNGDATA", strlen("PNGDATA")); - printf("testing FLAC__metadata_object_picture_set_data(copy)..."); - if(!FLAC__metadata_object_picture_set_data(block, (FLAC__byte*)"PNGDATA", strlen("PNGDATA"), /*copy=*/true)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - printf("OK\n"); - - pi_set_mime_type(picture, "image/png\t"); - printf("testing FLAC__metadata_object_picture_set_mime_type(own)..."); - if(!FLAC__metadata_object_picture_set_mime_type(block, strdup("image/png\t"), /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_picture_is_legal()..."); - { - const char *violation; - if(FLAC__metadata_object_picture_is_legal(block, &violation)) { - printf("FAILED, returned true when expecting false\n"); - return false; - } - printf("returned false as expected, violation=\"%s\" OK\n", violation); - } - - pi_set_mime_type(picture, "image/png"); - printf("testing FLAC__metadata_object_picture_set_mime_type(own)..."); - if(!FLAC__metadata_object_picture_set_mime_type(block, strdup("image/png"), /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_picture_is_legal()..."); - { - const char *violation; - if(!FLAC__metadata_object_picture_is_legal(block, &violation)) { - printf("FAILED, returned false, violation=\"%s\"\n", violation); - return false; - } - printf("OK\n"); - } - - pi_set_description(picture, (const FLAC__byte *)"DESCRIPTION\xff"); - printf("testing FLAC__metadata_object_picture_set_description(own)..."); - if(!FLAC__metadata_object_picture_set_description(block, (FLAC__byte *)strdup("DESCRIPTION\xff"), /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_picture_is_legal()..."); - { - const char *violation; - if(FLAC__metadata_object_picture_is_legal(block, &violation)) { - printf("FAILED, returned true when expecting false\n"); - return false; - } - printf("returned false as expected, violation=\"%s\" OK\n", violation); - } - - pi_set_description(picture, (const FLAC__byte *)"DESCRIPTION"); - printf("testing FLAC__metadata_object_picture_set_description(own)..."); - if(!FLAC__metadata_object_picture_set_description(block, (FLAC__byte *)strdup("DESCRIPTION"), /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_picture_is_legal()..."); - { - const char *violation; - if(!FLAC__metadata_object_picture_is_legal(block, &violation)) { - printf("FAILED, returned false, violation=\"%s\"\n", violation); - return false; - } - printf("OK\n"); - } - - pi_set_data(picture, (const FLAC__byte*)"PNGDATA", strlen("PNGDATA")); - printf("testing FLAC__metadata_object_picture_set_data(own)..."); - if(!FLAC__metadata_object_picture_set_data(block, (FLAC__byte*)strdup("PNGDATA"), strlen("PNGDATA"), /*copy=*/false)) { - printf("FAILED, returned false\n"); - return false; - } - if(!mutils__compare_block(picture, block)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_clone()... "); - blockcopy = FLAC__metadata_object_clone(block); - if(0 == blockcopy) { - printf("FAILED, returned NULL\n"); - return false; - } - if(!mutils__compare_block(block, blockcopy)) - return false; - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(blockcopy); - printf("OK\n"); - - printf("testing FLAC__metadata_object_delete()... "); - FLAC__metadata_object_delete(picture); - FLAC__metadata_object_delete(block); - printf("OK\n"); - - - return true; -} diff --git a/src/test_libFLAC/test_libFLAC.vcproj b/src/test_libFLAC/test_libFLAC.vcproj deleted file mode 100644 index 8689eebb..00000000 --- a/src/test_libFLAC/test_libFLAC.vcproj +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test_libFLAC/test_libFLAC.vcxproj b/src/test_libFLAC/test_libFLAC.vcxproj deleted file mode 100644 index 062b2ae2..00000000 --- a/src/test_libFLAC/test_libFLAC.vcxproj +++ /dev/null @@ -1,209 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc8c-c215-11db-8314-0800200c9a66} - test_libFLAC - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - .;..\libFLAC\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;CPU_IS_LITTLE_ENDIAN=1;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\libFLAC\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;ENABLE_64_BIT_WORDS;CPU_IS_LITTLE_ENDIAN=1;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\libFLAC\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;CPU_IS_LITTLE_ENDIAN=1;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\libFLAC\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;ENABLE_64_BIT_WORDS;CPU_IS_LITTLE_ENDIAN=1;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - {4cefbc81-c215-11db-8314-0800200c9a66} - false - - - {4cefbc8e-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/test_libFLAC/test_libFLAC.vcxproj.filters b/src/test_libFLAC/test_libFLAC.vcxproj.filters deleted file mode 100644 index 862efb6f..00000000 --- a/src/test_libFLAC/test_libFLAC.vcxproj.filters +++ /dev/null @@ -1,80 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/src/test_libs_common/CMakeLists.txt b/src/test_libs_common/CMakeLists.txt deleted file mode 100644 index 8a0c8712..00000000 --- a/src/test_libs_common/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -add_library(test_libs_common STATIC - file_utils_flac.c - metadata_utils.c) -target_link_libraries(test_libs_common PUBLIC FLAC) diff --git a/src/test_libs_common/Makefile.am b/src/test_libs_common/Makefile.am deleted file mode 100644 index a72530ee..00000000 --- a/src/test_libs_common/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# test_libs_common - Common code to library unit tests -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include - -noinst_LTLIBRARIES = libtest_libs_common.la - -libtest_libs_common_la_SOURCES = \ - file_utils_flac.c \ - metadata_utils.c - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - README \ - test_libs_common_static.vcproj \ - test_libs_common_static.vcxproj \ - test_libs_common_static.vcxproj.filters diff --git a/src/test_libs_common/Makefile.lite b/src/test_libs_common/Makefile.lite deleted file mode 100644 index 13f10511..00000000 --- a/src/test_libs_common/Makefile.lite +++ /dev/null @@ -1,42 +0,0 @@ -# test_libs_common - Common code to library unit tests -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/objs/$(BUILD)/lib - -LIB_NAME = libtest_libs_common - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lFLAC $(OGG_LIBS) -lm -endif - -INCLUDES = -I$(topdir)/include - -SRCS_C = \ - file_utils_flac.c \ - metadata_utils.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/test_libs_common/README b/src/test_libs_common/README deleted file mode 100644 index 6a704c20..00000000 --- a/src/test_libs_common/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory contains a convenience library of routines that are -common to the library unit testers. diff --git a/src/test_libs_common/file_utils_flac.c b/src/test_libs_common/file_utils_flac.c deleted file mode 100644 index 28ab08d5..00000000 --- a/src/test_libs_common/file_utils_flac.c +++ /dev/null @@ -1,155 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "FLAC/assert.h" -#include "FLAC/stream_encoder.h" -#include "test_libs_common/file_utils_flac.h" -#include -#include -#include /* for stat() */ -#include "share/compat.h" - -#ifdef min -#undef min -#endif -#define min(a,b) ((a)<(b)?(a):(b)) - -const long file_utils__ogg_serial_number = 12345; - -#ifdef FLAC__VALGRIND_TESTING -static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) -{ - size_t ret = fwrite(ptr, size, nmemb, stream); - if(!ferror(stream)) - fflush(stream); - return ret; -} -#else -#define local__fwrite fwrite -#endif - -typedef struct { - FILE *file; -} encoder_client_struct; - -static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data) -{ - encoder_client_struct *ecd = (encoder_client_struct*)client_data; - - (void)encoder, (void)samples, (void)current_frame; - - if(local__fwrite(buffer, 1, bytes, ecd->file) != bytes) - return FLAC__STREAM_ENCODER_WRITE_STATUS_FATAL_ERROR; - else - return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; -} - -static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - (void)encoder, (void)metadata, (void)client_data; -} - -FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_filename, FLAC__off_t *output_filesize, uint32_t length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, uint32_t num_metadata) -{ - FLAC__int32 samples[1024]; - FLAC__StreamEncoder *encoder; - FLAC__StreamEncoderInitStatus init_status; - encoder_client_struct encoder_client_data; - uint32_t i, n; - - FLAC__ASSERT(0 != output_filename); - FLAC__ASSERT(0 != streaminfo); - FLAC__ASSERT(streaminfo->type == FLAC__METADATA_TYPE_STREAMINFO); - FLAC__ASSERT((streaminfo->is_last && num_metadata == 0) || (!streaminfo->is_last && num_metadata > 0)); - - if(0 == (encoder_client_data.file = flac_fopen(output_filename, "wb"))) - return false; - - encoder = FLAC__stream_encoder_new(); - if(0 == encoder) { - fclose(encoder_client_data.file); - return false; - } - - FLAC__stream_encoder_set_ogg_serial_number(encoder, file_utils__ogg_serial_number); - FLAC__stream_encoder_set_verify(encoder, true); - FLAC__stream_encoder_set_streamable_subset(encoder, true); - FLAC__stream_encoder_set_do_mid_side_stereo(encoder, false); - FLAC__stream_encoder_set_loose_mid_side_stereo(encoder, false); - FLAC__stream_encoder_set_channels(encoder, streaminfo->data.stream_info.channels); - FLAC__stream_encoder_set_bits_per_sample(encoder, streaminfo->data.stream_info.bits_per_sample); - FLAC__stream_encoder_set_sample_rate(encoder, streaminfo->data.stream_info.sample_rate); - FLAC__stream_encoder_set_blocksize(encoder, streaminfo->data.stream_info.min_blocksize); - FLAC__stream_encoder_set_max_lpc_order(encoder, 0); - FLAC__stream_encoder_set_qlp_coeff_precision(encoder, 0); - FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder, false); - FLAC__stream_encoder_set_do_escape_coding(encoder, false); - FLAC__stream_encoder_set_do_exhaustive_model_search(encoder, false); - FLAC__stream_encoder_set_min_residual_partition_order(encoder, 0); - FLAC__stream_encoder_set_max_residual_partition_order(encoder, 0); - FLAC__stream_encoder_set_rice_parameter_search_dist(encoder, 0); - FLAC__stream_encoder_set_total_samples_estimate(encoder, streaminfo->data.stream_info.total_samples); - FLAC__stream_encoder_set_metadata(encoder, metadata, num_metadata); - - if(is_ogg) - init_status = FLAC__stream_encoder_init_ogg_stream(encoder, /*read_callback=*/0, encoder_write_callback_, /*seek_callback=*/0, /*tell_callback=*/0, encoder_metadata_callback_, &encoder_client_data); - else - init_status = FLAC__stream_encoder_init_stream(encoder, encoder_write_callback_, /*seek_callback=*/0, /*tell_callback=*/0, encoder_metadata_callback_, &encoder_client_data); - - if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK) { - fclose(encoder_client_data.file); - return false; - } - - /* init the dummy sample buffer */ - for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++) - samples[i] = i & 7; - - while(length > 0) { - n = min(length, sizeof(samples) / sizeof(FLAC__int32)); - - if(!FLAC__stream_encoder_process_interleaved(encoder, samples, n)) { - fclose(encoder_client_data.file); - return false; - } - - length -= n; - } - - (void)FLAC__stream_encoder_finish(encoder); - - fclose(encoder_client_data.file); - - FLAC__stream_encoder_delete(encoder); - - if(0 != output_filesize) { - struct flac_stat_s filestats; - - if(flac_stat(output_filename, &filestats) != 0) - return false; - else - *output_filesize = filestats.st_size; - } - - return true; -} diff --git a/src/test_libs_common/metadata_utils.c b/src/test_libs_common/metadata_utils.c deleted file mode 100644 index a3f44991..00000000 --- a/src/test_libs_common/metadata_utils.c +++ /dev/null @@ -1,635 +0,0 @@ -/* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -/* - * These are not tests, just utility functions used by the metadata tests - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "FLAC/metadata.h" -#include "test_libs_common/metadata_utils.h" -#include "share/compat.h" -#include -#include /* for malloc() */ -#include /* for memcmp() */ - -FLAC__bool mutils__compare_block_data_streaminfo(const FLAC__StreamMetadata_StreamInfo *block, const FLAC__StreamMetadata_StreamInfo *blockcopy) -{ - if(blockcopy->min_blocksize != block->min_blocksize) { - printf("FAILED, min_blocksize mismatch, expected %u, got %u\n", block->min_blocksize, blockcopy->min_blocksize); - return false; - } - if(blockcopy->max_blocksize != block->max_blocksize) { - printf("FAILED, max_blocksize mismatch, expected %u, got %u\n", block->max_blocksize, blockcopy->max_blocksize); - return false; - } - if(blockcopy->min_framesize != block->min_framesize) { - printf("FAILED, min_framesize mismatch, expected %u, got %u\n", block->min_framesize, blockcopy->min_framesize); - return false; - } - if(blockcopy->max_framesize != block->max_framesize) { - printf("FAILED, max_framesize mismatch, expected %u, got %u\n", block->max_framesize, blockcopy->max_framesize); - return false; - } - if(blockcopy->sample_rate != block->sample_rate) { - printf("FAILED, sample_rate mismatch, expected %u, got %u\n", block->sample_rate, blockcopy->sample_rate); - return false; - } - if(blockcopy->channels != block->channels) { - printf("FAILED, channels mismatch, expected %u, got %u\n", block->channels, blockcopy->channels); - return false; - } - if(blockcopy->bits_per_sample != block->bits_per_sample) { - printf("FAILED, bits_per_sample mismatch, expected %u, got %u\n", block->bits_per_sample, blockcopy->bits_per_sample); - return false; - } - if(blockcopy->total_samples != block->total_samples) { - printf("FAILED, total_samples mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", block->total_samples, blockcopy->total_samples); - return false; - } - if(0 != memcmp(blockcopy->md5sum, block->md5sum, sizeof(block->md5sum))) { - printf("FAILED, md5sum mismatch, expected %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X, got %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X\n", - (uint32_t)block->md5sum[0], - (uint32_t)block->md5sum[1], - (uint32_t)block->md5sum[2], - (uint32_t)block->md5sum[3], - (uint32_t)block->md5sum[4], - (uint32_t)block->md5sum[5], - (uint32_t)block->md5sum[6], - (uint32_t)block->md5sum[7], - (uint32_t)block->md5sum[8], - (uint32_t)block->md5sum[9], - (uint32_t)block->md5sum[10], - (uint32_t)block->md5sum[11], - (uint32_t)block->md5sum[12], - (uint32_t)block->md5sum[13], - (uint32_t)block->md5sum[14], - (uint32_t)block->md5sum[15], - (uint32_t)blockcopy->md5sum[0], - (uint32_t)blockcopy->md5sum[1], - (uint32_t)blockcopy->md5sum[2], - (uint32_t)blockcopy->md5sum[3], - (uint32_t)blockcopy->md5sum[4], - (uint32_t)blockcopy->md5sum[5], - (uint32_t)blockcopy->md5sum[6], - (uint32_t)blockcopy->md5sum[7], - (uint32_t)blockcopy->md5sum[8], - (uint32_t)blockcopy->md5sum[9], - (uint32_t)blockcopy->md5sum[10], - (uint32_t)blockcopy->md5sum[11], - (uint32_t)blockcopy->md5sum[12], - (uint32_t)blockcopy->md5sum[13], - (uint32_t)blockcopy->md5sum[14], - (uint32_t)blockcopy->md5sum[15] - ); - return false; - } - return true; -} - -FLAC__bool mutils__compare_block_data_padding(const FLAC__StreamMetadata_Padding *block, const FLAC__StreamMetadata_Padding *blockcopy, uint32_t block_length) -{ - /* we don't compare the padding guts */ - (void)block, (void)blockcopy, (void)block_length; - return true; -} - -FLAC__bool mutils__compare_block_data_application(const FLAC__StreamMetadata_Application *block, const FLAC__StreamMetadata_Application *blockcopy, uint32_t block_length) -{ - if(block_length < sizeof(block->id)) { - printf("FAILED, bad block length = %u\n", block_length); - return false; - } - if(0 != memcmp(blockcopy->id, block->id, sizeof(block->id))) { - printf("FAILED, id mismatch, expected %02X%02X%02X%02X, got %02X%02X%02X%02X\n", - (uint32_t)block->id[0], - (uint32_t)block->id[1], - (uint32_t)block->id[2], - (uint32_t)block->id[3], - (uint32_t)blockcopy->id[0], - (uint32_t)blockcopy->id[1], - (uint32_t)blockcopy->id[2], - (uint32_t)blockcopy->id[3] - ); - return false; - } - if(0 == block->data || 0 == blockcopy->data) { - if(block->data != blockcopy->data) { - printf("FAILED, data mismatch (%s's data pointer is null)\n", 0==block->data?"original":"copy"); - return false; - } - else if(block_length - sizeof(block->id) > 0) { - printf("FAILED, data pointer is null but block length is not 0\n"); - return false; - } - } - else { - if(block_length - sizeof(block->id) == 0) { - printf("FAILED, data pointer is not null but block length is 0\n"); - return false; - } - else if(0 != memcmp(blockcopy->data, block->data, block_length - sizeof(block->id))) { - printf("FAILED, data mismatch\n"); - return false; - } - } - return true; -} - -FLAC__bool mutils__compare_block_data_seektable(const FLAC__StreamMetadata_SeekTable *block, const FLAC__StreamMetadata_SeekTable *blockcopy) -{ - uint32_t i; - if(blockcopy->num_points != block->num_points) { - printf("FAILED, num_points mismatch, expected %u, got %u\n", block->num_points, blockcopy->num_points); - return false; - } - for(i = 0; i < block->num_points; i++) { - if(blockcopy->points[i].sample_number != block->points[i].sample_number) { - printf("FAILED, points[%u].sample_number mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", i, block->points[i].sample_number, blockcopy->points[i].sample_number); - return false; - } - if(blockcopy->points[i].stream_offset != block->points[i].stream_offset) { - printf("FAILED, points[%u].stream_offset mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", i, block->points[i].stream_offset, blockcopy->points[i].stream_offset); - return false; - } - if(blockcopy->points[i].frame_samples != block->points[i].frame_samples) { - printf("FAILED, points[%u].frame_samples mismatch, expected %u, got %u\n", i, block->points[i].frame_samples, blockcopy->points[i].frame_samples); - return false; - } - } - return true; -} - -FLAC__bool mutils__compare_block_data_vorbiscomment(const FLAC__StreamMetadata_VorbisComment *block, const FLAC__StreamMetadata_VorbisComment *blockcopy) -{ - uint32_t i; - if(blockcopy->vendor_string.length != block->vendor_string.length) { - printf("FAILED, vendor_string.length mismatch, expected %u, got %u\n", block->vendor_string.length, blockcopy->vendor_string.length); - return false; - } - if(0 == block->vendor_string.entry || 0 == blockcopy->vendor_string.entry) { - if(block->vendor_string.entry != blockcopy->vendor_string.entry) { - printf("FAILED, vendor_string.entry mismatch\n"); - return false; - } - } - else if(0 != memcmp(blockcopy->vendor_string.entry, block->vendor_string.entry, block->vendor_string.length)) { - printf("FAILED, vendor_string.entry mismatch\n"); - return false; - } - if(blockcopy->num_comments != block->num_comments) { - printf("FAILED, num_comments mismatch, expected %u, got %u\n", block->num_comments, blockcopy->num_comments); - return false; - } - for(i = 0; i < block->num_comments; i++) { - if(blockcopy->comments[i].length != block->comments[i].length) { - printf("FAILED, comments[%u].length mismatch, expected %u, got %u\n", i, block->comments[i].length, blockcopy->comments[i].length); - return false; - } - if(0 == block->comments[i].entry || 0 == blockcopy->comments[i].entry) { - if(block->comments[i].entry != blockcopy->comments[i].entry) { - printf("FAILED, comments[%u].entry mismatch\n", i); - return false; - } - } - else { - if(0 != memcmp(blockcopy->comments[i].entry, block->comments[i].entry, block->comments[i].length)) { - printf("FAILED, comments[%u].entry mismatch\n", i); - return false; - } - } - } - return true; -} - -FLAC__bool mutils__compare_block_data_cuesheet(const FLAC__StreamMetadata_CueSheet *block, const FLAC__StreamMetadata_CueSheet *blockcopy) -{ - uint32_t i, j; - - if(0 != strcmp(blockcopy->media_catalog_number, block->media_catalog_number)) { - printf("FAILED, media_catalog_number mismatch, expected %s, got %s\n", block->media_catalog_number, blockcopy->media_catalog_number); - return false; - } - if(blockcopy->lead_in != block->lead_in) { - printf("FAILED, lead_in mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", block->lead_in, blockcopy->lead_in); - return false; - } - if(blockcopy->is_cd != block->is_cd) { - printf("FAILED, is_cd mismatch, expected %u, got %u\n", (uint32_t)block->is_cd, (uint32_t)blockcopy->is_cd); - return false; - } - if(blockcopy->num_tracks != block->num_tracks) { - printf("FAILED, num_tracks mismatch, expected %u, got %u\n", block->num_tracks, blockcopy->num_tracks); - return false; - } - for(i = 0; i < block->num_tracks; i++) { - if(blockcopy->tracks[i].offset != block->tracks[i].offset) { - printf("FAILED, tracks[%u].offset mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", i, block->tracks[i].offset, blockcopy->tracks[i].offset); - return false; - } - if(blockcopy->tracks[i].number != block->tracks[i].number) { - printf("FAILED, tracks[%u].number mismatch, expected %u, got %u\n", i, (uint32_t)block->tracks[i].number, (uint32_t)blockcopy->tracks[i].number); - return false; - } - if(blockcopy->tracks[i].num_indices != block->tracks[i].num_indices) { - printf("FAILED, tracks[%u].num_indices mismatch, expected %u, got %u\n", i, (uint32_t)block->tracks[i].num_indices, (uint32_t)blockcopy->tracks[i].num_indices); - return false; - } - /* num_indices == 0 means lead-out track so only the track offset and number are valid */ - if(block->tracks[i].num_indices > 0) { - if(0 != strcmp(blockcopy->tracks[i].isrc, block->tracks[i].isrc)) { - printf("FAILED, tracks[%u].isrc mismatch, expected %s, got %s\n", i, block->tracks[i].isrc, blockcopy->tracks[i].isrc); - return false; - } - if(blockcopy->tracks[i].type != block->tracks[i].type) { - printf("FAILED, tracks[%u].type mismatch, expected %u, got %u\n", i, (uint32_t)block->tracks[i].type, (uint32_t)blockcopy->tracks[i].type); - return false; - } - if(blockcopy->tracks[i].pre_emphasis != block->tracks[i].pre_emphasis) { - printf("FAILED, tracks[%u].pre_emphasis mismatch, expected %u, got %u\n", i, (uint32_t)block->tracks[i].pre_emphasis, (uint32_t)blockcopy->tracks[i].pre_emphasis); - return false; - } - if(0 == block->tracks[i].indices || 0 == blockcopy->tracks[i].indices) { - if(block->tracks[i].indices != blockcopy->tracks[i].indices) { - printf("FAILED, tracks[%u].indices mismatch\n", i); - return false; - } - } - else { - for(j = 0; j < block->tracks[i].num_indices; j++) { - if(blockcopy->tracks[i].indices[j].offset != block->tracks[i].indices[j].offset) { - printf("FAILED, tracks[%u].indices[%u].offset mismatch, expected %" PRIu64 ", got %" PRIu64 "\n", i, j, block->tracks[i].indices[j].offset, blockcopy->tracks[i].indices[j].offset); - return false; - } - if(blockcopy->tracks[i].indices[j].number != block->tracks[i].indices[j].number) { - printf("FAILED, tracks[%u].indices[%u].number mismatch, expected %u, got %u\n", i, j, (uint32_t)block->tracks[i].indices[j].number, (uint32_t)blockcopy->tracks[i].indices[j].number); - return false; - } - } - } - } - } - return true; -} - -FLAC__bool mutils__compare_block_data_picture(const FLAC__StreamMetadata_Picture *block, const FLAC__StreamMetadata_Picture *blockcopy) -{ - size_t len, lencopy; - if(blockcopy->type != block->type) { - printf("FAILED, type mismatch, expected %u, got %u\n", (uint32_t)block->type, (uint32_t)blockcopy->type); - return false; - } - len = strlen(block->mime_type); - lencopy = strlen(blockcopy->mime_type); - if(lencopy != len) { - printf("FAILED, mime_type length mismatch, expected %u, got %u\n", (uint32_t)len, (uint32_t)lencopy); - return false; - } - if(strcmp(blockcopy->mime_type, block->mime_type)) { - printf("FAILED, mime_type mismatch, expected %s, got %s\n", block->mime_type, blockcopy->mime_type); - return false; - } - len = strlen((const char *)block->description); - lencopy = strlen((const char *)blockcopy->description); - if(lencopy != len) { - printf("FAILED, description length mismatch, expected %u, got %u\n", (uint32_t)len, (uint32_t)lencopy); - return false; - } - if(strcmp((const char *)blockcopy->description, (const char *)block->description)) { - printf("FAILED, description mismatch, expected %s, got %s\n", block->description, blockcopy->description); - return false; - } - if(blockcopy->width != block->width) { - printf("FAILED, width mismatch, expected %u, got %u\n", block->width, blockcopy->width); - return false; - } - if(blockcopy->height != block->height) { - printf("FAILED, height mismatch, expected %u, got %u\n", block->height, blockcopy->height); - return false; - } - if(blockcopy->depth != block->depth) { - printf("FAILED, depth mismatch, expected %u, got %u\n", block->depth, blockcopy->depth); - return false; - } - if(blockcopy->colors != block->colors) { - printf("FAILED, colors mismatch, expected %u, got %u\n", block->colors, blockcopy->colors); - return false; - } - if(blockcopy->data_length != block->data_length) { - printf("FAILED, data_length mismatch, expected %u, got %u\n", block->data_length, blockcopy->data_length); - return false; - } - if(block->data_length > 0 && memcmp(blockcopy->data, block->data, block->data_length)) { - printf("FAILED, data mismatch\n"); - return false; - } - return true; -} - -FLAC__bool mutils__compare_block_data_unknown(const FLAC__StreamMetadata_Unknown *block, const FLAC__StreamMetadata_Unknown *blockcopy, uint32_t block_length) -{ - if(0 == block->data || 0 == blockcopy->data) { - if(block->data != blockcopy->data) { - printf("FAILED, data mismatch (%s's data pointer is null)\n", 0==block->data?"original":"copy"); - return false; - } - else if(block_length > 0) { - printf("FAILED, data pointer is null but block length is not 0\n"); - return false; - } - } - else { - if(block_length == 0) { - printf("FAILED, data pointer is not null but block length is 0\n"); - return false; - } - else if(0 != memcmp(blockcopy->data, block->data, block_length)) { - printf("FAILED, data mismatch\n"); - return false; - } - } - return true; -} - -FLAC__bool mutils__compare_block(const FLAC__StreamMetadata *block, const FLAC__StreamMetadata *blockcopy) -{ - if(blockcopy->type != block->type) { - printf("FAILED, type mismatch, expected %s, got %s\n", FLAC__MetadataTypeString[block->type], FLAC__MetadataTypeString[blockcopy->type]); - return false; - } - if(blockcopy->is_last != block->is_last) { - printf("FAILED, is_last mismatch, expected %u, got %u\n", (uint32_t)block->is_last, (uint32_t)blockcopy->is_last); - return false; - } - if(blockcopy->length != block->length) { - printf("FAILED, length mismatch, expected %u, got %u\n", block->length, blockcopy->length); - return false; - } - switch(block->type) { - case FLAC__METADATA_TYPE_STREAMINFO: - return mutils__compare_block_data_streaminfo(&block->data.stream_info, &blockcopy->data.stream_info); - case FLAC__METADATA_TYPE_PADDING: - return mutils__compare_block_data_padding(&block->data.padding, &blockcopy->data.padding, block->length); - case FLAC__METADATA_TYPE_APPLICATION: - return mutils__compare_block_data_application(&block->data.application, &blockcopy->data.application, block->length); - case FLAC__METADATA_TYPE_SEEKTABLE: - return mutils__compare_block_data_seektable(&block->data.seek_table, &blockcopy->data.seek_table); - case FLAC__METADATA_TYPE_VORBIS_COMMENT: - return mutils__compare_block_data_vorbiscomment(&block->data.vorbis_comment, &blockcopy->data.vorbis_comment); - case FLAC__METADATA_TYPE_CUESHEET: - return mutils__compare_block_data_cuesheet(&block->data.cue_sheet, &blockcopy->data.cue_sheet); - case FLAC__METADATA_TYPE_PICTURE: - return mutils__compare_block_data_picture(&block->data.picture, &blockcopy->data.picture); - default: - return mutils__compare_block_data_unknown(&block->data.unknown, &blockcopy->data.unknown, block->length); - } -} - -static void *malloc_or_die_(size_t size) -{ - void *x = malloc(size); - if(0 == x) { - fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size); - exit(1); - } - return x; -} - -static void *calloc_or_die_(size_t n, size_t size) -{ - void *x = calloc(n, size); - if(0 == x) { - fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)n * (uint32_t)size); - exit(1); - } - return x; -} - -static char *strdup_or_die_(const char *s) -{ - char *x = strdup(s); - if(0 == x) { - fprintf(stderr, "ERROR: out of memory copying string \"%s\"\n", s); - exit(1); - } - return x; -} - -void mutils__init_metadata_blocks( - FLAC__StreamMetadata *streaminfo, - FLAC__StreamMetadata *padding, - FLAC__StreamMetadata *seektable, - FLAC__StreamMetadata *application1, - FLAC__StreamMetadata *application2, - FLAC__StreamMetadata *vorbiscomment, - FLAC__StreamMetadata *cuesheet, - FLAC__StreamMetadata *picture, - FLAC__StreamMetadata *unknown -) -{ - /* - most of the actual numbers and data in the blocks don't matter, - we just want to make sure the decoder parses them correctly - - remember, the metadata interface gets tested after the decoders, - so we do all the metadata manipulation here without it. - */ - - /* min/max_framesize and md5sum don't get written at first, so we have to leave them 0 */ - streaminfo->is_last = false; - streaminfo->type = FLAC__METADATA_TYPE_STREAMINFO; - streaminfo->length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH; - streaminfo->data.stream_info.min_blocksize = 576; - streaminfo->data.stream_info.max_blocksize = 576; - streaminfo->data.stream_info.min_framesize = 0; - streaminfo->data.stream_info.max_framesize = 0; - streaminfo->data.stream_info.sample_rate = 44100; - streaminfo->data.stream_info.channels = 1; - streaminfo->data.stream_info.bits_per_sample = 8; - streaminfo->data.stream_info.total_samples = 0; - memset(streaminfo->data.stream_info.md5sum, 0, 16); - - padding->is_last = false; - padding->type = FLAC__METADATA_TYPE_PADDING; - padding->length = 1234; - - seektable->is_last = false; - seektable->type = FLAC__METADATA_TYPE_SEEKTABLE; - seektable->data.seek_table.num_points = 2; - seektable->length = seektable->data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; - seektable->data.seek_table.points = malloc_or_die_(seektable->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint)); - seektable->data.seek_table.points[0].sample_number = 0; - seektable->data.seek_table.points[0].stream_offset = 0; - seektable->data.seek_table.points[0].frame_samples = streaminfo->data.stream_info.min_blocksize; - seektable->data.seek_table.points[1].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; - seektable->data.seek_table.points[1].stream_offset = 1000; - seektable->data.seek_table.points[1].frame_samples = streaminfo->data.stream_info.min_blocksize; - - application1->is_last = false; - application1->type = FLAC__METADATA_TYPE_APPLICATION; - application1->length = 8; - memcpy(application1->data.application.id, "This", 4); - application1->data.application.data = malloc_or_die_(4); - memcpy(application1->data.application.data, "\xf0\xe1\xd2\xc3", 4); - - application2->is_last = false; - application2->type = FLAC__METADATA_TYPE_APPLICATION; - application2->length = 4; - memcpy(application2->data.application.id, "Here", 4); - application2->data.application.data = 0; - - { - const uint32_t vendor_string_length = (uint32_t)strlen(FLAC__VENDOR_STRING); - vorbiscomment->is_last = false; - vorbiscomment->type = FLAC__METADATA_TYPE_VORBIS_COMMENT; - vorbiscomment->length = (4 + vendor_string_length) + 4 + (4 + 5) + (4 + 0); - vorbiscomment->data.vorbis_comment.vendor_string.length = vendor_string_length; - vorbiscomment->data.vorbis_comment.vendor_string.entry = malloc_or_die_(vendor_string_length+1); - memcpy(vorbiscomment->data.vorbis_comment.vendor_string.entry, FLAC__VENDOR_STRING, vendor_string_length+1); - vorbiscomment->data.vorbis_comment.num_comments = 2; - vorbiscomment->data.vorbis_comment.comments = malloc_or_die_(vorbiscomment->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); - vorbiscomment->data.vorbis_comment.comments[0].length = 5; - vorbiscomment->data.vorbis_comment.comments[0].entry = malloc_or_die_(5+1); - memcpy(vorbiscomment->data.vorbis_comment.comments[0].entry, "ab=cd", 5+1); - vorbiscomment->data.vorbis_comment.comments[1].length = 0; - vorbiscomment->data.vorbis_comment.comments[1].entry = 0; - } - - cuesheet->is_last = false; - cuesheet->type = FLAC__METADATA_TYPE_CUESHEET; - cuesheet->length = - /* cuesheet guts */ - ( - FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN + - FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN + - FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN + - FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN - ) / 8 + - /* 2 tracks */ - 3 * ( - FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN + - FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN - ) / 8 + - /* 3 index points */ - 3 * ( - FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN + - FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN + - FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN - ) / 8 - ; - memset(cuesheet->data.cue_sheet.media_catalog_number, 0, sizeof(cuesheet->data.cue_sheet.media_catalog_number)); - cuesheet->data.cue_sheet.media_catalog_number[0] = 'j'; - cuesheet->data.cue_sheet.media_catalog_number[1] = 'C'; - cuesheet->data.cue_sheet.lead_in = 2 * 44100; - cuesheet->data.cue_sheet.is_cd = true; - cuesheet->data.cue_sheet.num_tracks = 3; - cuesheet->data.cue_sheet.tracks = calloc_or_die_(cuesheet->data.cue_sheet.num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)); - cuesheet->data.cue_sheet.tracks[0].offset = 0; - cuesheet->data.cue_sheet.tracks[0].number = 1; - memcpy(cuesheet->data.cue_sheet.tracks[0].isrc, "ACBDE1234567", sizeof(cuesheet->data.cue_sheet.tracks[0].isrc)); - cuesheet->data.cue_sheet.tracks[0].type = 0; - cuesheet->data.cue_sheet.tracks[0].pre_emphasis = 1; - cuesheet->data.cue_sheet.tracks[0].num_indices = 2; - cuesheet->data.cue_sheet.tracks[0].indices = malloc_or_die_(cuesheet->data.cue_sheet.tracks[0].num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index)); - cuesheet->data.cue_sheet.tracks[0].indices[0].offset = 0; - cuesheet->data.cue_sheet.tracks[0].indices[0].number = 0; - cuesheet->data.cue_sheet.tracks[0].indices[1].offset = 123 * 588; - cuesheet->data.cue_sheet.tracks[0].indices[1].number = 1; - cuesheet->data.cue_sheet.tracks[1].offset = 1234 * 588; - cuesheet->data.cue_sheet.tracks[1].number = 2; - memcpy(cuesheet->data.cue_sheet.tracks[1].isrc, "ACBDE7654321", sizeof(cuesheet->data.cue_sheet.tracks[1].isrc)); - cuesheet->data.cue_sheet.tracks[1].type = 1; - cuesheet->data.cue_sheet.tracks[1].pre_emphasis = 0; - cuesheet->data.cue_sheet.tracks[1].num_indices = 1; - cuesheet->data.cue_sheet.tracks[1].indices = malloc_or_die_(cuesheet->data.cue_sheet.tracks[1].num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index)); - cuesheet->data.cue_sheet.tracks[1].indices[0].offset = 0; - cuesheet->data.cue_sheet.tracks[1].indices[0].number = 1; - cuesheet->data.cue_sheet.tracks[2].offset = 12345 * 588; - cuesheet->data.cue_sheet.tracks[2].number = 170; - cuesheet->data.cue_sheet.tracks[2].num_indices = 0; - - picture->is_last = false; - picture->type = FLAC__METADATA_TYPE_PICTURE; - picture->length = - ( - FLAC__STREAM_METADATA_PICTURE_TYPE_LEN + - FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN + /* will add the length for the string later */ - FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN + /* will add the length for the string later */ - FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN + - FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN + - FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN + - FLAC__STREAM_METADATA_PICTURE_COLORS_LEN + - FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN /* will add the length for the data later */ - ) / 8 - ; - picture->data.picture.type = FLAC__STREAM_METADATA_PICTURE_TYPE_FRONT_COVER; - picture->data.picture.mime_type = strdup_or_die_("image/jpeg"); - picture->length += strlen(picture->data.picture.mime_type); - picture->data.picture.description = (FLAC__byte*)strdup_or_die_("desc"); - picture->length += strlen((const char *)picture->data.picture.description); - picture->data.picture.width = 300; - picture->data.picture.height = 300; - picture->data.picture.depth = 24; - picture->data.picture.colors = 0; - picture->data.picture.data = (FLAC__byte*)strdup_or_die_("SOMEJPEGDATA"); - picture->data.picture.data_length = strlen((const char *)picture->data.picture.data); - picture->length += picture->data.picture.data_length; - - unknown->is_last = true; - unknown->type = 126; - unknown->length = 8; - unknown->data.unknown.data = malloc_or_die_(unknown->length); - memcpy(unknown->data.unknown.data, "\xfe\xdc\xba\x98\xf0\xe1\xd2\xc3", unknown->length); -} - -void mutils__free_metadata_blocks( - FLAC__StreamMetadata *streaminfo, - FLAC__StreamMetadata *padding, - FLAC__StreamMetadata *seektable, - FLAC__StreamMetadata *application1, - FLAC__StreamMetadata *application2, - FLAC__StreamMetadata *vorbiscomment, - FLAC__StreamMetadata *cuesheet, - FLAC__StreamMetadata *picture, - FLAC__StreamMetadata *unknown -) -{ - (void)streaminfo, (void)padding, (void)application2; - free(seektable->data.seek_table.points); - free(application1->data.application.data); - free(vorbiscomment->data.vorbis_comment.vendor_string.entry); - free(vorbiscomment->data.vorbis_comment.comments[0].entry); - free(vorbiscomment->data.vorbis_comment.comments); - free(cuesheet->data.cue_sheet.tracks[0].indices); - free(cuesheet->data.cue_sheet.tracks[1].indices); - free(cuesheet->data.cue_sheet.tracks); - free(picture->data.picture.mime_type); - free(picture->data.picture.description); - free(picture->data.picture.data); - free(unknown->data.unknown.data); -} diff --git a/src/test_libs_common/test_libs_common_static.vcproj b/src/test_libs_common/test_libs_common_static.vcproj deleted file mode 100644 index 763d3e71..00000000 --- a/src/test_libs_common/test_libs_common_static.vcproj +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test_libs_common/test_libs_common_static.vcxproj b/src/test_libs_common/test_libs_common_static.vcxproj deleted file mode 100644 index 812c8c38..00000000 --- a/src/test_libs_common/test_libs_common_static.vcxproj +++ /dev/null @@ -1,144 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc8e-c215-11db-8314-0800200c9a66} - test_libs_common_static - Win32Proj - - - - StaticLibrary - true - - - StaticLibrary - true - - - StaticLibrary - - - StaticLibrary - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Configuration)\lib\ - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\ - - - - Disabled - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - Disabled - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - true - Speed - true - true - .\include;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/test_libs_common/test_libs_common_static.vcxproj.filters b/src/test_libs_common/test_libs_common_static.vcxproj.filters deleted file mode 100644 index 2d941fb6..00000000 --- a/src/test_libs_common/test_libs_common_static.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/src/test_seeking/CMakeLists.txt b/src/test_seeking/CMakeLists.txt deleted file mode 100644 index 51442916..00000000 --- a/src/test_seeking/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_executable(test_seeking - main.c - $<$:../../include/share/win_utf8_io.h> - $<$:../share/win_utf8_io/win_utf8_io.c>) -target_link_libraries(test_seeking FLAC) diff --git a/src/test_seeking/Makefile.am b/src/test_seeking/Makefile.am deleted file mode 100644 index a42d78d5..00000000 --- a/src/test_seeking/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -# test_seeking - Seeking tester for libFLAC -# Copyright (C) 2004-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - test_seeking.vcproj \ - test_seeking.vcxproj \ - test_seeking.vcxproj.filters - -AM_CFLAGS = @OGG_CFLAGS@ - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include - -check_PROGRAMS = test_seeking -test_seeking_LDADD = \ - $(top_builddir)/src/libFLAC/libFLAC.la - -test_seeking_SOURCES = \ - main.c - -CLEANFILES = test_seeking.exe diff --git a/src/test_seeking/Makefile.lite b/src/test_seeking/Makefile.lite deleted file mode 100644 index 4c64540c..00000000 --- a/src/test_seeking/Makefile.lite +++ /dev/null @@ -1,43 +0,0 @@ -# test_seeking - Seeking tester for libFLAC -# Copyright (C) 2004-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = test_seeking - -INCLUDES = -I../libFLAC/include -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else - LIBS = -lFLAC $(OGG_LIBS) -lm -endif - -SRCS_C = \ - main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/test_seeking/main.c b/src/test_seeking/main.c deleted file mode 100644 index 5a7e3999..00000000 --- a/src/test_seeking/main.c +++ /dev/null @@ -1,473 +0,0 @@ -/* test_seeking - Seeking tester for libFLAC - * Copyright (C) 2004-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#if defined _MSC_VER || defined __MINGW32__ -#include -#else -#include -#endif -#include /* for stat() */ -#include "FLAC/assert.h" -#include "FLAC/metadata.h" -#include "FLAC/stream_decoder.h" -#include "share/compat.h" - -typedef struct { - FLAC__int32 **pcm; - FLAC__bool got_data; - FLAC__uint64 total_samples; - uint32_t channels; - uint32_t bits_per_sample; - FLAC__bool quiet; - FLAC__bool ignore_errors; - FLAC__bool error_occurred; -} DecoderClientData; - -static FLAC__bool stop_signal_ = false; - -static void our_sigint_handler_(int signum) -{ - (void)signum; - printf("(caught SIGINT) "); - fflush(stdout); - stop_signal_ = true; -} - -static FLAC__bool die_(const char *msg) -{ - printf("ERROR: %s\n", msg); - return false; -} - -static FLAC__bool die_s_(const char *msg, const FLAC__StreamDecoder *decoder) -{ - FLAC__StreamDecoderState state = FLAC__stream_decoder_get_state(decoder); - - if(msg) - printf("FAILED, %s", msg); - else - printf("FAILED"); - - printf(", state = %u (%s)\n", (uint32_t)state, FLAC__StreamDecoderStateString[state]); - - return false; -} - -static uint32_t local_rand_(void) -{ -#if !defined _MSC_VER && !defined __MINGW32__ -#define RNDFUNC random -#else -#define RNDFUNC rand -#endif - /* every RAND_MAX I've ever seen is 2^15-1 or 2^31-1, so a little hackery here: */ - if (RAND_MAX > 32767) - return RNDFUNC(); - else /* usually MSVC, some solaris */ - return (RNDFUNC()<<15) | RNDFUNC(); -#undef RNDFUNC -} - -static FLAC__off_t get_filesize_(const char *srcpath) -{ - struct flac_stat_s srcstat; - - if(0 == flac_stat(srcpath, &srcstat)) - return srcstat.st_size; - else - return -1; -} - -static FLAC__bool read_pcm_(FLAC__int32 *pcm[], const char *rawfilename, const char *flacfilename) -{ - FILE *f; - uint32_t channels = 0, bps = 0, samples, i, j; - - FLAC__off_t rawfilesize = get_filesize_(rawfilename); - if (rawfilesize < 0) { - fprintf(stderr, "ERROR: can't determine filesize for %s\n", rawfilename); - return false; - } - /* get sample format from flac file; would just use FLAC__metadata_get_streaminfo() except it doesn't work for Ogg FLAC yet */ - { -#if 0 - FLAC__StreamMetadata streaminfo; - if(!FLAC__metadata_get_streaminfo(flacfilename, &streaminfo)) { - printf("ERROR: getting STREAMINFO from %s\n", flacfilename); - return false; - } - channels = streaminfo.data.stream_info.channels; - bps = streaminfo.data.stream_info.bits_per_sample; -#else - FLAC__bool ok = true; - FLAC__Metadata_Chain *chain = FLAC__metadata_chain_new(); - FLAC__Metadata_Iterator *it = 0; - ok = ok && chain && (FLAC__metadata_chain_read(chain, flacfilename) || FLAC__metadata_chain_read_ogg(chain, flacfilename)); - ok = ok && (it = FLAC__metadata_iterator_new()); - if(ok) FLAC__metadata_iterator_init(it, chain); - ok = ok && (FLAC__metadata_iterator_get_block(it)->type == FLAC__METADATA_TYPE_STREAMINFO); - ok = ok && (channels = FLAC__metadata_iterator_get_block(it)->data.stream_info.channels); - ok = ok && (bps = FLAC__metadata_iterator_get_block(it)->data.stream_info.bits_per_sample); - if(it) FLAC__metadata_iterator_delete(it); - if(chain) FLAC__metadata_chain_delete(chain); - if(!ok) { - printf("ERROR: getting STREAMINFO from %s\n", flacfilename); - return false; - } -#endif - } - if(channels > 2) { - printf("ERROR: PCM verification requires 1 or 2 channels, got %u\n", channels); - return false; - } - if(bps != 8 && bps != 16) { - printf("ERROR: PCM verification requires 8 or 16 bps, got %u\n", bps); - return false; - } - samples = rawfilesize / channels / (bps>>3); - if (samples > 10000000) { - fprintf(stderr, "ERROR: %s is too big\n", rawfilename); - return false; - } - for(i = 0; i < channels; i++) { - if(0 == (pcm[i] = malloc(sizeof(FLAC__int32)*samples))) { - printf("ERROR: allocating space for PCM samples\n"); - return false; - } - } - if(0 == (f = flac_fopen(rawfilename, "rb"))) { - printf("ERROR: opening %s for reading\n", rawfilename); - return false; - } - /* assumes signed big-endian data */ - if(bps == 8) { - signed char c; - for(i = 0; i < samples; i++) { - for(j = 0; j < channels; j++) { - if (fread(&c, 1, 1, f) == 1) - pcm[j][i] = c; - } - } - } - else { /* bps == 16 */ - uint8_t c[2]; - uint16_t value; - for(i = 0; i < samples; i++) { - for(j = 0; j < channels; j++) { - if (fread(&c, 1, 2, f) == 2) { - value = (c[0] << 8) | c[1]; - pcm[j][i] = value & 0x8000 ? 0xffff0000 | value : value; - } - } - } - } - fclose(f); - return true; -} - -static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) -{ - DecoderClientData *dcd = (DecoderClientData*)client_data; - - (void)decoder, (void)buffer; - - if(0 == dcd) { - printf("ERROR: client_data in write callback is NULL\n"); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - - if(dcd->error_occurred) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - - FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); /* decoder guarantees this */ - if (!dcd->quiet) - printf("frame@%" PRIu64 "(%u)... ", frame->header.number.sample_number, frame->header.blocksize); - fflush(stdout); - - /* check against PCM data if we have it */ - if (dcd->pcm) { - uint32_t c, i, j; - for (c = 0; c < frame->header.channels; c++) - for (i = (uint32_t)frame->header.number.sample_number, j = 0; j < frame->header.blocksize; i++, j++) - if (buffer[c][j] != dcd->pcm[c][i]) { - printf("ERROR: sample mismatch at sample#%u(%u), channel=%u, expected %d, got %d\n", i, j, c, buffer[c][j], dcd->pcm[c][i]); - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - } - - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -static void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) -{ - DecoderClientData *dcd = (DecoderClientData*)client_data; - - (void)decoder; - - if(0 == dcd) { - printf("ERROR: client_data in metadata callback is NULL\n"); - return; - } - - if(dcd->error_occurred) - return; - - if (!dcd->got_data && metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { - dcd->got_data = true; - dcd->total_samples = metadata->data.stream_info.total_samples; - dcd->channels = metadata->data.stream_info.channels; - dcd->bits_per_sample = metadata->data.stream_info.bits_per_sample; - } -} - -static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) -{ - DecoderClientData *dcd = (DecoderClientData*)client_data; - - (void)decoder; - - if(0 == dcd) { - printf("ERROR: client_data in error callback is NULL\n"); - return; - } - - if(!dcd->ignore_errors) { - printf("ERROR: got error callback: err = %u (%s)\n", (uint32_t)status, FLAC__StreamDecoderErrorStatusString[status]); - dcd->error_occurred = true; - } -} - -/* read mode: - * 0 - no read after seek - * 1 - read 2 frames - * 2 - read until end - */ -static FLAC__bool seek_barrage(FLAC__bool is_ogg, const char *filename, FLAC__off_t filesize, uint32_t count, FLAC__int64 total_samples, uint32_t read_mode, FLAC__int32 **pcm) -{ - FLAC__StreamDecoder *decoder; - DecoderClientData decoder_client_data; - uint32_t i; - long int n; - - decoder_client_data.pcm = pcm; - decoder_client_data.got_data = false; - decoder_client_data.total_samples = 0; - decoder_client_data.quiet = false; - decoder_client_data.ignore_errors = false; - decoder_client_data.error_occurred = false; - - printf("\n+++ seek test: FLAC__StreamDecoder (%s FLAC, read_mode=%u)\n\n", is_ogg? "Ogg":"native", read_mode); - - decoder = FLAC__stream_decoder_new(); - if(0 == decoder) - return die_("FLAC__stream_decoder_new() FAILED, returned NULL\n"); - - if(is_ogg) { - if(FLAC__stream_decoder_init_ogg_file(decoder, filename, write_callback_, metadata_callback_, error_callback_, &decoder_client_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) - return die_s_("FLAC__stream_decoder_init_file() FAILED", decoder); - } - else { - if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, metadata_callback_, error_callback_, &decoder_client_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) - return die_s_("FLAC__stream_decoder_init_file() FAILED", decoder); - } - - if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) - return die_s_("FLAC__stream_decoder_process_until_end_of_metadata() FAILED", decoder); - - if(!is_ogg) { /* not necessary to do this for Ogg because of its seeking method */ - /* process until end of stream to make sure we can still seek in that state */ - decoder_client_data.quiet = true; - if(!FLAC__stream_decoder_process_until_end_of_stream(decoder)) - return die_s_("FLAC__stream_decoder_process_until_end_of_stream() FAILED", decoder); - decoder_client_data.quiet = false; - - printf("stream decoder state is %s\n", FLAC__stream_decoder_get_resolved_state_string(decoder)); - if(FLAC__stream_decoder_get_state(decoder) != FLAC__STREAM_DECODER_END_OF_STREAM) - return die_s_("expected FLAC__STREAM_DECODER_END_OF_STREAM", decoder); - } - - printf("file's total_samples is %" PRIu64 "\n", decoder_client_data.total_samples); - n = (long int)decoder_client_data.total_samples; - - if(n == 0 && total_samples >= 0) - n = (long int)total_samples; - - /* if we don't have a total samples count, just guess based on the file size */ - /* @@@ for is_ogg we should get it from last page's granulepos */ - if(n == 0) { - /* 8 would imply no compression, 9 guarantees that we will get some samples off the end of the stream to test that case */ - n = 9 * filesize / (decoder_client_data.channels * decoder_client_data.bits_per_sample); - } - - printf("Begin seek barrage, count=%u\n", count); - - for (i = 0; !stop_signal_ && (count == 0 || i < count); i++) { - FLAC__uint64 pos; - - /* for the first 10, seek to the first 10 samples */ - if (n >= 10 && i < 10) { - pos = i; - } - /* for the second 10, seek to the last 10 samples */ - else if (n >= 10 && i < 20) { - pos = n - 1 - (i-10); - } - /* for the third 10, seek past the end and make sure we fail properly as expected */ - else if (i < 30) { - pos = n + (i-20); - } - else { - pos = (FLAC__uint64)(local_rand_() % n); - } - - printf("#%u:seek(%" PRIu64 ")... ", i, pos); - fflush(stdout); - if(!FLAC__stream_decoder_seek_absolute(decoder, pos)) { - if(pos >= (FLAC__uint64)n) - printf("seek past end failed as expected... "); - else if(decoder_client_data.total_samples == 0 && total_samples <= 0) - printf("seek failed, assuming it was past EOF... "); - else - return die_s_("FLAC__stream_decoder_seek_absolute() FAILED", decoder); - if(!FLAC__stream_decoder_flush(decoder)) - return die_s_("FLAC__stream_decoder_flush() FAILED", decoder); - } - else if(read_mode == 1) { - printf("decode_frame... "); - fflush(stdout); - if(!FLAC__stream_decoder_process_single(decoder)) - return die_s_("FLAC__stream_decoder_process_single() FAILED", decoder); - - printf("decode_frame... "); - fflush(stdout); - if(!FLAC__stream_decoder_process_single(decoder)) - return die_s_("FLAC__stream_decoder_process_single() FAILED", decoder); - } - else if(read_mode == 2) { - printf("decode_all... "); - fflush(stdout); - decoder_client_data.quiet = true; - if(!FLAC__stream_decoder_process_until_end_of_stream(decoder)) - return die_s_("FLAC__stream_decoder_process_until_end_of_stream() FAILED", decoder); - decoder_client_data.quiet = false; - } - - printf("OK\n"); - fflush(stdout); - } - stop_signal_ = false; - - if(FLAC__stream_decoder_get_state(decoder) != FLAC__STREAM_DECODER_UNINITIALIZED) { - if(!FLAC__stream_decoder_finish(decoder)) - return die_s_("FLAC__stream_decoder_finish() FAILED", decoder); - } - - FLAC__stream_decoder_delete(decoder); - printf("\nPASSED!\n"); - - return true; -} - - -int main(int argc, char *argv[]) -{ - const char *flacfilename, *rawfilename = 0; - uint32_t count = 0, read_mode; - FLAC__int64 samples = -1; - FLAC__off_t flacfilesize; - FLAC__int32 *pcm[2] = { 0, 0 }; - FLAC__bool ok = true; - - static const char * const usage = "usage: test_seeking file.flac [#seeks] [#samples-in-file.flac] [file.raw]\n"; - - if (argc < 2 || argc > 5) { - fputs(usage, stderr); - return 1; - } - - flacfilename = argv[1]; - - if (argc > 2) - count = strtoul(argv[2], 0, 10); - if (argc > 3) - samples = strtoull(argv[3], 0, 10); - if (argc > 4) - rawfilename = argv[4]; - - if (count < 30) - fprintf(stderr, "WARNING: random seeks don't kick in until after 30 preprogrammed ones\n"); - -#if !defined _MSC_VER && !defined __MINGW32__ - { - struct timeval tv; - - if (gettimeofday(&tv, 0) < 0) { - fprintf(stderr, "WARNING: couldn't seed RNG with time\n"); - tv.tv_usec = 4321; - } - srandom(tv.tv_usec); - } -#else - srand((uint32_t)time(0)); -#endif - - flacfilesize = get_filesize_(flacfilename); - if (flacfilesize < 0) { - fprintf(stderr, "ERROR: can't determine filesize for %s\n", flacfilename); - return 1; - } - - if (rawfilename && !read_pcm_(pcm, rawfilename, flacfilename)) { - free(pcm[0]); - free(pcm[1]); - return 1; - } - - (void) signal(SIGINT, our_sigint_handler_); - - for (read_mode = 0; ok && read_mode <= 2; read_mode++) { - /* no need to do "decode all" read_mode if PCM checking is available */ - if (rawfilename && read_mode > 1) - continue; - if (strlen(flacfilename) > 4 && (0 == strcmp(flacfilename+strlen(flacfilename)-4, ".oga") || 0 == strcmp(flacfilename+strlen(flacfilename)-4, ".ogg"))) { -#if FLAC__HAS_OGG - ok = seek_barrage(/*is_ogg=*/true, flacfilename, flacfilesize, count, samples, read_mode, rawfilename? pcm : 0); -#else - fprintf(stderr, "ERROR: Ogg FLAC not supported\n"); - ok = false; -#endif - } - else { - ok = seek_barrage(/*is_ogg=*/false, flacfilename, flacfilesize, count, samples, read_mode, rawfilename? pcm : 0); - } - } - - free(pcm[0]); - free(pcm[1]); - - return ok? 0 : 2; -} diff --git a/src/test_seeking/test_seeking.vcproj b/src/test_seeking/test_seeking.vcproj deleted file mode 100644 index bcfe310b..00000000 --- a/src/test_seeking/test_seeking.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test_seeking/test_seeking.vcxproj b/src/test_seeking/test_seeking.vcxproj deleted file mode 100644 index cc20367e..00000000 --- a/src/test_seeking/test_seeking.vcxproj +++ /dev/null @@ -1,179 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc90-c215-11db-8314-0800200c9a66} - test_seeking - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - {4cefbc84-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/test_seeking/test_seeking.vcxproj.filters b/src/test_seeking/test_seeking.vcxproj.filters deleted file mode 100644 index 5c9040b8..00000000 --- a/src/test_seeking/test_seeking.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/src/test_streams/CMakeLists.txt b/src/test_streams/CMakeLists.txt deleted file mode 100644 index f9fafb9d..00000000 --- a/src/test_streams/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(test_streams main.c) -target_link_libraries(test_streams FLAC grabbag) diff --git a/src/test_streams/Makefile.am b/src/test_streams/Makefile.am deleted file mode 100644 index ef444ae2..00000000 --- a/src/test_streams/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# test_streams - Simple test pattern generator -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - test_streams.vcproj \ - test_streams.vcxproj \ - test_streams.vcxproj.filters - -AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -check_PROGRAMS = test_streams -test_streams_SOURCES = \ - main.c - -test_streams_LDADD = $(top_builddir)/src/share/grabbag/libgrabbag.la -lm - -CLEANFILES = test_streams.exe diff --git a/src/test_streams/Makefile.lite b/src/test_streams/Makefile.lite deleted file mode 100644 index 1e87c372..00000000 --- a/src/test_streams/Makefile.lite +++ /dev/null @@ -1,43 +0,0 @@ -# test_streams - Simple test pattern generator -# Copyright (C) 2000-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../.. - -include $(topdir)/build/config.mk -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = test_streams - -INCLUDES = -I./include -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a -lm -else - LIBS = -lgrabbag -lreplaygain_analysis -lm -endif - -SRCS_C = \ - main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/test_streams/main.c b/src/test_streams/main.c deleted file mode 100644 index 7f21fe0d..00000000 --- a/src/test_streams/main.c +++ /dev/null @@ -1,1284 +0,0 @@ -/* test_streams - Simple test pattern generator - * Copyright (C) 2000-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include "share/compat.h" -#if defined _MSC_VER || defined __MINGW32__ -#include -#else -#include -#endif -#include "FLAC/assert.h" -#include "FLAC/ordinals.h" -#include "share/compat.h" - -#if !defined _MSC_VER && !defined __MINGW32__ -#define GET_RANDOM_BYTE (((unsigned)random()) & 0xff) -#else -#define GET_RANDOM_BYTE (((unsigned)rand()) & 0xff) -#endif - -static FLAC__bool is_big_endian_host; - - -static FLAC__bool write_little_endian_unsigned(FILE *f, FLAC__uint32 x, size_t bytes) -{ - while(bytes) { - if(fputc(x, f) == EOF) - return false; - x >>= 8; - bytes--; - } - return true; -} - -static FLAC__bool write_little_endian_signed(FILE *f, FLAC__int32 x, size_t bytes) -{ - return write_little_endian_unsigned(f, (FLAC__uint32) x, bytes); -} - -static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 x) -{ - return - fputc(x, f) != EOF && - fputc(x >> 8, f) != EOF - ; -} - -static FLAC__bool write_little_endian_int16(FILE *f, FLAC__int16 x) -{ - return write_little_endian_uint16(f, (FLAC__uint16)x); -} - -static FLAC__bool write_little_endian_uint24(FILE *f, FLAC__uint32 x) -{ - return - fputc(x, f) != EOF && - fputc(x >> 8, f) != EOF && - fputc(x >> 16, f) != EOF - ; -} - -static FLAC__bool write_little_endian_int24(FILE *f, FLAC__int32 x) -{ - return write_little_endian_uint24(f, (FLAC__uint32)x); -} - -static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 x) -{ - return - fputc(x, f) != EOF && - fputc(x >> 8, f) != EOF && - fputc(x >> 16, f) != EOF && - fputc(x >> 24, f) != EOF - ; -} - -#if 0 -/* @@@ not used (yet) */ -static FLAC__bool write_little_endian_int32(FILE *f, FLAC__int32 x) -{ - return write_little_endian_uint32(f, (FLAC__uint32)x); -} -#endif - -static FLAC__bool write_little_endian_uint64(FILE *f, FLAC__uint64 x) -{ - return - fputc(x, f) != EOF && - fputc(x >> 8, f) != EOF && - fputc(x >> 16, f) != EOF && - fputc(x >> 24, f) != EOF && - fputc(x >> 32, f) != EOF && - fputc(x >> 40, f) != EOF && - fputc(x >> 48, f) != EOF && - fputc(x >> 56, f) != EOF - ; -} - -static FLAC__bool write_big_endian(FILE *f, FLAC__int32 x, size_t bytes) -{ - if(bytes < 4) - x <<= 8*(4-bytes); - while(bytes) { - if(fputc(x>>24, f) == EOF) - return false; - x <<= 8; - bytes--; - } - return true; -} - -static FLAC__bool write_big_endian_uint16(FILE *f, FLAC__uint16 x) -{ - return - fputc(x >> 8, f) != EOF && - fputc(x, f) != EOF - ; -} - -#if 0 -/* @@@ not used (yet) */ -static FLAC__bool write_big_endian_int16(FILE *f, FLAC__int16 x) -{ - return write_big_endian_uint16(f, (FLAC__uint16)x); -} -#endif - -#if 0 -/* @@@ not used (yet) */ -static FLAC__bool write_big_endian_uint24(FILE *f, FLAC__uint32 x) -{ - return - fputc(x >> 16, f) != EOF && - fputc(x >> 8, f) != EOF && - fputc(x, f) != EOF - ; -} -#endif - -#if 0 -/* @@@ not used (yet) */ -static FLAC__bool write_big_endian_int24(FILE *f, FLAC__int32 x) -{ - return write_big_endian_uint24(f, (FLAC__uint32)x); -} -#endif - -static FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 x) -{ - return - fputc(x >> 24, f) != EOF && - fputc(x >> 16, f) != EOF && - fputc(x >> 8, f) != EOF && - fputc(x, f) != EOF - ; -} - -#if 0 -/* @@@ not used (yet) */ -static FLAC__bool write_big_endian_int32(FILE *f, FLAC__int32 x) -{ - return write_big_endian_uint32(f, (FLAC__uint32)x); -} -#endif - -static FLAC__bool write_sane_extended(FILE *f, unsigned val) - /* Write to 'f' a SANE extended representation of 'val'. Return false if - * the write succeeds; return true otherwise. - * - * SANE extended is an 80-bit IEEE-754 representation with sign bit, 15 bits - * of exponent, and 64 bits of significand (mantissa). Unlike most IEEE-754 - * representations, it does not imply a 1 above the MSB of the significand. - * - * Preconditions: - * val!=0U - */ -{ - unsigned int shift, exponent; - - FLAC__ASSERT(val!=0U); /* handling 0 would require a special case */ - - for(shift= 0U; (val>>(31-shift))==0U; ++shift) - ; - val<<= shift; - exponent= 63U-(shift+32U); /* add 32 for unused second word */ - - if(!write_big_endian_uint16(f, (FLAC__uint16)(exponent+0x3FFF))) - return false; - if(!write_big_endian_uint32(f, val)) - return false; - if(!write_big_endian_uint32(f, 0)) /* unused second word */ - return false; - - return true; -} - -/* a mono one-sample 16bps stream */ -static FLAC__bool generate_01(void) -{ - FILE *f; - FLAC__int16 x = -32768; - - if(0 == (f = fopen("test01.raw", "wb"))) - return false; - - if(!write_little_endian_int16(f, x)) - goto foo; - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a stereo one-sample 16bps stream */ -static FLAC__bool generate_02(void) -{ - FILE *f; - FLAC__int16 xl = -32768, xr = 32767; - - if(0 == (f = fopen("test02.raw", "wb"))) - return false; - - if(!write_little_endian_int16(f, xl)) - goto foo; - if(!write_little_endian_int16(f, xr)) - goto foo; - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a mono five-sample 16bps stream */ -static FLAC__bool generate_03(void) -{ - FILE *f; - FLAC__int16 x[] = { -25, 0, 25, 50, 100 }; - unsigned i; - - if(0 == (f = fopen("test03.raw", "wb"))) - return false; - - for(i = 0; i < 5; i++) - if(!write_little_endian_int16(f, x[i])) - goto foo; - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a stereo five-sample 16bps stream */ -static FLAC__bool generate_04(void) -{ - FILE *f; - FLAC__int16 x[] = { -25, 500, 0, 400, 25, 300, 50, 200, 100, 100 }; - unsigned i; - - if(0 == (f = fopen("test04.raw", "wb"))) - return false; - - for(i = 0; i < 10; i++) - if(!write_little_endian_int16(f, x[i])) - goto foo; - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a mono full-scale deflection 8bps stream */ -static FLAC__bool generate_fsd8(const char *fn, const int pattern[], unsigned reps) -{ - FILE *f; - unsigned rep, p; - - FLAC__ASSERT(pattern != 0); - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(rep = 0; rep < reps; rep++) { - for(p = 0; pattern[p]; p++) { - signed char x = pattern[p] > 0? 127 : -128; - if(fwrite(&x, sizeof(x), 1, f) < 1) - goto foo; - } - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a mono full-scale deflection 16bps stream */ -static FLAC__bool generate_fsd16(const char *fn, const int pattern[], unsigned reps) -{ - FILE *f; - unsigned rep, p; - - FLAC__ASSERT(pattern != 0); - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(rep = 0; rep < reps; rep++) { - for(p = 0; pattern[p]; p++) { - FLAC__int16 x = pattern[p] > 0? 32767 : -32768; - if(!write_little_endian_int16(f, x)) - goto foo; - } - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a stereo wasted-bits-per-sample 16bps stream */ -static FLAC__bool generate_wbps16(const char *fn, unsigned samples) -{ - FILE *f; - unsigned sample; - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(sample = 0; sample < samples; sample++) { - FLAC__int16 l = (sample % 2000) << 2; - FLAC__int16 r = (sample % 1000) << 3; - if(!write_little_endian_int16(f, l)) - goto foo; - if(!write_little_endian_int16(f, r)) - goto foo; - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a mono full-scale deflection 24bps stream */ -static FLAC__bool generate_fsd24(const char *fn, const int pattern[], unsigned reps) -{ - FILE *f; - unsigned rep, p; - - FLAC__ASSERT(pattern != 0); - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(rep = 0; rep < reps; rep++) { - for(p = 0; pattern[p]; p++) { - FLAC__int32 x = pattern[p] > 0? 8388607 : -8388608; - if(!write_little_endian_int24(f, x)) - goto foo; - } - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a mono sine-wave 8bps stream */ -static FLAC__bool generate_sine8_1(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2) -{ - const FLAC__int8 full_scale = 127; - const double delta1 = 2.0 * M_PI / ( sample_rate / f1); - const double delta2 = 2.0 * M_PI / ( sample_rate / f2); - FILE *f; - double theta1, theta2; - unsigned i; - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int8 v = (FLAC__int8)(val + 0.5); - if(fwrite(&v, sizeof(v), 1, f) < 1) - goto foo; - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a stereo sine-wave 8bps stream */ -static FLAC__bool generate_sine8_2(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2, double fmult) -{ - const FLAC__int8 full_scale = 127; - const double delta1 = 2.0 * M_PI / ( sample_rate / f1); - const double delta2 = 2.0 * M_PI / ( sample_rate / f2); - FILE *f; - double theta1, theta2; - unsigned i; - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int8 v = (FLAC__int8)(val + 0.5); - if(fwrite(&v, sizeof(v), 1, f) < 1) - goto foo; - val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale; - v = (FLAC__int8)(val + 0.5); - if(fwrite(&v, sizeof(v), 1, f) < 1) - goto foo; - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a mono sine-wave 16bps stream */ -static FLAC__bool generate_sine16_1(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2) -{ - const FLAC__int16 full_scale = 32767; - const double delta1 = 2.0 * M_PI / ( sample_rate / f1); - const double delta2 = 2.0 * M_PI / ( sample_rate / f2); - FILE *f; - double theta1, theta2; - unsigned i; - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int16 v = (FLAC__int16)(val + 0.5); - if(!write_little_endian_int16(f, v)) - goto foo; - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a stereo sine-wave 16bps stream */ -static FLAC__bool generate_sine16_2(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2, double fmult) -{ - const FLAC__int16 full_scale = 32767; - const double delta1 = 2.0 * M_PI / ( sample_rate / f1); - const double delta2 = 2.0 * M_PI / ( sample_rate / f2); - FILE *f; - double theta1, theta2; - unsigned i; - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int16 v = (FLAC__int16)(val + 0.5); - if(!write_little_endian_int16(f, v)) - goto foo; - val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale; - v = (FLAC__int16)(val + 0.5); - if(!write_little_endian_int16(f, v)) - goto foo; - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a mono sine-wave 24bps stream */ -static FLAC__bool generate_sine24_1(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2) -{ - const FLAC__int32 full_scale = 0x7fffff; - const double delta1 = 2.0 * M_PI / ( sample_rate / f1); - const double delta2 = 2.0 * M_PI / ( sample_rate / f2); - FILE *f; - double theta1, theta2; - unsigned i; - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int32 v = (FLAC__int32)(val + 0.5); - if(!write_little_endian_int24(f, v)) - goto foo; - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* a stereo sine-wave 24bps stream */ -static FLAC__bool generate_sine24_2(const char *fn, const double sample_rate, const unsigned samples, const double f1, const double a1, const double f2, const double a2, double fmult) -{ - const FLAC__int32 full_scale = 0x7fffff; - const double delta1 = 2.0 * M_PI / ( sample_rate / f1); - const double delta2 = 2.0 * M_PI / ( sample_rate / f2); - FILE *f; - double theta1, theta2; - unsigned i; - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int32 v = (FLAC__int32)(val + 0.5); - if(!write_little_endian_int24(f, v)) - goto foo; - val = -(a1*sin(theta1*fmult) + a2*sin(theta2*fmult))*(double)full_scale; - v = (FLAC__int32)(val + 0.5); - if(!write_little_endian_int24(f, v)) - goto foo; - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -static FLAC__bool generate_noise(const char *fn, unsigned bytes) -{ - FILE *f; - unsigned b; - - if(0 == (f = fopen(fn, "wb"))) - return false; - - for(b = 0; b < bytes; b++) { -#if !defined _MSC_VER && !defined __MINGW32__ - FLAC__byte x = (FLAC__byte)(((unsigned)random()) & 0xff); -#else - FLAC__byte x = (FLAC__byte)(((unsigned)rand()) & 0xff); -#endif - if(fwrite(&x, sizeof(x), 1, f) < 1) - goto foo; - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -static FLAC__bool generate_signed_raw(const char *filename, unsigned channels, unsigned bytes_per_sample, unsigned samples) -{ - const FLAC__int32 full_scale = (1 << (bytes_per_sample*8-1)) - 1; - const double f1 = 441.0, a1 = 0.61, f2 = 661.5, a2 = 0.37; - const double delta1 = 2.0 * M_PI / ( 44100.0 / f1); - const double delta2 = 2.0 * M_PI / ( 44100.0 / f2); - double theta1, theta2; - FILE *f; - unsigned i, j; - - if(0 == (f = fopen(filename, "wb"))) - return false; - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - for(j = 0; j < channels; j++) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int32 v = (FLAC__int32)(val + 0.5) + ((GET_RANDOM_BYTE>>4)-8); - if(!write_little_endian_signed(f, v, bytes_per_sample)) - goto foo; - } - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -static FLAC__bool generate_unsigned_raw(const char *filename, unsigned channels, unsigned bytes_per_sample, unsigned samples) -{ - const FLAC__int32 full_scale = (1 << (bytes_per_sample*8-1)) - 1; - const double f1 = 441.0, a1 = 0.61, f2 = 661.5, a2 = 0.37; - const double delta1 = 2.0 * M_PI / ( 44100.0 / f1); - const double delta2 = 2.0 * M_PI / ( 44100.0 / f2); - const double half_scale = 0.5 * full_scale; - double theta1, theta2; - FILE *f; - unsigned i, j; - - if(0 == (f = fopen(filename, "wb"))) - return false; - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - for(j = 0; j < channels; j++) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int32 v = (FLAC__int32)(half_scale + val + 0.5) + ((GET_RANDOM_BYTE>>4)-8); - if(!write_little_endian_unsigned(f, v, bytes_per_sample)) - goto foo; - } - } - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -static FLAC__bool generate_aiff(const char *filename, unsigned sample_rate, unsigned channels, unsigned bps, unsigned samples) -{ - const unsigned bytes_per_sample = (bps+7)/8; - const unsigned true_size = channels * bytes_per_sample * samples; - const unsigned padded_size = (true_size + 1) & (~1u); - const unsigned shift = (bps%8)? 8 - (bps%8) : 0; - const FLAC__int32 full_scale = (1 << (bps-1)) - 1; - const double f1 = 441.0, a1 = 0.61, f2 = 661.5, a2 = 0.37; - const double delta1 = 2.0 * M_PI / ( sample_rate / f1); - const double delta2 = 2.0 * M_PI / ( sample_rate / f2); - double theta1, theta2; - FILE *f; - unsigned i, j; - - if(0 == (f = fopen(filename, "wb"))) - return false; - if(fwrite("FORM", 1, 4, f) < 4) - goto foo; - if(!write_big_endian_uint32(f, padded_size + 46)) - goto foo; - if(fwrite("AIFFCOMM\000\000\000\022", 1, 12, f) < 12) - goto foo; - if(!write_big_endian_uint16(f, (FLAC__uint16)channels)) - goto foo; - if(!write_big_endian_uint32(f, samples)) - goto foo; - if(!write_big_endian_uint16(f, (FLAC__uint16)bps)) - goto foo; - if(!write_sane_extended(f, sample_rate)) - goto foo; - if(fwrite("SSND", 1, 4, f) < 4) - goto foo; - if(!write_big_endian_uint32(f, true_size + 8)) - goto foo; - if(fwrite("\000\000\000\000\000\000\000\000", 1, 8, f) < 8) - goto foo; - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - for(j = 0; j < channels; j++) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int32 v = ((FLAC__int32)(val + 0.5) + ((GET_RANDOM_BYTE>>4)-8)) << shift; - if(!write_big_endian(f, v, bytes_per_sample)) - goto foo; - } - } - for(i = true_size; i < padded_size; i++) - if(fputc(0, f) == EOF) - goto foo; - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -/* flavor is: 0:WAVE, 1:RF64, 2:WAVE64 */ -static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsigned channels, unsigned bps, unsigned samples, FLAC__bool strict, int flavor) -{ - const FLAC__bool waveformatextensible = strict && (channels > 2 || (bps != 8 && bps != 16)); - - const unsigned bytes_per_sample = (bps+7)/8; - const unsigned shift = (bps%8)? 8 - (bps%8) : 0; - /* this rig is not going over 4G so we're ok with 32-bit sizes here */ - const FLAC__uint32 true_size = channels * bytes_per_sample * samples; - const FLAC__uint32 padded_size = flavor<2? (true_size + 1) & (~1u) : (true_size + 7) & (~7u); - const FLAC__int32 full_scale = (1 << (bps-1)) - 1; - const double f1 = 441.0, a1 = 0.61, f2 = 661.5, a2 = 0.37; - const double delta1 = 2.0 * M_PI / ( sample_rate / f1); - const double delta2 = 2.0 * M_PI / ( sample_rate / f2); - double theta1, theta2; - FILE *f; - unsigned i, j; - - if(0 == (f = fopen(filename, "wb"))) - return false; - /* RIFFxxxxWAVE or equivalent: */ - switch(flavor) { - case 0: - if(fwrite("RIFF", 1, 4, f) < 4) - goto foo; - /* +4 for WAVE */ - /* +8+{40,16} for fmt chunk */ - /* +8 for data chunk header */ - if(!write_little_endian_uint32(f, 4 + 8+(waveformatextensible?40:16) + 8 + padded_size)) - goto foo; - if(fwrite("WAVE", 1, 4, f) < 4) - goto foo; - break; - case 1: - if(fwrite("RF64", 1, 4, f) < 4) - goto foo; - if(!write_little_endian_uint32(f, 0xffffffff)) - goto foo; - if(fwrite("WAVE", 1, 4, f) < 4) - goto foo; - break; - case 2: - /* RIFF GUID 66666972-912E-11CF-A5D6-28DB04C10000 */ - if(fwrite("\x72\x69\x66\x66\x2E\x91\xCF\x11\xA5\xD6\x28\xDB\x04\xC1\x00\x00", 1, 16, f) < 16) - goto foo; - /* +(16+8) for RIFF GUID + size */ - /* +16 for WAVE GUID */ - /* +16+8+{40,16} for fmt chunk */ - /* +16+8 for data chunk header */ - if(!write_little_endian_uint64(f, (16+8) + 16 + 16+8+(waveformatextensible?40:16) + (16+8) + padded_size)) - goto foo; - /* WAVE GUID 65766177-ACF3-11D3-8CD1-00C04F8EDB8A */ - if(fwrite("\x77\x61\x76\x65\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 1, 16, f) < 16) - goto foo; - break; - default: - goto foo; - } - if(flavor == 1) { /* rf64 */ - if(fwrite("ds64", 1, 4, f) < 4) - goto foo; - if(!write_little_endian_uint32(f, 28)) /* ds64 chunk size */ - goto foo; - if(!write_little_endian_uint64(f, 36 + padded_size + (waveformatextensible?60:36))) - goto foo; - if(!write_little_endian_uint64(f, true_size)) - goto foo; - if(!write_little_endian_uint64(f, samples)) - goto foo; - if(!write_little_endian_uint32(f, 0)) /* table size */ - goto foo; - } - /* fmt chunk */ - if(flavor < 2) { - if(fwrite("fmt ", 1, 4, f) < 4) - goto foo; - /* chunk size */ - if(!write_little_endian_uint32(f, waveformatextensible?40:16)) - goto foo; - } - else { /* wave64 */ - /* fmt GUID 20746D66-ACF3-11D3-8CD1-00C04F8EDB8A */ - if(fwrite("\x66\x6D\x74\x20\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 1, 16, f) < 16) - goto foo; - /* chunk size (+16+8 for GUID and size fields) */ - if(!write_little_endian_uint64(f, 16+8+(waveformatextensible?40:16))) - goto foo; - } - if(!write_little_endian_uint16(f, (FLAC__uint16)(waveformatextensible?65534:1))) - goto foo; - if(!write_little_endian_uint16(f, (FLAC__uint16)channels)) - goto foo; - if(!write_little_endian_uint32(f, sample_rate)) - goto foo; - if(!write_little_endian_uint32(f, sample_rate * channels * bytes_per_sample)) - goto foo; - if(!write_little_endian_uint16(f, (FLAC__uint16)(channels * bytes_per_sample))) /* block align */ - goto foo; - if(!write_little_endian_uint16(f, (FLAC__uint16)(bps+shift))) - goto foo; - if(waveformatextensible) { - if(!write_little_endian_uint16(f, (FLAC__uint16)22)) /* cbSize */ - goto foo; - if(!write_little_endian_uint16(f, (FLAC__uint16)bps)) /* validBitsPerSample */ - goto foo; - if(!write_little_endian_uint32(f, 0)) /* channelMask */ - goto foo; - /* GUID = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} */ - if(fwrite("\x01\x00\x00\x00\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71", 1, 16, f) != 16) - goto foo; - } - /* data chunk */ - if(flavor < 2) { - if(fwrite("data", 1, 4, f) < 4) - goto foo; - if(!write_little_endian_uint32(f, flavor==1? 0xffffffff : true_size)) - goto foo; - } - else { /* wave64 */ - /* data GUID 61746164-ACF3-11D3-8CD1-00C04F8EDB8A */ - if(fwrite("\x64\x61\x74\x61\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 1, 16, f) != 16) - goto foo; - /* +16+8 for GUID and size fields */ - if(!write_little_endian_uint64(f, 16+8 + true_size)) - goto foo; - } - - for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { - for(j = 0; j < channels; j++) { - double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; - FLAC__int32 v = ((FLAC__int32)(val + 0.5) + ((GET_RANDOM_BYTE>>4)-8)) << shift; - if(!write_little_endian_signed(f, v, bytes_per_sample)) - goto foo; - } - } - for(i = true_size; i < padded_size; i++) - if(fputc(0, f) == EOF) - goto foo; - - fclose(f); - return true; -foo: - fclose(f); - return false; -} - -static FLAC__bool generate_wackywavs(void) -{ - FILE *f; - FLAC__byte wav[] = { - 'R', 'I', 'F', 'F', 76, 0, 0, 0, - 'W', 'A', 'V', 'E', 'j', 'u', 'n', 'k', - 4, 0, 0, 0 , 'b', 'l', 'a', 'h', - 'p', 'a', 'd', ' ', 4, 0, 0, 0, - 'B', 'L', 'A', 'H', 'f', 'm', 't', ' ', - 16, 0, 0, 0, 1, 0, 1, 0, - 0x44,0xAC, 0, 0,0x88,0x58,0x01, 0, - 2, 0, 16, 0, 'd', 'a', 't', 'a', - 16, 0, 0, 0, 0, 0, 1, 0, - 4, 0, 9, 0, 16, 0, 25, 0, - 36, 0, 49, 0, 'p', 'a', 'd', ' ', - 4, 0, 0, 0, 'b', 'l', 'a', 'h' - }; - - if(0 == (f = fopen("wacky1.wav", "wb"))) - return false; - if(fwrite(wav, 1, 84, f) < 84) - goto foo; - fclose(f); - - wav[4] += 12; - if(0 == (f = fopen("wacky2.wav", "wb"))) - return false; - if(fwrite(wav, 1, 96, f) < 96) - goto foo; - fclose(f); - - return true; -foo: - fclose(f); - return false; -} - -static FLAC__bool write_simple_wavex_header (FILE * f, unsigned samplerate, unsigned channels, unsigned bytespersample, unsigned frames) -{ - unsigned datalen = channels * bytespersample * frames ; - - if (fwrite("RIFF", 1, 4, f) != 4) - return false; - if (!write_little_endian_uint32(f, 40 + 4 + 4 + datalen)) - return false; - - if (fwrite("WAVEfmt ", 8, 1, f) != 1) - return false; - if (!write_little_endian_uint32(f, 40)) - return false; - - if(!write_little_endian_uint16(f, 65534)) /* WAVEFORMATEXTENSIBLE tag */ - return false; - if(!write_little_endian_uint16(f, channels)) - return false; - if(!write_little_endian_uint32(f, samplerate)) - return false; - if(!write_little_endian_uint32(f, samplerate * channels * bytespersample)) - return false; - if(!write_little_endian_uint16(f, channels * bytespersample)) /* block align */ - return false; - if(!write_little_endian_uint16(f, bytespersample * 8)) - return false; - - if(!write_little_endian_uint16(f, 22)) /* cbSize */ - return false; - if(!write_little_endian_uint16(f, bytespersample * 8)) /* validBitsPerSample */ - return false; - if(!write_little_endian_uint32(f, 0)) /* channelMask */ - return false; - /* GUID = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} */ - if(fwrite("\x01\x00\x00\x00\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71", 1, 16, f) != 16) - return false; - - if (fwrite("data", 1, 4, f) != 4) - return false; - if (!write_little_endian_uint32(f, datalen)) - return false; - - return true; -} - -static FLAC__bool generate_noisy_sine(void) -{ - FILE *f; - int64_t randstate = 0x1243456; - double sample, last_val = 0.0; - int k; - - if(0 == (f = fopen("noisy-sine.wav", "wb"))) - return false; - - if(!write_simple_wavex_header (f, 44100, 1, 2, 220500)) - goto foo; - - for (k = 0 ; k < 5 * 44100 ; k++) { - /* Obvioulsy not a crypto quality RNG. */ - randstate = 11117 * randstate + 211231; - randstate = 11117 * randstate + 211231; - randstate = 11117 * randstate + 211231; - - sample = ((int32_t) randstate) / (0x7fffffff * 1.000001); - sample = 0.2 * sample - 0.9 * last_val; - - last_val = sample; - - sample += sin (2.0 * k * M_PI * 1.0 / 32.0); - sample *= 0.4; -#if !defined _MSC_VER - write_little_endian_int16(f, lrintf(sample * 32700.0)); -#else - write_little_endian_int16(f, (FLAC__int16)(sample * 32700.0)); -#endif - }; - - fclose(f); - - return true; -foo: - fclose(f); - return false; -} - -static FLAC__bool generate_wackywav64s(void) -{ - FILE *f; - FLAC__byte wav[] = { - 0x72,0x69,0x66,0x66,0x2E,0x91,0xCF,0x11, /* RIFF GUID */ - 0xA5,0xD6,0x28,0xDB,0x04,0xC1,0x00,0x00, - 152, 0, 0, 0, 0, 0, 0, 0, - 0x77,0x61,0x76,0x65,0xF3,0xAC,0xD3,0x11, /* WAVE GUID */ - 0x8C,0xD1,0x00,0xC0,0x4F,0x8E,0xDB,0x8A, - 0x6A,0x75,0x6E,0x6B,0xF3,0xAC,0xD3,0x11, /* junk GUID */ - 0x8C,0xD1,0x00,0xC0,0x4F,0x8E,0xDB,0x8A, - 32, 0, 0, 0 , 0, 0, 0, 0, - 'b', 'l', 'a', 'h', 'b', 'l', 'a', 'h', - 0x66,0x6D,0x74,0x20,0xF3,0xAC,0xD3,0x11, /* fmt GUID */ - 0x8C,0xD1,0x00,0xC0,0x4F,0x8E,0xDB,0x8A, - 40, 0, 0, 0 , 0, 0, 0, 0, - 1, 0, 1, 0,0x44,0xAC, 0, 0, - 0x88,0x58,0x01, 0, 2, 0, 16, 0, - 0x64,0x61,0x74,0x61,0xF3,0xAC,0xD3,0x11, /* data GUID */ - 0x8C,0xD1,0x00,0xC0,0x4F,0x8E,0xDB,0x8A, - 40, 0, 0, 0 , 0, 0, 0, 0, - 0, 0, 1, 0, 4, 0, 9, 0, - 16, 0, 25, 0, 36, 0, 49, 0, - 0x6A,0x75,0x6E,0x6B,0xF3,0xAC,0xD3,0x11, /* junk GUID */ - 0x8C,0xD1,0x00,0xC0,0x4F,0x8E,0xDB,0x8A, - 32, 0, 0, 0 , 0, 0, 0, 0, - 'b', 'l', 'a', 'h', 'b', 'l', 'a', 'h' - }; - - if(0 == (f = fopen("wacky1.w64", "wb"))) - return false; - if(fwrite(wav, 1, wav[16], f) < wav[16]) - goto foo; - fclose(f); - - wav[16] += 32; - if(0 == (f = fopen("wacky2.w64", "wb"))) - return false; - if(fwrite(wav, 1, wav[16], f) < wav[16]) - goto foo; - fclose(f); - - return true; -foo: - fclose(f); - return false; -} - -static FLAC__bool generate_wackyrf64s(void) -{ - FILE *f; - FLAC__byte wav[] = { - 'R', 'F', '6', '4', 255, 255, 255, 255, - 'W', 'A', 'V', 'E', 'd', 's', '6', '4', - 28, 0, 0, 0, 112, 0, 0, 0, - 0, 0, 0, 0, 16, 0, 0, 0, - 0, 0, 0, 0, 8, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 'j', 'u', 'n', 'k', - 4, 0, 0, 0, 'b', 'l', 'a', 'h', - 'p', 'a', 'd', ' ', 4, 0, 0, 0, - 'B', 'L', 'A', 'H', 'f', 'm', 't', ' ', - 16, 0, 0, 0, 1, 0, 1, 0, - 0x44,0xAC, 0, 0,0x88,0x58,0x01, 0, - 2, 0, 16, 0, 'd', 'a', 't', 'a', - 255, 255, 255, 255, 0, 0, 1, 0, - 4, 0, 9, 0, 16, 0, 25, 0, - 36, 0, 49, 0, 'p', 'a', 'd', ' ', - 4, 0, 0, 0, 'b', 'l', 'a', 'h' - }; - - if(0 == (f = fopen("wacky1.rf64", "wb"))) - return false; - if(fwrite(wav, 1, 120, f) < 120) - goto foo; - fclose(f); - - wav[20] += 12; - if(0 == (f = fopen("wacky2.rf64", "wb"))) - return false; - if(fwrite(wav, 1, 132, f) < 132) - goto foo; - fclose(f); - - return true; -foo: - fclose(f); - return false; -} - -static FLAC__bool generate_replaygain_tone (unsigned samplerate) -{ - FILE *f; - char fname [256] ; - double tone, sample, samplerange; - int k; - - flac_snprintf(fname, sizeof(fname), "rpg-tone-%u.wav", samplerate); - - if(0 == (f = fopen(fname, "wb"))) - return false; - - if(!write_simple_wavex_header (f, samplerate, 1, 3, 220500)) - goto foo; - - - samplerange = 0x7fffff; /* Largest sample value allowed for a 24 bit PCM file. */ - tone = 1000.0; /* 1 kHz */ - - for (k = 0 ; k < 5 * 44100 ; k++) { - sample = sin(2 * M_PI * tone * k / samplerate); - sample *= samplerange; - if (!write_little_endian_uint24(f, (FLAC__int32) sample)) - goto foo; - }; - - fclose(f); - - return true; -foo: - fclose(f); - return false; -} - -int main(int argc, char *argv[]) -{ - FLAC__uint32 test = 1; - unsigned channels; - - int pattern01[] = { 1, -1, 0 }; - int pattern02[] = { 1, 1, -1, 0 }; - int pattern03[] = { 1, -1, -1, 0 }; - int pattern04[] = { 1, -1, 1, -1, 0 }; - int pattern05[] = { 1, -1, -1, 1, 0 }; - int pattern06[] = { 1, -1, 1, 1, -1, 0 }; - int pattern07[] = { 1, -1, -1, 1, -1, 0 }; - - (void)argc; - (void)argv; - is_big_endian_host = (*((FLAC__byte*)(&test)))? false : true; - -#if !defined _MSC_VER && !defined __MINGW32__ - { - struct timeval tv; - - if(gettimeofday(&tv, 0) < 0) { - fprintf(stderr, "WARNING: couldn't seed RNG with time\n"); - tv.tv_usec = 4321; - } - srandom(tv.tv_usec); - } -#else - srand((unsigned)time(0)); -#endif - - if(!generate_01()) return 1; - if(!generate_02()) return 1; - if(!generate_03()) return 1; - if(!generate_04()) return 1; - - if(!generate_fsd8("fsd8-01.raw", pattern01, 100)) return 1; - if(!generate_fsd8("fsd8-02.raw", pattern02, 100)) return 1; - if(!generate_fsd8("fsd8-03.raw", pattern03, 100)) return 1; - if(!generate_fsd8("fsd8-04.raw", pattern04, 100)) return 1; - if(!generate_fsd8("fsd8-05.raw", pattern05, 100)) return 1; - if(!generate_fsd8("fsd8-06.raw", pattern06, 100)) return 1; - if(!generate_fsd8("fsd8-07.raw", pattern07, 100)) return 1; - - if(!generate_fsd16("fsd16-01.raw", pattern01, 100)) return 1; - if(!generate_fsd16("fsd16-02.raw", pattern02, 100)) return 1; - if(!generate_fsd16("fsd16-03.raw", pattern03, 100)) return 1; - if(!generate_fsd16("fsd16-04.raw", pattern04, 100)) return 1; - if(!generate_fsd16("fsd16-05.raw", pattern05, 100)) return 1; - if(!generate_fsd16("fsd16-06.raw", pattern06, 100)) return 1; - if(!generate_fsd16("fsd16-07.raw", pattern07, 100)) return 1; - - if(!generate_fsd24("fsd24-01.raw", pattern01, 100)) return 1; - if(!generate_fsd24("fsd24-02.raw", pattern02, 100)) return 1; - if(!generate_fsd24("fsd24-03.raw", pattern03, 100)) return 1; - if(!generate_fsd24("fsd24-04.raw", pattern04, 100)) return 1; - if(!generate_fsd24("fsd24-05.raw", pattern05, 100)) return 1; - if(!generate_fsd24("fsd24-06.raw", pattern06, 100)) return 1; - if(!generate_fsd24("fsd24-07.raw", pattern07, 100)) return 1; - - if(!generate_wbps16("wbps16-01.raw", 1000)) return 1; - - if(!generate_sine8_1("sine8-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1; - if(!generate_sine8_1("sine8-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1; - if(!generate_sine8_1("sine8-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1; - if(!generate_sine8_1("sine8-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1; - if(!generate_sine8_1("sine8-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1; - - if(!generate_sine8_2("sine8-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1; - if(!generate_sine8_2("sine8-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1; - if(!generate_sine8_2("sine8-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1; - if(!generate_sine8_2("sine8-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1; - if(!generate_sine8_2("sine8-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1; - if(!generate_sine8_2("sine8-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1; - if(!generate_sine8_2("sine8-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1; - if(!generate_sine8_2("sine8-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1; - if(!generate_sine8_2("sine8-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1; - if(!generate_sine8_2("sine8-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1; - - if(!generate_sine16_1("sine16-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1; - if(!generate_sine16_1("sine16-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1; - if(!generate_sine16_1("sine16-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1; - if(!generate_sine16_1("sine16-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1; - if(!generate_sine16_1("sine16-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1; - - if(!generate_sine16_2("sine16-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1; - if(!generate_sine16_2("sine16-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1; - if(!generate_sine16_2("sine16-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1; - if(!generate_sine16_2("sine16-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1; - if(!generate_sine16_2("sine16-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1; - if(!generate_sine16_2("sine16-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1; - if(!generate_sine16_2("sine16-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1; - if(!generate_sine16_2("sine16-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1; - if(!generate_sine16_2("sine16-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1; - if(!generate_sine16_2("sine16-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1; - - if(!generate_sine24_1("sine24-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1; - if(!generate_sine24_1("sine24-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1; - if(!generate_sine24_1("sine24-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1; - if(!generate_sine24_1("sine24-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1; - if(!generate_sine24_1("sine24-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1; - - if(!generate_sine24_2("sine24-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1; - if(!generate_sine24_2("sine24-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1; - if(!generate_sine24_2("sine24-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1; - if(!generate_sine24_2("sine24-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1; - if(!generate_sine24_2("sine24-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1; - if(!generate_sine24_2("sine24-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1; - if(!generate_sine24_2("sine24-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1; - if(!generate_sine24_2("sine24-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1; - if(!generate_sine24_2("sine24-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1; - if(!generate_sine24_2("sine24-19.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 0.1)) return 1; - - if(!generate_replaygain_tone(8000)) return 1; - if(!generate_replaygain_tone(11025)) return 1; - if(!generate_replaygain_tone(12000)) return 1; - if(!generate_replaygain_tone(16000)) return 1; - if(!generate_replaygain_tone(18900)) return 1; - if(!generate_replaygain_tone(22050)) return 1; - if(!generate_replaygain_tone(24000)) return 1; - if(!generate_replaygain_tone(28000)) return 1; - if(!generate_replaygain_tone(32000)) return 1; - if(!generate_replaygain_tone(36000)) return 1; - if(!generate_replaygain_tone(37800)) return 1; - if(!generate_replaygain_tone(44100)) return 1; - if(!generate_replaygain_tone(48000)) return 1; - if(!generate_replaygain_tone(96000)) return 1; - if(!generate_replaygain_tone(192000)) return 1; - - /* WATCHOUT: the size of noise.raw is hardcoded into test/test_flac.sh */ - if(!generate_noise("noise.raw", 65536 * 8 * 3)) return 1; - if(!generate_noise("noise8m32.raw", 32)) return 1; - if(!generate_wackywavs()) return 1; - if(!generate_wackywav64s()) return 1; - if(!generate_wackyrf64s()) return 1; - if(!generate_noisy_sine()) return 1; - for(channels = 1; channels <= 8; channels *= 2) { - unsigned bits_per_sample; - for(bits_per_sample = 8; bits_per_sample <= 24; bits_per_sample += 4) { - static const unsigned nsamples[] = { 1, 111, 4777 } ; - unsigned samples; - for(samples = 0; samples < sizeof(nsamples)/sizeof(nsamples[0]); samples++) { - char fn[64]; - - flac_snprintf(fn, sizeof (fn), "rt-%u-%u-%u.aiff", channels, bits_per_sample, nsamples[samples]); - if(!generate_aiff(fn, 44100, channels, bits_per_sample, nsamples[samples])) - return 1; - - flac_snprintf(fn, sizeof (fn), "rt-%u-%u-%u.wav", channels, bits_per_sample, nsamples[samples]); - if(!generate_wav(fn, 44100, channels, bits_per_sample, nsamples[samples], /*strict=*/true, /*flavor=*/0)) - return 1; - - flac_snprintf(fn, sizeof (fn), "rt-%u-%u-%u.rf64", channels, bits_per_sample, nsamples[samples]); - if(!generate_wav(fn, 44100, channels, bits_per_sample, nsamples[samples], /*strict=*/true, /*flavor=*/1)) - return 1; - - flac_snprintf(fn, sizeof (fn), "rt-%u-%u-%u.w64", channels, bits_per_sample, nsamples[samples]); - if(!generate_wav(fn, 44100, channels, bits_per_sample, nsamples[samples], /*strict=*/true, /*flavor=*/2)) - return 1; - - if(bits_per_sample % 8 == 0) { - flac_snprintf(fn, sizeof (fn), "rt-%u-%u-signed-%u.raw", channels, bits_per_sample, nsamples[samples]); - if(!generate_signed_raw(fn, channels, bits_per_sample/8, nsamples[samples])) - return 1; - flac_snprintf(fn, sizeof (fn), "rt-%u-%u-unsigned-%u.raw", channels, bits_per_sample, nsamples[samples]); - if(!generate_unsigned_raw(fn, channels, bits_per_sample/8, nsamples[samples])) - return 1; - } - } - } - } - - return 0; -} diff --git a/src/test_streams/test_streams.vcproj b/src/test_streams/test_streams.vcproj deleted file mode 100644 index 65ed81ca..00000000 --- a/src/test_streams/test_streams.vcproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test_streams/test_streams.vcxproj b/src/test_streams/test_streams.vcxproj deleted file mode 100644 index 037f9abf..00000000 --- a/src/test_streams/test_streams.vcxproj +++ /dev/null @@ -1,175 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc91-c215-11db-8314-0800200c9a66} - test_streams - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - Default - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - {4cefbc81-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/test_streams/test_streams.vcxproj.filters b/src/test_streams/test_streams.vcxproj.filters deleted file mode 100644 index 5c9040b8..00000000 --- a/src/test_streams/test_streams.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am deleted file mode 100644 index 7696a6cd..00000000 --- a/src/utils/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -SUBDIRS = flacdiff flactimer diff --git a/src/utils/flacdiff/CMakeLists.txt b/src/utils/flacdiff/CMakeLists.txt deleted file mode 100644 index ec9f771c..00000000 --- a/src/utils/flacdiff/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_executable(flacdiff - main.cpp - $<$:../../../include/share/win_utf8_io.h> - $<$:../../share/win_utf8_io/win_utf8_io.c>) -target_link_libraries(flacdiff FLAC++) diff --git a/src/utils/flacdiff/Makefile.am b/src/utils/flacdiff/Makefile.am deleted file mode 100644 index 65f49d78..00000000 --- a/src/utils/flacdiff/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -# flacdiff - Displays where two FLAC streams differ -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - flacdiff.vcproj \ - flacdiff.vcxproj \ - flacdiff.vcxproj.filters \ - main.cpp diff --git a/src/utils/flacdiff/Makefile.lite b/src/utils/flacdiff/Makefile.lite deleted file mode 100644 index bd15022a..00000000 --- a/src/utils/flacdiff/Makefile.lite +++ /dev/null @@ -1,47 +0,0 @@ -# flacdiff - Displays where two FLAC streams differ -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../../.. -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = flacdiff - -INCLUDES = -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_EXPLICIT_LIBS) -lm -else -ifeq ($(findstring Windows,$(OS)),Windows) - LIBS = -lFLAC++ -lFLAC -lwin_utf8_io $(OGG_LIBS) -lm -else - LIBS = -lFLAC++ -lFLAC $(OGG_LIBS) -lm -endif -endif - -SRCS_CPP = \ - main.cpp - -include $(topdir)/build/exe.mk - -LINK = $(CCC) $(LINKAGE) - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/utils/flacdiff/flacdiff.vcproj b/src/utils/flacdiff/flacdiff.vcproj deleted file mode 100644 index e7831e2e..00000000 --- a/src/utils/flacdiff/flacdiff.vcproj +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/flacdiff/flacdiff.vcxproj b/src/utils/flacdiff/flacdiff.vcxproj deleted file mode 100644 index 448f2695..00000000 --- a/src/utils/flacdiff/flacdiff.vcxproj +++ /dev/null @@ -1,182 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc93-c215-11db-8314-0800200c9a66} - flacdiff - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - $(SolutionDir)objs\$(Platform)\$(Configuration)\lib\libogg_static.lib;%(AdditionalDependencies) - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - {4cefbc86-c215-11db-8314-0800200c9a66} - false - - - {4cefbc84-c215-11db-8314-0800200c9a66} - - - {4cefbe02-c215-11db-8314-0800200c9a66} - false - - - - - - \ No newline at end of file diff --git a/src/utils/flacdiff/flacdiff.vcxproj.filters b/src/utils/flacdiff/flacdiff.vcxproj.filters deleted file mode 100644 index 61a7d129..00000000 --- a/src/utils/flacdiff/flacdiff.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/src/utils/flacdiff/main.cpp b/src/utils/flacdiff/main.cpp deleted file mode 100644 index 6a42db15..00000000 --- a/src/utils/flacdiff/main.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* flacdiff - Displays where two FLAC streams differ - * Copyright (C) 2007-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include "FLAC++/decoder.h" -#include "share/compat.h" - -#ifdef _MSC_VER -// warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning) -#pragma warning ( disable : 4800 ) -#endif - -class AutoFILE { -protected: - ::FILE *f_; -public: - inline AutoFILE(const char *path, const char *mode): f_(::fopen(path, mode)) { } - inline virtual ~AutoFILE() { if (f_) (void)::fclose(f_); } - - inline operator bool() const { return 0 != f_; } - inline operator const ::FILE *() const { return f_; } - inline operator ::FILE *() { return f_; } -private: - AutoFILE(); - AutoFILE(const AutoFILE &); - void operator=(const AutoFILE &); -}; - -class Decoder: public FLAC::Decoder::Stream { -public: - Decoder(AutoFILE &f, FLAC__off_t tgt): tgtpos_((FLAC__uint64)tgt), curpos_(0), go_(true), err_(false), frame_(), f_(f) { memset(&frame_, 0, sizeof(::FLAC__Frame)); } - FLAC__uint64 tgtpos_, curpos_; - bool go_, err_; - ::FLAC__Frame frame_; -protected: - AutoFILE &f_; - // from FLAC::Decoder::Stream - virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], size_t *bytes) - { - *bytes = fread(buffer, 1, *bytes, f_); - if(ferror((FILE*)f_)) - return ::FLAC__STREAM_DECODER_READ_STATUS_ABORT; - else if(*bytes == 0 && feof((FILE*)f_)) - return ::FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; - else - return ::FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; - } - - virtual ::FLAC__StreamDecoderTellStatus tell_callback(FLAC__uint64 *absolute_byte_offset) - { - FLAC__off_t off = ftello(f_); - if(off < 0) - return ::FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - *absolute_byte_offset = off; - return ::FLAC__STREAM_DECODER_TELL_STATUS_OK; - } - - virtual bool eof_callback() - { - return (bool)feof((FILE*)f_); - } - - virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const /*buffer*/[]) - { - FLAC__uint64 pos; - if(!get_decode_position(&pos)) { - go_ = false; - err_ = true; - return ::FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - } - if(pos > tgtpos_) { - go_ = false; - frame_ = *frame; - } - else - curpos_ = pos; - return ::FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; - } - - virtual void error_callback(::FLAC__StreamDecoderErrorStatus status) - { - fprintf(stderr, "got error %d:%s\n", status, ::FLAC__StreamDecoderErrorStatusString[status]); - go_ = false; - err_ = true; - } -}; - -static bool show_diff(AutoFILE &f1, AutoFILE &f2, FLAC__off_t off) -{ - Decoder d1(f1, off), d2(f2, off); - if(!d1) { - fprintf(stderr, "ERROR: setting up decoder1, state=%s\n", d1.get_state().resolved_as_cstring(d1)); - return false; - } - if(!d2) { - fprintf(stderr, "ERROR: setting up decoder2, state=%s\n", d2.get_state().resolved_as_cstring(d2)); - return false; - } - ::FLAC__StreamDecoderInitStatus is; - if((is = d1.init()) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - fprintf(stderr, "ERROR: initializing decoder1, status=%s state=%s\n", FLAC__StreamDecoderInitStatusString[is], d1.get_state().resolved_as_cstring(d1)); - return false; - } - if((is = d2.init()) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - fprintf(stderr, "ERROR: initializing decoder2, status=%s state=%s\n", FLAC__StreamDecoderInitStatusString[is], d2.get_state().resolved_as_cstring(d2)); - return false; - } - if(!d1.process_until_end_of_metadata()) { - fprintf(stderr, "ERROR: skipping metadata in decoder1, state=%s\n", d1.get_state().resolved_as_cstring(d1)); - return false; - } - if(!d2.process_until_end_of_metadata()) { - fprintf(stderr, "ERROR: skipping metadata in decoder2, state=%s\n", d2.get_state().resolved_as_cstring(d2)); - return false; - } - while(d1.go_ && d2.go_) { - if(!d1.process_single()) { - fprintf(stderr, "ERROR: decoding frame in decoder1, state=%s\n", d1.get_state().resolved_as_cstring(d1)); - return false; - } - if(!d2.process_single()) { - fprintf(stderr, "ERROR: decoding frame in decoder2, state=%s\n", d2.get_state().resolved_as_cstring(d2)); - return false; - } - } - if(d1.err_) { - fprintf(stderr, "ERROR: got err_ in decoder1, state=%s\n", d1.get_state().resolved_as_cstring(d1)); - return false; - } - if(d2.err_) { - fprintf(stderr, "ERROR: got err_ in decoder2, state=%s\n", d2.get_state().resolved_as_cstring(d2)); - return false; - } - if(d1.go_ != d2.go_) { - fprintf(stderr, "ERROR: d1.go_(%s) != d2.go_(%s)\n", d1.go_?"true":"false", d2.go_?"true":"false"); - return false; - } - fprintf(stdout, "pos1 = %" PRIu64 " blocksize=%u sample#%" PRIu64 " frame#%" PRIu64 "\n", d1.curpos_, d1.frame_.header.blocksize, d1.frame_.header.number.sample_number, d1.frame_.header.number.sample_number / d1.frame_.header.blocksize); - fprintf(stdout, "pos2 = %" PRIu64 " blocksize=%u sample#%" PRIu64 " frame#%" PRIu64 "\n", d2.curpos_, d2.frame_.header.blocksize, d2.frame_.header.number.sample_number, d2.frame_.header.number.sample_number / d2.frame_.header.blocksize); - - return true; -} - -static FLAC__off_t get_diff_offset(AutoFILE &f1, AutoFILE &f2) -{ - FLAC__off_t off = 0; - while(1) { - if(feof((FILE*)f1) && feof((FILE*)f2)) { - fprintf(stderr, "ERROR: files are identical\n"); - return -1; - } - if(feof((FILE*)f1)) { - fprintf(stderr, "ERROR: file1 EOF\n"); - return -1; - } - if(feof((FILE*)f2)) { - fprintf(stderr, "ERROR: file2 EOF\n"); - return -1; - } - if(fgetc(f1) != fgetc(f2)) - return off; - off++; - } -} - -static bool run(const char *fn1, const char *fn2) -{ - FLAC__off_t off; - AutoFILE f1(fn1, "rb"), f2(fn2, "rb"); - - if(!f1) { - flac_fprintf(stderr, "ERROR: opening %s for reading\n", fn1); - return false; - } - if(!f2) { - flac_fprintf(stderr, "ERROR: opening %s for reading\n", fn2); - return false; - } - - if((off = get_diff_offset(f1, f2)) < 0) - return false; - - fprintf(stdout, "got diff offset = %" PRId64 "\n", off); - - return show_diff(f1, f2, off); -} - -int main(int argc, char *argv[]) -{ - const char *usage = "usage: flacdiff flacfile1 flacfile2\n"; - -#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 - - if(argc > 1 && 0 == strcmp(argv[1], "-h")) { - printf(usage); - return 0; - } - else if(argc != 3) { - fprintf(stderr, usage); - return 255; - } - - return run(argv[1], argv[2])? 0 : 1; -} diff --git a/src/utils/flactimer/CMakeLists.txt b/src/utils/flactimer/CMakeLists.txt deleted file mode 100644 index 47bf1e5f..00000000 --- a/src/utils/flactimer/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -add_executable(flactimer main.cpp) -target_link_libraries(flactimer FLAC++) diff --git a/src/utils/flactimer/Makefile.am b/src/utils/flactimer/Makefile.am deleted file mode 100644 index cfe209cb..00000000 --- a/src/utils/flactimer/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -# flactimer - Runs a command and prints timing information -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - flactimer.vcproj \ - flactimer.vcxproj \ - flactimer.vcxproj.filters \ - main.cpp diff --git a/src/utils/flactimer/Makefile.lite b/src/utils/flactimer/Makefile.lite deleted file mode 100644 index b0a98347..00000000 --- a/src/utils/flactimer/Makefile.lite +++ /dev/null @@ -1,43 +0,0 @@ -# flactimer - Runs a command and prints timing information -# Copyright (C) 2007-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = ../../.. -libdir = $(topdir)/objs/$(BUILD)/lib - -PROGRAM_NAME = flactimer - -INCLUDES = -I$(topdir)/include - -ifeq ($(OS),Darwin) - EXPLICIT_LIBS = -lm -else - LIBS = -lm -endif - -SRCS_CPP = \ - main.cpp - -include $(topdir)/build/exe.mk - -LINK = $(CCC) $(LINKAGE) - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/src/utils/flactimer/flactimer.vcproj b/src/utils/flactimer/flactimer.vcproj deleted file mode 100644 index b18bf60c..00000000 --- a/src/utils/flactimer/flactimer.vcproj +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/utils/flactimer/flactimer.vcxproj b/src/utils/flactimer/flactimer.vcxproj deleted file mode 100644 index 9dd83226..00000000 --- a/src/utils/flactimer/flactimer.vcxproj +++ /dev/null @@ -1,165 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4cefbc95-c215-11db-8314-0800200c9a66} - flactimer - Win32Proj - - - - Application - true - - - Application - true - - - Application - - - Application - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.30501.0 - - - $(SolutionDir)objs\$(Configuration)\bin\ - true - - - true - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - $(SolutionDir)objs\$(Configuration)\bin\ - false - - - false - $(SolutionDir)objs\$(Platform)\$(Configuration)\bin\ - - - - Disabled - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - MachineX86 - - - - - Disabled - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;DEBUG;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - - - - - true - Speed - true - true - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - MachineX86 - - - - - true - Speed - true - true - .;..\..\..\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreaded - false - Level3 - ProgramDatabase - 4267;4996;%(DisableSpecificWarnings) - - - uuid.lib;%(IgnoreSpecificDefaultLibraries) - true - Console - true - true - UseLinkTimeCodeGeneration - - - - - - - - - \ No newline at end of file diff --git a/src/utils/flactimer/flactimer.vcxproj.filters b/src/utils/flactimer/flactimer.vcxproj.filters deleted file mode 100644 index bc32d545..00000000 --- a/src/utils/flactimer/flactimer.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93993580-89BD-4b40-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4CF737F1-C7A5-4367-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - Source Files - - - \ No newline at end of file diff --git a/src/utils/flactimer/main.cpp b/src/utils/flactimer/main.cpp deleted file mode 100644 index 62f00e45..00000000 --- a/src/utils/flactimer/main.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/* flactimer - Runs a command and prints timing information - * Copyright (C) 2007-2009 Josh Coalson - * Copyright (C) 2011-2016 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include "share/compat.h" -#include "share/safe_str.h" - -static inline uint64_t time2nsec(const FILETIME &t) -{ - uint64_t n = t.dwHighDateTime; - n <<= 32; - n |= (uint64_t)t.dwLowDateTime; - return n * 100; -} - -static void printtime(FILE *fout, uint64_t nsec, uint64_t total) -{ - uint32_t pct = (uint32_t)(100.0 * ((double)nsec / (double)total)); - uint64_t msec = nsec / 1000000; nsec -= msec * 1000000; - uint64_t sec = msec / 1000; msec -= sec * 1000; - uint64_t min = sec / 60; sec -= min * 60; - uint64_t hour = min / 60; min -= hour * 60; - fprintf(fout, " %5u.%03u = %02u:%02u:%02u.%03u = %3u%%\n", - (uint32_t)((hour*60+min)*60+sec), - (uint32_t)msec, - (uint32_t)hour, - (uint32_t)min, - (uint32_t)sec, - (uint32_t)msec, - pct - ); -} - -int main(int argc, char *argv[]) -{ - const char *usage = "usage: flactimer [-1 | -2 | -o outputfile] command\n"; - FILE *fout = stderr; - - if(argc == 1 || (argc > 1 && 0 == strcmp(argv[1], "-h"))) { - fprintf(stderr, usage); - return 0; - } - argv++; - argc--; - if(0 == strcmp(argv[0], "-1") || 0 == strcmp(argv[0], "/1")) { - fout = stdout; - argv++; - argc--; - } - else if(0 == strcmp(argv[0], "-2") || 0 == strcmp(argv[0], "/2")) { - fout = stdout; - argv++; - argc--; - } - else if(0 == strcmp(argv[0], "-o")) { - if(argc < 2) { - fprintf(stderr, usage); - return 1; - } - fout = fopen(argv[1], "w"); - if(!fout) { - fprintf(stderr, "ERROR opening file %s for writing\n", argv[1]); - return 1; - } - argv += 2; - argc -= 2; - } - if(argc <= 0) { - fprintf(fout, "ERROR, no command!\n\n"); - fprintf(fout, usage); - fclose(fout); - return 1; - } - - // improvement: double-quote all args - int i, n = 0; - for(i = 0; i < argc; i++) { - if(i > 0) - n++; - n += strlen(argv[i]); - } - char *args = (char*)malloc(n+1); - if(!args) { - fprintf(fout, "ERROR, no memory\n"); - fclose(fout); - return 1; - } - args[0] = '\0'; - for(i = 0; i < argc; i++) { - if(i > 0) - safe_strncat(args, " ", sizeof(args)); - safe_strncat(args, argv[i], sizeof(args)); - } - - //fprintf(stderr, "@@@ cmd=[%s] args=[%s]\n", argv[0], args); - - STARTUPINFOA si; - GetStartupInfoA(&si); - - DWORD wallclock_msec = GetTickCount(); - - PROCESS_INFORMATION pi; - BOOL ok = CreateProcessA( - argv[0], // lpApplicationName - args, // lpCommandLine - NULL, // lpProcessAttributes - NULL, // lpThreadAttributes - FALSE, // bInheritHandles - 0, // dwCreationFlags - NULL, // lpEnvironment - NULL, // lpCurrentDirectory - &si, // lpStartupInfo (inherit from this proc?) - &pi // lpProcessInformation - ); - - if(!ok) { - fprintf(fout, "ERROR running command\n"); - free(args); //@@@ ok to free here or have to wait to wait till process is reaped? - fclose(fout); - return 1; - } - - //fprintf(stderr, "@@@ waiting...\n"); - WaitForSingleObject(pi.hProcess, INFINITE); - //fprintf(stderr, "@@@ done\n"); - - wallclock_msec = GetTickCount() - wallclock_msec; - - FILETIME creation_time; - FILETIME exit_time; - FILETIME kernel_time; - FILETIME user_time; - if(!GetProcessTimes(pi.hProcess, &creation_time, &exit_time, &kernel_time, &user_time)) { - fprintf(fout, "ERROR getting time info\n"); - free(args); //@@@ ok to free here or have to wait to wait till process is reaped? - fclose(fout); - return 1; - } - uint64_t kernel_nsec = time2nsec(kernel_time); - uint64_t user_nsec = time2nsec(user_time); - - fprintf(fout, "Kernel Time = "); printtime(fout, kernel_nsec, (uint64_t)wallclock_msec * 1000000); - fprintf(fout, "User Time = "); printtime(fout, user_nsec, (uint64_t)wallclock_msec * 1000000); - fprintf(fout, "Process Time = "); printtime(fout, kernel_nsec+user_nsec, (uint64_t)wallclock_msec * 1000000); - fprintf(fout, "Global Time = "); printtime(fout, (uint64_t)wallclock_msec * 1000000, (uint64_t)wallclock_msec * 1000000); - - CloseHandle(pi.hThread); - CloseHandle(pi.hProcess); - - free(args); //@@@ always causes crash, maybe CreateProcess takes ownership? - fclose(fout); - return 0; -} diff --git a/src/utils/loudness/loudness.sci b/src/utils/loudness/loudness.sci deleted file mode 100644 index a476a170..00000000 --- a/src/utils/loudness/loudness.sci +++ /dev/null @@ -1,115 +0,0 @@ -// Equal Loudness Filter -// -// Adapted from original MATLAB code written by David Robinson -// -// http://replaygain.hydrogenaudio.org/proposal/equal_loudness.html -// http://replaygain.hydrogenaudio.org/proposal/mfiles/equalloudfilt.m - -// ***************************************************************************** -// Print Filter Coefficients -// -// This function takes a vector of filter tap settings, and prints -// each tap setting from least significant to most significant. - -function c=printcoeff(p) - - c=coeff(p); - c=c($:-1:1); - - for ix = 1:1:length(c) - if ix > 1 - printf(" ") - end - printf("%.14f", c(ix)); - end - -endfunction - -// ***************************************************************************** -// Equal Loudness Filter -// -// This function is adapted from David Robison's original MATLAB code. -// Apart from changes to port it to scilab, the other change is to -// use a single specification of the frequency points in the 80dB Equal -// Loudness curve. -// -// The original code had different curves for different sampling -// frequencies. This code dynamically computes the current data -// points to use as determined by the Nyquist frequency. - -function [a1,b1,a2,b2]=equalloudfilt(fs); -// Design a filter to match equal loudness curves -// 9/7/2001 - -[%nargout,%nargin]=argn(0); - -// If the user hasn't specified a sampling frequency, use the CD default -if %nargin<1 then - fs=44100; -end - -// Specify the 80 dB Equal Loudness curve -EL80=[0,120;20,113;30,103;40,97;50,93;60,91;70,89;80,87;90,86; .. - .. - 100,85;200,78;300,76;400,76;500,76;600,76;700,77;800,78;900,79.5; .. - .. - 1000,80;1500,79;2000,77;2500,74;3000,71.5;3700,70;4000,70.5; .. - 5000,74;6000,79;7000,84;8000,86;9000,86; .. - .. - 10000,85;12000,95;15000,110;20000,125;24000,140]; - -for ex = 1:1:length(EL80(:,1)) - if EL80(ex,1) > fs/2 - EL80 = [ EL80(1:ex-1,:); fs/2, EL80(ex-1,2) ]; - break - elseif EL80(ex,1) == fs/2 - EL80 = EL80(1:ex,:); - break - end - if ex == length(EL80(:,1)) - EL80 = [ EL80(1:$, :); fs/2, EL80($,2) ]; - end -end - -// convert frequency and amplitude of the equal loudness curve into format suitable for yulewalk -f=EL80(:,1)./(fs/2); -m=10.^((70-EL80(:,2))/20); - -// Use a MATLAB utility to design a best bit IIR filter -[b1,a1]=yulewalk(10,f,m); - -// Add a 2nd order high pass filter at 150Hz to finish the job -hz=iir(2,'hp','butt',[150/fs,0],[1e-3 1e-3]); -b2=numer(hz); // b2=b2($:-1:1); -a2=denom(hz); // a2=a2($:-1:1); - -endfunction - -// ***************************************************************************** -// Generate Filter Taps -// -// Generate the filter taps for each of the desired frequencies. - -format('v', 16); - -freqs = [ 8000 11025 12000 16000 18900 22050 24000 .. - 28000 32000 36000 37800 44100 48000 ]; - -for fx = 1:1:length(freqs) - - printf("\n%d\n", freqs(fx)); - - [a1,b1,a2,b2] = equalloudfilt(freqs(fx)); - - printf("{ "); bb=printcoeff(b1); printf(" }\n"); - printf("{ "); aa=printcoeff(a1); printf(" }\n"); - - printf("{ "); printcoeff(b2); printf(" }\n"); - printf("{ "); printcoeff(a2); printf(" }\n"); - -// freqz_fwd(bb,aa,1024,freqs(fx)); - -end - - -quit diff --git a/strip_non_asm_libtool_args.sh b/strip_non_asm_libtool_args.sh deleted file mode 100755 index d5a61f15..00000000 --- a/strip_non_asm_libtool_args.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# -# libtool assumes that the compiler can handle the -fPIC flag. -# This isn't always true (for example, nasm can't handle it). -# Also, on some versions of OS X it tries to pass -fno-common -# to 'as' which causes problems. -command="" -while [ $1 ]; do - if [ "$1" != "-fPIC" ]; then - if [ "$1" != "-DPIC" ]; then - if [ "$1" != "-fno-common" ]; then - command="$command $1" - fi - fi - fi - shift -done -echo $command -exec $command diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 238144cc..00000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -if(NOT UNIX) - return() -endif() - -if(WIN32) - set(EXEEXT .exe) -endif() -set(top_srcdir "${PROJECT_SOURCE_DIR}") -set(top_builddir "${PROJECT_BINARY_DIR}") -configure_file(common.sh.in common.sh @ONLY) - -set(ALL_TESTS libFLAC grabbag flac metaflac replaygain seeking streams compression) - -add_test(NAME libFLAC - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -if(BUILD_CXXLIBS) - add_test(NAME libFLAC++ - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_libFLAC++.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - list(APPEND ALL_TESTS libFLAC++) -endif() -file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/cuesheets") -add_test(NAME grabbag - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_grabbag.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -add_test(NAME flac - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_flac.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/metaflac-test-files") -add_test(NAME metaflac - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_metaflac.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -add_test(NAME replaygain - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_replaygain.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -add_test(NAME seeking - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_seeking.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -add_test(NAME streams - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_streams.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") -# increase this if standard 1500 seconds are not enough -# set_tests_properties(streams PROPERTIES TIMEOUT 1500) -add_test(NAME compression - COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_compression.sh" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - -set_property(TEST ${ALL_TESTS} APPEND PROPERTY ENVIRONMENT ECHO_C=\\c) diff --git a/test/Makefile.am b/test/Makefile.am deleted file mode 100644 index dcd911d9..00000000 --- a/test/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -TESTS_ENVIRONMENT = FLAC__TEST_LEVEL=@FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND=@FLAC__TEST_WITH_VALGRIND@ ECHO_N="@ECHO_N@" ECHO_C="@ECHO_C@" - -SUBDIRS = cuesheets flac-to-flac-metadata-test-files metaflac-test-files pictures - -check_SCRIPTS = \ - test_libFLAC.sh \ - test_libFLAC++.sh \ - test_grabbag.sh \ - test_flac.sh \ - test_metaflac.sh \ - test_replaygain.sh \ - test_seeking.sh \ - test_streams.sh \ - test_compression.sh - -# This one should pass when building out-of-tree (e.g. 'make distcheck'). -check: $(check_SCRIPTS) - $(TESTS_ENVIRONMENT) $(srcdir)/test_libFLAC.sh -if FLaC__WITH_CPPLIBS - $(TESTS_ENVIRONMENT) $(srcdir)/test_libFLAC++.sh -endif - $(TESTS_ENVIRONMENT) $(srcdir)/test_grabbag.sh - $(TESTS_ENVIRONMENT) $(srcdir)/test_flac.sh - $(TESTS_ENVIRONMENT) $(srcdir)/test_metaflac.sh - $(TESTS_ENVIRONMENT) $(srcdir)/test_replaygain.sh - $(TESTS_ENVIRONMENT) $(srcdir)/test_seeking.sh - $(TESTS_ENVIRONMENT) $(srcdir)/test_streams.sh - $(TESTS_ENVIRONMENT) $(srcdir)/test_compression.sh - @echo "----------------" - @echo "All tests passed" - @echo "----------------" - -EXTRA_DIST = \ - CMakeLists.txt \ - Makefile.lite \ - cuesheet.ok \ - metaflac.flac.in \ - metaflac.flac.ok \ - picture.ok \ - $(check_SCRIPTS) \ - write_iff.pl - -clean-local: - -rm -f *.raw *.flac *.oga *.ogg *.cmp *.aiff *.wav *.w64 *.rf64 *.diff *.log *.cue core diff --git a/test/Makefile.lite b/test/Makefile.lite deleted file mode 100644 index 0bec1a1c..00000000 --- a/test/Makefile.lite +++ /dev/null @@ -1,56 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -# -# GNU makefile -# - -topdir = .. - -DEFAULT_CONFIG = release - -CONFIG = $(DEFAULT_CONFIG) - -all: clean - sed 's|@top_srcdir@|$(topdir)|;s|@EXEEXT@| |' common.sh.in > common.sh - $(FLAC__TEST_LEVEL) $(FLAC__TEST_WITH_VALGRIND) ./test_libFLAC.sh $(CONFIG) - $(FLAC__TEST_LEVEL) $(FLAC__TEST_WITH_VALGRIND) ./test_libFLAC++.sh $(CONFIG) - $(FLAC__TEST_LEVEL) $(FLAC__TEST_WITH_VALGRIND) ./test_grabbag.sh $(CONFIG) - $(FLAC__TEST_LEVEL) $(FLAC__TEST_WITH_VALGRIND) ./test_flac.sh $(CONFIG) - $(FLAC__TEST_LEVEL) $(FLAC__TEST_WITH_VALGRIND) ./test_metaflac.sh $(CONFIG) - $(FLAC__TEST_LEVEL) $(FLAC__TEST_WITH_VALGRIND) ./test_seeking.sh $(CONFIG) - $(FLAC__TEST_LEVEL) $(FLAC__TEST_WITH_VALGRIND) ./test_streams.sh $(CONFIG) - -debug : FLAC__TEST_LEVEL=FLAC__TEST_LEVEL=2 -valgrind: FLAC__TEST_LEVEL=FLAC__TEST_LEVEL=1 -release : FLAC__TEST_LEVEL=FLAC__TEST_LEVEL=2 - -debug : FLAC__TEST_WITH_VALGRIND=FLAC__TEST_WITH_VALGRIND=no -valgrind: FLAC__TEST_WITH_VALGRIND=FLAC__TEST_WITH_VALGRIND=yes -release : FLAC__TEST_WITH_VALGRIND=FLAC__TEST_WITH_VALGRIND=no - -debug : CONFIG = debug -valgrind: CONFIG = debug -release : CONFIG = release - -debug : all -valgrind: all -release : all - -clean: - rm -f *.raw *.flac *.oga *.ogg *.cmp *.aiff *.wav *.w64 *.rf64 *.diff *.log *.cue core flac-to-flac-metadata-test-files/out.* metaflac-test-files/out.* diff --git a/test/common.sh.in b/test/common.sh.in deleted file mode 100644 index 0884bbc5..00000000 --- a/test/common.sh.in +++ /dev/null @@ -1,83 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -export MALLOC_CHECK_=3 -export MALLOC_PERTURB_=$((RANDOM % 255 + 1)) - -if [ x = x"$1" ] ; then - BUILD=debug -else - BUILD="$1" -fi - -LD_LIBRARY_PATH=../objs/$BUILD/lib:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../objs/$BUILD/lib:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../src/libFLAC/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../src/share/getopt/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../src/share/grabbag/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=`pwd`/../src/share/utf8/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=../src/libFLAC/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=../src/libFLAC++/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=../src/share/getopt/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=../src/share/grabbag/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=../src/share/utf8/.libs:$LD_LIBRARY_PATH - -export LD_LIBRARY_PATH - -EXE=@EXEEXT@ - -# Needed for building out-of-tree where source files are in the $top_srcdir tree -# and build products in the $top_builddir tree. -top_srcdir=@top_srcdir@ -top_builddir=@top_builddir@ - -# Set `is_win` variable which is used in other scripts that source this one. -if test $(env | grep -ic '^comspec=') != 0 ; then - is_win=yes -else - is_win=no -fi - -# change to 'false' to show all flac/metaflac output (useful for debugging) -if true ; then - SILENT='--silent' - TOTALLY_SILENT='--totally-silent' -else - SILENT='' - TOTALLY_SILENT='' -fi - -# Functions - -die () -{ - echo $* 1>&2 - exit 1 -} - -make_streams () -{ - echo "Generating streams..." - if [ ! -f wacky1.wav ] ; then - test_streams${EXE} || die "ERROR during test_streams" - fi -} diff --git a/test/cuesheet.ok b/test/cuesheet.ok deleted file mode 100644 index dc9c82f0..00000000 --- a/test/cuesheet.ok +++ /dev/null @@ -1,94 +0,0 @@ -NEGATIVE cuesheets/bad.000.CATALOG_multiple.cue -pass1: parse error, line 2: "found multiple CATALOG commands" -NEGATIVE cuesheets/bad.001.CATALOG_missing_number.cue -pass1: parse error, line 1: "CATALOG is missing catalog number" -NEGATIVE cuesheets/bad.002.CATALOG_number_too_long.cue -pass1: parse error, line 1: "CATALOG number is too long" -NEGATIVE cuesheets/bad.003.CATALOG_not_13_digits.cue -pass1: parse error, line 1: "CD-DA CATALOG number must be 13 decimal digits" -NEGATIVE cuesheets/bad.030.FLAGS_multiple.cue -pass1: parse error, line 4: "found multiple FLAGS commands" -NEGATIVE cuesheets/bad.031.FLAGS_wrong_place_1.cue -pass1: parse error, line 1: "FLAGS command must come after TRACK but before INDEX" -NEGATIVE cuesheets/bad.032.FLAGS_wrong_place_2.cue -pass1: parse error, line 4: "FLAGS command must come after TRACK but before INDEX" -NEGATIVE cuesheets/bad.060.INDEX_wrong_place.cue -pass1: parse error, line 2: "found INDEX before any TRACK" -NEGATIVE cuesheets/bad.061.INDEX_missing_number.cue -pass1: parse error, line 4: "INDEX is missing index number" -NEGATIVE cuesheets/bad.062.INDEX_invalid_number_1.cue -pass1: parse error, line 4: "INDEX has invalid index number" -NEGATIVE cuesheets/bad.063.first_INDEX_not_0_or_1.cue -pass1: parse error, line 4: "first INDEX number of a TRACK must be 0 or 1" -NEGATIVE cuesheets/bad.064.INDEX_num_non_sequential.cue -pass1: parse error, line 5: "INDEX numbers must be sequential" -NEGATIVE cuesheets/bad.065.INDEX_num_out_of_range.cue -pass1: parse error, line 104: "CD-DA INDEX number must be between 0 and 99, inclusive" -NEGATIVE cuesheets/bad.066.INDEX_missing_offset.cue -pass1: parse error, line 4: "INDEX is missing an offset after the index number" -NEGATIVE cuesheets/bad.067.INDEX_illegal_offset.cue -pass1: parse error, line 4: "illegal INDEX offset (not of the form MM:SS:FF)" -NEGATIVE cuesheets/bad.068.INDEX_cdda_illegal_offset.cue -pass1: parse error, line 4: "illegal INDEX offset (not of the form MM:SS:FF)" -NEGATIVE cuesheets/bad.069.nonzero_first_INDEX.cue -pass1: parse error, line 4: "first INDEX of first TRACK must have an offset of 00:00:00" -NEGATIVE cuesheets/bad.070.INDEX_offset_not_ascending_1.cue -pass1: parse error, line 5: "CD-DA INDEX offsets must increase in time" -NEGATIVE cuesheets/bad.071.INDEX_offset_not_ascending_2.cue -pass1: parse error, line 6: "CD-DA INDEX offsets must increase in time" -NEGATIVE cuesheets/bad.110.ISRC_multiple.cue -pass1: parse error, line 4: "found multiple ISRC commands" -NEGATIVE cuesheets/bad.111.ISRC_wrong_place_1.cue -pass1: parse error, line 2: "ISRC command must come after TRACK but before INDEX" -NEGATIVE cuesheets/bad.112.ISRC_wrong_place_2.cue -pass1: parse error, line 4: "ISRC command must come after TRACK but before INDEX" -NEGATIVE cuesheets/bad.113.ISRC_missing_number.cue -pass1: parse error, line 3: "ISRC is missing ISRC number" -NEGATIVE cuesheets/bad.114.ISRC_invalid_number.cue -pass1: parse error, line 3: "invalid ISRC number" -NEGATIVE cuesheets/bad.130.TRACK_missing_INDEX_01_1.cue -pass1: parse error, line 2: "previous TRACK must specify at least one INDEX 01" -NEGATIVE cuesheets/bad.131.TRACK_missing_INDEX_01_2.cue -pass1: parse error, line 3: "previous TRACK must specify at least one INDEX 01" -NEGATIVE cuesheets/bad.132.TRACK_missing_INDEX_01_3.cue -pass1: parse error, line 3: "previous TRACK must specify at least one INDEX 01" -NEGATIVE cuesheets/bad.133.TRACK_missing_INDEX_01_4.cue -pass1: parse error, line 4: "previous TRACK must specify at least one INDEX 01" -NEGATIVE cuesheets/bad.134.TRACK_missing_number.cue -pass1: parse error, line 2: "TRACK is missing track number" -NEGATIVE cuesheets/bad.135.TRACK_invalid_number_1.cue -pass1: parse error, line 2: "TRACK has invalid track number" -NEGATIVE cuesheets/bad.136.TRACK_invalid_number_2.cue -pass1: parse error, line 2: "TRACK number must be greater than 0" -NEGATIVE cuesheets/bad.137.TRACK_cdda_out_of_range.cue -pass1: parse error, line 2: "CD-DA TRACK number must be between 1 and 99, inclusive" -NEGATIVE cuesheets/bad.138.TRACK_num_non_sequential.cue -pass1: parse error, line 6: "CD-DA TRACK numbers must be sequential" -NEGATIVE cuesheets/bad.139.TRACK_missing_type.cue -pass1: parse error, line 2: "TRACK is missing a track type after the track number" -NEGATIVE cuesheets/bad.140.no_TRACKs.cue -pass1: parse error, line 1: "there must be at least one TRACK command" -NEGATIVE cuesheets/bad.200.FLAC_leadin_missing_offset.cue -pass1: parse error, line 1: "FLAC__lead-in is missing offset" -NEGATIVE cuesheets/bad.201.FLAC_leadin_illegal_offset.cue -pass1: parse error, line 1: "illegal FLAC__lead-in offset" -NEGATIVE cuesheets/bad.202.FLAC_leadin_cdda_illegal_offset.cue -pass1: parse error, line 1: "illegal CD-DA FLAC__lead-in offset, must be even multiple of 588 samples" -NEGATIVE cuesheets/bad.230.FLAC_leadout_multiple.cue -pass1: parse error, line 3: "multiple FLAC__lead-out commands" -NEGATIVE cuesheets/bad.231.FLAC_leadout_missing_track.cue -pass1: parse error, line 1: "FLAC__lead-out is missing track number" -NEGATIVE cuesheets/bad.232.FLAC_leadout_illegal_track.cue -pass1: parse error, line 1: "illegal FLAC__lead-out track number" -NEGATIVE cuesheets/bad.233.FLAC_leadout_missing_offset.cue -pass1: parse error, line 1: "FLAC__lead-out is missing offset" -NEGATIVE cuesheets/bad.234.FLAC_leadout_illegal_offset.cue -pass1: parse error, line 1: "illegal FLAC__lead-out offset" -NEGATIVE cuesheets/bad.235.FLAC_leadout_offset_not_211680000.cue -pass1: parse error, line 1: "FLAC__lead-out offset does not match end-of-stream offset" -POSITIVE cuesheets/good.000.cue -POSITIVE cuesheets/good.001.cue -POSITIVE cuesheets/good.002.dos_format.cue -POSITIVE cuesheets/good.003.missing_final_newline.cue -POSITIVE cuesheets/good.004.dos_format.missing_final_newline.cue -POSITIVE cuesheets/good.005.quoted.isrc.cue diff --git a/test/cuesheets/Makefile.am b/test/cuesheets/Makefile.am deleted file mode 100644 index eb491715..00000000 --- a/test/cuesheets/Makefile.am +++ /dev/null @@ -1,69 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -EXTRA_DIST = \ - bad.000.CATALOG_multiple.cue \ - bad.001.CATALOG_missing_number.cue \ - bad.002.CATALOG_number_too_long.cue \ - bad.003.CATALOG_not_13_digits.cue \ - bad.030.FLAGS_multiple.cue \ - bad.031.FLAGS_wrong_place_1.cue \ - bad.032.FLAGS_wrong_place_2.cue \ - bad.060.INDEX_wrong_place.cue \ - bad.061.INDEX_missing_number.cue \ - bad.062.INDEX_invalid_number_1.cue \ - bad.063.first_INDEX_not_0_or_1.cue \ - bad.064.INDEX_num_non_sequential.cue \ - bad.065.INDEX_num_out_of_range.cue \ - bad.066.INDEX_missing_offset.cue \ - bad.067.INDEX_illegal_offset.cue \ - bad.068.INDEX_cdda_illegal_offset.cue \ - bad.069.nonzero_first_INDEX.cue \ - bad.070.INDEX_offset_not_ascending_1.cue \ - bad.071.INDEX_offset_not_ascending_2.cue \ - bad.110.ISRC_multiple.cue \ - bad.111.ISRC_wrong_place_1.cue \ - bad.112.ISRC_wrong_place_2.cue \ - bad.113.ISRC_missing_number.cue \ - bad.114.ISRC_invalid_number.cue \ - bad.130.TRACK_missing_INDEX_01_1.cue \ - bad.131.TRACK_missing_INDEX_01_2.cue \ - bad.132.TRACK_missing_INDEX_01_3.cue \ - bad.133.TRACK_missing_INDEX_01_4.cue \ - bad.134.TRACK_missing_number.cue \ - bad.135.TRACK_invalid_number_1.cue \ - bad.136.TRACK_invalid_number_2.cue \ - bad.137.TRACK_cdda_out_of_range.cue \ - bad.138.TRACK_num_non_sequential.cue \ - bad.139.TRACK_missing_type.cue \ - bad.140.no_TRACKs.cue \ - bad.200.FLAC_leadin_missing_offset.cue \ - bad.201.FLAC_leadin_illegal_offset.cue \ - bad.202.FLAC_leadin_cdda_illegal_offset.cue \ - bad.230.FLAC_leadout_multiple.cue \ - bad.231.FLAC_leadout_missing_track.cue \ - bad.232.FLAC_leadout_illegal_track.cue \ - bad.233.FLAC_leadout_missing_offset.cue \ - bad.234.FLAC_leadout_illegal_offset.cue \ - bad.235.FLAC_leadout_offset_not_211680000.cue \ - good.000.cue \ - good.001.cue \ - good.002.dos_format.cue \ - good.003.missing_final_newline.cue \ - good.004.dos_format.missing_final_newline.cue \ - good.005.quoted.isrc.cue diff --git a/test/cuesheets/bad.000.CATALOG_multiple.cue b/test/cuesheets/bad.000.CATALOG_multiple.cue deleted file mode 100644 index ef2769bf..00000000 --- a/test/cuesheets/bad.000.CATALOG_multiple.cue +++ /dev/null @@ -1,5 +0,0 @@ -CATALOG 1234567890123 -CATALOG 0234567890123 -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.001.CATALOG_missing_number.cue b/test/cuesheets/bad.001.CATALOG_missing_number.cue deleted file mode 100644 index ce2334f1..00000000 --- a/test/cuesheets/bad.001.CATALOG_missing_number.cue +++ /dev/null @@ -1,4 +0,0 @@ -CATALOG -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.002.CATALOG_number_too_long.cue b/test/cuesheets/bad.002.CATALOG_number_too_long.cue deleted file mode 100644 index 8585a0ae..00000000 --- a/test/cuesheets/bad.002.CATALOG_number_too_long.cue +++ /dev/null @@ -1,4 +0,0 @@ -CATALOG 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.003.CATALOG_not_13_digits.cue b/test/cuesheets/bad.003.CATALOG_not_13_digits.cue deleted file mode 100644 index c75d4c0e..00000000 --- a/test/cuesheets/bad.003.CATALOG_not_13_digits.cue +++ /dev/null @@ -1,4 +0,0 @@ -CATALOG 123456789012z -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.030.FLAGS_multiple.cue b/test/cuesheets/bad.030.FLAGS_multiple.cue deleted file mode 100644 index ee82b137..00000000 --- a/test/cuesheets/bad.030.FLAGS_multiple.cue +++ /dev/null @@ -1,5 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - FLAGS 4CH - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.031.FLAGS_wrong_place_1.cue b/test/cuesheets/bad.031.FLAGS_wrong_place_1.cue deleted file mode 100644 index 3b7f0180..00000000 --- a/test/cuesheets/bad.031.FLAGS_wrong_place_1.cue +++ /dev/null @@ -1,4 +0,0 @@ -FLAGS PRE -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.032.FLAGS_wrong_place_2.cue b/test/cuesheets/bad.032.FLAGS_wrong_place_2.cue deleted file mode 100644 index 926cc915..00000000 --- a/test/cuesheets/bad.032.FLAGS_wrong_place_2.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 - FLAGS PRE diff --git a/test/cuesheets/bad.060.INDEX_wrong_place.cue b/test/cuesheets/bad.060.INDEX_wrong_place.cue deleted file mode 100644 index fb175f27..00000000 --- a/test/cuesheets/bad.060.INDEX_wrong_place.cue +++ /dev/null @@ -1,5 +0,0 @@ -FILE "z.wav" WAVE -INDEX 00 00:00:00 - TRACK 01 AUDIO - FLAGS PRE - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.061.INDEX_missing_number.cue b/test/cuesheets/bad.061.INDEX_missing_number.cue deleted file mode 100644 index bf72604b..00000000 --- a/test/cuesheets/bad.061.INDEX_missing_number.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX diff --git a/test/cuesheets/bad.062.INDEX_invalid_number_1.cue b/test/cuesheets/bad.062.INDEX_invalid_number_1.cue deleted file mode 100644 index fcb4dd30..00000000 --- a/test/cuesheets/bad.062.INDEX_invalid_number_1.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX thhpt! diff --git a/test/cuesheets/bad.063.first_INDEX_not_0_or_1.cue b/test/cuesheets/bad.063.first_INDEX_not_0_or_1.cue deleted file mode 100644 index a136f3f6..00000000 --- a/test/cuesheets/bad.063.first_INDEX_not_0_or_1.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX 02 00:00:00 diff --git a/test/cuesheets/bad.064.INDEX_num_non_sequential.cue b/test/cuesheets/bad.064.INDEX_num_non_sequential.cue deleted file mode 100644 index 9df3b47b..00000000 --- a/test/cuesheets/bad.064.INDEX_num_non_sequential.cue +++ /dev/null @@ -1,5 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX 01 00:00:00 - INDEX 00 00:00:00 diff --git a/test/cuesheets/bad.065.INDEX_num_out_of_range.cue b/test/cuesheets/bad.065.INDEX_num_out_of_range.cue deleted file mode 100644 index a72d7e03..00000000 --- a/test/cuesheets/bad.065.INDEX_num_out_of_range.cue +++ /dev/null @@ -1,104 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX 00 00:00:00 - INDEX 01 02:10:15 - INDEX 02 02:20:15 - INDEX 03 02:30:15 - INDEX 04 03:30:15 - INDEX 05 03:31:15 - INDEX 06 03:32:06 - INDEX 07 03:32:07 - INDEX 08 03:32:08 - INDEX 09 03:32:09 - INDEX 10 03:32:10 - INDEX 11 03:32:11 - INDEX 12 03:32:12 - INDEX 13 03:32:13 - INDEX 14 03:32:14 - INDEX 15 03:32:15 - INDEX 16 03:32:16 - INDEX 17 03:32:17 - INDEX 18 03:32:18 - INDEX 19 03:32:19 - INDEX 20 03:32:20 - INDEX 21 03:32:21 - INDEX 22 03:32:22 - INDEX 23 03:32:23 - INDEX 24 03:32:24 - INDEX 25 03:32:25 - INDEX 26 03:32:26 - INDEX 27 03:32:27 - INDEX 28 03:32:28 - INDEX 29 03:32:29 - INDEX 30 03:32:30 - INDEX 31 03:32:31 - INDEX 32 03:32:32 - INDEX 33 03:32:33 - INDEX 34 03:32:34 - INDEX 35 03:32:35 - INDEX 36 03:32:36 - INDEX 37 03:32:37 - INDEX 38 03:32:38 - INDEX 39 03:32:39 - INDEX 40 03:32:40 - INDEX 41 03:32:41 - INDEX 42 03:32:42 - INDEX 43 03:32:43 - INDEX 44 03:32:44 - INDEX 45 03:32:45 - INDEX 46 03:32:46 - INDEX 47 03:32:47 - INDEX 48 03:32:48 - INDEX 49 03:32:49 - INDEX 50 03:32:50 - INDEX 51 03:32:51 - INDEX 52 03:32:52 - INDEX 53 03:32:53 - INDEX 54 03:32:54 - INDEX 55 03:32:55 - INDEX 56 03:32:56 - INDEX 57 03:32:57 - INDEX 58 03:32:58 - INDEX 59 03:32:59 - INDEX 60 03:32:60 - INDEX 61 03:32:61 - INDEX 62 03:32:62 - INDEX 63 03:32:63 - INDEX 64 03:32:64 - INDEX 65 03:32:65 - INDEX 66 03:32:66 - INDEX 67 03:32:67 - INDEX 68 03:32:68 - INDEX 69 03:32:69 - INDEX 70 03:40:50 - INDEX 71 03:40:51 - INDEX 72 03:40:52 - INDEX 73 03:40:53 - INDEX 74 03:40:54 - INDEX 75 03:40:55 - INDEX 76 03:40:56 - INDEX 77 03:40:57 - INDEX 78 03:40:58 - INDEX 79 03:40:59 - INDEX 80 03:41:50 - INDEX 81 03:41:51 - INDEX 82 03:41:52 - INDEX 83 03:41:53 - INDEX 84 03:41:54 - INDEX 85 03:41:55 - INDEX 86 03:41:56 - INDEX 87 03:41:57 - INDEX 88 03:41:58 - INDEX 89 03:41:59 - INDEX 90 03:42:50 - INDEX 91 03:42:51 - INDEX 92 03:42:52 - INDEX 93 03:42:53 - INDEX 94 03:42:54 - INDEX 95 03:42:55 - INDEX 96 03:42:56 - INDEX 97 03:42:57 - INDEX 98 03:42:58 - INDEX 99 03:42:59 - INDEX 100 04:00:00 diff --git a/test/cuesheets/bad.066.INDEX_missing_offset.cue b/test/cuesheets/bad.066.INDEX_missing_offset.cue deleted file mode 100644 index 1e78bc61..00000000 --- a/test/cuesheets/bad.066.INDEX_missing_offset.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX 01 diff --git a/test/cuesheets/bad.067.INDEX_illegal_offset.cue b/test/cuesheets/bad.067.INDEX_illegal_offset.cue deleted file mode 100644 index 87420296..00000000 --- a/test/cuesheets/bad.067.INDEX_illegal_offset.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX 01 00:00.00 diff --git a/test/cuesheets/bad.068.INDEX_cdda_illegal_offset.cue b/test/cuesheets/bad.068.INDEX_cdda_illegal_offset.cue deleted file mode 100644 index 6e00fed7..00000000 --- a/test/cuesheets/bad.068.INDEX_cdda_illegal_offset.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX 01 588 diff --git a/test/cuesheets/bad.069.nonzero_first_INDEX.cue b/test/cuesheets/bad.069.nonzero_first_INDEX.cue deleted file mode 100644 index 74649497..00000000 --- a/test/cuesheets/bad.069.nonzero_first_INDEX.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX 01 00:02:00 diff --git a/test/cuesheets/bad.070.INDEX_offset_not_ascending_1.cue b/test/cuesheets/bad.070.INDEX_offset_not_ascending_1.cue deleted file mode 100644 index a4fe0638..00000000 --- a/test/cuesheets/bad.070.INDEX_offset_not_ascending_1.cue +++ /dev/null @@ -1,5 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 - INDEX 02 00:02:00 - INDEX 03 00:01:74 diff --git a/test/cuesheets/bad.071.INDEX_offset_not_ascending_2.cue b/test/cuesheets/bad.071.INDEX_offset_not_ascending_2.cue deleted file mode 100644 index 8983a03c..00000000 --- a/test/cuesheets/bad.071.INDEX_offset_not_ascending_2.cue +++ /dev/null @@ -1,6 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 - INDEX 02 00:02:00 - TRACK 02 AUDIO - INDEX 01 00:01:74 diff --git a/test/cuesheets/bad.110.ISRC_multiple.cue b/test/cuesheets/bad.110.ISRC_multiple.cue deleted file mode 100644 index 907c1b80..00000000 --- a/test/cuesheets/bad.110.ISRC_multiple.cue +++ /dev/null @@ -1,5 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - ISRC ABCDE1234567 - ISRC ABCD01234567 - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.111.ISRC_wrong_place_1.cue b/test/cuesheets/bad.111.ISRC_wrong_place_1.cue deleted file mode 100644 index 86fbe905..00000000 --- a/test/cuesheets/bad.111.ISRC_wrong_place_1.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE -ISRC ABCD01234567 - TRACK 01 AUDIO - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.112.ISRC_wrong_place_2.cue b/test/cuesheets/bad.112.ISRC_wrong_place_2.cue deleted file mode 100644 index e0b4e772..00000000 --- a/test/cuesheets/bad.112.ISRC_wrong_place_2.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 - ISRC ABCD01234567 diff --git a/test/cuesheets/bad.113.ISRC_missing_number.cue b/test/cuesheets/bad.113.ISRC_missing_number.cue deleted file mode 100644 index 742e054d..00000000 --- a/test/cuesheets/bad.113.ISRC_missing_number.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - ISRC - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.114.ISRC_invalid_number.cue b/test/cuesheets/bad.114.ISRC_invalid_number.cue deleted file mode 100644 index 362130a0..00000000 --- a/test/cuesheets/bad.114.ISRC_invalid_number.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - ISRC ABCD0123456Z - INDEX 01 00:00:00 diff --git a/test/cuesheets/bad.130.TRACK_missing_INDEX_01_1.cue b/test/cuesheets/bad.130.TRACK_missing_INDEX_01_1.cue deleted file mode 100644 index 06970740..00000000 --- a/test/cuesheets/bad.130.TRACK_missing_INDEX_01_1.cue +++ /dev/null @@ -1,2 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO diff --git a/test/cuesheets/bad.131.TRACK_missing_INDEX_01_2.cue b/test/cuesheets/bad.131.TRACK_missing_INDEX_01_2.cue deleted file mode 100644 index 554cf12c..00000000 --- a/test/cuesheets/bad.131.TRACK_missing_INDEX_01_2.cue +++ /dev/null @@ -1,3 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 00 00:00:00 diff --git a/test/cuesheets/bad.132.TRACK_missing_INDEX_01_3.cue b/test/cuesheets/bad.132.TRACK_missing_INDEX_01_3.cue deleted file mode 100644 index 5618db89..00000000 --- a/test/cuesheets/bad.132.TRACK_missing_INDEX_01_3.cue +++ /dev/null @@ -1,4 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - TRACK 02 AUDIO - INDEX 01 00:02:00 diff --git a/test/cuesheets/bad.133.TRACK_missing_INDEX_01_4.cue b/test/cuesheets/bad.133.TRACK_missing_INDEX_01_4.cue deleted file mode 100644 index f74a9e40..00000000 --- a/test/cuesheets/bad.133.TRACK_missing_INDEX_01_4.cue +++ /dev/null @@ -1,5 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 00 00:00:00 - TRACK 02 AUDIO - INDEX 01 00:02:00 diff --git a/test/cuesheets/bad.134.TRACK_missing_number.cue b/test/cuesheets/bad.134.TRACK_missing_number.cue deleted file mode 100644 index f95180b8..00000000 --- a/test/cuesheets/bad.134.TRACK_missing_number.cue +++ /dev/null @@ -1,2 +0,0 @@ -FILE "z.wav" WAVE - TRACK diff --git a/test/cuesheets/bad.135.TRACK_invalid_number_1.cue b/test/cuesheets/bad.135.TRACK_invalid_number_1.cue deleted file mode 100644 index 9c3c9ea1..00000000 --- a/test/cuesheets/bad.135.TRACK_invalid_number_1.cue +++ /dev/null @@ -1,2 +0,0 @@ -FILE "z.wav" WAVE - TRACK thhpt! AUDIO diff --git a/test/cuesheets/bad.136.TRACK_invalid_number_2.cue b/test/cuesheets/bad.136.TRACK_invalid_number_2.cue deleted file mode 100644 index 69caafa8..00000000 --- a/test/cuesheets/bad.136.TRACK_invalid_number_2.cue +++ /dev/null @@ -1,2 +0,0 @@ -FILE "z.wav" WAVE - TRACK 0 AUDIO diff --git a/test/cuesheets/bad.137.TRACK_cdda_out_of_range.cue b/test/cuesheets/bad.137.TRACK_cdda_out_of_range.cue deleted file mode 100644 index 8696f520..00000000 --- a/test/cuesheets/bad.137.TRACK_cdda_out_of_range.cue +++ /dev/null @@ -1,2 +0,0 @@ -FILE "z.wav" WAVE - TRACK 100 AUDIO diff --git a/test/cuesheets/bad.138.TRACK_num_non_sequential.cue b/test/cuesheets/bad.138.TRACK_num_non_sequential.cue deleted file mode 100644 index 37870c39..00000000 --- a/test/cuesheets/bad.138.TRACK_num_non_sequential.cue +++ /dev/null @@ -1,6 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 0:0:0 - TRACK 02 AUDIO - INDEX 01 2:0:0 - TRACK 01 AUDIO diff --git a/test/cuesheets/bad.139.TRACK_missing_type.cue b/test/cuesheets/bad.139.TRACK_missing_type.cue deleted file mode 100644 index 01fca6a1..00000000 --- a/test/cuesheets/bad.139.TRACK_missing_type.cue +++ /dev/null @@ -1,2 +0,0 @@ -FILE "z.wav" WAVE - TRACK 01 diff --git a/test/cuesheets/bad.140.no_TRACKs.cue b/test/cuesheets/bad.140.no_TRACKs.cue deleted file mode 100644 index 73cb8cf5..00000000 --- a/test/cuesheets/bad.140.no_TRACKs.cue +++ /dev/null @@ -1 +0,0 @@ -FILE "z.wav" WAVE diff --git a/test/cuesheets/bad.200.FLAC_leadin_missing_offset.cue b/test/cuesheets/bad.200.FLAC_leadin_missing_offset.cue deleted file mode 100644 index 7441aa53..00000000 --- a/test/cuesheets/bad.200.FLAC_leadin_missing_offset.cue +++ /dev/null @@ -1 +0,0 @@ -REM FLAC__lead-in diff --git a/test/cuesheets/bad.201.FLAC_leadin_illegal_offset.cue b/test/cuesheets/bad.201.FLAC_leadin_illegal_offset.cue deleted file mode 100644 index acf69409..00000000 --- a/test/cuesheets/bad.201.FLAC_leadin_illegal_offset.cue +++ /dev/null @@ -1 +0,0 @@ -REM FLAC__lead-in thhpt! diff --git a/test/cuesheets/bad.202.FLAC_leadin_cdda_illegal_offset.cue b/test/cuesheets/bad.202.FLAC_leadin_cdda_illegal_offset.cue deleted file mode 100644 index 6f2d0f7d..00000000 --- a/test/cuesheets/bad.202.FLAC_leadin_cdda_illegal_offset.cue +++ /dev/null @@ -1 +0,0 @@ -REM FLAC__lead-in 123 diff --git a/test/cuesheets/bad.230.FLAC_leadout_multiple.cue b/test/cuesheets/bad.230.FLAC_leadout_multiple.cue deleted file mode 100644 index 656fe9d9..00000000 --- a/test/cuesheets/bad.230.FLAC_leadout_multiple.cue +++ /dev/null @@ -1,3 +0,0 @@ -REM FLAC__lead-in 88200 -REM FLAC__lead-out 170 211680000 -REM FLAC__lead-out 170 211680588 diff --git a/test/cuesheets/bad.231.FLAC_leadout_missing_track.cue b/test/cuesheets/bad.231.FLAC_leadout_missing_track.cue deleted file mode 100644 index a723b7a6..00000000 --- a/test/cuesheets/bad.231.FLAC_leadout_missing_track.cue +++ /dev/null @@ -1 +0,0 @@ -REM FLAC__lead-out diff --git a/test/cuesheets/bad.232.FLAC_leadout_illegal_track.cue b/test/cuesheets/bad.232.FLAC_leadout_illegal_track.cue deleted file mode 100644 index 6001826b..00000000 --- a/test/cuesheets/bad.232.FLAC_leadout_illegal_track.cue +++ /dev/null @@ -1 +0,0 @@ -REM FLAC__lead-out thhpt! diff --git a/test/cuesheets/bad.233.FLAC_leadout_missing_offset.cue b/test/cuesheets/bad.233.FLAC_leadout_missing_offset.cue deleted file mode 100644 index ef5f1dc3..00000000 --- a/test/cuesheets/bad.233.FLAC_leadout_missing_offset.cue +++ /dev/null @@ -1 +0,0 @@ -REM FLAC__lead-out 170 diff --git a/test/cuesheets/bad.234.FLAC_leadout_illegal_offset.cue b/test/cuesheets/bad.234.FLAC_leadout_illegal_offset.cue deleted file mode 100644 index 01c69f40..00000000 --- a/test/cuesheets/bad.234.FLAC_leadout_illegal_offset.cue +++ /dev/null @@ -1 +0,0 @@ -REM FLAC__lead-out 170 thhpt! diff --git a/test/cuesheets/bad.235.FLAC_leadout_offset_not_211680000.cue b/test/cuesheets/bad.235.FLAC_leadout_offset_not_211680000.cue deleted file mode 100644 index 8add1d6e..00000000 --- a/test/cuesheets/bad.235.FLAC_leadout_offset_not_211680000.cue +++ /dev/null @@ -1 +0,0 @@ -REM FLAC__lead-out 170 211680588 diff --git a/test/cuesheets/good.000.cue b/test/cuesheets/good.000.cue deleted file mode 100644 index bdfbccf9..00000000 --- a/test/cuesheets/good.000.cue +++ /dev/null @@ -1,4 +0,0 @@ -CATALOG "1234567890123" -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 diff --git a/test/cuesheets/good.001.cue b/test/cuesheets/good.001.cue deleted file mode 100644 index f9887cfa..00000000 --- a/test/cuesheets/good.001.cue +++ /dev/null @@ -1,184 +0,0 @@ -REM FLAC__lead-in 88200 -REM FLAC__lead-out 170 211680000 -CATALOG 1234567890123 -FILE "z.wav" WAVE - TRACK 01 AUDIO - FLAGS PRE - INDEX 01 00:00:00 - TRACK 02 AUDIO - FLAGS PRE - ISRC ABCDE7654321 - INDEX 00 02:09:12 - INDEX 01 02:10:15 - INDEX 02 02:20:15 - INDEX 03 02:30:15 - INDEX 04 03:30:15 - INDEX 05 03:31:15 - INDEX 06 03:32:06 - INDEX 07 03:32:07 - INDEX 08 03:32:08 - INDEX 09 03:32:09 - INDEX 10 03:32:10 - INDEX 11 03:32:11 - INDEX 12 03:32:12 - INDEX 13 03:32:13 - INDEX 14 03:32:14 - INDEX 15 03:32:15 - INDEX 16 03:32:16 - INDEX 17 03:32:17 - INDEX 18 03:32:18 - INDEX 19 03:32:19 - INDEX 20 03:32:20 - INDEX 21 03:32:21 - INDEX 22 03:32:22 - INDEX 23 03:32:23 - INDEX 24 03:32:24 - INDEX 25 03:32:25 - INDEX 26 03:32:26 - INDEX 27 03:32:27 - INDEX 28 03:32:28 - INDEX 29 03:32:29 - INDEX 30 03:32:30 - INDEX 31 03:32:31 - INDEX 32 03:32:32 - INDEX 33 03:32:33 - INDEX 34 03:32:34 - INDEX 35 03:32:35 - INDEX 36 03:32:36 - INDEX 37 03:32:37 - INDEX 38 03:32:38 - INDEX 39 03:32:39 - INDEX 40 03:32:40 - INDEX 41 03:32:41 - INDEX 42 03:32:42 - INDEX 43 03:32:43 - INDEX 44 03:32:44 - INDEX 45 03:32:45 - INDEX 46 03:32:46 - INDEX 47 03:32:47 - INDEX 48 03:32:48 - INDEX 49 03:32:49 - INDEX 50 03:32:50 - INDEX 51 03:32:51 - INDEX 52 03:32:52 - INDEX 53 03:32:53 - INDEX 54 03:32:54 - INDEX 55 03:32:55 - INDEX 56 03:32:56 - INDEX 57 03:32:57 - INDEX 58 03:32:58 - INDEX 59 03:32:59 - INDEX 60 03:32:60 - INDEX 61 03:32:61 - INDEX 62 03:32:62 - INDEX 63 03:32:63 - INDEX 64 03:32:64 - INDEX 65 03:32:65 - INDEX 66 03:32:66 - INDEX 67 03:32:67 - INDEX 68 03:32:68 - INDEX 69 03:32:69 - INDEX 70 03:40:50 - INDEX 71 03:40:51 - INDEX 72 03:40:52 - INDEX 73 03:40:53 - INDEX 74 03:40:54 - INDEX 75 03:40:55 - INDEX 76 03:40:56 - INDEX 77 03:40:57 - INDEX 78 03:40:58 - INDEX 79 03:40:59 - INDEX 80 03:41:50 - INDEX 81 03:41:51 - INDEX 82 03:41:52 - INDEX 83 03:41:53 - INDEX 84 03:41:54 - INDEX 85 03:41:55 - INDEX 86 03:41:56 - INDEX 87 03:41:57 - INDEX 88 03:41:58 - INDEX 89 03:41:59 - INDEX 90 03:42:50 - INDEX 91 03:42:51 - INDEX 92 03:42:52 - INDEX 93 03:42:53 - INDEX 94 03:42:54 - INDEX 95 03:42:55 - INDEX 96 03:42:56 - INDEX 97 03:42:57 - INDEX 98 03:42:58 - INDEX 99 03:42:59 - TRACK 03 AUDIO - ISRC AB-CD7-65-43210 - INDEX 00 04:50:12 - INDEX 01 04:51:72 - TRACK 04 AUDIO - INDEX 00 06:36:10 - INDEX 01 06:38:47 - TRACK 05 AUDIO - INDEX 00 08:34:45 - INDEX 01 08:36:15 - TRACK 06 AUDIO - INDEX 00 13:20:22 - INDEX 01 13:22:12 - TRACK 07 AUDIO - INDEX 00 16:08:20 - INDEX 01 16:11:17 - TRACK 08 AUDIO - INDEX 01 17:48:37 - TRACK 09 AUDIO - INDEX 00 19:38:17 - INDEX 01 19:39:30 - TRACK 10 AUDIO - INDEX 00 22:07:07 - INDEX 01 22:08:20 - TRACK 11 AUDIO - INDEX 01 24:16:45 - TRACK 12 AUDIO - INDEX 01 26:13:67 - TRACK 13 AUDIO - INDEX 01 28:03:27 - TRACK 14 AUDIO - INDEX 00 30:22:42 - INDEX 01 30:24:45 - TRACK 15 AUDIO - INDEX 00 34:06:22 - INDEX 01 34:07:62 - TRACK 16 AUDIO - INDEX 00 35:54:30 - INDEX 01 35:56:60 - TRACK 17 AUDIO - INDEX 00 38:49:10 - INDEX 01 38:51:22 - TRACK 18 AUDIO - INDEX 00 41:14:15 - INDEX 01 41:17:15 - TRACK 19 AUDIO - INDEX 00 44:27:15 - INDEX 01 44:28:45 - TRACK 20 AUDIO - INDEX 00 48:07:17 - INDEX 01 48:09:72 - TRACK 21 AUDIO - INDEX 00 50:48:05 - INDEX 01 50:49:27 - TRACK 22 AUDIO - INDEX 00 53:29:72 - INDEX 01 53:31:20 - TRACK 23 AUDIO - INDEX 00 57:57:60 - INDEX 01 58:00:40 - TRACK 24 AUDIO - INDEX 00 61:52:65 - INDEX 01 61:55:37 - TRACK 25 AUDIO - INDEX 00 65:07:50 - INDEX 01 65:10:52 - TRACK 26 AUDIO - INDEX 00 68:30:05 - INDEX 01 68:32:45 - TRACK 27 AUDIO - INDEX 01 71:45:17 - TRACK 28 AUDIO - INDEX 00 74:49:07 - INDEX 01 74:51:47 diff --git a/test/cuesheets/good.002.dos_format.cue b/test/cuesheets/good.002.dos_format.cue deleted file mode 100644 index a60e03bf..00000000 --- a/test/cuesheets/good.002.dos_format.cue +++ /dev/null @@ -1,4 +0,0 @@ -CATALOG "1234567890123" -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 diff --git a/test/cuesheets/good.003.missing_final_newline.cue b/test/cuesheets/good.003.missing_final_newline.cue deleted file mode 100644 index a4c298f3..00000000 --- a/test/cuesheets/good.003.missing_final_newline.cue +++ /dev/null @@ -1,4 +0,0 @@ -CATALOG "1234567890123" -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 \ No newline at end of file diff --git a/test/cuesheets/good.004.dos_format.missing_final_newline.cue b/test/cuesheets/good.004.dos_format.missing_final_newline.cue deleted file mode 100644 index 1f6d0e59..00000000 --- a/test/cuesheets/good.004.dos_format.missing_final_newline.cue +++ /dev/null @@ -1,4 +0,0 @@ -CATALOG "1234567890123" -FILE "z.wav" WAVE - TRACK 01 AUDIO - INDEX 01 00:00:00 \ No newline at end of file diff --git a/test/cuesheets/good.005.quoted.isrc.cue b/test/cuesheets/good.005.quoted.isrc.cue deleted file mode 100644 index 3d8e9055..00000000 --- a/test/cuesheets/good.005.quoted.isrc.cue +++ /dev/null @@ -1,6 +0,0 @@ -TRACK 01 AUDIO -TITLE "Foo" -PERFORMER "Bar" -DISC_ID "" -ISRC "US-SM1-23-45678" -INDEX 01 00:00:00 diff --git a/test/flac-to-flac-metadata-test-files/Makefile.am b/test/flac-to-flac-metadata-test-files/Makefile.am deleted file mode 100644 index fc96f824..00000000 --- a/test/flac-to-flac-metadata-test-files/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2006-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -EXTRA_DIST = \ - case00a-expect.meta \ - case01a-expect.meta \ - case01b-expect.meta \ - case01c-expect.meta \ - case01d-expect.meta \ - case01e-expect.meta \ - case02a-expect.meta \ - case02b-expect.meta \ - case02c-expect.meta \ - case03a-expect.meta \ - case03b-expect.meta \ - case03c-expect.meta \ - case04a-expect.meta \ - case04b-expect.meta \ - case04c-expect.meta \ - case04d-expect.meta \ - case04e-expect.meta \ - input-SCPAP.flac \ - input-SCVA.flac \ - input-SCVAUP.flac \ - input-SCVPAP.flac \ - input-SVAUP.flac \ - input-VA.flac \ - input0.cue - -clean-local: - -rm -f out.* diff --git a/test/flac-to-flac-metadata-test-files/case00a-expect.meta b/test/flac-to-flac-metadata-test-files/case00a-expect.meta deleted file mode 100644 index 6facc3e7..00000000 --- a/test/flac-to-flac-metadata-test-files/case00a-expect.meta +++ /dev/null @@ -1,84 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #2 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #3 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 126 (UNKNOWN) - is last: false - length: XXX - data contents: -METADATA block #6 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case01a-expect.meta b/test/flac-to-flac-metadata-test-files/case01a-expect.meta deleted file mode 100644 index 25ceaecb..00000000 --- a/test/flac-to-flac-metadata-test-files/case01a-expect.meta +++ /dev/null @@ -1,79 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #2 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #3 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case01b-expect.meta b/test/flac-to-flac-metadata-test-files/case01b-expect.meta deleted file mode 100644 index 19706469..00000000 --- a/test/flac-to-flac-metadata-test-files/case01b-expect.meta +++ /dev/null @@ -1,75 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #2 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #3 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #4 - type: 2 (APPLICATION) - is last: true - length: XXX - application ID: 66616b65 - data contents: diff --git a/test/flac-to-flac-metadata-test-files/case01c-expect.meta b/test/flac-to-flac-metadata-test-files/case01c-expect.meta deleted file mode 100644 index 25ceaecb..00000000 --- a/test/flac-to-flac-metadata-test-files/case01c-expect.meta +++ /dev/null @@ -1,79 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #2 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #3 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case01d-expect.meta b/test/flac-to-flac-metadata-test-files/case01d-expect.meta deleted file mode 100644 index 25ceaecb..00000000 --- a/test/flac-to-flac-metadata-test-files/case01d-expect.meta +++ /dev/null @@ -1,79 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #2 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #3 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case01e-expect.meta b/test/flac-to-flac-metadata-test-files/case01e-expect.meta deleted file mode 100644 index 25ceaecb..00000000 --- a/test/flac-to-flac-metadata-test-files/case01e-expect.meta +++ /dev/null @@ -1,79 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #2 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #3 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case02a-expect.meta b/test/flac-to-flac-metadata-test-files/case02a-expect.meta deleted file mode 100644 index 63bf6f6d..00000000 --- a/test/flac-to-flac-metadata-test-files/case02a-expect.meta +++ /dev/null @@ -1,73 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 0 -METADATA block #2 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case02b-expect.meta b/test/flac-to-flac-metadata-test-files/case02b-expect.meta deleted file mode 100644 index a6b269da..00000000 --- a/test/flac-to-flac-metadata-test-files/case02b-expect.meta +++ /dev/null @@ -1,74 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: artist=0 -METADATA block #2 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case02c-expect.meta b/test/flac-to-flac-metadata-test-files/case02c-expect.meta deleted file mode 100644 index 2e2e06f0..00000000 --- a/test/flac-to-flac-metadata-test-files/case02c-expect.meta +++ /dev/null @@ -1,79 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: artist=0 -METADATA block #2 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 126 (UNKNOWN) - is last: false - length: XXX - data contents: -METADATA block #6 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case03a-expect.meta b/test/flac-to-flac-metadata-test-files/case03a-expect.meta deleted file mode 100644 index c4c4c93d..00000000 --- a/test/flac-to-flac-metadata-test-files/case03a-expect.meta +++ /dev/null @@ -1,84 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 9294969890929 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 588 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 2352 - number: 2 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #2 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #3 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 126 (UNKNOWN) - is last: false - length: XXX - data contents: -METADATA block #6 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case03b-expect.meta b/test/flac-to-flac-metadata-test-files/case03b-expect.meta deleted file mode 100644 index c4c4c93d..00000000 --- a/test/flac-to-flac-metadata-test-files/case03b-expect.meta +++ /dev/null @@ -1,84 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 9294969890929 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 588 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 2352 - number: 2 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #2 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 10 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER - point 5: PLACEHOLDER - point 6: PLACEHOLDER - point 7: PLACEHOLDER - point 8: PLACEHOLDER - point 9: PLACEHOLDER -METADATA block #3 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #4 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #5 - type: 126 (UNKNOWN) - is last: false - length: XXX - data contents: -METADATA block #6 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case03c-expect.meta b/test/flac-to-flac-metadata-test-files/case03c-expect.meta deleted file mode 100644 index 6bdefb3c..00000000 --- a/test/flac-to-flac-metadata-test-files/case03c-expect.meta +++ /dev/null @@ -1,41 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5879 - MD5 signature: 2ea0e6a767b66bf0668523fd77672ce1 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #3 - type: 2 (APPLICATION) - is last: false - length: XXX - application ID: 66616b65 - data contents: -METADATA block #4 - type: 126 (UNKNOWN) - is last: false - length: XXX - data contents: -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/flac-to-flac-metadata-test-files/case04a-expect.meta b/test/flac-to-flac-metadata-test-files/case04a-expect.meta deleted file mode 100644 index cb50bb46..00000000 --- a/test/flac-to-flac-metadata-test-files/case04a-expect.meta +++ /dev/null @@ -1,26 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #2 - type: 2 (APPLICATION) - is last: true - length: XXX - application ID: 66616b65 - data contents: diff --git a/test/flac-to-flac-metadata-test-files/case04b-expect.meta b/test/flac-to-flac-metadata-test-files/case04b-expect.meta deleted file mode 100644 index 71d9b95c..00000000 --- a/test/flac-to-flac-metadata-test-files/case04b-expect.meta +++ /dev/null @@ -1,36 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 5 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #3 - type: 2 (APPLICATION) - is last: true - length: XXX - application ID: 66616b65 - data contents: diff --git a/test/flac-to-flac-metadata-test-files/case04c-expect.meta b/test/flac-to-flac-metadata-test-files/case04c-expect.meta deleted file mode 100644 index f163edf9..00000000 --- a/test/flac-to-flac-metadata-test-files/case04c-expect.meta +++ /dev/null @@ -1,32 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #3 - type: 2 (APPLICATION) - is last: true - length: XXX - application ID: 66616b65 - data contents: diff --git a/test/flac-to-flac-metadata-test-files/case04d-expect.meta b/test/flac-to-flac-metadata-test-files/case04d-expect.meta deleted file mode 100644 index 086f684c..00000000 --- a/test/flac-to-flac-metadata-test-files/case04d-expect.meta +++ /dev/null @@ -1,60 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #3 - type: 2 (APPLICATION) - is last: true - length: XXX - application ID: 66616b65 - data contents: diff --git a/test/flac-to-flac-metadata-test-files/case04e-expect.meta b/test/flac-to-flac-metadata-test-files/case04e-expect.meta deleted file mode 100644 index 65598402..00000000 --- a/test/flac-to-flac-metadata-test-files/case04e-expect.meta +++ /dev/null @@ -1,70 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 44100 Hz - channels: 2 - bits-per-sample: 16 - total samples: 5880 - MD5 signature: 74ffd4737eb5488d512be4af58943362 -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 5 - point 0: sample_number=0 - point 1: sample_number=4096 - point 2: PLACEHOLDER - point 3: PLACEHOLDER - point 4: PLACEHOLDER -METADATA block #2 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 88200 - is CD: true - number of tracks: 3 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 2 - index[0] - offset: 0 - number: 1 - index[1] - offset: 588 - number: 2 - track[1] - offset: 2940 - number: 2 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[2] - offset: 5880 - number: 170 (LEAD-OUT) -METADATA block #3 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 6 - comment[0]: REPLAYGAIN_TRACK_PEAK=0.99996948 - comment[1]: REPLAYGAIN_TRACK_GAIN=-7.89 dB - comment[2]: REPLAYGAIN_ALBUM_PEAK=0.99996948 - comment[3]: REPLAYGAIN_ALBUM_GAIN=-7.89 dB - comment[4]: artist=1 - comment[5]: title=2 -METADATA block #4 - type: 2 (APPLICATION) - is last: true - length: XXX - application ID: 66616b65 - data contents: diff --git a/test/flac-to-flac-metadata-test-files/input-SCPAP.flac b/test/flac-to-flac-metadata-test-files/input-SCPAP.flac deleted file mode 100644 index 6fde318d..00000000 Binary files a/test/flac-to-flac-metadata-test-files/input-SCPAP.flac and /dev/null differ diff --git a/test/flac-to-flac-metadata-test-files/input-SCVA.flac b/test/flac-to-flac-metadata-test-files/input-SCVA.flac deleted file mode 100644 index 4bb69262..00000000 Binary files a/test/flac-to-flac-metadata-test-files/input-SCVA.flac and /dev/null differ diff --git a/test/flac-to-flac-metadata-test-files/input-SCVAUP.flac b/test/flac-to-flac-metadata-test-files/input-SCVAUP.flac deleted file mode 100644 index e4ecc952..00000000 Binary files a/test/flac-to-flac-metadata-test-files/input-SCVAUP.flac and /dev/null differ diff --git a/test/flac-to-flac-metadata-test-files/input-SCVPAP.flac b/test/flac-to-flac-metadata-test-files/input-SCVPAP.flac deleted file mode 100644 index 74749288..00000000 Binary files a/test/flac-to-flac-metadata-test-files/input-SCVPAP.flac and /dev/null differ diff --git a/test/flac-to-flac-metadata-test-files/input-SVAUP.flac b/test/flac-to-flac-metadata-test-files/input-SVAUP.flac deleted file mode 100644 index e3fa5c18..00000000 Binary files a/test/flac-to-flac-metadata-test-files/input-SVAUP.flac and /dev/null differ diff --git a/test/flac-to-flac-metadata-test-files/input-VA.flac b/test/flac-to-flac-metadata-test-files/input-VA.flac deleted file mode 100644 index 4fac8781..00000000 Binary files a/test/flac-to-flac-metadata-test-files/input-VA.flac and /dev/null differ diff --git a/test/flac-to-flac-metadata-test-files/input0.cue b/test/flac-to-flac-metadata-test-files/input0.cue deleted file mode 100644 index 2894bd06..00000000 --- a/test/flac-to-flac-metadata-test-files/input0.cue +++ /dev/null @@ -1,7 +0,0 @@ -CATALOG 9294969890929 -FILE "blah" FLAC - TRACK 01 AUDIO - INDEX 01 00:00:00 - TRACK 02 AUDIO - INDEX 01 00:00:01 - INDEX 02 00:00:05 diff --git a/test/metaflac-test-files/Makefile.am b/test/metaflac-test-files/Makefile.am deleted file mode 100644 index adcb34ae..00000000 --- a/test/metaflac-test-files/Makefile.am +++ /dev/null @@ -1,85 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2006-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -EXTRA_DIST = \ - case00-expect.meta \ - case01-expect.meta \ - case02-expect.meta \ - case03-expect.meta \ - case04-expect.meta \ - case05-expect.meta \ - case06-expect.meta \ - case07-expect.meta \ - case08-expect.meta \ - case09-expect.meta \ - case10-expect.meta \ - case11-expect.meta \ - case12-expect.meta \ - case13-expect.meta \ - case14-expect.meta \ - case15-expect.meta \ - case16-expect.meta \ - case17-expect.meta \ - case18-expect.meta \ - case19-expect.meta \ - case20-expect.meta \ - case21-expect.meta \ - case22-expect.meta \ - case23-expect.meta \ - case24-expect.meta \ - case25-expect.meta \ - case26-expect.meta \ - case27-expect.meta \ - case28-expect.meta \ - case29-expect.meta \ - case30-expect.meta \ - case31-expect.meta \ - case32-expect.meta \ - case33-expect.meta \ - case34-expect.meta \ - case35-expect.meta \ - case36-expect.meta \ - case37-expect.meta \ - case38-expect.meta \ - case39-expect.meta \ - case40-expect.meta \ - case41-expect.meta \ - case42-expect.meta \ - case43-expect.meta \ - case44-expect.meta \ - case45-expect.meta \ - case46-expect.meta \ - case47-expect.meta \ - case48-expect.meta \ - case49-expect.meta \ - case50-expect.meta \ - case51-expect.meta \ - case52-expect.meta \ - case53-expect.meta \ - case54-expect.meta \ - case55-expect.meta \ - case56-expect.meta \ - case57-expect.meta \ - case58-expect.meta \ - case59-expect.meta \ - case60-expect.meta \ - case61-expect.meta \ - case62-expect.meta - -clean-local: - -rm -f out.* diff --git a/test/metaflac-test-files/case00-expect.meta b/test/metaflac-test-files/case00-expect.meta deleted file mode 100644 index a1a37708..00000000 --- a/test/metaflac-test-files/case00-expect.meta +++ /dev/null @@ -1,24 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 0 -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case01-expect.meta b/test/metaflac-test-files/case01-expect.meta deleted file mode 100644 index bae8f49a..00000000 --- a/test/metaflac-test-files/case01-expect.meta +++ /dev/null @@ -1,9 +0,0 @@ -a042237c5493fdb9656b94a83608d11a -1152 -1152 -10 -10 -8000 -1 -8 -80000 diff --git a/test/metaflac-test-files/case02-expect.meta b/test/metaflac-test-files/case02-expect.meta deleted file mode 100644 index 830302c0..00000000 --- a/test/metaflac-test-files/case02-expect.meta +++ /dev/null @@ -1,28 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 0 -METADATA block #3 - type: 1 (PADDING) - is last: false - length: XXX -METADATA block #4 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case03-expect.meta b/test/metaflac-test-files/case03-expect.meta deleted file mode 100644 index a3b88bd8..00000000 --- a/test/metaflac-test-files/case03-expect.meta +++ /dev/null @@ -1,25 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: ARTIST=The_artist_formerly_known_as_the_artist... -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case04-expect.meta b/test/metaflac-test-files/case04-expect.meta deleted file mode 100644 index 056f5afb..00000000 --- a/test/metaflac-test-files/case04-expect.meta +++ /dev/null @@ -1,26 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 2 - comment[0]: ARTIST=The_artist_formerly_known_as_the_artist... - comment[1]: ARTIST=Chuck_Woolery -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case05-expect.meta b/test/metaflac-test-files/case05-expect.meta deleted file mode 100644 index 6bc02380..00000000 --- a/test/metaflac-test-files/case05-expect.meta +++ /dev/null @@ -1,27 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 3 - comment[0]: ARTIST=The_artist_formerly_known_as_the_artist... - comment[1]: ARTIST=Chuck_Woolery - comment[2]: ARTIST=Vern -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case06-expect.meta b/test/metaflac-test-files/case06-expect.meta deleted file mode 100644 index 74353290..00000000 --- a/test/metaflac-test-files/case06-expect.meta +++ /dev/null @@ -1,28 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: ARTIST=The_artist_formerly_known_as_the_artist... - comment[1]: ARTIST=Chuck_Woolery - comment[2]: ARTIST=Vern - comment[3]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case07-expect.meta b/test/metaflac-test-files/case07-expect.meta deleted file mode 100644 index 5612e04b..00000000 --- a/test/metaflac-test-files/case07-expect.meta +++ /dev/null @@ -1,4 +0,0 @@ -reference libFLAC 1.3.3 20190804 -ARTIST=The_artist_formerly_known_as_the_artist... -ARTIST=Chuck_Woolery -ARTIST=Vern diff --git a/test/metaflac-test-files/case08-expect.meta b/test/metaflac-test-files/case08-expect.meta deleted file mode 100644 index 61845ae8..00000000 --- a/test/metaflac-test-files/case08-expect.meta +++ /dev/null @@ -1,27 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 3 - comment[0]: ARTIST=Chuck_Woolery - comment[1]: ARTIST=Vern - comment[2]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case09-expect.meta b/test/metaflac-test-files/case09-expect.meta deleted file mode 100644 index 71f72706..00000000 --- a/test/metaflac-test-files/case09-expect.meta +++ /dev/null @@ -1,25 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case10-expect.meta b/test/metaflac-test-files/case10-expect.meta deleted file mode 100644 index 402ad6d5..00000000 --- a/test/metaflac-test-files/case10-expect.meta +++ /dev/null @@ -1,6 +0,0 @@ -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it diff --git a/test/metaflac-test-files/case11-expect.meta b/test/metaflac-test-files/case11-expect.meta deleted file mode 100644 index 530001bd..00000000 --- a/test/metaflac-test-files/case11-expect.meta +++ /dev/null @@ -1,9 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a diff --git a/test/metaflac-test-files/case12-expect.meta b/test/metaflac-test-files/case12-expect.meta deleted file mode 100644 index 1d29f44e..00000000 --- a/test/metaflac-test-files/case12-expect.meta +++ /dev/null @@ -1,12 +0,0 @@ -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it diff --git a/test/metaflac-test-files/case13-expect.meta b/test/metaflac-test-files/case13-expect.meta deleted file mode 100644 index 004104f5..00000000 --- a/test/metaflac-test-files/case13-expect.meta +++ /dev/null @@ -1,10 +0,0 @@ -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case14-expect.meta b/test/metaflac-test-files/case14-expect.meta deleted file mode 100644 index a9a11673..00000000 --- a/test/metaflac-test-files/case14-expect.meta +++ /dev/null @@ -1,13 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case15-expect.meta b/test/metaflac-test-files/case15-expect.meta deleted file mode 100644 index 6f68176b..00000000 --- a/test/metaflac-test-files/case15-expect.meta +++ /dev/null @@ -1,16 +0,0 @@ -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case16-expect.meta b/test/metaflac-test-files/case16-expect.meta deleted file mode 100644 index 28eaf2bb..00000000 --- a/test/metaflac-test-files/case16-expect.meta +++ /dev/null @@ -1,33 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: false - length: XXX -METADATA block #4 - type: 1 (PADDING) - is last: false - length: XXX -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case17-expect.meta b/test/metaflac-test-files/case17-expect.meta deleted file mode 100644 index 71f72706..00000000 --- a/test/metaflac-test-files/case17-expect.meta +++ /dev/null @@ -1,25 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case18-expect.meta b/test/metaflac-test-files/case18-expect.meta deleted file mode 100644 index 81f1f0e4..00000000 --- a/test/metaflac-test-files/case18-expect.meta +++ /dev/null @@ -1,29 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: false - length: XXX -METADATA block #4 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case19-expect.meta b/test/metaflac-test-files/case19-expect.meta deleted file mode 100644 index 71f72706..00000000 --- a/test/metaflac-test-files/case19-expect.meta +++ /dev/null @@ -1,25 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case20-expect.meta b/test/metaflac-test-files/case20-expect.meta deleted file mode 100644 index 81f1f0e4..00000000 --- a/test/metaflac-test-files/case20-expect.meta +++ /dev/null @@ -1,29 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: TITLE=He_who_smelt_it_dealt_it -METADATA block #3 - type: 1 (PADDING) - is last: false - length: XXX -METADATA block #4 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case21-expect.meta b/test/metaflac-test-files/case21-expect.meta deleted file mode 100644 index a1a37708..00000000 --- a/test/metaflac-test-files/case21-expect.meta +++ /dev/null @@ -1,24 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 0 -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case22-expect.meta b/test/metaflac-test-files/case22-expect.meta deleted file mode 100644 index d102550b..00000000 --- a/test/metaflac-test-files/case22-expect.meta +++ /dev/null @@ -1,18 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 0 -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case23-expect.meta b/test/metaflac-test-files/case23-expect.meta deleted file mode 100644 index d102550b..00000000 --- a/test/metaflac-test-files/case23-expect.meta +++ /dev/null @@ -1,18 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 0 -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case24-expect.meta b/test/metaflac-test-files/case24-expect.meta deleted file mode 100644 index d102550b..00000000 --- a/test/metaflac-test-files/case24-expect.meta +++ /dev/null @@ -1,18 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 0 -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case25-expect.meta b/test/metaflac-test-files/case25-expect.meta deleted file mode 100644 index 79de56e4..00000000 --- a/test/metaflac-test-files/case25-expect.meta +++ /dev/null @@ -1,14 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: true - length: XXX - comments: 0 diff --git a/test/metaflac-test-files/case26-expect.meta b/test/metaflac-test-files/case26-expect.meta deleted file mode 100644 index 622d19a2..00000000 --- a/test/metaflac-test-files/case26-expect.meta +++ /dev/null @@ -1,22 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 0 -METADATA block #2 - type: 1 (PADDING) - is last: false - length: XXX -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case27-expect.meta b/test/metaflac-test-files/case27-expect.meta deleted file mode 100644 index 1fd3fb6f..00000000 --- a/test/metaflac-test-files/case27-expect.meta +++ /dev/null @@ -1,13 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case28-expect.meta b/test/metaflac-test-files/case28-expect.meta deleted file mode 100644 index 1fd3fb6f..00000000 --- a/test/metaflac-test-files/case28-expect.meta +++ /dev/null @@ -1,13 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case29-expect.meta b/test/metaflac-test-files/case29-expect.meta deleted file mode 100644 index 0ebcd923..00000000 --- a/test/metaflac-test-files/case29-expect.meta +++ /dev/null @@ -1,9 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: true - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a diff --git a/test/metaflac-test-files/case30-expect.meta b/test/metaflac-test-files/case30-expect.meta deleted file mode 100644 index 0ebcd923..00000000 --- a/test/metaflac-test-files/case30-expect.meta +++ /dev/null @@ -1,9 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: true - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a diff --git a/test/metaflac-test-files/case31-expect.meta b/test/metaflac-test-files/case31-expect.meta deleted file mode 100644 index a76e4852..00000000 --- a/test/metaflac-test-files/case31-expect.meta +++ /dev/null @@ -1,15 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: true - length: XXX - comments: 1 - comment[0]: f=0123456789abcdefghij diff --git a/test/metaflac-test-files/case32-expect.meta b/test/metaflac-test-files/case32-expect.meta deleted file mode 100644 index ad585965..00000000 --- a/test/metaflac-test-files/case32-expect.meta +++ /dev/null @@ -1,15 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: true - length: XXX - comments: 1 - comment[0]: f=0123456789abcdefghi diff --git a/test/metaflac-test-files/case33-expect.meta b/test/metaflac-test-files/case33-expect.meta deleted file mode 100644 index aed79279..00000000 --- a/test/metaflac-test-files/case33-expect.meta +++ /dev/null @@ -1,19 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: f=0123456789abcde -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case34-expect.meta b/test/metaflac-test-files/case34-expect.meta deleted file mode 100644 index 619bbcce..00000000 --- a/test/metaflac-test-files/case34-expect.meta +++ /dev/null @@ -1,19 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: f=0 -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case35-expect.meta b/test/metaflac-test-files/case35-expect.meta deleted file mode 100644 index 274076da..00000000 --- a/test/metaflac-test-files/case35-expect.meta +++ /dev/null @@ -1,19 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: f=0123456789 -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case36-expect.meta b/test/metaflac-test-files/case36-expect.meta deleted file mode 100644 index ad585965..00000000 --- a/test/metaflac-test-files/case36-expect.meta +++ /dev/null @@ -1,15 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: true - length: XXX - comments: 1 - comment[0]: f=0123456789abcdefghi diff --git a/test/metaflac-test-files/case37-expect.meta b/test/metaflac-test-files/case37-expect.meta deleted file mode 100644 index 274076da..00000000 --- a/test/metaflac-test-files/case37-expect.meta +++ /dev/null @@ -1,19 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: f=0123456789 -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case38-expect.meta b/test/metaflac-test-files/case38-expect.meta deleted file mode 100644 index d6c3f794..00000000 --- a/test/metaflac-test-files/case38-expect.meta +++ /dev/null @@ -1,19 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 1 - comment[0]: f=0123456789abcdefghij -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case39-expect.meta b/test/metaflac-test-files/case39-expect.meta deleted file mode 100644 index 937f2529..00000000 --- a/test/metaflac-test-files/case39-expect.meta +++ /dev/null @@ -1,20 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 2 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case40-expect.meta b/test/metaflac-test-files/case40-expect.meta deleted file mode 100644 index f1635374..00000000 --- a/test/metaflac-test-files/case40-expect.meta +++ /dev/null @@ -1,22 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case41-expect.meta b/test/metaflac-test-files/case41-expect.meta deleted file mode 100644 index d2acc4b3..00000000 --- a/test/metaflac-test-files/case41-expect.meta +++ /dev/null @@ -1,27 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 9 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits - comment[4]: REPLAYGAIN_REFERENCE_LOUDNESS=89.0 dB - comment[5]: REPLAYGAIN_TRACK_GAIN=+64.82 dB - comment[6]: REPLAYGAIN_TRACK_PEAK=0.00000000 - comment[7]: REPLAYGAIN_ALBUM_GAIN=+64.82 dB - comment[8]: REPLAYGAIN_ALBUM_PEAK=0.00000000 -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case42-expect.meta b/test/metaflac-test-files/case42-expect.meta deleted file mode 100644 index f1635374..00000000 --- a/test/metaflac-test-files/case42-expect.meta +++ /dev/null @@ -1,22 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #2 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case43-expect.meta b/test/metaflac-test-files/case43-expect.meta deleted file mode 100644 index 3bead393..00000000 --- a/test/metaflac-test-files/case43-expect.meta +++ /dev/null @@ -1,49 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case44-expect.meta b/test/metaflac-test-files/case44-expect.meta deleted file mode 100644 index 776daa5e..00000000 --- a/test/metaflac-test-files/case44-expect.meta +++ /dev/null @@ -1,28 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case45-expect.meta b/test/metaflac-test-files/case45-expect.meta deleted file mode 100644 index 3bead393..00000000 --- a/test/metaflac-test-files/case45-expect.meta +++ /dev/null @@ -1,49 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case46-expect.meta b/test/metaflac-test-files/case46-expect.meta deleted file mode 100644 index 25778cba..00000000 --- a/test/metaflac-test-files/case46-expect.meta +++ /dev/null @@ -1,62 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case47-expect.meta b/test/metaflac-test-files/case47-expect.meta deleted file mode 100644 index 096c4302..00000000 --- a/test/metaflac-test-files/case47-expect.meta +++ /dev/null @@ -1,75 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case48-expect.meta b/test/metaflac-test-files/case48-expect.meta deleted file mode 100644 index 40553966..00000000 --- a/test/metaflac-test-files/case48-expect.meta +++ /dev/null @@ -1,88 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case49-expect.meta b/test/metaflac-test-files/case49-expect.meta deleted file mode 100644 index 56f7d5e9..00000000 --- a/test/metaflac-test-files/case49-expect.meta +++ /dev/null @@ -1,101 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case50-expect.meta b/test/metaflac-test-files/case50-expect.meta deleted file mode 100644 index 868df7c5..00000000 --- a/test/metaflac-test-files/case50-expect.meta +++ /dev/null @@ -1,114 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case51-expect.meta b/test/metaflac-test-files/case51-expect.meta deleted file mode 100644 index c98eae4f..00000000 --- a/test/metaflac-test-files/case51-expect.meta +++ /dev/null @@ -1,127 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 0.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #10 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case52-expect.meta b/test/metaflac-test-files/case52-expect.meta deleted file mode 100644 index 4053288e..00000000 --- a/test/metaflac-test-files/case52-expect.meta +++ /dev/null @@ -1,140 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 0.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #10 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 1.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #11 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case53-expect.meta b/test/metaflac-test-files/case53-expect.meta deleted file mode 100644 index 9dc3ef5b..00000000 --- a/test/metaflac-test-files/case53-expect.meta +++ /dev/null @@ -1,153 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 0.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #10 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 1.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #11 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 2.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #12 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case54-expect.meta b/test/metaflac-test-files/case54-expect.meta deleted file mode 100644 index 866cd36d..00000000 --- a/test/metaflac-test-files/case54-expect.meta +++ /dev/null @@ -1,166 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 0.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #10 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 1.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #11 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 2.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #12 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 3.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #13 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case55-expect.meta b/test/metaflac-test-files/case55-expect.meta deleted file mode 100644 index 38058eaf..00000000 --- a/test/metaflac-test-files/case55-expect.meta +++ /dev/null @@ -1,179 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 0.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #10 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 1.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #11 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 2.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #12 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 3.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #13 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 4.png - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #14 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case56-expect.meta b/test/metaflac-test-files/case56-expect.meta deleted file mode 100644 index 0bcf922d..00000000 --- a/test/metaflac-test-files/case56-expect.meta +++ /dev/null @@ -1,192 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 0.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #10 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 1.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #11 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 2.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #12 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 3.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #13 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 4.png - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #14 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 5.png - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #15 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case57-expect.meta b/test/metaflac-test-files/case57-expect.meta deleted file mode 100644 index 546a6003..00000000 --- a/test/metaflac-test-files/case57-expect.meta +++ /dev/null @@ -1,205 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 0.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #10 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 1.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #11 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 2.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #12 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 3.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #13 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 4.png - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #14 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 5.png - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #15 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 6.png - width: 31 - height: 47 - depth: 24 - colors: 23 - data length: XXX - data: -METADATA block #16 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case58-expect.meta b/test/metaflac-test-files/case58-expect.meta deleted file mode 100644 index 64961672..00000000 --- a/test/metaflac-test-files/case58-expect.meta +++ /dev/null @@ -1,218 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 0.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #10 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 1.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #11 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 2.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #12 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 3.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #13 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 4.png - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #14 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 5.png - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #15 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 6.png - width: 31 - height: 47 - depth: 24 - colors: 23 - data length: XXX - data: -METADATA block #16 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 7.png - width: 31 - height: 47 - depth: 24 - colors: 23 - data length: XXX - data: -METADATA block #17 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case59-expect.meta b/test/metaflac-test-files/case59-expect.meta deleted file mode 100644 index cbe812d7..00000000 --- a/test/metaflac-test-files/case59-expect.meta +++ /dev/null @@ -1,231 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 0.gif - width: 24 - height: 24 - depth: 24 - colors: 2 - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 1.gif - width: 12 - height: 8 - depth: 24 - colors: 256 - data length: XXX - data: -METADATA block #6 - type: 6 (PICTURE) - is last: false - length: XXX - type: 3 (Cover (front)) - MIME type: image/gif - description: 2.gif - width: 16 - height: 14 - depth: 24 - colors: 128 - data length: XXX - data: -METADATA block #7 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 0.jpg - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #8 - type: 6 (PICTURE) - is last: false - length: XXX - type: 4 (Cover (back)) - MIME type: image/jpeg - description: 4.jpg - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #9 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 0.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #10 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 1.png - width: 30 - height: 20 - depth: 8 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #11 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 2.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #12 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 3.png - width: 30 - height: 20 - depth: 24 - colors: 7 - data length: XXX - data: -METADATA block #13 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 4.png - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #14 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 5.png - width: 31 - height: 47 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #15 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 6.png - width: 31 - height: 47 - depth: 24 - colors: 23 - data length: XXX - data: -METADATA block #16 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 7.png - width: 31 - height: 47 - depth: 24 - colors: 23 - data length: XXX - data: -METADATA block #17 - type: 6 (PICTURE) - is last: false - length: XXX - type: 5 (Leaflet page) - MIME type: image/png - description: 8.png - width: 32 - height: 32 - depth: 32 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #18 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case60-expect.meta b/test/metaflac-test-files/case60-expect.meta deleted file mode 100644 index 3bead393..00000000 --- a/test/metaflac-test-files/case60-expect.meta +++ /dev/null @@ -1,49 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case61-expect.meta b/test/metaflac-test-files/case61-expect.meta deleted file mode 100644 index 535cde39..00000000 --- a/test/metaflac-test-files/case61-expect.meta +++ /dev/null @@ -1,62 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 1 (32x32 pixels 'file icon' (PNG only)) - MIME type: image/png - description: standard_icon - width: 32 - height: 32 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #5 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac-test-files/case62-expect.meta b/test/metaflac-test-files/case62-expect.meta deleted file mode 100644 index 472fec3d..00000000 --- a/test/metaflac-test-files/case62-expect.meta +++ /dev/null @@ -1,75 +0,0 @@ -METADATA block #0 - type: 0 (STREAMINFO) - is last: false - length: XXX - sample_rate: 8000 Hz - channels: 1 - bits-per-sample: 8 - total samples: 80000 - MD5 signature: a042237c5493fdb9656b94a83608d11a -METADATA block #1 - type: 3 (SEEKTABLE) - is last: false - length: XXX - seek points: 1 - point 0: sample_number=0 -METADATA block #2 - type: 4 (VORBIS_COMMENT) - is last: false - length: XXX - comments: 4 - comment[0]: f=0123456789abcdefghij - comment[1]: TITLE=Tittle - comment[2]: artist=Fartist - comment[3]: artist=artits -METADATA block #3 - type: 5 (CUESHEET) - is last: false - length: XXX - media catalog number: 1234567890123 - lead-in: 0 - is CD: false - number of tracks: 2 - track[0] - offset: 0 - number: 1 - ISRC: - type: AUDIO - pre-emphasis: false - number of index points: 1 - index[0] - offset: 0 - number: 1 - track[1] - offset: 80000 - number: 255 (LEAD-OUT) -METADATA block #4 - type: 6 (PICTURE) - is last: false - length: XXX - type: 1 (32x32 pixels 'file icon' (PNG only)) - MIME type: image/png - description: standard_icon - width: 32 - height: 32 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #5 - type: 6 (PICTURE) - is last: false - length: XXX - type: 2 (Other file icon) - MIME type: image/png - description: icon - width: 64 - height: 64 - depth: 24 - colors: 0 (unindexed) - data length: XXX - data: -METADATA block #6 - type: 1 (PADDING) - is last: true - length: XXX diff --git a/test/metaflac.flac.in b/test/metaflac.flac.in deleted file mode 100644 index 79892630..00000000 Binary files a/test/metaflac.flac.in and /dev/null differ diff --git a/test/metaflac.flac.ok b/test/metaflac.flac.ok deleted file mode 100644 index 82ad84cc..00000000 Binary files a/test/metaflac.flac.ok and /dev/null differ diff --git a/test/picture.ok b/test/picture.ok deleted file mode 100644 index 4b7e55d6..00000000 --- a/test/picture.ok +++ /dev/null @@ -1,42 +0,0 @@ - -+++ grabbag unit test: picture - -testing grabbag__picture_parse_specification("")... OK (failed as expected, error: error opening picture file) -testing grabbag__picture_parse_specification("||||")... OK (failed as expected: error opening picture file) -testing grabbag__picture_parse_specification("|image/gif|||")... OK (failed as expected: error opening picture file) -testing grabbag__picture_parse_specification("|image/gif|desc|320|0.gif")... OK (failed as expected: invalid picture specification: can't parse resolution/color part) -testing grabbag__picture_parse_specification("|image/gif|desc|320x240|0.gif")... OK (failed as expected: invalid picture specification: can't parse resolution/color part) -testing grabbag__picture_parse_specification("|image/gif|desc|320x240x9|")... OK (failed as expected: error opening picture file) -testing grabbag__picture_parse_specification("|image/gif|desc|320x240x9/2345|0.gif")... OK (failed as expected: invalid picture specification: can't parse resolution/color part) -testing grabbag__picture_parse_specification("1|-->|desc|32x24x9|0.gif")... OK (failed as expected: type 1 icon must be a 32x32 pixel PNG) -testing grabbag__picture_parse_specification("|-->|desc||http://blah.blah.blah/z.gif")... OK (failed as expected: unable to extract resolution and color info from URL, user must set explicitly) -testing grabbag__picture_parse_specification("|-->|desc|320x240x9|http://blah.blah.blah/z.gif")... OK -testing grabbag__picture_parse_specification("pictures/0.gif")... OK -testing grabbag__picture_parse_specification("pictures/1.gif")... OK -testing grabbag__picture_parse_specification("pictures/2.gif")... OK -testing grabbag__picture_parse_specification("pictures/0.jpg")... OK -testing grabbag__picture_parse_specification("pictures/4.jpg")... OK -testing grabbag__picture_parse_specification("pictures/0.png")... OK -testing grabbag__picture_parse_specification("pictures/1.png")... OK -testing grabbag__picture_parse_specification("pictures/2.png")... OK -testing grabbag__picture_parse_specification("pictures/3.png")... OK -testing grabbag__picture_parse_specification("pictures/4.png")... OK -testing grabbag__picture_parse_specification("pictures/5.png")... OK -testing grabbag__picture_parse_specification("pictures/6.png")... OK -testing grabbag__picture_parse_specification("pictures/7.png")... OK -testing grabbag__picture_parse_specification("pictures/8.png")... OK -testing grabbag__picture_parse_specification("3|image/gif|||pictures/0.gif")... OK -testing grabbag__picture_parse_specification("4|image/gif|||pictures/1.gif")... OK -testing grabbag__picture_parse_specification("0|image/gif|||pictures/2.gif")... OK -testing grabbag__picture_parse_specification("3|image/jpeg|||pictures/0.jpg")... OK -testing grabbag__picture_parse_specification("3|image/jpeg|||pictures/4.jpg")... OK -testing grabbag__picture_parse_specification("3|image/png|||pictures/0.png")... OK -testing grabbag__picture_parse_specification("3|image/png|||pictures/1.png")... OK -testing grabbag__picture_parse_specification("3|image/png|||pictures/2.png")... OK -testing grabbag__picture_parse_specification("3|image/png|||pictures/3.png")... OK -testing grabbag__picture_parse_specification("3|image/png|||pictures/4.png")... OK -testing grabbag__picture_parse_specification("3|image/png|||pictures/5.png")... OK -testing grabbag__picture_parse_specification("3|image/png|||pictures/6.png")... OK -testing grabbag__picture_parse_specification("3|image/png|||pictures/7.png")... OK -testing grabbag__picture_parse_specification("999|image/png|||pictures/8.png")... OK -testing grabbag__picture_parse_specification("3|image/gif||320x240x3/2|pictures/0.gif")... OK diff --git a/test/pictures/0.gif b/test/pictures/0.gif deleted file mode 100644 index c9f3d71d..00000000 Binary files a/test/pictures/0.gif and /dev/null differ diff --git a/test/pictures/0.jpg b/test/pictures/0.jpg deleted file mode 100644 index 54b9a7c8..00000000 Binary files a/test/pictures/0.jpg and /dev/null differ diff --git a/test/pictures/0.png b/test/pictures/0.png deleted file mode 100644 index 2f3ec800..00000000 Binary files a/test/pictures/0.png and /dev/null differ diff --git a/test/pictures/1.gif b/test/pictures/1.gif deleted file mode 100644 index c40eeae8..00000000 Binary files a/test/pictures/1.gif and /dev/null differ diff --git a/test/pictures/1.png b/test/pictures/1.png deleted file mode 100644 index 2b487c07..00000000 Binary files a/test/pictures/1.png and /dev/null differ diff --git a/test/pictures/2.gif b/test/pictures/2.gif deleted file mode 100644 index 632098be..00000000 Binary files a/test/pictures/2.gif and /dev/null differ diff --git a/test/pictures/2.png b/test/pictures/2.png deleted file mode 100644 index a7ca42b2..00000000 Binary files a/test/pictures/2.png and /dev/null differ diff --git a/test/pictures/3.png b/test/pictures/3.png deleted file mode 100644 index 9d117b64..00000000 Binary files a/test/pictures/3.png and /dev/null differ diff --git a/test/pictures/4.jpg b/test/pictures/4.jpg deleted file mode 100644 index da78796c..00000000 Binary files a/test/pictures/4.jpg and /dev/null differ diff --git a/test/pictures/4.png b/test/pictures/4.png deleted file mode 100644 index 72c0a452..00000000 Binary files a/test/pictures/4.png and /dev/null differ diff --git a/test/pictures/5.png b/test/pictures/5.png deleted file mode 100644 index abefad59..00000000 Binary files a/test/pictures/5.png and /dev/null differ diff --git a/test/pictures/6.png b/test/pictures/6.png deleted file mode 100644 index 4953ceb6..00000000 Binary files a/test/pictures/6.png and /dev/null differ diff --git a/test/pictures/7.png b/test/pictures/7.png deleted file mode 100644 index c8934c1b..00000000 Binary files a/test/pictures/7.png and /dev/null differ diff --git a/test/pictures/8.png b/test/pictures/8.png deleted file mode 100644 index 01e41184..00000000 Binary files a/test/pictures/8.png and /dev/null differ diff --git a/test/pictures/Makefile.am b/test/pictures/Makefile.am deleted file mode 100644 index 63225946..00000000 --- a/test/pictures/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2006-2009 Josh Coalson -# Copyright (C) 2011-2016 Xiph.Org Foundation -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under different licenses. The codec libraries -# are distributed under Xiph.Org's BSD-like license (see the file -# COPYING.Xiph in this distribution). All other programs, libraries, and -# plugins are distributed under the GPL (see COPYING.GPL). The documentation -# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the -# FLAC distribution contains at the top the terms under which it may be -# distributed. -# -# Since this particular file is relevant to all components of FLAC, -# it may be distributed under the Xiph.Org license, which is the least -# restrictive of those mentioned above. See the file COPYING.Xiph in this -# distribution. - -EXTRA_DIST = \ - 0.gif \ - 0.jpg \ - 0.png \ - 1.gif \ - 1.png \ - 2.gif \ - 2.png \ - 3.png \ - 4.jpg \ - 4.png \ - 5.png \ - 6.png \ - 7.png \ - 8.png diff --git a/test/test_compression.sh b/test/test_compression.sh deleted file mode 100755 index e1191ad7..00000000 --- a/test/test_compression.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -e - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2012-2016 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. - -. ./common.sh - -PATH=`pwd`/../src/flac:$PATH - -echo "Using FLAC binary :" $(which flac) - -date=`date "+%Y%m%dT%H%M%S"` -fname="comp${date}.flac" - -last_k=0 -last_size=$(wc -c < noisy-sine.wav) - -echo "Original file size ${last_size} bytes." - -for k in 0 1 2 3 4 5 6 7 8 ; do - flac${EXE} -${k} --silent noisy-sine.wav -o ${fname} - size=$(wc -c < ${fname}) - echo "Compression level ${k}, file size ${size} bytes." - if test ${last_size} -lt ${size} ; then - echo "Error : Compression ${last_k} size ${last_size} >= compression ${k} size ${size}." - exit 1 - fi - # Need this because OSX's 'wc -c' returns a number with leading whitespace. - last_size=$((${size}+10)) - last_k=${k} - rm -f ${fname} - done diff --git a/test/test_flac.sh b/test/test_flac.sh deleted file mode 100755 index cd17b164..00000000 --- a/test/test_flac.sh +++ /dev/null @@ -1,1256 +0,0 @@ -#!/bin/sh -e - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -. ./common.sh - -# we use '.' as decimal separator in --skip/--until tests -export LANG=C LC_ALL=C - -dddie="die ERROR: creating files with dd" - -PATH=`pwd`/../src/flac:$PATH -PATH=`pwd`/../src/metaflac:$PATH -PATH=`pwd`/../src/test_streams:$PATH -PATH=`pwd`/../objs/$BUILD/bin:$PATH - -flac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" - -run_flac () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_flac.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac${EXE} $TOTALLY_SILENT --no-error-on-compression-fail $* 4>>test_flac.valgrind.log - else - flac${EXE} $TOTALLY_SILENT --no-error-on-compression-fail $* - fi -} - -run_metaflac () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_flac.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac${EXE} $* 4>>test_flac.valgrind.log - else - metaflac${EXE} $* - fi -} - -md5cmp () -{ - n=`( [ -f "$1" ] && [ -f "$2" ] && metaflac${EXE} --show-md5sum --no-filename "$1" "$2" 2>/dev/null || exit 1 ) | uniq | wc -l` - [ "$n" != "" ] && [ $n = 1 ] -} - -echo "Checking for --ogg support in flac..." -if flac${EXE} --ogg $TOTTALY_SILENT --force-raw-format --endian=little --sign=signed --channels=1 --bps=8 --sample-rate=44100 -c $0 1>/dev/null 2>&1 ; then - has_ogg=yes; - echo "flac --ogg works" -else - has_ogg=no; - echo "flac --ogg doesn't work" -fi - -echo "Generating streams..." -if [ ! -f wacky1.wav ] ; then - test_streams || die "ERROR during test_streams" -fi - -############################################################################ -# test that flac doesn't automatically overwrite files unless -f is used -############################################################################ - -echo "Try encoding to a file that exists; should fail" -cp wacky1.wav exist.wav -touch exist.flac -if run_flac -0 exist.wav ; then - die "ERROR: it should have failed but didn't" -else - echo "OK, it failed as it should" -fi - -echo "Try encoding with -f to a file that exists; should succeed" -if run_flac -0 --force exist.wav ; then - echo "OK, it succeeded as it should" -else - die "ERROR: it should have succeeded but didn't" -fi - -echo "Try decoding to a file that exists; should fail" -if run_flac -d exist.flac ; then - die "ERROR: it should have failed but didn't" -else - echo "OK, it failed as it should" -fi - -echo "Try decoding with -f to a file that exists; should succeed" -if run_flac -d -f exist.flac ; then - echo "OK, it succeeded as it should" -else - die "ERROR: it should have succeeded but didn't" -fi - -rm -f exist.wav exist.flac - -############################################################################ -# test fractional block sizes -############################################################################ - -test_fractional () -{ - blocksize=$1 - samples=$2 - dd if=noise.raw ibs=4 count=$samples of=pbs.raw 2>/dev/null || $dddie - echo $ECHO_N "fractional block size test (blocksize=$blocksize samples=$samples) encode... " $ECHO_C - run_flac --force --verify --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=$blocksize --no-padding --lax -o pbs.flac pbs.raw || die "ERROR" - echo $ECHO_N "decode... " $ECHO_C - run_flac --force --decode --force-raw-format --endian=little --sign=signed -o pbs.cmp pbs.flac || die "ERROR" - echo $ECHO_N "compare... " $ECHO_C - cmp pbs.raw pbs.cmp || die "ERROR: file mismatch" - echo "OK" - rm -f pbs.raw pbs.flac pbs.cmp -} - -# The special significance of 2048 is it's the # of samples that flac calls -# FLAC__stream_encoder_process() on. -# -# We're trying to make sure the 1-sample overread logic in the stream encoder -# (used for last-block checking) works; these values probe around common -# multiples of the flac sample chunk size (2048) and the blocksize. -for samples in 31 32 33 34 35 2046 2047 2048 2049 2050 ; do - test_fractional 33 $samples -done -for samples in 254 255 256 257 258 510 511 512 513 514 1022 1023 1024 1025 1026 2046 2047 2048 2049 2050 4094 4095 4096 4097 4098 ; do - test_fractional 256 $samples -done -for samples in 1022 1023 1024 1025 1026 2046 2047 2048 2049 2050 4094 4095 4096 4097 4098 ; do - test_fractional 2048 $samples -done -for samples in 1022 1023 1024 1025 1026 2046 2047 2048 2049 2050 4094 4095 4096 4097 4098 4606 4607 4608 4609 4610 8190 8191 8192 8193 8194 16382 16383 16384 16385 16386 ; do - test_fractional 4608 $samples -done - -############################################################################ -# basic 'round-trip' tests of various kinds of streams -############################################################################ - -rt_test_raw () -{ - f="$1" - extra="$2" - channels=`echo $f | awk -F- '{print $2}'` - bps=`echo $f | awk -F- '{print $3}'` - sign=`echo $f | awk -F- '{print $4}'` - - echo $ECHO_N "round-trip test ($f) encode... " $ECHO_C - run_flac --force --verify --force-raw-format --endian=little --sign=$sign --sample-rate=44100 --bps=$bps --channels=$channels --no-padding --lax -o rt.flac $extra $f || die "ERROR" - echo $ECHO_N "decode... " $ECHO_C - run_flac --force --decode --force-raw-format --endian=little --sign=$sign -o rt.raw $extra rt.flac || die "ERROR" - echo $ECHO_N "compare... " $ECHO_C - cmp $f rt.raw || die "ERROR: file mismatch" - echo "OK" - rm -f rt.flac rt.raw -} - -rt_test_wav () -{ - f="$1" - extra="$2" - echo $ECHO_N "round-trip test ($f) encode... " $ECHO_C - run_flac --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR" - echo $ECHO_N "decode... " $ECHO_C - run_flac --force --decode --channel-map=none -o rt.wav $extra rt.flac || die "ERROR" - echo $ECHO_N "compare... " $ECHO_C - cmp $f rt.wav || die "ERROR: file mismatch" - echo "OK" - rm -f rt.flac rt.wav -} - -rt_test_w64 () -{ - f="$1" - extra="$2" - echo $ECHO_N "round-trip test ($f) encode... " $ECHO_C - run_flac --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR" - echo $ECHO_N "decode... " $ECHO_C - run_flac --force --decode --channel-map=none -o rt.w64 $extra rt.flac || die "ERROR" - echo $ECHO_N "compare... " $ECHO_C - cmp $f rt.w64 || die "ERROR: file mismatch" - echo "OK" - rm -f rt.flac rt.w64 -} - -rt_test_rf64 () -{ - f="$1" - extra="$2" - echo $ECHO_N "round-trip test ($f) encode... " $ECHO_C - run_flac --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR" - echo $ECHO_N "decode... " $ECHO_C - run_flac --force --decode --channel-map=none -o rt.rf64 $extra rt.flac || die "ERROR" - echo $ECHO_N "compare... " $ECHO_C - cmp $f rt.rf64 || die "ERROR: file mismatch" - echo "OK" - rm -f rt.flac rt.rf64 -} - -rt_test_aiff () -{ - f="$1" - extra="$2" - echo $ECHO_N "round-trip test ($f) encode... " $ECHO_C - run_flac --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR" - echo $ECHO_N "decode... " $ECHO_C - run_flac --force --decode --channel-map=none -o rt.aiff $extra rt.flac || die "ERROR" - echo $ECHO_N "compare... " $ECHO_C - cmp $f rt.aiff || die "ERROR: file mismatch" - echo "OK" - rm -f rt.flac rt.aiff -} - -# assumes input file is WAVE; does not check the metadata-preserving features of flac-to-flac; that is checked later -rt_test_flac () -{ - f="$1" - extra="$2" - echo $ECHO_N "round-trip test ($f->flac->flac->wav) encode... " $ECHO_C - run_flac --force --verify --channel-map=none --no-padding --lax -o rt.flac $extra $f || die "ERROR" - echo $ECHO_N "re-encode... " $ECHO_C - run_flac --force --verify --lax -o rt2.flac rt.flac || die "ERROR" - echo $ECHO_N "decode... " $ECHO_C - run_flac --force --decode --channel-map=none -o rt.wav $extra rt2.flac || die "ERROR" - echo $ECHO_N "compare... " $ECHO_C - cmp $f rt.wav || die "ERROR: file mismatch" - echo "OK" - rm -f rt.wav rt.flac rt2.flac -} - -# assumes input file is WAVE; does not check the metadata-preserving features of flac-to-flac; that is checked later -rt_test_ogg_flac () -{ - f="$1" - extra="$2" - echo $ECHO_N "round-trip test ($f->oggflac->oggflac->wav) encode... " $ECHO_C - run_flac --force --verify --channel-map=none --no-padding --lax -o rt.oga --ogg $extra $f || die "ERROR" - echo $ECHO_N "re-encode... " $ECHO_C - run_flac --force --verify --lax -o rt2.oga --ogg rt.oga || die "ERROR" - echo $ECHO_N "decode... " $ECHO_C - run_flac --force --decode --channel-map=none -o rt.wav $extra rt2.oga || die "ERROR" - echo $ECHO_N "compare... " $ECHO_C - cmp $f rt.wav || die "ERROR: file mismatch" - echo "OK" - rm -f rt.wav rt.oga rt2.oga -} - -for f in rt-*.raw ; do - rt_test_raw $f -done -for f in rt-*.wav ; do - rt_test_wav $f -done -for f in rt-*.w64 ; do - rt_test_w64 $f -done -for f in rt-*.rf64 ; do - rt_test_rf64 $f -done -for f in rt-*.aiff ; do - rt_test_aiff $f -done -for f in rt-*.wav ; do - rt_test_flac $f -done -if [ $has_ogg = yes ] ; then - for f in rt-*.wav ; do - rt_test_ogg_flac $f - done -fi - -############################################################################ -# test --skip and --until -############################################################################ - -# -# first make some chopped-up raw files -# -echo "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMN" > master.raw -dd if=master.raw ibs=1 count=50 of=50c.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=10 count=40 of=50c.skip10.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=11 count=39 of=50c.skip11.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=20 count=30 of=50c.skip20.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=30 count=20 of=50c.skip30.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=40 count=10 of=50c.skip40.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 count=10 of=50c.until10.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 count=20 of=50c.until20.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 count=30 of=50c.until30.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 count=39 of=50c.until39.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 count=40 of=50c.until40.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=10 count=20 of=50c.skip10.until30.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=10 count=29 of=50c.skip10.until39.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=10 count=30 of=50c.skip10.until40.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=20 count=10 of=50c.skip20.until30.raw 2>/dev/null || $dddie -dd if=master.raw ibs=1 skip=20 count=20 of=50c.skip20.until40.raw 2>/dev/null || $dddie - -wav_eopt="--force --verify --no-padding --lax" -wav_dopt="--force --decode" - -raw_eopt="$wav_eopt --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1" -raw_dopt="$wav_dopt --force-raw-format --endian=big --sign=signed" - -# -# convert them to WAVE/AIFF/Ogg FLAC files -# -convert_to_wav () -{ - run_flac "$2" $1.raw || die "ERROR converting $1.raw to WAVE" - run_flac "$3" $1.flac || die "ERROR converting $1.raw to WAVE" -} -convert_to_wav 50c "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip10 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip11 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip20 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip30 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip40 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.until10 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.until20 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.until30 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.until39 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.until40 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip10.until30 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip10.until39 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip10.until40 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip20.until30 "$raw_eopt" "$wav_dopt" -convert_to_wav 50c.skip20.until40 "$raw_eopt" "$wav_dopt" - -convert_to_aiff () -{ - run_flac "$2" $1.raw || die "ERROR converting $1.raw to AIFF" - run_flac "$3" $1.flac -o $1.aiff || die "ERROR converting $1.raw to AIFF" -} -convert_to_aiff 50c "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip10 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip11 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip20 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip30 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip40 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.until10 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.until20 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.until30 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.until39 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.until40 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip10.until30 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip10.until39 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip10.until40 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip20.until30 "$raw_eopt" "$wav_dopt" -convert_to_aiff 50c.skip20.until40 "$raw_eopt" "$wav_dopt" - -convert_to_ogg () -{ - run_flac "$wav_eopt" --ogg $1.wav || die "ERROR converting $1.raw to Ogg FLAC" -} -if [ $has_ogg = yes ] ; then - convert_to_ogg 50c - convert_to_ogg 50c.skip10 - convert_to_ogg 50c.skip11 - convert_to_ogg 50c.skip20 - convert_to_ogg 50c.skip30 - convert_to_ogg 50c.skip40 - convert_to_ogg 50c.until10 - convert_to_ogg 50c.until20 - convert_to_ogg 50c.until30 - convert_to_ogg 50c.until39 - convert_to_ogg 50c.until40 - convert_to_ogg 50c.skip10.until30 - convert_to_ogg 50c.skip10.until39 - convert_to_ogg 50c.skip10.until40 - convert_to_ogg 50c.skip20.until30 - convert_to_ogg 50c.skip20.until40 -fi - -test_skip_until () -{ - in_fmt=$1 - out_fmt=$2 - - [ "$in_fmt" = wav ] || [ "$in_fmt" = aiff ] || [ "$in_fmt" = raw ] || [ "$in_fmt" = flac ] || [ "$in_fmt" = ogg ] || die "ERROR: internal error, bad 'in' format '$in_fmt'" - - [ "$out_fmt" = flac ] || [ "$out_fmt" = ogg ] || die "ERROR: internal error, bad 'out' format '$out_fmt'" - - if [ $in_fmt = raw ] ; then - eopt="$raw_eopt" - dopt="$raw_dopt" - else - eopt="$wav_eopt" - dopt="$wav_dopt" - fi - - if ( [ $in_fmt = flac ] || [ $in_fmt = ogg ] ) && ( [ $out_fmt = flac ] || [ $out_fmt = ogg ] ) ; then - CMP=md5cmp - else - CMP=cmp - fi - - if [ $out_fmt = ogg ] ; then - eopt="--ogg $eopt" - fi - - # - # test --skip when encoding - # - - desc="($in_fmt<->$out_fmt)" - - echo $ECHO_N "testing --skip=# (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 -o z50c.skip10.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.$in_fmt z50c.skip10.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.$in_fmt z50c.skip10.$in_fmt || die "ERROR: file mismatch for --skip=10 (encode) $desc" - rm -f z50c.skip10.$out_fmt z50c.skip10.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=mm:ss (encode) $desc... " $ECHO_C - run_flac $eopt --skip=0:01 -o z50c.skip0_01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip0_01.$in_fmt z50c.skip0_01.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.$in_fmt z50c.skip0_01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (encode) $desc" - rm -f z50c.skip0_01.$out_fmt z50c.skip0_01.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=mm:ss.sss (encode) $desc... " $ECHO_C - run_flac $eopt --skip=0:01.1001 -o z50c.skip0_01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip0_01.1001.$in_fmt z50c.skip0_01.1001.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip11.$in_fmt z50c.skip0_01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (encode) $desc" - rm -f z50c.skip0_01.1001.$out_fmt z50c.skip0_01.1001.$in_fmt - echo OK - - # - # test --skip when decoding - # - - if [ $in_fmt != $out_fmt ] ; then run_flac $eopt -o z50c.$out_fmt 50c.$in_fmt ; else cp -f 50c.$in_fmt z50c.$out_fmt ; fi || die "ERROR generating FLAC file $desc" - - echo $ECHO_N "testing --skip=# (decode) $desc... " $ECHO_C - run_flac $dopt --skip=10 -o z50c.skip10.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.$in_fmt z50c.skip10.$in_fmt || die "ERROR: file mismatch for --skip=10 (decode) $desc" - rm -f z50c.skip10.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=mm:ss (decode) $desc... " $ECHO_C - run_flac $dopt --skip=0:01 -o z50c.skip0_01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.$in_fmt z50c.skip0_01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (decode) $desc" - rm -f z50c.skip0_01.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=mm:ss.sss (decode) $desc... " $ECHO_C - run_flac $dopt --skip=0:01.1001 -o z50c.skip0_01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip11.$in_fmt z50c.skip0_01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (decode) $desc" - rm -f z50c.skip0_01.1001.$in_fmt - echo OK - - rm -f z50c.$out_fmt - - # - # test --until when encoding - # - - echo $ECHO_N "testing --until=# (encode) $desc... " $ECHO_C - run_flac $eopt --until=40 -o z50c.until40.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until40.$in_fmt z50c.until40.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.until40.$in_fmt || die "ERROR: file mismatch for --until=40 (encode) $desc" - rm -f z50c.until40.$out_fmt z50c.until40.$in_fmt - echo OK - - echo $ECHO_N "testing --until=mm:ss (encode) $desc... " $ECHO_C - run_flac $eopt --until=0:04 -o z50c.until0_04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until0_04.$in_fmt z50c.until0_04.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.until0_04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (encode) $desc" - rm -f z50c.until0_04.$out_fmt z50c.until0_04.$in_fmt - echo OK - - echo $ECHO_N "testing --until=mm:ss.sss (encode) $desc... " $ECHO_C - run_flac $eopt --until=0:03.9001 -o z50c.until0_03.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until0_03.9001.$in_fmt z50c.until0_03.9001.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until39.$in_fmt z50c.until0_03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (encode) $desc" - rm -f z50c.until0_03.9001.$out_fmt z50c.until0_03.9001.$in_fmt - echo OK - - echo $ECHO_N "testing --until=-# (encode) $desc... " $ECHO_C - run_flac $eopt --until=-10 -o z50c.until-10.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until-10.$in_fmt z50c.until-10.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.until-10.$in_fmt || die "ERROR: file mismatch for --until=-10 (encode) $desc" - rm -f z50c.until-10.$out_fmt z50c.until-10.$in_fmt - echo OK - - echo $ECHO_N "testing --until=-mm:ss (encode) $desc... " $ECHO_C - run_flac $eopt --until=-0:01 -o z50c.until-0_01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until-0_01.$in_fmt z50c.until-0_01.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.until-0_01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (encode) $desc" - rm -f z50c.until-0_01.$out_fmt z50c.until-0_01.$in_fmt - echo OK - - echo $ECHO_N "testing --until=-mm:ss.sss (encode) $desc... " $ECHO_C - run_flac $eopt --until=-0:01.1001 -o z50c.until-0_01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.until-0_01.1001.$in_fmt z50c.until-0_01.1001.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until39.$in_fmt z50c.until-0_01.1001.$in_fmt || die "ERROR: file mismatch for --until=-0:01.1001 (encode) $desc" - rm -f z50c.until-0_01.1001.$out_fmt z50c.until-0_01.1001.$in_fmt - echo OK - - # - # test --until when decoding - # - - if [ $in_fmt != $out_fmt ] ; then run_flac $eopt -o z50c.$out_fmt 50c.$in_fmt ; else cp -f 50c.$in_fmt z50c.$out_fmt ; fi || die "ERROR generating FLAC file $desc" - - echo $ECHO_N "testing --until=# (decode) $desc... " $ECHO_C - run_flac $dopt --until=40 -o z50c.until40.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.until40.$in_fmt || die "ERROR: file mismatch for --until=40 (decode) $desc" - rm -f z50c.until40.$in_fmt - echo OK - - echo $ECHO_N "testing --until=mm:ss (decode) $desc... " $ECHO_C - run_flac $dopt --until=0:04 -o z50c.until0_04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.until0_04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (decode) $desc" - rm -f z50c.until0_04.$in_fmt - echo OK - - echo $ECHO_N "testing --until=mm:ss.sss (decode) $desc... " $ECHO_C - run_flac $dopt --until=0:03.9001 -o z50c.until0_03.9001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until39.$in_fmt z50c.until0_03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (decode) $desc" - rm -f z50c.until0_03.9001.$in_fmt - echo OK - - echo $ECHO_N "testing --until=-# (decode) $desc... " $ECHO_C - run_flac $dopt --until=-10 -o z50c.until-10.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.until-10.$in_fmt || die "ERROR: file mismatch for --until=-10 (decode) $desc" - rm -f z50c.until-10.$in_fmt - echo OK - - echo $ECHO_N "testing --until=-mm:ss (decode) $desc... " $ECHO_C - run_flac $dopt --until=-0:01 -o z50c.until-0_01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.until-0_01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (decode) $desc" - rm -f z50c.until-0_01.$in_fmt - echo OK - - echo $ECHO_N "testing --until=-mm:ss.sss (decode) $desc... " $ECHO_C - run_flac $dopt --until=-0:01.1001 -o z50c.until-0_01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until39.$in_fmt z50c.until-0_01.1001.$in_fmt || die "ERROR: file mismatch for --until=-0:01.1001 (decode) $desc" - rm -f z50c.until-0_01.1001.$in_fmt - echo OK - - rm -f z50c.$out_fmt - - # - # test --skip and --until when encoding - # - - echo $ECHO_N "testing --skip=10 --until=# (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 --until=40 -o z50c.skip10.until40.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until40.$in_fmt z50c.skip10.until40.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until40.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=40 (encode) $desc" - rm -f z50c.skip10.until40.$out_fmt z50c.skip10.until40.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=mm:ss (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 --until=0:04 -o z50c.skip10.until0_04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until0_04.$in_fmt z50c.skip10.until0_04.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until0_04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (encode) $desc" - rm -f z50c.skip10.until0_04.$out_fmt z50c.skip10.until0_04.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=mm:ss.sss (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0_03.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until0_03.9001.$in_fmt z50c.skip10.until0_03.9001.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until0_03.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (encode) $desc" - rm -f z50c.skip10.until0_03.9001.$out_fmt z50c.skip10.until0_03.9001.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=+# (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 --until=+30 -o z50c.skip10.until+30.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until+30.$in_fmt z50c.skip10.until+30.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until+30.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+30 (encode) $desc" - rm -f z50c.skip10.until+30.$out_fmt z50c.skip10.until+30.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=+mm:ss (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 --until=+0:03 -o z50c.skip10.until+0_03.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until+0_03.$in_fmt z50c.skip10.until+0_03.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until+0_03.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+0:03 (encode) $desc" - rm -f z50c.skip10.until+0_03.$out_fmt z50c.skip10.until+0_03.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=+mm:ss.sss (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 --until=+0:02.9001 -o z50c.skip10.until+0_02.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until+0_02.9001.$in_fmt z50c.skip10.until+0_02.9001.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until+0_02.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+0:02.9001 (encode) $desc" - rm -f z50c.skip10.until+0_02.9001.$out_fmt z50c.skip10.until+0_02.9001.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=-# (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 --until=-10 -o z50c.skip10.until-10.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until-10.$in_fmt z50c.skip10.until-10.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until-10.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (encode) $desc" - rm -f z50c.skip10.until-10.$out_fmt z50c.skip10.until-10.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=-mm:ss (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 --until=-0:01 -o z50c.skip10.until-0_01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until-0_01.$in_fmt z50c.skip10.until-0_01.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until-0_01.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (encode) $desc" - rm -f z50c.skip10.until-0_01.$out_fmt z50c.skip10.until-0_01.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=-mm:ss.sss (encode) $desc... " $ECHO_C - run_flac $eopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0_01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - [ $in_fmt = $out_fmt ] || run_flac $dopt -o z50c.skip10.until-0_01.1001.$in_fmt z50c.skip10.until-0_01.1001.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until-0_01.1001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (encode) $desc" - rm -f z50c.skip10.until-0_01.1001.$out_fmt z50c.skip10.until-0_01.1001.$in_fmt - echo OK - - # - # test --skip and --until when decoding - # - - if [ $in_fmt != $out_fmt ] ; then run_flac $eopt -o z50c.$out_fmt 50c.$in_fmt ; else cp -f 50c.$in_fmt z50c.$out_fmt ; fi || die "ERROR generating FLAC file $desc" - - - echo $ECHO_N "testing --skip=10 --until=# (decode) $desc... " $ECHO_C - run_flac $dopt --skip=10 --until=40 -o z50c.skip10.until40.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until40.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=40 (decode) $desc" - rm -f z50c.skip10.until40.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=mm:ss (decode) $desc... " $ECHO_C - run_flac $dopt --skip=10 --until=0:04 -o z50c.skip10.until0_04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until0_04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (decode) $desc" - rm -f z50c.skip10.until0_04.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=mm:ss.sss (decode) $desc... " $ECHO_C - run_flac $dopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0_03.9001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until0_03.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (decode) $desc" - rm -f z50c.skip10.until0_03.9001.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=-# (decode) $desc... " $ECHO_C - run_flac $dopt --skip=10 --until=-10 -o z50c.skip10.until-10.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until-10.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (decode) $desc" - rm -f z50c.skip10.until-10.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=-mm:ss (decode) $desc... " $ECHO_C - run_flac $dopt --skip=10 --until=-0:01 -o z50c.skip10.until-0_01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.skip10.until-0_01.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (decode) $desc" - rm -f z50c.skip10.until-0_01.$in_fmt - echo OK - - echo $ECHO_N "testing --skip=10 --until=-mm:ss.sss (decode) $desc... " $ECHO_C - run_flac $dopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0_01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until39.$in_fmt z50c.skip10.until-0_01.1001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (decode) $desc" - rm -f z50c.skip10.until-0_01.1001.$in_fmt - echo OK - - rm -f z50c.$out_fmt -} - -test_skip_until raw flac -test_skip_until wav flac -test_skip_until aiff flac -test_skip_until flac flac -#@@@if [ $has_ogg = yes ] ; then -#@@@ #@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet -#@@@ test_skip_until ogg flac -#@@@fi - -if [ $has_ogg = yes ] ; then - test_skip_until raw ogg - test_skip_until wav ogg - test_skip_until aiff ogg - #@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet - #@@@test_skip_until flac ogg - #@@@test_skip_until ogg ogg -fi - -echo "testing seek extremes:" - -run_flac --verify --force --no-padding --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 noise.raw || die "ERROR generating FLAC file" - -if [ $is_win = no ] ; then - total_noise_cdda_samples=`run_metaflac --show-total-samples noise.flac` - [ $? = 0 ] || die "ERROR getting total sample count from noise.flac" -else - # some flavors of cygwin don't seem to treat the \x0d as a word - # separator, so we hard code it. we'll just have to fix it later - # if we change the way noise.flac is made. - total_noise_cdda_samples=393216 -fi - -echo $ECHO_N "testing --skip=0... " $ECHO_C -run_flac $wav_dopt --skip=0 -o z.wav noise.flac || die "ERROR decoding FLAC file noise.flac" -echo OK - -for delta in 2 1 ; do - n=`expr $total_noise_cdda_samples - $delta` - echo $ECHO_N "testing --skip=$n... " $ECHO_C - run_flac $wav_dopt --skip=$n -o z.wav noise.flac || die "ERROR decoding FLAC file noise.flac" - echo OK -done - -rm noise.flac z.wav - -############################################################################ -# test --input-size -############################################################################ - -#@@@ cat will not work on old cygwin, need to fix -if [ $is_win = no ] ; then - echo $ECHO_N "testing --input-size=50 --skip=10... " $ECHO_C - cat 50c.raw | run_flac $raw_eopt --input-size=50 --skip=10 -o z50c.skip10.flac - || die "ERROR generating FLAC file" - run_flac $raw_dopt -o z50c.skip10.raw z50c.skip10.flac || die "ERROR decoding FLAC file" - cmp 50c.skip10.raw z50c.skip10.raw || die "ERROR: file mismatch for --input-size=50 --skip=10" - rm -f z50c.skip10.raw z50c.skip10.flac - echo OK -fi - -############################################################################ -# test --output-prefix -############################################################################ - -in_dir=./tmp_in -out_dir=./tmp_out -mkdir $in_dir $out_dir || die "ERROR failed to create temp directories" - -cp 50c.raw 50c.flac $in_dir - -# -# test --output-prefix when encoding -# - -echo $ECHO_N "testing --output-prefix=$out_dir/ (encode)... " $ECHO_C -run_flac $raw_eopt --output-prefix=$out_dir/ $in_dir/50c.raw || die "ERROR generating FLAC file in $out_dir (encode)" -[ -f $out_dir/50c.flac ] || die "ERROR FLAC file not in $out_dir (encode)" -run_flac $raw_dopt $out_dir/50c.flac || die "ERROR decoding FLAC file (encode)" -[ -f $out_dir/50c.raw ] || die "ERROR RAW file not in $out_dir (encode)" -cmp 50c.raw $out_dir/50c.raw || die "ERROR: file mismatch for --output-prefix=$out_dir (encode)" -rm -f $out_dir/50c.flac $out_dir/50c.raw -echo OK - -# -# test --ouput-prefix when decoding -# - -echo $ECHO_N "testing --output-prefix=$out_dir/ (decode)... " $ECHO_C -run_flac $raw_dopt --output-prefix=$out_dir/ $in_dir/50c.flac || die "ERROR deocding FLAC file in $out_dir (decode)" -[ -f $out_dir/50c.raw ] || die "ERROR RAW file not in $out_dir (decode)" -run_flac $raw_eopt $out_dir/50c.raw || die "ERROR generating FLAC file (decode)" -[ -f $out_dir/50c.flac ] || die "ERROR FLAC file not in $out_dir (decode)" -cmp 50c.flac $out_dir/50c.flac || die "ERROR: file mismatch for --output-prefix=$out_dir (decode)" -rm -f $out_dir/50c.flac $out_dir/50c.raw -echo OK - -rm -rf $in_dir $out_dir - -############################################################################ -# test --cue -############################################################################ - -# -# create the cue sheet -# -cuesheet=cuetest.cue -cat > $cuesheet << EOF -CATALOG 1234567890123 -FILE "blah" WAVE - TRACK 01 AUDIO - INDEX 01 0 - INDEX 02 10 - INDEX 03 20 - TRACK 02 AUDIO - INDEX 01 30 - TRACK 04 AUDIO - INDEX 01 40 -EOF - -test_cue () -{ - in_fmt=$1 - out_fmt=$2 - - [ "$in_fmt" = wav ] || [ "$in_fmt" = aiff ] || [ "$in_fmt" = raw ] || [ "$in_fmt" = flac ] || [ "$in_fmt" = ogg ] || die "ERROR: internal error, bad 'in' format '$in_fmt'" - - [ "$out_fmt" = flac ] || [ "$out_fmt" = ogg ] || die "ERROR: internal error, bad 'out' format '$out_fmt'" - - if [ $in_fmt = raw ] ; then - eopt="$raw_eopt" - dopt="$raw_dopt" - else - eopt="$wav_eopt" - dopt="$wav_dopt" - fi - - if ( [ $in_fmt = flac ] || [ $in_fmt = ogg ] ) && ( [ $out_fmt = flac ] || [ $out_fmt = ogg ] ) ; then - CMP=md5cmp - else - CMP=cmp - fi - - if [ $out_fmt = ogg ] ; then - eopt="--ogg $eopt" - fi - - desc="($in_fmt<->$out_fmt)" - - # - # for this we need just need just one FLAC file; --cue only works while decoding - # - run_flac $eopt --cuesheet=$cuesheet -o z50c.cue.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" - - # To make it easy to translate from cue point to sample numbers, the - # file has a sample rate of 10 Hz and a cuesheet like so: - # - # TRACK 01, INDEX 01 : 0:00.00 -> sample 0 - # TRACK 01, INDEX 02 : 0:01.00 -> sample 10 - # TRACK 01, INDEX 03 : 0:02.00 -> sample 20 - # TRACK 02, INDEX 01 : 0:03.00 -> sample 30 - # TRACK 04, INDEX 01 : 0:04.00 -> sample 40 - # - echo $ECHO_N "testing --cue=- $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=- $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.0 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.0 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.0- $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.0- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.0- $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.1 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.1 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.1- $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.1- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.1- $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.2 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.2 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.2 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.2- $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.2- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.2- $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.4 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.4 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip20.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.4 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.4- $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.4- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip20.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.4- $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=-5.0 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=-5.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=-5.0 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=-4.1 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=-4.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=-4.1 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=-3.1 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=-3.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until40.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=-3.1 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=-1.4 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=-1.4 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.until30.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=-1.4 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.0-5.0 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.0-5.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.0-5.0 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.1-5.0 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.1-5.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.1-5.0 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.2-4.1 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.2-4.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip10.until40.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.2-4.1 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - echo $ECHO_N "testing --cue=1.4-2.0 $desc... " $ECHO_C - run_flac $dopt -o z50c.cued.$in_fmt --cue=1.4-2.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" - $CMP 50c.skip20.until30.$in_fmt z50c.cued.$in_fmt || die "ERROR: file mismatch for --cue=1.4-2.0 $desc" - rm -f z50c.cued.$in_fmt - echo OK - - rm -f z50c.cue.$out_fmt -} - -test_cue raw flac -test_cue wav flac -test_cue aiff flac -test_cue flac flac -#@@@if [ $has_ogg = yes ] ; then -#@@@ #@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet -#@@@ test_cue ogg flac -#@@@fi - -if [ $has_ogg = yes ] ; then - test_cue raw ogg - test_cue wav ogg - test_cue aiff ogg - #@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet - #@@@test_cue flac ogg - #@@@test_cue ogg ogg -fi - -############################################################################ -# test 'fixup' code that happens when a FLAC file with total_samples == 0 -# in the STREAMINFO block is converted to WAVE or AIFF, requiring the -# decoder go back and fix up the chunk headers -############################################################################ - -echo $ECHO_N "WAVE fixup test... " $ECHO_C - -echo $ECHO_N "prepare... " $ECHO_C -convert_to_wav noise "$raw_eopt" "$wav_dopt" || die "ERROR creating reference WAVE" - -echo $ECHO_N "encode... " $ECHO_C -# the pipe from 'cat' to 'flac' does not work on cygwin because of the EOF/ -# binary-mode stdin problem, so we use an undocumented option to metaflac to -# set the total sample count to 0 -if [ $is_win = yes ] ; then - run_flac $raw_eopt noise.raw -o fixup.flac || die "ERROR generating FLAC file" - run_metaflac --set-total-samples=0 fixup.flac 2> /dev/null -else - cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file" -fi - -echo $ECHO_N "decode... " $ECHO_C -run_flac $wav_dopt fixup.flac -o fixup.wav || die "ERROR decoding FLAC file" - -echo $ECHO_N "compare... " $ECHO_C -cmp noise.wav fixup.wav || die "ERROR: file mismatch" - -echo OK -rm -f noise.wav fixup.wav fixup.flac - -echo $ECHO_N "AIFF fixup test... " $ECHO_C - -echo $ECHO_N "prepare... " $ECHO_C -convert_to_aiff noise "$raw_eopt" "$wav_dopt" || die "ERROR creating reference AIFF" - -echo $ECHO_N "encode... " $ECHO_C -# the pipe from 'cat' to 'flac' does not work on cygwin because of the EOF/ -# binary-mode stdin problem, so we use an undocumented option to metaflac to -# set the total sample count to 0 -if [ $is_win = yes ] ; then - run_flac $raw_eopt noise.raw -o fixup.flac || die "ERROR generating FLAC file" - run_metaflac --set-total-samples=0 fixup.flac 2> /dev/null -else - cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file" -fi - -echo $ECHO_N "decode... " $ECHO_C -run_flac $wav_dopt fixup.flac -o fixup.aiff || die "ERROR decoding FLAC file" - -echo $ECHO_N "compare... " $ECHO_C -cmp noise.aiff fixup.aiff || die "ERROR: file mismatch" - -echo OK -rm -f noise.aiff fixup.aiff fixup.flac - - -############################################################################ -# multi-file tests -############################################################################ - -echo "Generating multiple input files from noise..." -multifile_format_decode="--endian=big --sign=signed" -multifile_format_encode="$multifile_format_decode --sample-rate=44100 --bps=16 --channels=2 --no-padding" -short_noise_cdda_samples=`expr $total_noise_cdda_samples / 8` -run_flac --verify --force --force-raw-format $multifile_format_encode --until=$short_noise_cdda_samples -o shortnoise.flac noise.raw || die "ERROR generating FLAC file" -run_flac --decode --force shortnoise.flac -o shortnoise.raw --force-raw-format $multifile_format_decode || die "ERROR generating RAW file" -run_flac --decode --force shortnoise.flac || die "ERROR generating WAVE file" -run_flac --decode --force shortnoise.flac -o shortnoise.aiff || die "ERROR generating AIFF file" -cp shortnoise.flac file0.flac -cp shortnoise.flac file1.flac -cp shortnoise.flac file2.flac -rm -f shortnoise.flac -cp shortnoise.wav file0.wav -cp shortnoise.wav file1.wav -cp shortnoise.wav file2.wav -rm -f shortnoise.wav -cp shortnoise.aiff file0.aiff -cp shortnoise.aiff file1.aiff -cp shortnoise.aiff file2.aiff -rm -f shortnoise.aiff -cp shortnoise.raw file0.raw -cp shortnoise.raw file1.raw -cp shortnoise.raw file2.raw -rm -f shortnoise.raw -# create authoritative sector-aligned files for comparison -file0_samples=`expr \( $short_noise_cdda_samples / 588 \) \* 588` -file0_remainder=`expr $short_noise_cdda_samples - $file0_samples` -file1_samples=`expr \( \( $file0_remainder + $short_noise_cdda_samples \) / 588 \) \* 588` -file1_remainder=`expr $file0_remainder + $short_noise_cdda_samples - $file1_samples` -file1_samples=`expr $file1_samples - $file0_remainder` -file2_samples=`expr \( \( $file1_remainder + $short_noise_cdda_samples \) / 588 \) \* 588` -file2_remainder=`expr $file1_remainder + $short_noise_cdda_samples - $file2_samples` -file2_samples=`expr $file2_samples - $file1_remainder` -if [ $file2_remainder != '0' ] ; then - file2_samples=`expr $file2_samples + $file2_remainder` - file2_remainder=`expr 588 - $file2_remainder` -fi - -dd if=file0.raw ibs=4 count=$file0_samples of=file0s.raw 2>/dev/null || $dddie -dd if=file0.raw ibs=4 count=$file0_remainder of=file1s.raw skip=$file0_samples 2>/dev/null || $dddie -dd if=file1.raw ibs=4 count=$file1_samples of=z.raw 2>/dev/null || $dddie -cat z.raw >> file1s.raw || die "ERROR: cat-ing sector-aligned files" -dd if=file1.raw ibs=4 count=$file1_remainder of=file2s.raw skip=$file1_samples 2>/dev/null || $dddie -dd if=file2.raw ibs=4 count=$file2_samples of=z.raw 2>/dev/null || $dddie -cat z.raw >> file2s.raw || die "ERROR: cat-ing sector-aligned files" -dd if=/dev/zero ibs=4 count=$file2_remainder of=z.raw 2>/dev/null || $dddie -cat z.raw >> file2s.raw || die "ERROR: cat-ing sector-aligned files" -rm -f z.raw - -convert_to_wav file0s "$multifile_format_encode --force --force-raw-format" "$SILENT --force --decode" || die "ERROR creating authoritative sector-aligned WAVE" -convert_to_wav file1s "$multifile_format_encode --force --force-raw-format" "$SILENT --force --decode" || die "ERROR creating authoritative sector-aligned WAVE" -convert_to_wav file2s "$multifile_format_encode --force --force-raw-format" "$SILENT --force --decode" || die "ERROR creating authoritative sector-aligned WAVE" - -convert_to_aiff file0s "$multifile_format_encode --force --force-raw-format" "$SILENT --force --decode" || die "ERROR creating authoritative sector-aligned AIFF" -convert_to_aiff file1s "$multifile_format_encode --force --force-raw-format" "$SILENT --force --decode" || die "ERROR creating authoritative sector-aligned AIFF" -convert_to_aiff file2s "$multifile_format_encode --force --force-raw-format" "$SILENT --force --decode" || die "ERROR creating authoritative sector-aligned AIFF" - -test_multifile () -{ - input_type=$1 - streamtype=$2 - sector_align=$3 - encode_options="$4" - - extra_encode_options="" - extra_decode_options="" - if [ $input_type = "raw" ] ; then - extra_encode_options="--force-raw-format $multifile_format_encode" - extra_decode_options="--force-raw-format $multifile_format_decode" - else - if [ $input_type = "aiff" ] ; then - extra_decode_options="--force-aiff-format" - fi - fi - - if [ $streamtype = ogg ] ; then - suffix=oga - encode_options="$encode_options --ogg" - else - suffix=flac - fi - - if [ $sector_align = sector_align ] ; then - encode_options="$encode_options --sector-align" - fi - - if [ $input_type = flac ] || [ $input_type = ogg ] ; then - CMP=md5cmp - else - CMP=cmp - fi - - for n in 0 1 2 ; do - cp file$n.$input_type file${n}x.$input_type - done - run_flac --force $encode_options $extra_encode_options file0x.$input_type file1x.$input_type file2x.$input_type || die "ERROR" - run_flac --force --decode $extra_decode_options file0x.$suffix file1x.$suffix file2x.$suffix || die "ERROR" - if [ $sector_align != sector_align ] ; then - for n in 0 1 2 ; do - $CMP file$n.$input_type file${n}x.$input_type || die "ERROR: file mismatch on file #$n" - done - else - for n in 0 1 2 ; do - $CMP file${n}s.$input_type file${n}x.$input_type || die "ERROR: file mismatch on file #$n" - done - fi - for n in 0 1 2 ; do - rm -f file${n}x.$suffix file${n}x.$input_type - done -} - -input_types="raw wav aiff flac" -#@@@ doesn't work yet because md5cmp doesn't work because metaflac doesn't work on ogg flac yet -#@@@if [ $has_ogg = yes ] ; then -#@@@ input_types="$input_types ogg" -#@@@fi -for input_type in $input_types ; do - echo "Testing multiple $input_type files without verify..." - test_multifile $input_type flac no_sector_align "" - - echo "Testing multiple $input_type files with verify..." - test_multifile $input_type flac no_sector_align "--verify" - - if [ $input_type != flac ] && [ $input_type != ogg ] ; then # --sector-align not supported for FLAC input - echo "Testing multiple $input_type files with --sector-align, without verify..." - test_multifile $input_type flac sector_align "" - - echo "Testing multiple $input_type files with --sector-align, with verify..." - test_multifile $input_type flac sector_align "--verify" - fi - - if [ $has_ogg = yes ] ; then - echo "Testing multiple $input_type files with --ogg, without verify..." - test_multifile $input_type ogg no_sector_align "" - - echo "Testing multiple $input_type files with --ogg, with verify..." - test_multifile $input_type ogg no_sector_align "--verify" - - if [ $input_type != flac ] ; then # --sector-align not supported for FLAC input - echo "Testing multiple $input_type files with --ogg and --sector-align, without verify..." - test_multifile $input_type ogg sector_align "" - - echo "Testing multiple $input_type files with --ogg and --sector-align, with verify..." - test_multifile $input_type ogg sector_align "--verify" - fi - - echo "Testing multiple $input_type files with --ogg and --serial-number, with verify..." - test_multifile $input_type ogg no_sector_align "--serial-number=321 --verify" - fi -done - - -############################################################################ -# test --keep-foreign-metadata -############################################################################ - -echo "Testing --keep-foreign-metadata..." - -rt_test_wav wacky1.wav '--keep-foreign-metadata' -rt_test_wav wacky2.wav '--keep-foreign-metadata' -rt_test_w64 wacky1.w64 '--keep-foreign-metadata' -rt_test_w64 wacky2.w64 '--keep-foreign-metadata' -rt_test_rf64 wacky1.rf64 '--keep-foreign-metadata' -rt_test_rf64 wacky2.rf64 '--keep-foreign-metadata' - - -############################################################################ -# test the metadata-handling properties of flac-to-flac encoding -############################################################################ - -echo "Testing the metadata-handling properties of flac-to-flac encoding..." - -testdatadir=${top_srcdir}/test/flac-to-flac-metadata-test-files - -filter () -{ - # minor danger, changing vendor strings might change the length of the - # VORBIS_COMMENT block, but if we add "^ length: " to the patterns, - # we lose info about PADDING size that we need - grep -Ev '^ vendor string: |^ m..imum .....size: ' | sed -e 's/, stream_offset.*//' -} -flac2flac () -{ - file="$testdatadir/$1" - case="$testdatadir/$2" - args="$3" - expect="$case-expect.meta" - echo $ECHO_N "$2... " $ECHO_C - # The 'make distcheck' target needs this. - chmod u+w $file - run_flac -f -o out.flac $args $file || die "ERROR encoding FLAC file" - run_metaflac --list out.flac | filter > out1.meta || die "ERROR listing metadata of output FLAC file" - # Ignore lengths which can be affected by the version string. - sed "s/length:.*/length: XXX/" out1.meta > out.meta - diff -q -w $expect out.meta 2>/dev/null || die "ERROR: metadata does not match expected $expect" - echo OK -} - -#filter=', stream_offset.*|^ vendor string: |^ length: |^ m..imum .....size: ' - -# case 00a: no alterations on a file with all metadata types, keep all metadata, in same order -flac2flac input-SCVAUP.flac case00a "" -# case 01a: on file with multiple PADDING blocks, they should be aggregated into one at the end -flac2flac input-SCVPAP.flac case01a "" -# case 01b: on file with multiple PADDING blocks and --no-padding specified, they should all be deleted -flac2flac input-SCVPAP.flac case01b "--no-padding" -# case 01c: on file with multiple PADDING blocks and -P specified, they should all be overwritten with -P value -flac2flac input-SCVPAP.flac case01c "-P 1234" -# case 01d: on file with no PADDING blocks, use -P setting -flac2flac input-SCVA.flac case01d "-P 1234" -# case 01e: on file with no PADDING blocks and no -P given, use default padding -flac2flac input-SCVA.flac case01e "" -# case 02a: on file with no VORBIS_COMMENT block, add new VORBIS_COMMENT -flac2flac input-SCPAP.flac case02a "" -# case 02b: on file with no VORBIS_COMMENT block and --tag, add new VORBIS_COMMENT with tags -flac2flac input-SCPAP.flac case02b "--tag=artist=0" -# case 02c: on file with VORBIS_COMMENT block and --tag, replace existing VORBIS_COMMENT with new tags -flac2flac input-SCVAUP.flac case02c "--tag=artist=0" -# case 03a: on file with no CUESHEET block and --cuesheet specified, add it -flac2flac input-SVAUP.flac case03a "--cuesheet=$testdatadir/input0.cue" -# case 03b: on file with CUESHEET block and --cuesheet specified, overwrite existing CUESHEET -flac2flac input-SCVAUP.flac case03b "--cuesheet=$testdatadir/input0.cue" -# case 03c: on file with CUESHEET block and size-changing option specified, drop existing CUESHEET -flac2flac input-SCVAUP.flac case03c "--skip=1" -# case 04a: on file with no SEEKTABLE block and --no-seektable specified, no SEEKTABLE -flac2flac input-VA.flac case04a "--no-padding --no-seektable" -# case 04b: on file with no SEEKTABLE block and -S specified, new SEEKTABLE -flac2flac input-VA.flac case04b "--no-padding -S 5x" -# case 04c: on file with no SEEKTABLE block and no seektable options specified, new SEEKTABLE with default points -flac2flac input-VA.flac case04c "--no-padding" -# case 04d: on file with SEEKTABLE block and --no-seektable specified, drop existing SEEKTABLE -flac2flac input-SCVA.flac case04d "--no-padding --no-seektable" -# case 04e: on file with SEEKTABLE block and -S specified, overwrite existing SEEKTABLE -flac2flac input-SCVA.flac case04e "--no-padding -S 5x" -# case 04f: on file with SEEKTABLE block and size-changing option specified, drop existing SEEKTABLE, new SEEKTABLE with default points -#(already covered by case03c) - -rm -f out.flac out.meta out1.meta - -#@@@ when metaflac handles ogg flac, duplicate flac2flac tests here - -cd .. diff --git a/test/test_grabbag.sh b/test/test_grabbag.sh deleted file mode 100755 index 3af2741d..00000000 --- a/test/test_grabbag.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/sh -e - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -. ./common.sh - -PATH=../src/test_grabbag/cuesheet:$PATH -PATH=../src/test_grabbag/picture:$PATH -PATH=../objs/$BUILD/bin:$PATH - -test_cuesheet -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_cuesheet executable" -test_picture -h 1>/dev/null 2>/dev/null || die "ERROR can't find test_picture executable" - -run_test_cuesheet () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 test_cuesheet $*" >>test_grabbag.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_cuesheet${EXE} $* 4>>test_grabbag.valgrind.log - else - test_cuesheet${EXE} $* - fi -} - -run_test_picture () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 test_picture $*" >>test_grabbag.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_picture${EXE} $* 4>>test_grabbag.valgrind.log - else - test_picture${EXE} $* - fi -} - -######################################################################## -# -# test_picture -# -######################################################################## - -log=picture.log -picture_dir=${top_srcdir}/test/pictures - -echo "Running test_picture..." - -rm -f $log - -run_test_picture $picture_dir >> $log 2>&1 - -if [ $is_win = yes ] ; then - diff -w ${top_srcdir}/test/picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff" -else - diff ${top_srcdir}/test/picture.ok $log > picture.diff || die "Error: .log file does not match .ok file, see picture.diff" -fi - -echo "PASSED (results are in $log)" - -######################################################################## -# -# test_cuesheet -# -######################################################################## - -log=cuesheet.log -bad_cuesheets=${top_srcdir}/test/cuesheets/bad.*.cue -good_cuesheets=${top_srcdir}/test/cuesheets/good.*.cue -good_leadout=`expr 80 \* 60 \* 44100` -bad_leadout=`expr $good_leadout + 1` - -echo "Running test_cuesheet..." - -rm -f $log - -# -# negative tests -# -for cuesheet in $bad_cuesheets ; do - echo "NEGATIVE $cuesheet" | sed "s|${top_srcdir}/test/||" >> $log 2>&1 - run_test_cuesheet $cuesheet $good_leadout 44100 cdda >> $log 2>&1 || exit_code=$? - if [ "$exit_code" = 255 ] ; then - die "Error: test script is broken" - fi - cuesheet_pass1=${cuesheet}.1 - cuesheet_pass2=${cuesheet}.2 - rm -f $cuesheet_pass1 $cuesheet_pass2 -done - -# -# positive tests -# -for cuesheet in $good_cuesheets ; do - echo "POSITIVE $cuesheet" | sed "s|${top_srcdir}/test/||" >> $log 2>&1 - run_test_cuesheet $cuesheet $good_leadout 44100 cdda >> $log 2>&1 - exit_code=$? - if [ "$exit_code" = 255 ] ; then - die "Error: test script is broken" - elif [ "$exit_code" != 0 ] ; then - die "Error: good cuesheet is broken" - fi - cuesheet_out=$(echo $cuesheet | sed "s|${top_srcdir}/test/||") - cuesheet_pass1=${cuesheet_out}.1 - cuesheet_pass2=${cuesheet_out}.2 - diff $cuesheet_pass1 $cuesheet_pass2 >> $log 2>&1 || die "Error: pass1 and pass2 output differ" - rm -f $cuesheet_pass1 $cuesheet_pass2 -done - -if [ $is_win = yes ] ; then - diff -w ${top_srcdir}/test/cuesheet.ok $log > cuesheet.diff || die "Error: .log file does not match .ok file, see cuesheet.diff" -else - diff ${top_srcdir}/test/cuesheet.ok $log > cuesheet.diff || die "Error: .log file does not match .ok file, see cuesheet.diff" -fi - -echo "PASSED (results are in $log)" diff --git a/test/test_libFLAC++.sh b/test/test_libFLAC++.sh deleted file mode 100755 index d71f36f3..00000000 --- a/test/test_libFLAC++.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -e - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -. ./common.sh - -PATH=../src/test_libFLAC++:$PATH -PATH=../objs/$BUILD/bin:$PATH - -run_test_libFLACpp () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_libFLAC++${EXE} $* 4>>test_libFLAC++.valgrind.log - else - test_libFLAC++${EXE} $* - fi -} - -run_test_libFLACpp || die "ERROR during test_libFLAC++" diff --git a/test/test_libFLAC.sh b/test/test_libFLAC.sh deleted file mode 100755 index 2259eb08..00000000 --- a/test/test_libFLAC.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -e - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -. ./common.sh - -PATH=../src/test_libFLAC:$PATH -PATH=../objs/$BUILD/bin:$PATH - -run_test_libFLAC () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_libFLAC${EXE} $* 4>>test_libFLAC.valgrind.log - else - test_libFLAC${EXE} $* - fi -} - -run_test_libFLAC || die "ERROR during test_libFLAC" diff --git a/test/test_metaflac.sh b/test/test_metaflac.sh deleted file mode 100755 index 3df56a4e..00000000 --- a/test/test_metaflac.sh +++ /dev/null @@ -1,377 +0,0 @@ -#!/bin/sh -e - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -. ./common.sh - -PATH=`pwd`/../src/flac:$PATH -PATH=`pwd`/../src/metaflac:$PATH -PATH=`pwd`/../objs/$BUILD/bin:$PATH - -if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then EGREP='grep -E' - else EGREP='egrep' -fi - -testdir="metaflac-test-files" -flacfile="metaflac.flac" - -flac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" -metaflac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable" - -run_flac () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_metaflac.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac${EXE} ${TOTALLY_SILENT} --no-error-on-compression-fail $* 4>>test_metaflac.valgrind.log - else - flac${EXE} ${TOTALLY_SILENT} --no-error-on-compression-fail $* - fi -} - -run_metaflac () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_metaflac.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac${EXE} $* 4>>test_metaflac.valgrind.log - else - metaflac${EXE} $* - fi -} - -run_metaflac_silent () -{ - if [ -z "$SILENT" ] ; then - run_metaflac $* - else - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_metaflac.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac${EXE} $* 2>/dev/null 4>>test_metaflac.valgrind.log - else - metaflac${EXE} $* 2>/dev/null - fi - fi -} - -check_flac () -{ - run_flac --silent --test $flacfile || die "ERROR in $flacfile" 1>&2 -} - -echo "Generating stream..." -bytes=80000 -if dd if=/dev/zero ibs=1 count=$bytes 2>/dev/null | flac${EXE} ${TOTALLY_SILENT} --force --verify -0 --input-size=$bytes --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=8000 - ; then - chmod +w $flacfile -else - die "ERROR during generation" -fi - -check_flac - -testdatadir=${top_srcdir}/test/metaflac-test-files - -filter () -{ - # minor danger, changing vendor strings will change the length of the - # VORBIS_COMMENT block, but if we add "^ length: " to the patterns, - # we lose info about PADDING size that we need - # grep pattern 1: remove vendor string - # grep pattern 2: remove minimum/maximum frame and block size from STREAMINFO - # grep pattern 3: remove hexdump data from PICTURE metadata blocks - # sed pattern 1: remove stream offset values from SEEKTABLE points - $EGREP -v '^ vendor string: |^ m..imum .....size: |^ 0000[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]: ' \ - | sed -e 's/, stream_offset.*//' -} -metaflac_test () -{ - case="$testdatadir/$1" - desc="$2" - args="$3" - expect="$case-expect.meta" - echo $ECHO_N "test $1: $desc... " $ECHO_C - run_metaflac $args $flacfile | filter > $testdir/out1.meta || die "ERROR running metaflac" - # Ignore lengths which can be affected by the version string. - sed "s/length:.*/length: XXX/" $testdir/out1.meta > $testdir/out.meta - diff -w $expect $testdir/out.meta > /dev/null 2>&1 || die "ERROR: metadata does not match expected $expect" - # To blindly accept (and check later): cp -f $testdir/out.meta $expect - echo OK -} - -metaflac_test case00 "--list" "--list" - -metaflac_test case01 "STREAMINFO --show-* shortcuts" " - --show-md5sum - --show-min-blocksize - --show-max-blocksize - --show-min-framesize - --show-max-framesize - --show-sample-rate - --show-channels - --show-bps - --show-total-samples" - -run_metaflac --preserve-modtime --add-padding=12345 $flacfile -check_flac -metaflac_test case02 "--add-padding" "--list" - -# some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore: -run_metaflac --set-tag="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile -check_flac -metaflac_test case03 "--set-tag=ARTIST" "--list" - -run_metaflac --set-tag="ARTIST=Chuck_Woolery" $flacfile -check_flac -metaflac_test case04 "--set-tag=ARTIST" "--list" - -run_metaflac --set-tag="ARTIST=Vern" $flacfile -check_flac -metaflac_test case05 "--set-tag=ARTIST" "--list" - -run_metaflac --set-tag="TITLE=He_who_smelt_it_dealt_it" $flacfile -check_flac -metaflac_test case06 "--set-tag=TITLE" "--list" - -metaflac_test case07 "--show-vendor-tag --show-tag=ARTIST" "--show-vendor-tag --show-tag=ARTIST" - -run_metaflac --remove-first-tag=ARTIST $flacfile -check_flac -metaflac_test case08 "--remove-first-tag=ARTIST" "--list" - -run_metaflac --remove-tag=ARTIST $flacfile -check_flac -metaflac_test case09 "--remove-tag=ARTIST" "--list" - -metaflac_test case10 "--list --block-type=VORBIS_COMMENT" "--list --block-type=VORBIS_COMMENT" -metaflac_test case11 "--list --block-number=0" "--list --block-number=0" -metaflac_test case12 "--list --block-number=1,2,999" "--list --block-number=1,2,999" -metaflac_test case13 "--list --block-type=VORBIS_COMMENT,PADDING" "--list --block-type=VORBIS_COMMENT,PADDING" -metaflac_test case14 "--list --except-block-type=SEEKTABLE,VORBIS_COMMENT" "--list --except-block-type=SEEKTABLE,VORBIS_COMMENT" -metaflac_test case15 "--list --except-block-type=STREAMINFO" "--list --except-block-type=STREAMINFO" - -run_metaflac --add-padding=4321 $flacfile $flacfile -check_flac -metaflac_test case16 "--add-padding=4321 * 2" "--list" - -run_metaflac --merge-padding $flacfile -check_flac -metaflac_test case17 "--merge-padding" "--list" - -run_metaflac --add-padding=0 $flacfile -check_flac -metaflac_test case18 "--add-padding=0" "--list" - -run_metaflac --sort-padding $flacfile -check_flac -metaflac_test case19 "--sort-padding" "--list" - -run_metaflac --add-padding=0 $flacfile -check_flac -metaflac_test case20 "--add-padding=0" "--list" - -run_metaflac --remove-all-tags $flacfile -check_flac -metaflac_test case21 "--remove-all-tags" "--list" - -run_metaflac --remove --block-number=1,99 --dont-use-padding $flacfile -check_flac -metaflac_test case22 "--remove --block-number=1,99 --dont-use-padding" "--list" - -run_metaflac --remove --block-number=99 --dont-use-padding $flacfile -check_flac -metaflac_test case23 "--remove --block-number=99 --dont-use-padding" "--list" - -run_metaflac --remove --block-type=PADDING $flacfile -check_flac -metaflac_test case24 "--remove --block-type=PADDING" "--list" - -run_metaflac --remove --block-type=PADDING --dont-use-padding $flacfile -check_flac -metaflac_test case25 "--remove --block-type=PADDING --dont-use-padding" "--list" - -run_metaflac --add-padding=0 $flacfile $flacfile -check_flac -metaflac_test case26 "--add-padding=0 * 2" "--list" - -run_metaflac --remove --except-block-type=PADDING $flacfile -check_flac -metaflac_test case27 "--remove --except-block-type=PADDING" "--list" - -run_metaflac --remove-all $flacfile -check_flac -metaflac_test case28 "--remove-all" "--list" - -run_metaflac --remove-all --dont-use-padding $flacfile -check_flac -metaflac_test case29 "--remove-all --dont-use-padding" "--list" - -run_metaflac --remove-all --dont-use-padding $flacfile -check_flac -metaflac_test case30 "--remove-all --dont-use-padding" "--list" - -run_metaflac --set-tag="f=0123456789abcdefghij" $flacfile -check_flac -metaflac_test case31 "--set-tag=..." "--list" - -run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile -check_flac -metaflac_test case32 "--remove-all-tags --set-tag=..." "--list" - -run_metaflac --remove-all-tags --set-tag="f=0123456789abcde" $flacfile -check_flac -metaflac_test case33 "--remove-all-tags --set-tag=..." "--list" - -run_metaflac --remove-all-tags --set-tag="f=0" $flacfile -check_flac -metaflac_test case34 "--remove-all-tags --set-tag=..." "--list" - -run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile -check_flac -metaflac_test case35 "--remove-all-tags --set-tag=..." "--list" - -run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile -check_flac -metaflac_test case36 "--remove-all-tags --set-tag=..." "--list" - -run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile -check_flac -metaflac_test case37 "--remove-all-tags --set-tag=..." "--list" - -run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghij" $flacfile -check_flac -metaflac_test case38 "--remove-all-tags --set-tag=..." "--list" - -echo "TITLE=Tittle" | run_metaflac --import-tags-from=- $flacfile -check_flac -metaflac_test case39 "--import-tags-from=-" "--list" - -cat > vc.txt << EOF -artist=Fartist -artist=artits -EOF -run_metaflac --import-tags-from=vc.txt $flacfile -check_flac -metaflac_test case40 "--import-tags-from=[FILE]" "--list" - -rm vc.txt - -run_metaflac --add-replay-gain $flacfile -check_flac -metaflac_test case41 "--add-replay-gain" "--list" - -run_metaflac --remove-replay-gain $flacfile -check_flac -metaflac_test case42 "--remove-replay-gain" "--list" - -run_metaflac --scan-replay-gain $flacfile -check_flac -metaflac_test case42 "--scan-replay-gain" "--list" - -# CUESHEET blocks -cs_in=${top_srcdir}/test/cuesheets/good.000.cue -cs_out=metaflac.cue -cs_out2=metaflac2.cue -run_metaflac --import-cuesheet-from="$cs_in" $flacfile -check_flac -metaflac_test case43 "--import-cuesheet-from" "--list" -run_metaflac --export-cuesheet-to=$cs_out $flacfile -run_metaflac --remove --block-type=CUESHEET $flacfile -check_flac -metaflac_test case44 "--remove --block-type=CUESHEET" "--list" -run_metaflac --import-cuesheet-from=$cs_out $flacfile -check_flac -metaflac_test case45 "--import-cuesheet-from" "--list" -run_metaflac --export-cuesheet-to=$cs_out2 $flacfile -echo "comparing cuesheets:" -diff $cs_out $cs_out2 || die "ERROR, cuesheets should be identical" -echo identical - -rm -f $cs_out $cs_out2 - -# PICTURE blocks -ncase=46 -for f in \ - 0.gif \ - 1.gif \ - 2.gif \ -; do - run_metaflac --import-picture-from="|image/gif|$f||${top_srcdir}/test/pictures/$f" $flacfile - check_flac - metaflac_test "case$ncase" "--import-picture-from" "--list" - ncase=`expr $ncase + 1` -done -for f in \ - 0.jpg \ - 4.jpg \ -; do - run_metaflac --import-picture-from="4|image/jpeg|$f||${top_srcdir}/test/pictures/$f" $flacfile - check_flac - metaflac_test "case$ncase" "--import-picture-from" "--list" - ncase=`expr $ncase + 1` -done -for f in \ - 0.png \ - 1.png \ - 2.png \ - 3.png \ - 4.png \ - 5.png \ - 6.png \ - 7.png \ - 8.png \ -; do - run_metaflac --import-picture-from="5|image/png|$f||${top_srcdir}/test/pictures/$f" $flacfile - check_flac - metaflac_test "case$ncase" "--import-picture-from" "--list" - ncase=`expr $ncase + 1` -done -[ $ncase = 60 ] || die "expected case# to be 60" - -fn=export-picture-check -echo $ECHO_N "Testing --export-picture-to... " $ECHO_C -run_metaflac --export-picture-to=$fn $flacfile -check_flac -cmp $fn ${top_srcdir}/test/pictures/0.gif || die "ERROR, exported picture file and original differ" -echo OK -rm -f $fn -echo $ECHO_N "Testing --block-number --export-picture-to... " $ECHO_C -run_metaflac --block-number=9 --export-picture-to=$fn $flacfile -check_flac -cmp $fn ${top_srcdir}/test/pictures/0.png || die "ERROR, exported picture file and original differ" -echo OK -rm -f $fn - -run_metaflac --remove --block-type=PICTURE $flacfile -check_flac -metaflac_test case60 "--remove --block-type=PICTURE" "--list" -run_metaflac --import-picture-from="1|image/png|standard_icon|32x32x24|${top_srcdir}/test/pictures/0.png" $flacfile -check_flac -metaflac_test case61 "--import-picture-from" "--list" -run_metaflac --import-picture-from="2|image/png|icon|64x64x24|${top_srcdir}/test/pictures/1.png" $flacfile -check_flac -metaflac_test case62 "--import-picture-from" "--list" - -# UNKNOWN blocks -echo $ECHO_N "Testing FLAC file with unknown metadata... " $ECHO_C -cp -p ${top_srcdir}/test/metaflac.flac.in $flacfile -# remove the VORBIS_COMMENT block so vendor string changes don't interfere with the comparison: -run_metaflac --remove --block-type=VORBIS_COMMENT --dont-use-padding $flacfile -cmp $flacfile ${top_srcdir}/test/metaflac.flac.ok || die "ERROR, $flacfile and metaflac.flac.ok differ" -echo OK - -rm -f metaflac-test-files/out.meta metaflac-test-files/out1.meta diff --git a/test/test_replaygain.sh b/test/test_replaygain.sh deleted file mode 100755 index 2e7ab53a..00000000 --- a/test/test_replaygain.sh +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/sh -e - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2002-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -. ./common.sh - -PATH=`pwd`/../src/flac:$PATH -PATH=`pwd`/../src/metaflac:$PATH -PATH=`pwd`/../objs/$BUILD/bin:$PATH - -if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then EGREP='grep -E' - else EGREP='egrep' -fi - -testdir="metaflac-test-files" -flacfile="replaygain.flac" - -run_flac () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_replaygain.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac --no-error-on-compression-fail $* 4>>test_replaygain.valgrind.log - else - flac${EXE} --no-error-on-compression-fail $* - fi -} - -run_metaflac () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_replaygain.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac $* 4>>test_replaygain.valgrind.log - else - metaflac${EXE} $* - fi -} - -run_metaflac_silent () -{ - if [ -z "$SILENT" ] ; then - run_metaflac $* - else - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_replaygain.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac $* 2>/dev/null 4>>test_replaygain.valgrind.log - else - metaflac${EXE} $* 2>/dev/null - fi - fi -} - -check_flac () -{ - run_flac --silent --test $flacfile || die "ERROR in $flacfile" 1>&2 -} - -echo "Generating stream..." -bytes=80000 -if dd if=/dev/zero ibs=1 count=$bytes 2>/dev/null | flac${EXE} --silent --force --verify -0 --input-size=$bytes --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=8000 - ; then - chmod +w $flacfile -else - die "ERROR during generation" -fi - -check_flac - -# Replay gain tests - Test the rates which have specific filter table entries -# and verify that harmonics can be processed correctly. - -tonegenerator () -{ - flac${EXE} --force --output-name=$2 --silent --no-seektable --no-error-on-compression-fail rpg-tone-$1.wav -} - -REPLAYGAIN_FREQ= -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 8000/-12.73" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 11025/-12.91" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 12000/-12.98" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 16000/-13.27" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 18900/-13.41" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 22050/-13.77" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 24000/-13.82" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 28000/-14.06" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 32000/-14.08" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 36000/-14.12" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 37800/-14.18" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 44100/-14.17" -REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 48000/-14.16:1:2:4" - -set -e - -for ACTION in $REPLAYGAIN_FREQ ; do - if [ -n "${ACTION##*:*}" ] ; then - HARMONICS=1 - else - HARMONICS="${ACTION#*:}" - fi - FREQ="${ACTION%%/*}" - GAIN="${ACTION#*/}" - GAIN="${GAIN%%:*}" - while [ -n "$HARMONICS" ] ; do - MULTIPLE="${HARMONICS%%:*}" - if [ x"$MULTIPLE" = x"$HARMONICS" ] ; then - HARMONICS= - else - HARMONICS="${HARMONICS#*:}" - fi - RATE=$(($MULTIPLE * FREQ)) - [ $MULTIPLE -eq 1 -o -n "${REPLAYGAIN_FREQ##* $RATE/*}" ] || break - echo $ECHO_N "Testing FLAC replaygain $RATE ($FREQ x $MULTIPLE) ... " $ECHO_C - tonegenerator $RATE $flacfile - run_metaflac --scan-replay-gain $flacfile - run_metaflac --add-replay-gain $flacfile - run_metaflac --list $flacfile | grep REPLAYGAIN.*GAIN= | - while read -r REPLAYGAIN ; do - MEASUREDGAIN="${REPLAYGAIN##*=}" - MEASUREDGAIN="${MEASUREDGAIN%% *}" - if [ x"$MEASUREDGAIN" != x"$GAIN" ] ; then - die "ERROR, Expected $GAIN db instead of $REPLAYGAIN" - fi - done - echo OK - done -done - - -rm -f $testdir/out.flac $testdir/out.meta - -exit 0 diff --git a/test/test_seeking.sh b/test/test_seeking.sh deleted file mode 100755 index 316d3db3..00000000 --- a/test/test_seeking.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/sh -e - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2004-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -. ./common.sh - -PATH=../src/flac:$PATH -PATH=../src/metaflac:$PATH -PATH=../src/test_seeking:$PATH -PATH=../src/test_streams:$PATH -PATH=../objs/$BUILD/bin:$PATH - -if [ x"$FLAC__TEST_LEVEL" = x ] ; then - FLAC__TEST_LEVEL=1 -fi - -flac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" -metaflac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable" - -run_flac () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_seeking.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac${EXE} --no-error-on-compression-fail $* 4>>test_seeking.valgrind.log - else - flac${EXE} --no-error-on-compression-fail $* - fi -} - -run_metaflac () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_seeking.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac${EXE} $* 4>>test_seeking.valgrind.log - else - metaflac${EXE} $* - fi -} - -run_test_seeking () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 test_seeking $*" >>test_seeking.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 test_seeking $* 4>>test_seeking.valgrind.log - else - test_seeking${EXE} $* - fi -} - -echo $ECHO_N "Checking for --ogg support in flac ... " $ECHO_C -if flac${EXE} --ogg --no-error-on-compression-fail --silent --force-raw-format --endian=little --sign=signed --channels=1 --bps=8 --sample-rate=44100 -c $0 1>/dev/null 2>&1 ; then - has_ogg=yes; -else - has_ogg=no; -fi -echo ${has_ogg} - -echo "Generating streams..." -if [ ! -f noise.raw ] ; then - test_streams || die "ERROR during test_streams" -fi - -echo "generating FLAC files for seeking:" -run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 -S- --output-name=tiny.flac noise8m32.raw || die "ERROR generating FLAC file" -run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 -S- --output-name=small.flac noise.raw || die "ERROR generating FLAC file" -run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 -S10x --output-name=tiny-s.flac noise8m32.raw || die "ERROR generating FLAC file" -run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 -S10x --output-name=small-s.flac noise.raw || die "ERROR generating FLAC file" - -tiny_samples=`metaflac${EXE} --show-total-samples tiny.flac` -small_samples=`metaflac${EXE} --show-total-samples small.flac` - -tiny_seek_count=100 -if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then - small_seek_count=10000 -else - small_seek_count=100 -fi - -for suffix in '' '-s' ; do - echo "testing tiny$suffix.flac:" - if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else - die "ERROR: during test_seeking" - fi - - echo "testing small$suffix.flac:" - if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else - die "ERROR: during test_seeking" - fi - - echo "removing sample count from tiny$suffix.flac and small$suffix.flac:" - if run_metaflac --no-filename --set-total-samples=0 tiny$suffix.flac small$suffix.flac ; then : ; else - die "ERROR: during metaflac" - fi - - echo "testing tiny$suffix.flac with total_samples=0:" - if run_test_seeking tiny$suffix.flac $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else - die "ERROR: during test_seeking" - fi - - echo "testing small$suffix.flac with total_samples=0:" - if run_test_seeking small$suffix.flac $small_seek_count $small_samples noise.raw ; then : ; else - die "ERROR: during test_seeking" - fi -done - -if [ $has_ogg = "yes" ] ; then - - echo "generating Ogg FLAC files for seeking:" - run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=8 --channels=1 --blocksize=576 --output-name=tiny.oga --ogg noise8m32.raw || die "ERROR generating Ogg FLAC file" - run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 --output-name=small.oga --ogg noise.raw || die "ERROR generating Ogg FLAC file" - # seek tables are not used in Ogg FLAC - - echo "testing tiny.oga:" - if run_test_seeking tiny.oga $tiny_seek_count $tiny_samples noise8m32.raw ; then : ; else - die "ERROR: during test_seeking" - fi - - echo "testing small.oga:" - if run_test_seeking small.oga $small_seek_count $small_samples noise.raw ; then : ; else - die "ERROR: during test_seeking" - fi - -fi - -rm -f tiny.flac tiny.oga small.flac small.oga tiny-s.flac small-s.flac diff --git a/test/test_streams.sh b/test/test_streams.sh deleted file mode 100755 index f4cbd006..00000000 --- a/test/test_streams.sh +++ /dev/null @@ -1,257 +0,0 @@ -#!/bin/sh -e - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001-2009 Josh Coalson -# Copyright (C) 2011-2016 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. - -. ./common.sh - -PATH=../src/flac:$PATH -PATH=../src/test_streams:$PATH -PATH=../objs/$BUILD/bin:$PATH - -if [ x"$FLAC__TEST_LEVEL" = x ] ; then - FLAC__TEST_LEVEL=1 -fi - -flac${EXE} --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" - -run_flac () -{ - if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then - echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_streams.valgrind.log - valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac --no-error-on-compression-fail $* 4>>test_streams.valgrind.log - else - flac${EXE} --no-error-on-compression-fail $* - fi -} - -echo "Generating streams..." -if [ ! -f wacky1.wav ] ; then - test_streams || die "ERROR: missing files" -fi - -# -# single-file test routines -# - -test_file () -{ - name=$1 - channels=$2 - bps=$3 - encode_options="$4" - - echo $ECHO_N "$name (--channels=$channels --bps=$bps $encode_options): encode..." $ECHO_C - cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding $name.raw" - echo "### ENCODE $name #######################################################" >> ./streams.log - echo "### cmd=$cmd" >> ./streams.log - $cmd 2>>./streams.log || die "ERROR during encode of $name" - - echo $ECHO_N "decode..." $ECHO_C - cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --output-name=$name.cmp $name.flac" - echo "### DECODE $name #######################################################" >> ./streams.log - echo "### cmd=$cmd" >> ./streams.log - $cmd 2>>./streams.log || die "ERROR during decode of $name" - - ls -1l $name.raw >> ./streams.log - ls -1l $name.flac >> ./streams.log - ls -1l $name.cmp >> ./streams.log - - echo $ECHO_N "compare..." $ECHO_C - cmp $name.raw $name.cmp || die "ERROR during compare of $name" - - echo OK -} - -test_file_piped () -{ - name=$1 - channels=$2 - bps=$3 - encode_options="$4" - - if [ `env | grep -ic '^comspec='` != 0 ] ; then - is_win=yes - else - is_win=no - fi - - echo $ECHO_N "$name: encode via pipes..." $ECHO_C - if [ $is_win = yes ] ; then - cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding --stdout $name.raw" - echo "### ENCODE $name #######################################################" >> ./streams.log - echo "### cmd=$cmd" >> ./streams.log - $cmd 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name" - else - cmd="run_flac --verify --silent --force --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --no-padding --stdout -" - echo "### ENCODE $name #######################################################" >> ./streams.log - echo "### cmd=$cmd" >> ./streams.log - cat $name.raw | $cmd 1>$name.flac 2>>./streams.log || die "ERROR during encode of $name" - fi - echo $ECHO_N "decode via pipes..." $ECHO_C - if [ $is_win = yes ] ; then - cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --stdout $name.flac" - echo "### DECODE $name #######################################################" >> ./streams.log - echo "### cmd=$cmd" >> ./streams.log - $cmd 1>$name.cmp 2>>./streams.log || die "ERROR during decode of $name" - else - cmd="run_flac --silent --force --endian=little --sign=signed --decode --force-raw-format --stdout -" - echo "### DECODE $name #######################################################" >> ./streams.log - echo "### cmd=$cmd" >> ./streams.log - cat $name.flac | $cmd 1>$name.cmp 2>>./streams.log || die "ERROR during decode of $name" - fi - ls -1l $name.raw >> ./streams.log - ls -1l $name.flac >> ./streams.log - ls -1l $name.cmp >> ./streams.log - - echo $ECHO_N "compare..." $ECHO_C - cmp $name.raw $name.cmp || die "ERROR during compare of $name" - - echo OK -} - -if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then - max_lpc_order=32 -else - max_lpc_order=16 -fi - -echo "Testing noise through pipes..." -test_file_piped noise 1 8 "-0" - -echo "Testing small files..." -test_file test01 1 16 "-0 -l $max_lpc_order --lax -m -e -p" -test_file test02 2 16 "-0 -l $max_lpc_order --lax -m -e -p" -test_file test03 1 16 "-0 -l $max_lpc_order --lax -m -e -p" -test_file test04 2 16 "-0 -l $max_lpc_order --lax -m -e -p" - -for bps in 8 16 24 ; do - echo "Testing $bps-bit full-scale deflection streams..." - for b in 01 02 03 04 05 06 07 ; do - test_file fsd$bps-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e -p" - done -done - -echo "Testing 16-bit wasted-bits-per-sample streams..." -for b in 01 ; do - test_file wbps16-$b 1 16 "-0 -l $max_lpc_order --lax -m -e -p" -done - -for bps in 8 16 24 ; do - echo "Testing $bps-bit sine wave streams..." - for b in 00 ; do - test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000" - done - for b in 01 ; do - test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000" - done - for b in 02 03 04 ; do - test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order --lax -m -e" - done - for b in 10 11 ; do - test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=48000" - done - for b in 12 ; do - test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e --sample-rate=96000" - done - for b in 13 14 15 16 17 18 19 ; do - test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order --lax -m -e" - done -done - -echo "Testing blocksize variations..." -for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do - for blocksize in 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ; do - for lpc_order in 0 1 2 3 4 5 7 8 9 15 16 17 31 32 ; do - if [ $lpc_order = 0 ] || [ $lpc_order -le $blocksize ] ; then - test_file noise8m32 1 8 "-8 -p -e -l $lpc_order --lax --blocksize=$blocksize $disable" - fi - done - done -done - -echo "Testing some frame header variations..." -test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax -b $max_lpc_order" -test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax -b 65535" -test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=9" -test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90" -test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90000" -test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=9" -test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90" -test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90000" - -echo "Testing option variations..." -for f in 00 01 02 03 04 ; do - for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do - if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then - for opt in 0 1 2 4 5 6 8 ; do - for extras in '' '-p' '-e' ; do - if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then - test_file sine16-$f 1 16 "-$opt $extras $disable" - fi - done - done - if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then - test_file sine16-$f 1 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable" - fi - fi - done -done - -for f in 10 11 12 13 14 15 16 17 18 19 ; do - for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do - if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then - for opt in 0 1 2 4 5 6 8 ; do - for extras in '' '-p' '-e' ; do - if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then - test_file sine16-$f 2 16 "-$opt $extras $disable" - fi - done - done - if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then - test_file sine16-$f 2 16 "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable" - fi - fi - done -done - -echo "Testing noise..." -for disable in '' '--disable-verbatim-subframes --disable-constant-subframes' '--disable-verbatim-subframes --disable-constant-subframes --disable-fixed-subframes' ; do - if [ -z "$disable" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then - for channels in 1 2 4 8 ; do - if [ $channels -le 2 ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then - for bps in 8 16 24 ; do - for opt in 0 1 2 3 4 5 6 7 8 ; do - for extras in '' '-p' '-e' ; do - if [ -z "$extras" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then - for blocksize in '' '--lax -b 32' '--lax -b 32768' '--lax -b 65535' ; do - if [ -z "$blocksize" ] || [ "$FLAC__TEST_LEVEL" -gt 0 ] ; then - test_file noise $channels $bps "-$opt $extras $blocksize $disable" - fi - done - fi - done - done - if [ "$FLAC__TEST_LEVEL" -gt 1 ] ; then - test_file noise $channels $bps "-b 16384 -m -r 8 -l $max_lpc_order --lax -e -p $disable" - fi - done - fi - done - fi -done diff --git a/test/write_iff.pl b/test/write_iff.pl deleted file mode 100755 index f9efa74d..00000000 --- a/test/write_iff.pl +++ /dev/null @@ -1,211 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -require Math::BigInt; - -my $usage = " -$0 <#samples> - - is one of aiff,wave,wave64,rf64 - is 8,16,24,32 - is 1-8 - is any 32-bit value - <#samples> is 0-2^64-1 - is one of zero,rand - -"; - -die $usage unless @ARGV == 6; - -my %formats = ( 'aiff'=>1, 'wave'=>1, 'wave64'=>1, 'rf64'=>1 ); -my %sampletypes = ( 'zero'=>1, 'rand'=>1 ); -my @channelmask = ( 0, 1, 3, 7, 0x33, 0x607, 0x60f, 0, 0 ); #@@@@@@ need proper masks for 7,8 - -my ($format, $bps, $channels, $samplerate, $samples, $sampletype) = @ARGV; -my $bigsamples = new Math::BigInt $samples; - -die $usage unless defined $formats{$format}; -die $usage unless $bps == 8 || $bps == 16 || $bps == 24 || $bps == 32; -die $usage unless $channels >= 1 && $channels <= 8; -die $usage unless $samplerate >= 0 && $samplerate <= 4294967295; -die $usage unless defined $sampletypes{$sampletype}; - -# convert bits-per-sample to bytes-per-sample -$bps /= 8; - -my $datasize = $samples * $bps * $channels; -my $bigdatasize = $bigsamples * $bps * $channels; - -my $padding = int($bigdatasize & 1); # for aiff/wave/rf64 chunk alignment -my $padding8 = 8 - int($bigdatasize & 7); $padding8 = 0 if $padding8 == 8; # for wave64 alignment -# wave-ish file needs to be WAVEFORMATEXTENSIBLE? -my $wavx = ($format eq 'wave' || $format eq 'wave64' || $format eq 'rf64') && ($channels > 2 || ($bps != 8 && $bps != 16)); - -# write header - -if ($format eq 'aiff') { - die "sample data too big for format\n" if 46 + $datasize + $padding > 4294967295; - # header - print "FORM"; - print pack('N', 46 + $datasize + $padding); - print "AIFF"; - # COMM chunk - print "COMM"; - print pack('N', 18); # chunk size = 18 - print pack('n', $channels); - print pack('N', $samples); - print pack('n', $bps * 8); - print pack_sane_extended($samplerate); - # SSND header - print "SSND"; - print pack('N', $datasize + 8); # chunk size - print pack('N', 0); # ssnd_offset_size - print pack('N', 0); # blocksize -} -elsif ($format eq 'wave' || $format eq 'wave64' || $format eq 'rf64') { - die "sample data too big for format\n" if $format eq 'wave' && ($wavx?60:36) + $datasize + $padding > 4294967295; - # header - if ($format eq 'wave') { - print "RIFF"; - # +4 for WAVE - # +8+{40,16} for fmt chunk - # +8 for data chunk header - print pack('V', 4 + 8+($wavx?40:16) + 8 + $datasize + $padding); - print "WAVE"; - } - elsif ($format eq 'wave64') { - # RIFF GUID 66666972-912E-11CF-A5D6-28DB04C10000 - print "\x72\x69\x66\x66\x2E\x91\xCF\x11\xD6\xA5\x28\xDB\x04\xC1\x00\x00"; - # +(16+8) for RIFF GUID + size - # +16 for WAVE GUID - # +16+8+{40,16} for fmt chunk - # +16+8 for data chunk header - my $bigriffsize = $bigdatasize + (16+8) + 16 + 16+8+($wavx?40:16) + (16+8) + $padding8; - print pack_64('V', $bigriffsize); - # WAVE GUID 65766177-ACF3-11D3-8CD1-00C04F8EDB8A - print "\x77\x61\x76\x65\xF3\xAC\xD3\x11\xD1\x8C\x00\xC0\x4F\x8E\xDB\x8A"; - } - else { - print "RF64"; - print pack('V', 0xffffffff); - print "WAVE"; - # ds64 chunk - print "ds64"; - print pack('V', 28); # chunk size - # +4 for WAVE - # +(8+28) for ds64 chunk - # +8+{40,16} for fmt chunk - # +8 for data chunk header - my $bigriffsize = $bigdatasize + 4 + (8+28) + 8+($wavx?40:16) + 8 + $padding; - print pack_64('V', $bigriffsize); - print pack_64('V', $bigdatasize); - print pack_64('V', $bigsamples); - print pack('V', 0); # table size - } - # fmt chunk - if ($format ne 'wave64') { - print "fmt "; - print pack('V', $wavx?40:16); # chunk size - } - else { # wave64 - # fmt GUID 20746D66-ACF3-11D3-8CD1-00C04F8EDB8A - print "\x66\x6D\x74\x20\xF3\xAC\xD3\x11\xD1\x8C\x00\xC0\x4F\x8E\xDB\x8A"; - print pack('V', 16+8+($wavx?40:16)); # chunk size (+16+8 for GUID and size fields) - print pack('V', 0); # ...is 8 bytes for wave64 - } - print pack('v', $wavx?65534:1); # compression code - print pack('v', $channels); - print pack('V', $samplerate); - print pack('V', $samplerate * $channels * $bps); - print pack('v', $channels * $bps); # block align = channels*((bps+7)/8) - print pack('v', $bps * 8); # bits per sample = ((bps+7)/8)*8 - if ($wavx) { - print pack('v', 22); # cbSize - print pack('v', $bps * 8); # validBitsPerSample - print pack('V', $channelmask[$channels]); - # GUID = {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} - print "\x01\x00\x00\x00\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71"; - } - # data header - if ($format ne 'wave64') { - print "data"; - print pack('V', $format eq 'wave'? $datasize : 0xffffffff); - } - else { # wave64 - # data GUID 61746164-ACF3-11D3-8CD1-00C04F8EDB8A - print "\x64\x61\x74\x61\xF3\xAC\xD3\x11\xD1\x8C\x00\xC0\x4F\x8E\xDB\x8A"; - print pack_64('V', $bigdatasize+16+8); # +16+8 for GUID and size fields - } -} -else { - die; -} - -# write sample data - -if ($sampletype eq 'zero') { - my $chunk = 4096; - my $buf = pack("x[".($channels*$bps*$chunk)."]"); - for (my $s = $samples; $s > 0; $s -= $chunk) { - if ($s < $chunk) { - print substr($buf, 0, $channels*$bps*$s); - } - else { - print $buf; - } - } -} -elsif ($sampletype eq 'rand') { - for (my $s = 0; $s < $samples; $s++) { - for (my $c = 0; $c < $channels; $c++) { - for (my $b = 0; $b < $bps; $b++) { - print pack('C', int(rand(256))); - } - } - } -} -else { - die; -} - -# write padding -if ($format eq 'wave64') { - print pack("x[$padding8]") if $padding8; -} -else { - print "\x00" if $padding; -} - -exit 0; - -sub pack_sane_extended -{ - my $val = shift; - die unless $val > 0; - my $shift; - for ($shift = 0; ($val>>(31-$shift)) == 0; ++$shift) { - } - $val <<= $shift; - my $exponent = 63 - ($shift + 32); - return pack('nNN', $exponent + 16383, $val, 0); -} - -sub pack_64 -{ - my $c = shift; # 'N' for big-endian, 'V' for little-endian, ala pack() - my $v1 = shift; # value, must be Math::BigInt - my $v2 = $v1->copy(); - if ($c eq 'V') { - $v1->band(0xffffffff); - $v2->brsft(32); - } - elsif ($c eq 'N') { - $v2->band(0xffffffff); - $v1->brsft(32); - } - else { - die; - } - return pack("$c$c", 0+$v1->bstr(), 0+$v2->bstr()); -}