diff options
Diffstat (limited to '3rdparty/libflac/src')
370 files changed, 32278 insertions, 45713 deletions
diff --git a/3rdparty/libflac/src/CMakeLists.txt b/3rdparty/libflac/src/CMakeLists.txt new file mode 100644 index 00000000000..262feeaddfc --- /dev/null +++ b/3rdparty/libflac/src/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.11) + +option(ENABLE_64_BIT_WORDS "Set FLAC__BYTES_PER_WORD to 8, for 64-bit machines. For 32-bit machines, turning this off might give a tiny speed improvement" ON) +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(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/3rdparty/libflac/src/Makefile.am b/3rdparty/libflac/src/Makefile.am index 131383e6a17..e9d60a9bf32 100644 --- a/3rdparty/libflac/src/Makefile.am +++ b/3rdparty/libflac/src/Makefile.am @@ -1,8 +1,9 @@ # FLAC - Free Lossless Audio Codec -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference licenses. The codec libraries +# 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 @@ -15,28 +16,25 @@ # 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 +if FLaC__WITH_PROGRAMS +PROGRAMS_DIRS = flac metaflac +endif + SUBDIRS = \ libFLAC \ share \ - flac \ - metaflac \ - monkeys_audio_utilities \ - $(XMMS_DIRS) \ - plugin_winamp2 \ + $(PROGRAMS_DIRS) \ test_grabbag \ test_libs_common \ test_libFLAC \ test_seeking \ test_streams \ + utils \ $(CPPLIBS_DIRS) EXTRA_DIST = \ - Makefile.lite + CMakeLists.txt diff --git a/3rdparty/libflac/src/Makefile.in b/3rdparty/libflac/src/Makefile.in index 14ac8913644..808cc51eb06 100644 --- a/3rdparty/libflac/src/Makefile.in +++ b/3rdparty/libflac/src/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,10 +15,11 @@ @SET_MAKE@ # FLAC - Free Lossless Audio Codec -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference licenses. The codec libraries +# 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 @@ -30,17 +31,67 @@ # 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. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +103,116 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +subdir = src +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = libFLAC share flac metaflac test_grabbag \ + test_libs_common test_libFLAC test_seeking test_streams utils \ + libFLAC++ test_libFLAC++ +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,207 +221,192 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - -@FLaC__HAS_XMMS_TRUE@XMMS_DIRS = plugin_common plugin_xmms - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ @FLaC__WITH_CPPLIBS_TRUE@CPPLIBS_DIRS = libFLAC++ test_libFLAC++ - +@FLaC__WITH_PROGRAMS_TRUE@PROGRAMS_DIRS = flac metaflac SUBDIRS = \ libFLAC \ share \ - flac \ - metaflac \ - monkeys_audio_utilities \ - $(XMMS_DIRS) \ - plugin_winamp2 \ + $(PROGRAMS_DIRS) \ test_grabbag \ test_libs_common \ test_libFLAC \ test_seeking \ test_streams \ + utils \ $(CPPLIBS_DIRS) - EXTRA_DIST = \ - Makefile.lite - -subdir = src -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = + CMakeLists.txt -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = libFLAC share flac metaflac monkeys_audio_utilities \ - plugin_common plugin_xmms plugin_winamp2 test_grabbag \ - test_libs_common test_libFLAC test_seeking test_streams \ - libFLAC++ test_libFLAC++ all: all-recursive .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo @@ -274,21 +414,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -296,152 +441,131 @@ $(RECURSIVE_TARGETS): else \ local_target="$$target"; \ fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ + empty_fix=.; \ else \ include_option=--include; \ + empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ @@ -451,7 +575,6 @@ check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: - install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -462,16 +585,22 @@ install-am: all-am installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -482,25 +611,46 @@ clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags +distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: +html: html-recursive + +html-am: + info: info-recursive info-am: install-data-am: +install-dvi: install-dvi-recursive + +install-dvi-am: + install-exec-am: +install-html: install-html-recursive + +install-html-am: + install-info: install-info-recursive +install-info-am: + install-man: +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -519,26 +669,25 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/Makefile.lite b/3rdparty/libflac/src/Makefile.lite deleted file mode 100644 index 1d496b02a56..00000000000 --- a/3rdparty/libflac/src/Makefile.lite +++ /dev/null @@ -1,61 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference 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 flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms share test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking test_streams -all: flac libFLAC libFLAC++ metaflac plugin_common plugin_xmms 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 test_grabbag test_libs_common test_libFLAC test_libFLAC++ test_seeking test_streams: - (cd $@ ; $(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) - -flac: libFLAC share -libFLAC++: libFLAC -metaflac: libFLAC share -plugin_common: libFLAC -plugin_xmms: libFLAC plugin_common -share: libFLAC -test_grabbag: share -test_libFLAC++: libFLAC libFLAC++ test_libs_common -test_libFLAC: libFLAC test_libs_common -test_seeking: libFLAC -test_streams: libFLAC diff --git a/3rdparty/libflac/src/flac/CMakeLists.txt b/3rdparty/libflac/src/flac/CMakeLists.txt new file mode 100644 index 00000000000..da7ce8de9c7 --- /dev/null +++ b/3rdparty/libflac/src/flac/CMakeLists.txt @@ -0,0 +1,25 @@ +check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H) +check_include_file("termios.h" HAVE_TERMIOS_H) + +add_executable(flacapp + analyze.c + decode.c + encode.c + foreign_metadata.c + main.c + local_string_utils.c + utils.c + vorbiscomment.c + version.rc + $<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h> + $<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>) +set_property(TARGET flacapp PROPERTY RUNTIME_OUTPUT_NAME flac) +set_property(TARGET flacapp PROPERTY PROJECT_LABEL "flac") +target_link_libraries(flacapp + FLAC + getopt + replaygain_synthesis + utf8) + +install(TARGETS flacapp EXPORT targets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") diff --git a/3rdparty/libflac/src/flac/Makefile.am b/3rdparty/libflac/src/flac/Makefile.am index 638cd74d413..279a7cb9b64 100644 --- a/3rdparty/libflac/src/flac/Makefile.am +++ b/3rdparty/libflac/src/flac/Makefile.am @@ -1,5 +1,6 @@ # flac - Command-line FLAC encoder/decoder -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,22 +12,26 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 OS_IS_WINDOWS +win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la +if HAVE_WINDRES +flac_DEPENDENCIES = version.o +windows_resource_link = -Wl,version.o +endif +endif bin_PROGRAMS = flac AM_CFLAGS = @OGG_CFLAGS@ - +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include EXTRA_DIST = \ - Makefile.lite \ - Makefile.lite.iffscan \ - flac.dsp \ - flac.vcproj \ + CMakeLists.txt \ iffscan.c \ - iffscan.dsp \ - iffscan.vcproj + version.rc flac_SOURCES = \ analyze.c \ @@ -46,13 +51,19 @@ flac_SOURCES = \ vorbiscomment.h flac_LDADD = \ + $(top_builddir)/src/share/utf8/libutf8.la \ $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/getopt/libgetopt.a \ + $(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/share/utf8/libutf8.la \ $(top_builddir)/src/libFLAC/libFLAC.la \ - @OGG_LIBS@ \ - @LIBICONV@ \ - @MINGW_WINSOCK_LIBS@ \ + $(win_utf8_lib) \ + @LTLIBICONV@ \ -lm + +flac_LDFLAGS = $(AM_LDFLAGS) $(windows_resource_link) + +CLEANFILES = flac.exe + +.rc.o: + $(RC) $(AM_CPPFLAGS) $< $@ diff --git a/3rdparty/libflac/src/flac/Makefile.in b/3rdparty/libflac/src/flac/Makefile.in index b828c301a86..bc1d11eb9b9 100644 --- a/3rdparty/libflac/src/flac/Makefile.in +++ b/3rdparty/libflac/src/flac/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # flac - Command-line FLAC encoder/decoder -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,20 +28,71 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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. -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +104,128 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +@HAVE_WINDRES_FALSE@flac_DEPENDENCIES = \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/share/utf8/libutf8.la \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/share/grabbag/libgrabbag.la \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/share/getopt/libgetopt.la \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/libFLAC/libFLAC.la \ +@HAVE_WINDRES_FALSE@ $(win_utf8_lib) +@OS_IS_WINDOWS_FALSE@flac_DEPENDENCIES = $(top_builddir)/src/share/utf8/libutf8.la \ +@OS_IS_WINDOWS_FALSE@ $(top_builddir)/src/share/grabbag/libgrabbag.la \ +@OS_IS_WINDOWS_FALSE@ $(top_builddir)/src/share/getopt/libgetopt.la \ +@OS_IS_WINDOWS_FALSE@ $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ +@OS_IS_WINDOWS_FALSE@ $(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \ +@OS_IS_WINDOWS_FALSE@ $(top_builddir)/src/libFLAC/libFLAC.la \ +@OS_IS_WINDOWS_FALSE@ $(win_utf8_lib) +bin_PROGRAMS = flac$(EXEEXT) +subdir = src/flac +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_flac_OBJECTS = analyze.$(OBJEXT) decode.$(OBJEXT) encode.$(OBJEXT) \ + foreign_metadata.$(OBJEXT) main.$(OBJEXT) \ + local_string_utils.$(OBJEXT) utils.$(OBJEXT) \ + vorbiscomment.$(OBJEXT) +flac_OBJECTS = $(am_flac_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +flac_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(flac_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/analyze.Po ./$(DEPDIR)/decode.Po \ + ./$(DEPDIR)/encode.Po ./$(DEPDIR)/foreign_metadata.Po \ + ./$(DEPDIR)/local_string_utils.Po ./$(DEPDIR)/main.Po \ + ./$(DEPDIR)/utils.Po ./$(DEPDIR)/vorbiscomment.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(flac_SOURCES) +DIST_SOURCES = $(flac_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,172 +234,152 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - -bin_PROGRAMS = flac - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@OS_IS_WINDOWS_TRUE@win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la +@HAVE_WINDRES_TRUE@@OS_IS_WINDOWS_TRUE@flac_DEPENDENCIES = version.o +@HAVE_WINDRES_TRUE@@OS_IS_WINDOWS_TRUE@windows_resource_link = -Wl,version.o AM_CFLAGS = @OGG_CFLAGS@ - +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include EXTRA_DIST = \ - Makefile.lite \ - Makefile.lite.iffscan \ - flac.dsp \ - flac.vcproj \ + CMakeLists.txt \ iffscan.c \ - iffscan.dsp \ - iffscan.vcproj - + version.rc flac_SOURCES = \ analyze.c \ @@ -250,149 +398,150 @@ flac_SOURCES = \ utils.h \ vorbiscomment.h - flac_LDADD = \ + $(top_builddir)/src/share/utf8/libutf8.la \ $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/getopt/libgetopt.a \ + $(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/share/utf8/libutf8.la \ $(top_builddir)/src/libFLAC/libFLAC.la \ - @OGG_LIBS@ \ - @LIBICONV@ \ - @MINGW_WINSOCK_LIBS@ \ + $(win_utf8_lib) \ + @LTLIBICONV@ \ -lm -subdir = src/flac -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -bin_PROGRAMS = flac$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am_flac_OBJECTS = analyze.$(OBJEXT) decode.$(OBJEXT) encode.$(OBJEXT) \ - foreign_metadata.$(OBJEXT) main.$(OBJEXT) \ - local_string_utils.$(OBJEXT) utils.$(OBJEXT) \ - vorbiscomment.$(OBJEXT) -flac_OBJECTS = $(am_flac_OBJECTS) -flac_DEPENDENCIES = $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/getopt/libgetopt.a \ - $(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 -flac_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/analyze.Po ./$(DEPDIR)/decode.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/encode.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/foreign_metadata.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/local_string_utils.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/utils.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/vorbiscomment.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(flac_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(flac_SOURCES) - +flac_LDFLAGS = $(AM_LDFLAGS) $(windows_resource_link) +CLEANFILES = flac.exe all: all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/flac/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +.SUFFIXES: .c .lo .o .obj .rc +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/flac/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/flac/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ - else :; fi; \ - done + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ - done + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -flac$(EXEEXT): $(flac_OBJECTS) $(flac_DEPENDENCIES) + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +flac$(EXEEXT): $(flac_OBJECTS) $(flac_DEPENDENCIES) $(EXTRA_flac_DEPENDENCIES) @rm -f flac$(EXEEXT) - $(LINK) $(flac_LDFLAGS) $(flac_OBJECTS) $(flac_LDADD) $(LIBS) + $(AM_V_CCLD)$(flac_LINK) $(flac_OBJECTS) $(flac_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/analyze.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encode.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/foreign_metadata.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local_string_utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vorbiscomment.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/analyze.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decode.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encode.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/foreign_metadata.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local_string_utils.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vorbiscomment.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -400,101 +549,97 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -505,16 +650,23 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -524,31 +676,67 @@ clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/analyze.Po + -rm -f ./$(DEPDIR)/decode.Po + -rm -f ./$(DEPDIR)/encode.Po + -rm -f ./$(DEPDIR)/foreign_metadata.Po + -rm -f ./$(DEPDIR)/local_string_utils.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/utils.Po + -rm -f ./$(DEPDIR)/vorbiscomment.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: install-binPROGRAMS +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/analyze.Po + -rm -f ./$(DEPDIR)/decode.Po + -rm -f ./$(DEPDIR)/encode.Po + -rm -f ./$(DEPDIR)/foreign_metadata.Po + -rm -f ./$(DEPDIR)/local_string_utils.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/utils.Po + -rm -f ./$(DEPDIR)/vorbiscomment.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -565,19 +753,29 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-info-am + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS + +.PRECIOUS: Makefile + + +.rc.o: + $(RC) $(AM_CPPFLAGS) $< $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/flac/Makefile.lite b/3rdparty/libflac/src/flac/Makefile.lite deleted file mode 100644 index 9e8a0cc90a4..00000000000 --- a/3rdparty/libflac/src/flac/Makefile.lite +++ /dev/null @@ -1,47 +0,0 @@ -# flac - Command-line FLAC encoder/decoder -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -PROGRAM_NAME = flac - -INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR) - -ifeq ($(DARWIN_BUILD),yes) -EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libFLAC.a $(libdir)/libreplaygain_analysis.a $(libdir)/libreplaygain_synthesis.a $(libdir)/libgetopt.a $(libdir)/libutf8.a $(OGG_LIB_DIR)/libogg.a -liconv -lm -else -LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lreplaygain_synthesis -lgetopt -lutf8 -L$(OGG_LIB_DIR) -logg -lm -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/3rdparty/libflac/src/flac/Makefile.lite.iffscan b/3rdparty/libflac/src/flac/Makefile.lite.iffscan deleted file mode 100644 index b12bb10a60e..00000000000 --- a/3rdparty/libflac/src/flac/Makefile.lite.iffscan +++ /dev/null @@ -1,41 +0,0 @@ -# flac - Command-line FLAC encoder/decoder -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -PROGRAM_NAME = iffscan - -INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR) - -ifeq ($(DARWIN_BUILD),yes) -EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -liconv -lm -else -LIBS = -lFLAC -L$(OGG_LIB_DIR) -logg -lm -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/3rdparty/libflac/src/flac/analyze.c b/3rdparty/libflac/src/flac/analyze.c index 47a5e76d7a9..0a85565e89b 100644 --- a/3rdparty/libflac/src/flac/analyze.c +++ b/3rdparty/libflac/src/flac/analyze.c @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -25,19 +26,22 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> + #include "FLAC/all.h" #include "analyze.h" +#include "share/compat.h" + typedef struct { FLAC__int32 residual; - unsigned count; + uint32_t count; } pair_t; typedef struct { pair_t buckets[FLAC__MAX_BLOCK_SIZE]; int peak_index; - unsigned nbuckets; - unsigned nsamples; + uint32_t nbuckets; + uint32_t nsamples; double sum, sos; double variance; double mean; @@ -47,7 +51,7 @@ typedef struct { static subframe_stats_t all_; static void init_stats(subframe_stats_t *stats); -static void update_stats(subframe_stats_t *stats, FLAC__int32 residual, unsigned incr); +static void update_stats(subframe_stats_t *stats, FLAC__int32 residual, uint32_t incr); static void compute_stats(subframe_stats_t *stats); static FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename); @@ -58,36 +62,32 @@ void flac__analyze_init(analysis_options aopts) } } -void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__uint64 frame_offset, unsigned frame_bytes, analysis_options aopts, FILE *fout) +void flac__analyze_frame(const FLAC__Frame *frame, uint32_t frame_number, FLAC__uint64 frame_offset, FLAC__uint64 frame_bytes, analysis_options aopts, FILE *fout) { - const unsigned channels = frame->header.channels; + const uint32_t channels = frame->header.channels; char outfilename[1024]; subframe_stats_t stats; - unsigned i, channel, partitions; + uint32_t i, channel, partitions; /* do the human-readable part first */ -#ifdef _MSC_VER - fprintf(fout, "frame=%u\toffset=%I64u\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]); -#else - fprintf(fout, "frame=%u\toffset=%llu\tbits=%u\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, (unsigned long long)frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]); -#endif + fprintf(fout, "frame=%u\toffset=%" PRIu64 "\tbits=%" PRIu64 "\tblocksize=%u\tsample_rate=%u\tchannels=%u\tchannel_assignment=%s\n", frame_number, frame_offset, frame_bytes*8, frame->header.blocksize, frame->header.sample_rate, channels, FLAC__ChannelAssignmentString[frame->header.channel_assignment]); for(channel = 0; channel < channels; channel++) { const FLAC__Subframe *subframe = frame->subframes+channel; const FLAC__bool is_rice2 = subframe->data.fixed.entropy_coding_method.type == FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2; - const unsigned pesc = is_rice2? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; + const uint32_t pesc = is_rice2? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; fprintf(fout, "\tsubframe=%u\twasted_bits=%u\ttype=%s", channel, subframe->wasted_bits, FLAC__SubframeTypeString[subframe->type]); switch(subframe->type) { case FLAC__SUBFRAME_TYPE_CONSTANT: - fprintf(fout, "\tvalue=%d\n", subframe->data.constant.value); + fprintf(fout, "\tvalue=%" PRId64 "\n", subframe->data.constant.value); break; case FLAC__SUBFRAME_TYPE_FIXED: FLAC__ASSERT(subframe->data.fixed.entropy_coding_method.type <= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2); fprintf(fout, "\torder=%u\tresidual_type=%s\tpartition_order=%u\n", subframe->data.fixed.order, is_rice2? "RICE2":"RICE", subframe->data.fixed.entropy_coding_method.data.partitioned_rice.order); for(i = 0; i < subframe->data.fixed.order; i++) - fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.fixed.warmup[i]); + fprintf(fout, "\t\twarmup[%u]=%" PRId64 "\n", i, subframe->data.fixed.warmup[i]); partitions = (1u << subframe->data.fixed.entropy_coding_method.data.partitioned_rice.order); for(i = 0; i < partitions; i++) { - unsigned parameter = subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->parameters[i]; + uint32_t parameter = subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->parameters[i]; if(parameter == pesc) fprintf(fout, "\t\tparameter[%u]=ESCAPE, raw_bits=%u\n", i, subframe->data.fixed.entropy_coding_method.data.partitioned_rice.contents->raw_bits[i]); else @@ -104,10 +104,10 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__ for(i = 0; i < subframe->data.lpc.order; i++) fprintf(fout, "\t\tqlp_coeff[%u]=%d\n", i, subframe->data.lpc.qlp_coeff[i]); for(i = 0; i < subframe->data.lpc.order; i++) - fprintf(fout, "\t\twarmup[%u]=%d\n", i, subframe->data.lpc.warmup[i]); + fprintf(fout, "\t\twarmup[%u]=%" PRId64 "\n", i, subframe->data.lpc.warmup[i]); partitions = (1u << subframe->data.lpc.entropy_coding_method.data.partitioned_rice.order); for(i = 0; i < partitions; i++) { - unsigned parameter = subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->parameters[i]; + uint32_t parameter = subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->parameters[i]; if(parameter == pesc) fprintf(fout, "\t\tparameter[%u]=ESCAPE, raw_bits=%u\n", i, subframe->data.lpc.entropy_coding_method.data.partitioned_rice.contents->raw_bits[i]); else @@ -128,7 +128,7 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__ if(aopts.do_residual_gnuplot) { for(channel = 0; channel < channels; channel++) { const FLAC__Subframe *subframe = frame->subframes+channel; - unsigned residual_samples; + uint32_t residual_samples; init_stats(&stats); @@ -152,18 +152,20 @@ void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__ update_stats(&all_, stats.buckets[i].residual, stats.buckets[i].count); } - /* write the subframe */ - sprintf(outfilename, "f%06u.s%u.gp", frame_number, channel); - compute_stats(&stats); + if(stats.nsamples > 0) { + /* write the subframe */ + flac_snprintf(outfilename, sizeof (outfilename), "f%06u.s%u.gp", frame_number, channel); + compute_stats(&stats); - (void)dump_stats(&stats, outfilename); + (void)dump_stats(&stats, outfilename); + } } } } void flac__analyze_finish(analysis_options aopts) { - if(aopts.do_residual_gnuplot) { + if(aopts.do_residual_gnuplot && all_.nsamples > 0) { compute_stats(&all_); (void)dump_stats(&all_, "all"); } @@ -178,9 +180,9 @@ void init_stats(subframe_stats_t *stats) stats->sos = 0.0; } -void update_stats(subframe_stats_t *stats, FLAC__int32 residual, unsigned incr) +void update_stats(subframe_stats_t *stats, FLAC__int32 residual, uint32_t incr) { - unsigned i; + uint32_t i; const double r = (double)residual, a = r*incr; stats->nsamples += incr; @@ -213,12 +215,12 @@ void compute_stats(subframe_stats_t *stats) FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename) { FILE *outfile; - unsigned i; + uint32_t i; const double m = stats->mean; const double s1 = stats->stddev, s2 = s1*2, s3 = s1*3, s4 = s1*4, s5 = s1*5, s6 = s1*6; const double p = stats->buckets[stats->peak_index].count; - outfile = fopen(filename, "w"); + outfile = flac_fopen(filename, "w"); if(0 == outfile) { fprintf(stderr, "ERROR opening %s: %s\n", filename, strerror(errno)); @@ -243,5 +245,8 @@ FLAC__bool dump_stats(const subframe_stats_t *stats, const char *filename) fprintf(outfile, "pause -1 'waiting...'\n"); fclose(outfile); +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + unlink(filename); +#endif return true; } diff --git a/3rdparty/libflac/src/flac/analyze.h b/3rdparty/libflac/src/flac/analyze.h index b58b6b875ff..ce07b145ec8 100644 --- a/3rdparty/libflac/src/flac/analyze.h +++ b/3rdparty/libflac/src/flac/analyze.h @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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__analyze_h @@ -25,7 +26,7 @@ typedef struct { } analysis_options; void flac__analyze_init(analysis_options aopts); -void flac__analyze_frame(const FLAC__Frame *frame, unsigned frame_number, FLAC__uint64 frame_offset, unsigned frame_bytes, analysis_options aopts, FILE *fout); +void flac__analyze_frame(const FLAC__Frame *frame, uint32_t frame_number, FLAC__uint64 frame_offset, FLAC__uint64 frame_bytes, analysis_options aopts, FILE *fout); void flac__analyze_finish(analysis_options aopts); #endif diff --git a/3rdparty/libflac/src/flac/decode.c b/3rdparty/libflac/src/flac/decode.c index 1e537c064e2..90f7a6c8607 100644 --- a/3rdparty/libflac/src/flac/decode.c +++ b/3rdparty/libflac/src/flac/decode.c @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,35 +12,24 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif -#if defined _WIN32 && !defined __CYGWIN__ -/* where MSVC puts unlink() */ -# include <io.h> -#else -# include <unistd.h> -#endif -#if defined _MSC_VER || defined __MINGW32__ -#include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif #include <errno.h> #include <math.h> /* for floor() */ #include <stdio.h> /* for FILE etc. */ #include <string.h> /* for strcmp(), strerror() */ +#include <time.h> /* for clock() */ #include "FLAC/all.h" #include "share/grabbag.h" #include "share/replaygain_synthesis.h" +#include "share/compat.h" #include "decode.h" typedef struct { @@ -49,11 +39,12 @@ typedef struct { long serial_number; #endif - FLAC__bool is_aiff_out; - FLAC__bool is_wave_out; + FileFormat format; + FileSubFormat subformat; FLAC__bool treat_warnings_as_errors; FLAC__bool continue_through_decode_errors; FLAC__bool channel_map_none; + FLAC__bool relaxed_foreign_metadata_handling; struct { replaygain_synthesis_spec_t spec; @@ -74,10 +65,12 @@ typedef struct { const char *outfilename; FLAC__uint64 samples_processed; - unsigned frame_counter; + uint32_t frame_counter; FLAC__bool abort_flag; FLAC__bool aborting_due_to_until; /* true if we intentionally abort decoding prematurely because we hit the --until point */ FLAC__bool aborting_due_to_unparseable; /* true if we abort decoding because we hit an unparseable frame */ + FLAC__bool error_callback_suppress_messages; /* turn on to prevent repeating messages from the error callback */ + FLAC__bool warn_user_about_foreign_metadata; /* to prevent more than one warning message per file */ FLAC__bool iff_headers_need_fixup; @@ -86,9 +79,9 @@ typedef struct { FLAC__bool got_stream_info; FLAC__bool has_md5sum; FLAC__uint64 total_samples; - unsigned bps; - unsigned channels; - unsigned sample_rate; + uint32_t bps; + uint32_t channels; + uint32_t sample_rate; FLAC__uint32 channel_mask; /* these are used only in analyze mode */ @@ -99,7 +92,9 @@ typedef struct { FILE *fout; foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */ - off_t fm_offset1, fm_offset2, fm_offset3; + FLAC__off_t fm_offset1, fm_offset2, fm_offset3; + + clock_t old_clock_t; } DecoderSession; @@ -109,21 +104,22 @@ static FLAC__bool is_big_endian_host_; /* * local routines */ -static FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool use_first_serial_number, long serial_number, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, foreign_metadata_t *foreign_metadata, const char *infilename, const char *outfilename); +static FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool use_first_serial_number, long serial_number, FileFormat format, FileSubFormat subformat, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, FLAC__bool relaxed_foreign_metadata_handling, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, foreign_metadata_t *foreign_metadata, const char *infilename, const char *outfilename); static void DecoderSession_destroy(DecoderSession *d, FLAC__bool error_occurred); static FLAC__bool DecoderSession_init_decoder(DecoderSession *d, const char *infilename); static FLAC__bool DecoderSession_process(DecoderSession *d); static int DecoderSession_finish_ok(DecoderSession *d); static int DecoderSession_finish_error(DecoderSession *d); -static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input); +static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, uint32_t sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input); static FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uint64 samples); -static FLAC__bool write_riff_wave_fmt_chunk(FILE *f, FLAC__bool is_waveformatextensible, unsigned bps, unsigned channels, unsigned sample_rate, FLAC__uint32 channel_mask); -static FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, unsigned bps, unsigned channels, unsigned sample_rate); +static FLAC__bool write_riff_wave_fmt_chunk_body(FILE *f, FLAC__bool is_waveformatextensible, uint32_t bps, uint32_t channels, uint32_t sample_rate, FLAC__uint32 channel_mask); +static FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, uint32_t bps, uint32_t channels, uint32_t sample_rate, FileFormat format, FileSubFormat subformat, FLAC__uint32 comm_length); static FLAC__bool write_little_endian_uint16(FILE *f, FLAC__uint16 val); static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 val); +static FLAC__bool write_little_endian_uint64(FILE *f, FLAC__uint64 val); static FLAC__bool write_big_endian_uint16(FILE *f, FLAC__uint16 val); static FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 val); -static FLAC__bool write_sane_extended(FILE *f, unsigned val); +static FLAC__bool write_sane_extended(FILE *f, uint32_t val); static FLAC__bool fixup_iff_headers(DecoderSession *d); 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); @@ -136,129 +132,56 @@ static void print_stats(const DecoderSession *decoder_session); /* * public routines */ -int flac__decode_aiff(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options) +int flac__decode_file(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, decode_options_t options) { DecoderSession decoder_session; - if(! - DecoderSession_construct( - &decoder_session, -#if FLAC__HAS_OGG - options.common.is_ogg, - options.common.use_first_serial_number, - options.common.serial_number, -#else - /*is_ogg=*/false, - /*use_first_serial_number=*/false, - /*serial_number=*/0, -#endif - /*is_aiff_out=*/true, - /*is_wave_out=*/false, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - options.common.channel_map_none, - options.common.replaygain_synthesis_spec, - analysis_mode, - aopts, - &options.common.skip_specification, - &options.common.until_specification, - options.common.has_cue_specification? &options.common.cue_specification : 0, - options.foreign_metadata, - infilename, - outfilename - ) - ) - return 1; - - if(!DecoderSession_init_decoder(&decoder_session, infilename)) - return DecoderSession_finish_error(&decoder_session); - - if(!DecoderSession_process(&decoder_session)) - return DecoderSession_finish_error(&decoder_session); - - return DecoderSession_finish_ok(&decoder_session); -} - -int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options) -{ - DecoderSession decoder_session; - - if(! - DecoderSession_construct( - &decoder_session, -#if FLAC__HAS_OGG - options.common.is_ogg, - options.common.use_first_serial_number, - options.common.serial_number, -#else - /*is_ogg=*/false, - /*use_first_serial_number=*/false, - /*serial_number=*/0, -#endif - /*is_aiff_out=*/false, - /*is_wave_out=*/true, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - options.common.channel_map_none, - options.common.replaygain_synthesis_spec, - analysis_mode, - aopts, - &options.common.skip_specification, - &options.common.until_specification, - options.common.has_cue_specification? &options.common.cue_specification : 0, - options.foreign_metadata, - infilename, - outfilename - ) - ) - return 1; - - if(!DecoderSession_init_decoder(&decoder_session, infilename)) - return DecoderSession_finish_error(&decoder_session); - - if(!DecoderSession_process(&decoder_session)) - return DecoderSession_finish_error(&decoder_session); - - return DecoderSession_finish_ok(&decoder_session); -} - -int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, raw_decode_options_t options) -{ - DecoderSession decoder_session; - - decoder_session.is_big_endian = options.is_big_endian; - decoder_session.is_unsigned_samples = options.is_unsigned_samples; + FLAC__ASSERT( + options.format == FORMAT_WAVE || + options.format == FORMAT_WAVE64 || + options.format == FORMAT_RF64 || + options.format == FORMAT_AIFF || + options.format == FORMAT_AIFF_C || + options.format == FORMAT_RAW + ); + + if(options.format == FORMAT_RAW) { + decoder_session.is_big_endian = options.format_options.raw.is_big_endian; + decoder_session.is_unsigned_samples = options.format_options.raw.is_unsigned_samples; + } if(! DecoderSession_construct( &decoder_session, #if FLAC__HAS_OGG - options.common.is_ogg, - options.common.use_first_serial_number, - options.common.serial_number, + options.is_ogg, + options.use_first_serial_number, + options.serial_number, #else /*is_ogg=*/false, /*use_first_serial_number=*/false, /*serial_number=*/0, #endif - /*is_aiff_out=*/false, - /*is_wave_out=*/false, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - options.common.channel_map_none, - options.common.replaygain_synthesis_spec, + options.format, + options.force_subformat, + options.treat_warnings_as_errors, + options.continue_through_decode_errors, + options.channel_map_none, + options.relaxed_foreign_metadata_handling, + options.replaygain_synthesis_spec, analysis_mode, aopts, - &options.common.skip_specification, - &options.common.until_specification, - options.common.has_cue_specification? &options.common.cue_specification : 0, - /*foreign_metadata=*/NULL, + &options.skip_specification, + &options.until_specification, + options.has_cue_specification? &options.cue_specification : 0, + options.format == FORMAT_RAW? NULL : options.format_options.iff.foreign_metadata, infilename, outfilename ) ) return 1; + stats_new_file(); if(!DecoderSession_init_decoder(&decoder_session, infilename)) return DecoderSession_finish_error(&decoder_session); @@ -268,7 +191,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool return DecoderSession_finish_ok(&decoder_session); } -FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool use_first_serial_number, long serial_number, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, foreign_metadata_t *foreign_metadata, const char *infilename, const char *outfilename) +FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool use_first_serial_number, long serial_number, FileFormat format, FileSubFormat subformat, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, FLAC__bool relaxed_foreign_metadata_handling, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, foreign_metadata_t *foreign_metadata, const char *infilename, const char *outfilename) { #if FLAC__HAS_OGG d->is_ogg = is_ogg; @@ -280,11 +203,12 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__ (void)serial_number; #endif - d->is_aiff_out = is_aiff_out; - d->is_wave_out = is_wave_out; + d->format = format; + d->subformat = subformat; d->treat_warnings_as_errors = treat_warnings_as_errors; d->continue_through_decode_errors = continue_through_decode_errors; d->channel_map_none = channel_map_none; + d->relaxed_foreign_metadata_handling = relaxed_foreign_metadata_handling; d->replaygain.spec = replaygain_synthesis_spec; d->replaygain.apply = false; d->replaygain.scale = 0.0; @@ -305,6 +229,11 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__ d->abort_flag = false; d->aborting_due_to_until = false; d->aborting_due_to_unparseable = false; + d->error_callback_suppress_messages = false; + if(relaxed_foreign_metadata_handling) + d->warn_user_about_foreign_metadata = false; + else + d->warn_user_about_foreign_metadata = true; d->iff_headers_need_fixup = false; @@ -313,7 +242,7 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__ d->has_md5sum = false; d->bps = 0; d->channels = 0; - d->sample_rate = 0; + d->sample_rate = UINT32_MAX; d->channel_mask = 0; d->decode_position = 0; @@ -324,6 +253,8 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__ d->foreign_metadata = foreign_metadata; + d->old_clock_t = 0; + FLAC__ASSERT(!(d->test_only && d->analysis_mode)); if(!d->test_only) { @@ -331,7 +262,7 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__ d->fout = grabbag__file_get_binary_stdout(); } else { - if(0 == (d->fout = fopen(outfilename, "wb"))) { + if(0 == (d->fout = flac_fopen(outfilename, "wb"))) { flac__utils_printf(stderr, 1, "%s: ERROR: can't open output file %s: %s\n", d->inbasefilename, outfilename, strerror(errno)); DecoderSession_destroy(d, /*error_occurred=*/true); return false; @@ -348,9 +279,30 @@ FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__ void DecoderSession_destroy(DecoderSession *d, FLAC__bool error_occurred) { if(0 != d->fout && d->fout != stdout) { +#if defined _WIN32 && !defined __CYGWIN__ + if(!error_occurred) { + FLAC__off_t written_size = ftello(d->fout); + if(written_size > 0) { + HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if(fh != INVALID_HANDLE_VALUE) { + if(GetFileType(fh) == FILE_TYPE_DISK) { + LARGE_INTEGER size; + size.QuadPart = written_size; + if(SetFilePointerEx(fh, size, NULL, FILE_CURRENT)) /* correct the file size */ + SetEndOfFile(fh); + } + CloseHandle(fh); + } + } + } +#endif fclose(d->fout); + +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* Always delete output file when fuzzing */ if(error_occurred) - unlink(d->outfilename); +#endif + flac_unlink(d->outfilename); } } @@ -361,14 +313,30 @@ FLAC__bool DecoderSession_init_decoder(DecoderSession *decoder_session, const ch is_big_endian_host_ = (*((FLAC__byte*)(&test)))? false : true; - if(!decoder_session->analysis_mode && !decoder_session->test_only && (decoder_session->is_wave_out || decoder_session->is_aiff_out)) { - if(decoder_session->foreign_metadata) { - const char *error; - if(!flac__foreign_metadata_read_from_flac(decoder_session->foreign_metadata, infilename, &error)) { - flac__utils_printf(stderr, 1, "%s: ERROR reading foreign metadata: %s\n", decoder_session->inbasefilename, error); + if(decoder_session->test_only && strcmp(infilename, "-") != 0) { + /* When testing, we can be a little more pedantic, as long + * as we can seek properly */ + FLAC__byte buffer[3]; + FILE * f; + + if(0 == (f = flac_fopen(infilename, "rb"))) { + flac__utils_printf(stderr, 1, "ERROR: can't open input file %s: %s\n", infilename, strerror(errno)); + return false; + } + + if(fread(buffer, 1, 3, f) < 3) { + flac__utils_printf(stderr, 1, "%s: ERROR checking for ID3v2 tag\n", decoder_session->inbasefilename); + fclose(f); + return false; + } + if(memcmp(buffer, "ID3", 3) == 0){ + flac__utils_printf(stderr, 1, "%s: WARNING, ID3v2 tag found. This is non-standard and strongly discouraged\n", decoder_session->inbasefilename); + if(decoder_session->treat_warnings_as_errors) { + fclose(f); return false; } } + fclose(f); } decoder_session->decoder = FLAC__stream_decoder_new(); @@ -381,9 +349,16 @@ FLAC__bool DecoderSession_init_decoder(DecoderSession *decoder_session, const ch FLAC__stream_decoder_set_md5_checking(decoder_session->decoder, true); if (0 != decoder_session->cue_specification) FLAC__stream_decoder_set_metadata_respond(decoder_session->decoder, FLAC__METADATA_TYPE_CUESHEET); - if (decoder_session->replaygain.spec.apply) + if (decoder_session->replaygain.spec.apply || !decoder_session->channel_map_none) FLAC__stream_decoder_set_metadata_respond(decoder_session->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); + if(!decoder_session->analysis_mode && !decoder_session->test_only && decoder_session->foreign_metadata == NULL) { + /* Warn user if foreign metadata is found */ + uint32_t i; + for(i = 0; i < FLAC__FOREIGN_METADATA_NUMBER_OF_RECOGNIZED_APPLICATION_IDS; i++) + FLAC__stream_decoder_set_metadata_respond_application(decoder_session->decoder, (FLAC__byte *)FLAC__FOREIGN_METADATA_APPLICATION_ID[i]); + } + #if FLAC__HAS_OGG if(decoder_session->is_ogg) { if(!decoder_session->use_first_serial_number) @@ -418,41 +393,70 @@ FLAC__bool DecoderSession_process(DecoderSession *d) return false; } + if(d->analysis_mode) + FLAC__stream_decoder_get_decode_position(d->decoder, &d->decode_position); + if(d->abort_flag) return false; /* set channel mapping */ - if(!d->channel_map_none) { - /* currently FLAC order matches SMPTE/WAVEFORMATEXTENSIBLE order, so no reordering is necessary; see encode.c */ - /* only the channel mask must be set if it was not already picked up from the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag */ + /* currently FLAC order matches SMPTE/WAVEFORMATEXTENSIBLE order, so no reordering is necessary; see encode.c */ + /* only the channel mask must be set if it was not already picked up from the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag */ + if(!d->channel_map_none && d->channel_mask == 0) { if(d->channels == 1) { - if(d->channel_mask == 0) - d->channel_mask = 0x0001; + d->channel_mask = 0x0004; } else if(d->channels == 2) { - if(d->channel_mask == 0) - d->channel_mask = 0x0003; + d->channel_mask = 0x0003; } else if(d->channels == 3) { - if(d->channel_mask == 0) - d->channel_mask = 0x0007; + d->channel_mask = 0x0007; } else if(d->channels == 4) { - if(d->channel_mask == 0) - d->channel_mask = 0x0033; + d->channel_mask = 0x0033; } else if(d->channels == 5) { - if(d->channel_mask == 0) - d->channel_mask = 0x0607; + d->channel_mask = 0x0607; } else if(d->channels == 6) { - if(d->channel_mask == 0) - d->channel_mask = 0x060f; + d->channel_mask = 0x060f; + } + else if(d->channels == 7) { + d->channel_mask = 0x070f; + } + else if(d->channels == 8) { + d->channel_mask = 0x063f; + } + } + +#if defined _WIN32 && !defined __CYGWIN__ + if(!d->analysis_mode && !d->test_only && d->total_samples > 0 && d->fout != stdout) { + HANDLE fh = CreateFile_utf8(d->outfilename, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if(fh != INVALID_HANDLE_VALUE) { + if (GetFileType(fh) == FILE_TYPE_DISK) { + LARGE_INTEGER size; + size.QuadPart = d->total_samples * d->channels * ((d->bps+7)/8); + if(d->format != FORMAT_RAW) { + size.QuadPart += 512; + if(d->foreign_metadata) { + size_t i; + for(i = d->format==FORMAT_RF64?2:1; i < d->foreign_metadata->num_blocks; i++) { + if(i != d->foreign_metadata->format_block && i != d->foreign_metadata->audio_block) + size.QuadPart += d->foreign_metadata->blocks[i].size; + } + } + } + + if(SetFilePointerEx(fh, size, NULL, FILE_CURRENT)) /* tell filesystem the expected filesize to eliminate fragmentation */ + SetEndOfFile(fh); + } + CloseHandle(fh); } } +#endif /* write the WAVE/AIFF headers if necessary */ - if(!d->analysis_mode && !d->test_only && (d->is_wave_out || d->is_aiff_out)) { + if(!d->analysis_mode && !d->test_only && d->format != FORMAT_RAW) { if(!write_iff_headers(d->fout, d, d->total_samples)) { d->abort_flag = true; return false; @@ -482,13 +486,28 @@ FLAC__bool DecoderSession_process(DecoderSession *d) return false; } - if(!d->analysis_mode && !d->test_only && (d->is_wave_out || d->is_aiff_out) && ((d->total_samples * d->channels * ((d->bps+7)/8)) & 1)) { - if(flac__utils_fwrite("\000", 1, 1, d->fout) != 1) { - print_error_with_state(d, d->is_wave_out? - "ERROR writing pad byte to WAVE data chunk" : - "ERROR writing pad byte to AIFF SSND chunk" - ); - return false; + /* write padding bytes for alignment if necessary */ + if(!d->analysis_mode && !d->test_only && d->format != FORMAT_RAW) { + const FLAC__uint64 data_size = d->total_samples * d->channels * ((d->bps+7)/8); + uint32_t padding; + if(d->format != FORMAT_WAVE64) { + padding = (uint32_t)(data_size & 1); + } + else { + /* 8-byte alignment for Wave64 */ + padding = (8 - (uint32_t)(data_size & 7)) & 7; + } + for( ; padding > 0; --padding) { + if(flac__utils_fwrite("\000", 1, 1, d->fout) != 1) { + print_error_with_state( + d, + d->format == FORMAT_WAVE? "ERROR writing pad byte to WAVE data chunk" : + d->format == FORMAT_WAVE64? "ERROR writing pad bytes to WAVE64 data chunk" : + d->format == FORMAT_RF64? "ERROR writing pad byte to RF64 data chunk" : + "ERROR writing pad byte to AIFF SSND chunk" + ); + return false; + } } } @@ -507,22 +526,36 @@ int DecoderSession_finish_ok(DecoderSession *d) if(d->analysis_mode) flac__analyze_finish(d->aopts); if(md5_failure) { - flac__utils_printf(stderr, 1, "\r%s: ERROR, MD5 signature mismatch\n", d->inbasefilename); + stats_print_name(1, d->inbasefilename); + flac__utils_printf(stderr, 1, "ERROR, MD5 signature mismatch\n"); + ok = d->continue_through_decode_errors; + } + else if(d->got_stream_info && d->total_samples && (d->total_samples > d->samples_processed)){ + stats_print_name(1, d->inbasefilename); + flac__utils_printf(stderr, 1, "ERROR, decoded number of samples is smaller than the total number of samples set in the STREAMINFO\n"); ok = d->continue_through_decode_errors; } else { if(!d->got_stream_info) { - flac__utils_printf(stderr, 1, "\r%s: WARNING, cannot check MD5 signature since there was no STREAMINFO\n", d->inbasefilename); + stats_print_name(1, d->inbasefilename); + flac__utils_printf(stderr, 1, "WARNING, cannot check MD5 signature since there was no STREAMINFO\n"); ok = !d->treat_warnings_as_errors; } else if(!d->has_md5sum) { - flac__utils_printf(stderr, 1, "\r%s: WARNING, cannot check MD5 signature since it was unset in the STREAMINFO\n", d->inbasefilename); + stats_print_name(1, d->inbasefilename); + flac__utils_printf(stderr, 1, "WARNING, cannot check MD5 signature since it was unset in the STREAMINFO\n"); ok = !d->treat_warnings_as_errors; } - flac__utils_printf(stderr, 2, "\r%s: %s \n", d->inbasefilename, d->test_only? "ok ":d->analysis_mode?"done ":"done"); + else if(!d->total_samples) { + stats_print_name(1, d->inbasefilename); + flac__utils_printf(stderr, 1, "WARNING, cannot check total number of samples since it was unset in the STREAMINFO\n"); + ok = !d->treat_warnings_as_errors; + } + stats_print_name(2, d->inbasefilename); + flac__utils_printf(stderr, 2, "%s \n", d->test_only? "ok ":d->analysis_mode?"done ":"done"); } DecoderSession_destroy(d, /*error_occurred=*/!ok); - if(!d->analysis_mode && !d->test_only && (d->is_wave_out || d->is_aiff_out)) { + if(!d->analysis_mode && !d->test_only && d->format != FORMAT_RAW) { if(d->iff_headers_need_fixup || (!d->got_stream_info && strcmp(d->outfilename, "-"))) { if(!fixup_iff_headers(d)) return 1; @@ -533,6 +566,10 @@ int DecoderSession_finish_ok(DecoderSession *d) flac__utils_printf(stderr, 1, "ERROR updating foreign metadata from %s to %s: %s\n", d->infilename, d->outfilename, error); return 1; } + if(!flac__foreign_metadata_compare_with_iff(d->foreign_metadata, d->infilename, d->outfilename, d->fm_offset3, &error)) { + flac__utils_printf(stderr, 1, "ERROR verifying foreign metadata restore from %s to %s: %s\n", d->infilename, d->outfilename, error); + return 1; + } } } return ok? 0 : 1; @@ -550,10 +587,13 @@ int DecoderSession_finish_error(DecoderSession *d) return 1; } -FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input) +FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, uint32_t sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input) { /* convert from mm:ss.sss to sample number if necessary */ - flac__utils_canonicalize_skip_until_specification(spec, sample_rate); + if(!flac__utils_canonicalize_skip_until_specification(spec, sample_rate)) { + flac__utils_printf(stderr, 1, "%s: ERROR, value of --until is too large\n", inbasefilename); + return false; + } /* special case: if "--until=-0", use the special value '0' to mean "end-of-stream" */ if(spec->is_relative && spec->value.samples == 0) { @@ -597,15 +637,42 @@ FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uint64 samples) { - const char *fmt_desc = decoder_session->is_wave_out? "WAVE" : "AIFF"; - const FLAC__bool is_waveformatextensible = decoder_session->is_wave_out && (decoder_session->channel_mask == 2 || decoder_session->channel_mask > 3 || decoder_session->bps%8 || decoder_session->channels > 2); - FLAC__uint64 data_size = samples * decoder_session->channels * ((decoder_session->bps+7)/8); - const FLAC__uint32 aligned_data_size = (FLAC__uint32)((data_size+1) & (~1U)); /* we'll check for overflow later */ - - unsigned foreign_metadata_size = 0; /* size of all non-audio non-fmt/COMM foreign metadata chunks */ + const FileFormat format = decoder_session->format; + const FileSubFormat subformat = decoder_session->subformat; + const char *fmt_desc = + format==FORMAT_WAVE? "WAVE" : + format==FORMAT_WAVE64? "Wave64" : + format==FORMAT_RF64? "RF64" : + format==FORMAT_AIFF? "AIFF" : + "AIFC"; + const FLAC__bool is_waveformatextensible = + subformat == SUBFORMAT_WAVE_EXTENSIBLE || ( + (format == FORMAT_WAVE || format == FORMAT_WAVE64 || format == FORMAT_RF64) && + subformat != SUBFORMAT_WAVE_PCM && + ( + (decoder_session->channel_mask != 0 && decoder_session->channel_mask != 0x0004 && decoder_session->channel_mask != 0x0003) || + (decoder_session->bps != 8 && decoder_session->bps != 16) || + decoder_session->channels > 2 + )); + const FLAC__uint64 data_size = samples * decoder_session->channels * ((decoder_session->bps+7)/8); + const FLAC__uint64 aligned_data_size = + format == FORMAT_WAVE64? + (data_size+7) & (~(FLAC__uint64)7) : + (data_size+1) & (~(FLAC__uint64)1); + + FLAC__uint64 iff_size; + uint32_t foreign_metadata_size = 0; /* size of all non-audio non-fmt/COMM foreign metadata chunks */ foreign_metadata_t *fm = decoder_session->foreign_metadata; size_t i; + FLAC__ASSERT( + format == FORMAT_WAVE || + format == FORMAT_WAVE64 || + format == FORMAT_RF64 || + format == FORMAT_AIFF || + format == FORMAT_AIFF_C + ); + if(samples == 0) { if(f == stdout) { flac__utils_printf(stderr, 1, "%s: WARNING, don't have accurate sample count available for %s header.\n", decoder_session->inbasefilename, fmt_desc); @@ -623,33 +690,96 @@ FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uin FLAC__ASSERT(fm->format_block); FLAC__ASSERT(fm->audio_block); FLAC__ASSERT(fm->format_block < fm->audio_block); - /* calc foreign metadata size; for RIFF/AIFF we always skip the first chunk, format chunk, and sound chunk since we write our own */ - for(i = 1; i < fm->num_blocks; i++) { + /* calc foreign metadata size; we always skip the first chunk, ds64 chunk, format chunk, and sound chunk since we write our own */ + for(i = format==FORMAT_RF64?2:1; i < fm->num_blocks; i++) { if(i != fm->format_block && i != fm->audio_block) foreign_metadata_size += fm->blocks[i].size; } } - if(data_size + foreign_metadata_size + 60/*worst-case*/ >= 0xFFFFFFF4) { + if(samples == 0) + iff_size = 0; + else if(format == FORMAT_WAVE || format == FORMAT_RF64) + /* 4 for WAVE form bytes */ + /* +{36,0} for ds64 chunk */ + /* +8+{40,16} for fmt chunk header and body */ + /* +8 for data chunk header */ + iff_size = 4 + (format==FORMAT_RF64?36:0) + 8+(is_waveformatextensible?40:16) + 8 + foreign_metadata_size + aligned_data_size; + else if(format == FORMAT_WAVE64) + /* 16+8 for RIFF GUID and size field */ + /* +16 for WAVE GUID */ + /* +16+8+{40,16} for fmt chunk header (GUID and size field) and body */ + /* +16+8 for data chunk header (GUID and size field) */ + iff_size = 16+8 + 16 + 16+8+(is_waveformatextensible?40:16) + 16+8 + foreign_metadata_size + aligned_data_size; + else if(format == FORMAT_AIFF) + iff_size = 46 + foreign_metadata_size + aligned_data_size; + else /* AIFF-C */ + iff_size = 16 + foreign_metadata_size + aligned_data_size + (fm?fm->aifc_comm_length:0); + + if(format != FORMAT_WAVE64 && format != FORMAT_RF64 && iff_size >= 0xFFFFFFF4) { flac__utils_printf(stderr, 1, "%s: ERROR: stream is too big to fit in a single %s file\n", decoder_session->inbasefilename, fmt_desc); return false; } - if(decoder_session->is_wave_out) { - if(flac__utils_fwrite("RIFF", 1, 4, f) != 4) - return false; + if(format == FORMAT_WAVE || format == FORMAT_WAVE64 || format == FORMAT_RF64) { + /* RIFF header */ + switch(format) { + case FORMAT_WAVE: + if(flac__utils_fwrite("RIFF", 1, 4, f) != 4) + return false; + if(!write_little_endian_uint32(f, (FLAC__uint32)iff_size)) /* filesize-8 */ + return false; + if(flac__utils_fwrite("WAVE", 1, 4, f) != 4) + return false; + break; + case FORMAT_WAVE64: + /* RIFF GUID 66666972-912E-11CF-A5D6-28DB04C10000 */ + if(flac__utils_fwrite("\x72\x69\x66\x66\x2E\x91\xCF\x11\xA5\xD6\x28\xDB\x04\xC1\x00\x00", 1, 16, f) != 16) + return false; + if(!write_little_endian_uint64(f, iff_size)) + return false; + /* WAVE GUID 65766177-ACF3-11D3-8CD1-00C04F8EDB8A */ + if(flac__utils_fwrite("\x77\x61\x76\x65\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 1, 16, f) != 16) + return false; + break; + case FORMAT_RF64: + if(flac__utils_fwrite("RF64", 1, 4, f) != 4) + return false; + if(!write_little_endian_uint32(f, 0xffffffff)) + return false; + if(flac__utils_fwrite("WAVE", 1, 4, f) != 4) + return false; + break; + default: + return false; + } - if(!write_little_endian_uint32(f, foreign_metadata_size + aligned_data_size + (is_waveformatextensible?60:36))) /* filesize-8 */ - return false; + /* ds64 chunk for RF64 */ + if(format == FORMAT_RF64) { + if(flac__utils_fwrite("ds64", 1, 4, f) != 4) + return false; - if(flac__utils_fwrite("WAVE", 1, 4, f) != 4) - return false; + if(!write_little_endian_uint32(f, 28)) /* chunk size */ + return false; + + if(!write_little_endian_uint64(f, iff_size)) + return false; + + if(!write_little_endian_uint64(f, data_size)) + return false; + + if(!write_little_endian_uint64(f, samples)) /*@@@@@@ correct? */ + return false; + + if(!write_little_endian_uint32(f, 0)) /* table size */ + return false; + } decoder_session->fm_offset1 = ftello(f); if(fm) { /* seek forward to {allocate} or {skip over already-written chunks} before "fmt " */ - for(i = 1; i < fm->format_block; i++) { + for(i = format==FORMAT_RF64?2:1; i < fm->format_block; i++) { if(fseeko(f, fm->blocks[i].size, SEEK_CUR) < 0) { flac__utils_printf(stderr, 1, "%s: ERROR: allocating/skipping foreign metadata before \"fmt \"\n", decoder_session->inbasefilename); return false; @@ -657,7 +787,22 @@ FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uin } } - if(!write_riff_wave_fmt_chunk(f, is_waveformatextensible, decoder_session->bps, decoder_session->channels, decoder_session->sample_rate, decoder_session->channel_mask)) + if(format != FORMAT_WAVE64) { + if(flac__utils_fwrite("fmt ", 1, 4, f) != 4) + return false; + if(!write_little_endian_uint32(f, is_waveformatextensible? 40 : 16)) /* chunk size */ + return false; + } + else { /* Wave64 */ + /* fmt GUID 20746D66-ACF3-11D3-8CD1-00C04F8EDB8A */ + if(flac__utils_fwrite("\x66\x6D\x74\x20\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 1, 16, f) != 16) + return false; + /* chunk size (+16+8 for GUID and size fields) */ + if(!write_little_endian_uint64(f, 16+8+(is_waveformatextensible?40:16))) + return false; + } + + if(!write_riff_wave_fmt_chunk_body(f, is_waveformatextensible, decoder_session->bps, decoder_session->channels, decoder_session->sample_rate, decoder_session->channel_mask)) return false; decoder_session->fm_offset2 = ftello(f); @@ -672,25 +817,37 @@ FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uin } } - if(flac__utils_fwrite("data", 1, 4, f) != 4) - return false; - - if(!write_little_endian_uint32(f, (FLAC__uint32)data_size)) /* data size */ - return false; + if(format != FORMAT_WAVE64) { + if(flac__utils_fwrite("data", 1, 4, f) != 4) + return false; + if(!write_little_endian_uint32(f, format==FORMAT_RF64? 0xffffffff : (FLAC__uint32)data_size)) + return false; + } + else { /* Wave64 */ + /* data GUID 61746164-ACF3-11D3-8CD1-00C04F8EDB8A */ + if(flac__utils_fwrite("\x64\x61\x74\x61\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 1, 16, f) != 16) + return false; + /* +16+8 for GUID and size fields */ + if(!write_little_endian_uint64(f, 16+8 + data_size)) + return false; + } decoder_session->fm_offset3 = ftello(f) + aligned_data_size; } else { - FLAC__uint32 ssnd_offset_size = (fm? fm->ssnd_offset_size : 0); - if(flac__utils_fwrite("FORM", 1, 4, f) != 4) return false; - if(!write_big_endian_uint32(f, foreign_metadata_size + aligned_data_size + 46 + ssnd_offset_size)) /* filesize-8 */ + if(!write_big_endian_uint32(f, (FLAC__uint32)iff_size)) /* filesize-8 */ return false; - if(flac__utils_fwrite("AIFF", 1, 4, f) != 4) - return false; + if(format == FORMAT_AIFF) { + if(flac__utils_fwrite("AIFF", 1, 4, f) != 4) + return false; + } + else + if(flac__utils_fwrite("AIFC", 1, 4, f) != 4) + return false; decoder_session->fm_offset1 = ftello(f); @@ -704,7 +861,7 @@ FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uin } } - if(!write_aiff_form_comm_chunk(f, samples, decoder_session->bps, decoder_session->channels, decoder_session->sample_rate)) + if(!write_aiff_form_comm_chunk(f, samples, decoder_session->bps, decoder_session->channels, decoder_session->sample_rate, format, subformat, fm?fm->aifc_comm_length:0)) return false; decoder_session->fm_offset2 = ftello(f); @@ -722,37 +879,23 @@ FLAC__bool write_iff_headers(FILE *f, DecoderSession *decoder_session, FLAC__uin if(flac__utils_fwrite("SSND", 1, 4, f) != 4) return false; - if(!write_big_endian_uint32(f, (FLAC__uint32)data_size + 8 + ssnd_offset_size)) /* data size */ + if(!write_big_endian_uint32(f, (FLAC__uint32)data_size + 8)) /* data size */ return false; - if(!write_big_endian_uint32(f, ssnd_offset_size)) + if(!write_big_endian_uint32(f, 0/*offset_size*/)) return false; if(!write_big_endian_uint32(f, 0/*block_size*/)) return false; - if(ssnd_offset_size) { - /* seek forward to {allocate} or {skip over already-written} SSND offset */ - if(fseeko(f, ssnd_offset_size, SEEK_CUR) < 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: allocating/skipping \"SSND\" offset\n", decoder_session->inbasefilename); - return false; - } - } - decoder_session->fm_offset3 = ftello(f) + aligned_data_size; } return true; } -FLAC__bool write_riff_wave_fmt_chunk(FILE *f, FLAC__bool is_waveformatextensible, unsigned bps, unsigned channels, unsigned sample_rate, FLAC__uint32 channel_mask) +FLAC__bool write_riff_wave_fmt_chunk_body(FILE *f, FLAC__bool is_waveformatextensible, uint32_t bps, uint32_t channels, uint32_t sample_rate, FLAC__uint32 channel_mask) { - if(flac__utils_fwrite("fmt ", 1, 4, f) != 4) - return false; - - if(!write_little_endian_uint32(f, is_waveformatextensible? 40 : 16)) /* chunk size */ - return false; - if(!write_little_endian_uint16(f, (FLAC__uint16)(is_waveformatextensible? 65534 : 1))) /* compression code */ return false; @@ -789,14 +932,22 @@ FLAC__bool write_riff_wave_fmt_chunk(FILE *f, FLAC__bool is_waveformatextensible return true; } -FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, unsigned bps, unsigned channels, unsigned sample_rate) +FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, uint32_t bps, uint32_t channels, uint32_t sample_rate, FileFormat format, FileSubFormat subformat, FLAC__uint32 comm_length) { + FLAC__uint32 i; FLAC__ASSERT(samples <= 0xffffffff); + if(comm_length == 0) { + if(format == FORMAT_AIFF) + comm_length = 30; + else + comm_length = 36; + } + if(flac__utils_fwrite("COMM", 1, 4, f) != 4) return false; - if(!write_big_endian_uint32(f, 18)) /* chunk size = 18 */ + if(!write_big_endian_uint32(f, comm_length-12)) /* chunk size = 18 */ return false; if(!write_big_endian_uint16(f, (FLAC__uint16)channels)) @@ -811,6 +962,23 @@ FLAC__bool write_aiff_form_comm_chunk(FILE *f, FLAC__uint64 samples, unsigned bp if(!write_sane_extended(f, sample_rate)) return false; + if(format == FORMAT_AIFF_C) { + if(subformat == SUBFORMAT_AIFF_C_NONE) { + if(flac__utils_fwrite("NONE", 1, 4, f) != 4) + return false; + } + else if(subformat == SUBFORMAT_AIFF_C_SOWT) { + if(flac__utils_fwrite("sowt", 1, 4, f) != 4) + return false; + } + for(i = 34; i < comm_length; i++) { + if(flac__utils_fwrite("\x00", 1, 1, f) != 1) + return false; + } + } + + + return true; } @@ -835,6 +1003,19 @@ FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 val) return flac__utils_fwrite(b, 1, 4, f) == 4; } +FLAC__bool write_little_endian_uint64(FILE *f, FLAC__uint64 val) +{ + FLAC__byte *b = (FLAC__byte*)(&val); + if(is_big_endian_host_) { + FLAC__byte tmp; + tmp = b[7]; b[7] = b[0]; b[0] = tmp; + tmp = b[6]; b[6] = b[1]; b[1] = tmp; + tmp = b[5]; b[5] = b[2]; b[2] = tmp; + tmp = b[4]; b[4] = b[3]; b[3] = tmp; + } + return flac__utils_fwrite(b, 1, 8, f) == 8; +} + FLAC__bool write_big_endian_uint16(FILE *f, FLAC__uint16 val) { FLAC__byte *b = (FLAC__byte*)(&val); @@ -856,7 +1037,7 @@ FLAC__bool write_big_endian_uint32(FILE *f, FLAC__uint32 val) return flac__utils_fwrite(b, 1, 4, f) == 4; } -FLAC__bool write_sane_extended(FILE *f, unsigned val) +FLAC__bool write_sane_extended(FILE *f, uint32_t val) /* Write to 'f' a SANE extended representation of 'val'. Return false if * the write succeeds; return true otherwise. * @@ -864,13 +1045,19 @@ FLAC__bool write_sane_extended(FILE *f, unsigned val) * 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; + uint32_t shift, exponent; - FLAC__ASSERT(val!=0U); /* handling 0 would require a special case */ + if(val == 0U) { + if(!write_big_endian_uint16(f, 0)) + return false; + if(!write_big_endian_uint32(f, 0)) + return false; + if(!write_big_endian_uint32(f, 0)) + return false; + return true; + } for(shift= 0U; (val>>(31-shift))==0U; ++shift) ; @@ -889,8 +1076,12 @@ FLAC__bool write_sane_extended(FILE *f, unsigned val) FLAC__bool fixup_iff_headers(DecoderSession *d) { - const char *fmt_desc = (d->is_wave_out? "WAVE" : "AIFF"); - FILE *f = fopen(d->outfilename, "r+b"); /* stream is positioned at beginning of file */ + const char *fmt_desc = + d->format==FORMAT_WAVE? "WAVE" : + d->format==FORMAT_WAVE64? "Wave64" : + d->format==FORMAT_RF64? "RF64" : + "AIFF"; + FILE *f = flac_fopen(d->outfilename, "r+b"); /* stream is positioned at beginning of file */ if(0 == f) { flac__utils_printf(stderr, 1, "ERROR, couldn't open file %s while fixing up %s chunk size: %s\n", d->outfilename, fmt_desc, strerror(errno)); @@ -910,18 +1101,31 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder { DecoderSession *decoder_session = (DecoderSession*)client_data; FILE *fout = decoder_session->fout; - const unsigned bps = frame->header.bits_per_sample, channels = frame->header.channels; - const unsigned shift = ((decoder_session->is_wave_out || decoder_session->is_aiff_out) && (bps%8)? 8-(bps%8): 0); - FLAC__bool is_big_endian = (decoder_session->is_aiff_out? true : (decoder_session->is_wave_out? false : decoder_session->is_big_endian)); - FLAC__bool is_unsigned_samples = (decoder_session->is_aiff_out? false : (decoder_session->is_wave_out? bps<=8 : decoder_session->is_unsigned_samples)); - unsigned wide_samples = frame->header.blocksize, wide_sample, sample, channel, byte; - unsigned frame_bytes = 0; - static FLAC__int8 s8buffer[FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * sizeof(FLAC__int32)]; /* WATCHOUT: can be up to 2 megs */ - FLAC__uint8 *u8buffer = (FLAC__uint8 *)s8buffer; - FLAC__int16 *s16buffer = (FLAC__int16 *)s8buffer; - FLAC__uint16 *u16buffer = (FLAC__uint16 *)s8buffer; - FLAC__int32 *s32buffer = (FLAC__int32 *)s8buffer; - FLAC__uint32 *u32buffer = (FLAC__uint32 *)s8buffer; + const uint32_t bps = frame->header.bits_per_sample, channels = frame->header.channels; + const uint32_t shift = (bps%8)? 8-(bps%8): 0; + FLAC__bool is_big_endian = ( + (decoder_session->format == FORMAT_AIFF || (decoder_session->format == FORMAT_AIFF_C && decoder_session->subformat == SUBFORMAT_AIFF_C_NONE)) ? true : ( + decoder_session->format == FORMAT_WAVE || decoder_session->format == FORMAT_WAVE64 || decoder_session->format == FORMAT_RF64 || (decoder_session->format == FORMAT_AIFF_C && decoder_session->subformat == SUBFORMAT_AIFF_C_SOWT) ? false : + decoder_session->is_big_endian + )); + FLAC__bool is_unsigned_samples = ( + decoder_session->format == FORMAT_AIFF || decoder_session->format == FORMAT_AIFF_C ? false : ( + decoder_session->format == FORMAT_WAVE || decoder_session->format == FORMAT_WAVE64 || decoder_session->format == FORMAT_RF64 ? bps<=8 : + decoder_session->is_unsigned_samples + )); + uint32_t wide_samples = frame->header.blocksize, wide_sample, sample, channel; + FLAC__uint64 frame_bytes = 0; + + static union + { /* The arrays defined within this union are all the same size. */ + FLAC__int8 s8buffer [FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * sizeof(FLAC__int32)]; /* WATCHOUT: can be up to 2 megs */ + FLAC__uint8 u8buffer [FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * sizeof(FLAC__int32)]; + FLAC__int16 s16buffer [FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * sizeof(FLAC__int16)]; + FLAC__uint16 u16buffer [FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * sizeof(FLAC__int16)]; + FLAC__int32 s32buffer [FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS]; + FLAC__uint32 u32buffer [FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS]; + } ubuf; + size_t bytes_to_write = 0; (void)decoder; @@ -943,6 +1147,10 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder else { /* must not have gotten STREAMINFO, save the bps from the frame header */ FLAC__ASSERT(!decoder_session->got_stream_info); + if(decoder_session->format == FORMAT_RAW && ((decoder_session->bps % 8) != 0 || decoder_session->bps < 4)) { + flac__utils_printf(stderr, 1, "%s: ERROR: bits per sample is %u, must be 8/16/24/32 for raw format output\n", decoder_session->inbasefilename, decoder_session->bps); + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } decoder_session->bps = bps; } @@ -964,7 +1172,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder } /* sanity-check the sample rate */ - if(decoder_session->sample_rate) { + if(decoder_session->sample_rate < UINT32_MAX) { if(frame->header.sample_rate != decoder_session->sample_rate) { if(decoder_session->got_stream_info) flac__utils_printf(stderr, 1, "%s: ERROR, sample rate is %u in frame but %u in STREAMINFO\n", decoder_session->inbasefilename, frame->header.sample_rate, decoder_session->sample_rate); @@ -983,9 +1191,8 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder /* * limit the number of samples to accept based on --until */ - FLAC__ASSERT(!decoder_session->skip_specification->is_relative); /* if we never got the total_samples from the metadata, the skip and until specs would never have been canonicalized, so protect against that: */ - if(decoder_session->skip_specification->is_relative) { + if(decoder_session->skip_specification->is_relative || !decoder_session->got_stream_info) { if(decoder_session->skip_specification->value.samples == 0) /* special case for when no --skip was given */ decoder_session->skip_specification->is_relative = false; /* convert to our meaning of beginning-of-stream */ else { @@ -993,7 +1200,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; } } - if(decoder_session->until_specification->is_relative) { + if(decoder_session->until_specification->is_relative || !decoder_session->got_stream_info) { if(decoder_session->until_specification->value.samples == 0) /* special case for when no --until was given */ decoder_session->until_specification->is_relative = false; /* convert to our meaning of end-of-stream */ else { @@ -1009,7 +1216,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder const FLAC__uint64 input_samples_passed = skip + decoder_session->samples_processed; FLAC__ASSERT(until >= input_samples_passed); if(input_samples_passed + wide_samples > until) - wide_samples = (unsigned)(until - input_samples_passed); + wide_samples = (uint32_t)(until - input_samples_passed); if (wide_samples == 0) { decoder_session->abort_flag = true; decoder_session->aborting_due_to_until = true; @@ -1020,7 +1227,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder if(decoder_session->analysis_mode) { FLAC__uint64 dpos; FLAC__stream_decoder_get_decode_position(decoder_session->decoder, &dpos); - frame_bytes = (unsigned)(dpos-decoder_session->decode_position); + frame_bytes = (dpos-decoder_session->decode_position); decoder_session->decode_position = dpos; } @@ -1028,8 +1235,16 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder decoder_session->samples_processed += wide_samples; decoder_session->frame_counter++; - if(!(decoder_session->frame_counter & 0x3f)) +#if 0 /* in case time.h with clock() isn't available for some reason */ + if(!(decoder_session->frame_counter & 0x1ff)) + print_stats(decoder_session); +#else + if((clock() - decoder_session->old_clock_t) > (CLOCKS_PER_SEC/4)) { print_stats(decoder_session); + decoder_session->old_clock_t = clock(); + } +#endif + if(decoder_session->analysis_mode) { flac__analyze_frame(frame, decoder_session->frame_counter-1, decoder_session->decode_position-frame_bytes, frame_bytes, decoder_session->aopts, fout); @@ -1038,11 +1253,11 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder if(shift && !decoder_session->replaygain.apply) { for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) for(channel = 0; channel < channels; channel++) - ((FLAC__int32**)buffer)[channel][wide_sample] <<= shift;/*@@@@@@un-const'ing the buffer is hacky but safe*/ + ((uint32_t **)buffer)[channel][wide_sample] <<= shift;/*@@@@@@un-const'ing the buffer is hacky but safe*/ } if(decoder_session->replaygain.apply) { bytes_to_write = FLAC__replaygain_synthesis__apply_gain( - u8buffer, + ubuf.u8buffer, !is_big_endian, is_unsigned_samples, buffer, @@ -1058,17 +1273,17 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder } /* first some special code for common cases */ else if(is_big_endian == is_big_endian_host_ && !is_unsigned_samples && channels == 2 && bps+shift == 16) { - FLAC__int16 *buf1_ = s16buffer + 1; + FLAC__int16 *buf1_ = ubuf.s16buffer + 1; if(is_big_endian) - memcpy(s16buffer, ((FLAC__byte*)(buffer[0]))+2, sizeof(FLAC__int32) * wide_samples - 2); + memcpy(ubuf.s16buffer, ((FLAC__byte*)(buffer[0]))+2, sizeof(FLAC__int32) * wide_samples - 2); else - memcpy(s16buffer, buffer[0], sizeof(FLAC__int32) * wide_samples); + memcpy(ubuf.s16buffer, buffer[0], sizeof(FLAC__int32) * wide_samples); for(sample = 0; sample < wide_samples; sample++, buf1_+=2) *buf1_ = (FLAC__int16)buffer[1][sample]; bytes_to_write = 4 * sample; } else if(is_big_endian == is_big_endian_host_ && !is_unsigned_samples && channels == 1 && bps+shift == 16) { - FLAC__int16 *buf1_ = s16buffer; + FLAC__int16 *buf1_ = ubuf.s16buffer; for(sample = 0; sample < wide_samples; sample++) *buf1_++ = (FLAC__int16)buffer[0][sample]; bytes_to_write = 2 * sample; @@ -1078,44 +1293,45 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder if(is_unsigned_samples) { if(channels == 2) { for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) { - u16buffer[sample++] = (FLAC__uint16)(buffer[0][wide_sample] + 0x8000); - u16buffer[sample++] = (FLAC__uint16)(buffer[1][wide_sample] + 0x8000); + ubuf.u16buffer[sample++] = (FLAC__uint16)(buffer[0][wide_sample] + 0x8000); + ubuf.u16buffer[sample++] = (FLAC__uint16)(buffer[1][wide_sample] + 0x8000); } } else if(channels == 1) { for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - u16buffer[sample++] = (FLAC__uint16)(buffer[0][wide_sample] + 0x8000); + ubuf.u16buffer[sample++] = (FLAC__uint16)(buffer[0][wide_sample] + 0x8000); } else { /* works for any 'channels' but above flavors are faster for 1 and 2 */ for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) for(channel = 0; channel < channels; channel++, sample++) - u16buffer[sample] = (FLAC__uint16)(buffer[channel][wide_sample] + 0x8000); + ubuf.u16buffer[sample] = (FLAC__uint16)(buffer[channel][wide_sample] + 0x8000); } } else { if(channels == 2) { for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) { - s16buffer[sample++] = (FLAC__int16)(buffer[0][wide_sample]); - s16buffer[sample++] = (FLAC__int16)(buffer[1][wide_sample]); + ubuf.s16buffer[sample++] = (FLAC__int16)(buffer[0][wide_sample]); + ubuf.s16buffer[sample++] = (FLAC__int16)(buffer[1][wide_sample]); } } else if(channels == 1) { for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - s16buffer[sample++] = (FLAC__int16)(buffer[0][wide_sample]); + ubuf.s16buffer[sample++] = (FLAC__int16)(buffer[0][wide_sample]); } else { /* works for any 'channels' but above flavors are faster for 1 and 2 */ for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) for(channel = 0; channel < channels; channel++, sample++) - s16buffer[sample] = (FLAC__int16)(buffer[channel][wide_sample]); + ubuf.s16buffer[sample] = (FLAC__int16)(buffer[channel][wide_sample]); } } if(is_big_endian != is_big_endian_host_) { - unsigned char tmp; - const unsigned bytes = sample * 2; - for(byte = 0; byte < bytes; byte += 2) { - tmp = u8buffer[byte]; - u8buffer[byte] = u8buffer[byte+1]; - u8buffer[byte+1] = tmp; + uint8_t tmp; + const uint32_t bytes = sample * 2; + uint32_t b; + for(b = 0; b < bytes; b += 2) { + tmp = ubuf.u8buffer[b]; + ubuf.u8buffer[b] = ubuf.u8buffer[b+1]; + ubuf.u8buffer[b+1] = tmp; } } bytes_to_write = 2 * sample; @@ -1124,43 +1340,44 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder if(is_unsigned_samples) { for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) for(channel = 0; channel < channels; channel++, sample++) - u32buffer[sample] = buffer[channel][wide_sample] + 0x800000; + ubuf.u32buffer[sample] = buffer[channel][wide_sample] + 0x800000; } else { for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) for(channel = 0; channel < channels; channel++, sample++) - s32buffer[sample] = buffer[channel][wide_sample]; + ubuf.s32buffer[sample] = buffer[channel][wide_sample]; } if(is_big_endian != is_big_endian_host_) { - unsigned char tmp; - const unsigned bytes = sample * 4; - for(byte = 0; byte < bytes; byte += 4) { - tmp = u8buffer[byte]; - u8buffer[byte] = u8buffer[byte+3]; - u8buffer[byte+3] = tmp; - tmp = u8buffer[byte+1]; - u8buffer[byte+1] = u8buffer[byte+2]; - u8buffer[byte+2] = tmp; + uint8_t tmp; + const uint32_t bytes = sample * 4; + uint32_t b; + for(b = 0; b < bytes; b += 4) { + tmp = ubuf.u8buffer[b]; + ubuf.u8buffer[b] = ubuf.u8buffer[b+3]; + ubuf.u8buffer[b+3] = tmp; + tmp = ubuf.u8buffer[b+1]; + ubuf.u8buffer[b+1] = ubuf.u8buffer[b+2]; + ubuf.u8buffer[b+2] = tmp; } } if(is_big_endian) { - unsigned lbyte; - const unsigned bytes = sample * 4; - for(lbyte = byte = 0; byte < bytes; ) { - byte++; - u8buffer[lbyte++] = u8buffer[byte++]; - u8buffer[lbyte++] = u8buffer[byte++]; - u8buffer[lbyte++] = u8buffer[byte++]; + uint32_t b, lbyte; + const uint32_t bytes = sample * 4; + for(lbyte = b = 0; b < bytes; ) { + b++; + ubuf.u8buffer[lbyte++] = ubuf.u8buffer[b++]; + ubuf.u8buffer[lbyte++] = ubuf.u8buffer[b++]; + ubuf.u8buffer[lbyte++] = ubuf.u8buffer[b++]; } } else { - unsigned lbyte; - const unsigned bytes = sample * 4; - for(lbyte = byte = 0; byte < bytes; ) { - u8buffer[lbyte++] = u8buffer[byte++]; - u8buffer[lbyte++] = u8buffer[byte++]; - u8buffer[lbyte++] = u8buffer[byte++]; - byte++; + uint32_t b, lbyte; + const uint32_t bytes = sample * 4; + for(lbyte = b = 0; b < bytes; ) { + ubuf.u8buffer[lbyte++] = ubuf.u8buffer[b++]; + ubuf.u8buffer[lbyte++] = ubuf.u8buffer[b++]; + ubuf.u8buffer[lbyte++] = ubuf.u8buffer[b++]; + b++; } } bytes_to_write = 3 * sample; @@ -1169,15 +1386,41 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder if(is_unsigned_samples) { for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) for(channel = 0; channel < channels; channel++, sample++) - u8buffer[sample] = (FLAC__uint8)(buffer[channel][wide_sample] + 0x80); + ubuf.u8buffer[sample] = (FLAC__uint8)(buffer[channel][wide_sample] + 0x80); } else { for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) for(channel = 0; channel < channels; channel++, sample++) - s8buffer[sample] = (FLAC__int8)(buffer[channel][wide_sample]); + ubuf.s8buffer[sample] = (FLAC__int8)(buffer[channel][wide_sample]); } bytes_to_write = sample; } + else if(bps+shift == 32) { + if(is_unsigned_samples) { + for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) + for(channel = 0; channel < channels; channel++, sample++) + ubuf.u32buffer[sample] = buffer[channel][wide_sample]; + } + else { + for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) + for(channel = 0; channel < channels; channel++, sample++) + ubuf.s32buffer[sample] = buffer[channel][wide_sample]; + } + if(is_big_endian != is_big_endian_host_) { + uint8_t tmp; + const uint32_t bytes = sample * 4; + uint32_t b; + for(b = 0; b < bytes; b += 4) { + tmp = ubuf.u8buffer[b]; + ubuf.u8buffer[b] = ubuf.u8buffer[b+3]; + ubuf.u8buffer[b+3] = tmp; + tmp = ubuf.u8buffer[b+1]; + ubuf.u8buffer[b+1] = ubuf.u8buffer[b+2]; + ubuf.u8buffer[b+2] = tmp; + } + } + bytes_to_write = 4 * sample; + } else { FLAC__ASSERT(0); /* double protection */ @@ -1187,7 +1430,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder } } if(bytes_to_write > 0) { - if(flac__utils_fwrite(u8buffer, 1, bytes_to_write, fout) != bytes_to_write) { + if(flac__utils_fwrite(ubuf.u8buffer, 1, bytes_to_write, fout) != bytes_to_write) { /* if a pipe closed when writing to stdout, we let it go without an error message */ if(errno == EPIPE && decoder_session->fout == stdout) decoder_session->aborting_due_to_until = true; @@ -1202,18 +1445,30 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet { DecoderSession *decoder_session = (DecoderSession*)client_data; - if(decoder_session->analysis_mode) - FLAC__stream_decoder_get_decode_position(decoder, &decoder_session->decode_position); + (void)decoder; if(metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { FLAC__uint64 skip, until; + + if(decoder_session->got_stream_info){ + /* There was already a STREAMINFO received */ + flac__utils_printf(stderr, 1, "%s: ERROR, more than one STREAMINFO found\n", decoder_session->inbasefilename); + if(!decoder_session->continue_through_decode_errors) + decoder_session->abort_flag = true; + return; + } + decoder_session->got_stream_info = true; - decoder_session->has_md5sum = memcmp(metadata->data.stream_info.md5sum, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16); + decoder_session->has_md5sum = memcmp(metadata->data.stream_info.md5sum, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) != 0; decoder_session->bps = metadata->data.stream_info.bits_per_sample; decoder_session->channels = metadata->data.stream_info.channels; decoder_session->sample_rate = metadata->data.stream_info.sample_rate; - flac__utils_canonicalize_skip_until_specification(decoder_session->skip_specification, decoder_session->sample_rate); + if(!flac__utils_canonicalize_skip_until_specification(decoder_session->skip_specification, decoder_session->sample_rate)) { + flac__utils_printf(stderr, 1, "%s: ERROR, value of --skip is too large\n", decoder_session->inbasefilename); + decoder_session->abort_flag = true; + return; + } FLAC__ASSERT(decoder_session->skip_specification->value.samples >= 0); skip = (FLAC__uint64)decoder_session->skip_specification->value.samples; @@ -1245,8 +1500,14 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet decoder_session->total_samples -= (metadata->data.stream_info.total_samples - until); } - if(decoder_session->bps < 4 || decoder_session->bps > 24) { - flac__utils_printf(stderr, 1, "%s: ERROR: bits per sample is %u, must be 4-24\n", decoder_session->inbasefilename, decoder_session->bps); + if(decoder_session->format == FORMAT_RAW && ((decoder_session->bps % 8) != 0 || decoder_session->bps < 4)) { + flac__utils_printf(stderr, 1, "%s: ERROR: bits per sample is %u, must be 8/16/24/32 for raw format output\n", decoder_session->inbasefilename, decoder_session->bps); + decoder_session->abort_flag = true; + return; + } + + if(decoder_session->bps < 4 || decoder_session->bps > 32) { + flac__utils_printf(stderr, 1, "%s: ERROR: bits per sample is %u, must be 4-32\n", decoder_session->inbasefilename, decoder_session->bps); decoder_session->abort_flag = true; return; } @@ -1284,6 +1545,13 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet return; } } + else if(decoder_session->bps == 0) { + flac__utils_printf(stderr, 1, "%s: WARNING: can't apply ReplayGain, bit-per-sample value is invalid\n", decoder_session->inbasefilename); + if(decoder_session->treat_warnings_as_errors) { + decoder_session->abort_flag = true; + return; + } + } else { const char *ls[] = { "no", "peak", "hard" }; const char *ns[] = { "no", "low", "medium", "high" }; @@ -1297,17 +1565,39 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMet } (void)flac__utils_get_channel_mask_tag(metadata, &decoder_session->channel_mask); } + else if(metadata->type == FLAC__METADATA_TYPE_APPLICATION && decoder_session->warn_user_about_foreign_metadata) { + /* Foreign metadata signalling */ + flac__utils_printf(stderr, 1, "%s: WARNING: found foreign metadata, use --keep-foreign-metadata to restore\n", decoder_session->inbasefilename); + decoder_session->warn_user_about_foreign_metadata = false; + } } void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) { DecoderSession *decoder_session = (DecoderSession*)client_data; (void)decoder; - flac__utils_printf(stderr, 1, "%s: *** Got error code %d:%s\n", decoder_session->inbasefilename, status, FLAC__StreamDecoderErrorStatusString[status]); + if(!decoder_session->error_callback_suppress_messages) { + stats_print_name(1, decoder_session->inbasefilename); + flac__utils_printf(stderr, 1, "*** Got error code %d:%s\n", status, FLAC__StreamDecoderErrorStatusString[status]); + } if(!decoder_session->continue_through_decode_errors) { - decoder_session->abort_flag = true; - if(status == FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM) + /* if we got a sync error while looking for metadata, either it's not a FLAC file (more likely) or the file is corrupted */ + if( + !decoder_session->error_callback_suppress_messages && + status == FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC && + FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA + ) { + flac__utils_printf(stderr, 1, + "\n" + "The input file is either not a FLAC file or is corrupted. If you are\n" + "convinced it is a FLAC file, you can rerun the same command and add the\n" + "-F parameter to try and recover as much as possible from the file.\n" + ); + decoder_session->error_callback_suppress_messages = true; + } + else if(status == FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM) decoder_session->aborting_due_to_unparseable = true; + decoder_session->abort_flag = true; } } @@ -1323,8 +1613,13 @@ void print_error_with_init_status(const DecoderSession *d, const char *message, if (init_status == FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE) { flac__utils_printf(stderr, 1, "\n" +#ifdef _WIN32 + "An error occurred opening the input file; it is likely that it does not exist,\n" + "is not readable or has a filename that exceeds the path length limit.\n" +#else "An error occurred opening the input file; it is likely that it does not exist\n" "or is not readable.\n" +#endif ); } } @@ -1346,7 +1641,7 @@ void print_error_with_state(const DecoderSession *d, const char *message) "not able to decode the file. If the version number is not, the file\n" "may be corrupted, or you may have found a bug. In this case please\n" "submit a bug report to\n" - " http://sourceforge.net/bugs/?func=addbug&group_id=13478\n" + " https://github.com/xiph/flac/issues\n" "Make sure to use the \"Monitor\" feature to monitor the bug status.\n", d->inbasefilename, FLAC__VERSION_STRING ); @@ -1356,24 +1651,23 @@ void print_error_with_state(const DecoderSession *d, const char *message) void print_stats(const DecoderSession *decoder_session) { if(flac__utils_verbosity_ >= 2) { -#if defined _MSC_VER || defined __MINGW32__ - /* with MSVC you have to spoon feed it the casting */ - const double progress = (double)(FLAC__int64)decoder_session->samples_processed / (double)(FLAC__int64)decoder_session->total_samples * 100.0; -#else const double progress = (double)decoder_session->samples_processed / (double)decoder_session->total_samples * 100.0; -#endif + if(decoder_session->total_samples > 0) { - fprintf(stderr, "\r%s: %s%u%% complete", - decoder_session->inbasefilename, + if ((uint32_t)floor(progress + 0.5) == 100) + return; + + stats_print_name(2, decoder_session->inbasefilename); + stats_print_info(2, "%s%u%% complete", decoder_session->test_only? "testing, " : decoder_session->analysis_mode? "analyzing, " : "", - (unsigned)floor(progress + 0.5) + (uint32_t)floor(progress + 0.5) ); } else { - fprintf(stderr, "\r%s: %s %u samples", - decoder_session->inbasefilename, + stats_print_name(2, decoder_session->inbasefilename); + stats_print_info(2, "%s %" PRIu64 " samples", decoder_session->test_only? "tested" : decoder_session->analysis_mode? "analyzed" : "wrote", - (unsigned)decoder_session->samples_processed + decoder_session->samples_processed ); } } diff --git a/3rdparty/libflac/src/flac/decode.h b/3rdparty/libflac/src/flac/decode.h index 2ab9deb6605..24f5723dada 100644 --- a/3rdparty/libflac/src/flac/decode.h +++ b/3rdparty/libflac/src/flac/decode.h @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,15 +12,15 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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__decode_h #define flac__decode_h -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -51,24 +52,22 @@ typedef struct { FLAC__bool has_cue_specification; utils__CueSpecification cue_specification; FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */ -} decode_options_t; - -/* used for AIFF also */ -typedef struct { - decode_options_t common; - foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */ -} wav_decode_options_t; + FLAC__bool relaxed_foreign_metadata_handling; + FileSubFormat force_subformat; -typedef struct { - decode_options_t common; - - FLAC__bool is_big_endian; - FLAC__bool is_unsigned_samples; -} raw_decode_options_t; + FileFormat format; + union { + struct { + FLAC__bool is_big_endian; + FLAC__bool is_unsigned_samples; + } raw; + struct { + foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */ + } iff; + } format_options; +} decode_options_t; /* outfile == 0 => test only */ -int flac__decode_aiff(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options); -int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, wav_decode_options_t options); -int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, raw_decode_options_t options); +int flac__decode_file(const char *infilename, const char *outfilename, FLAC__bool analysis_mode, analysis_options aopts, decode_options_t options); #endif diff --git a/3rdparty/libflac/src/flac/encode.c b/3rdparty/libflac/src/flac/encode.c index 8d2434993e5..a945b356a52 100644 --- a/3rdparty/libflac/src/flac/encode.c +++ b/3rdparty/libflac/src/flac/encode.c @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,37 +12,30 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif -#if defined _WIN32 && !defined __CYGWIN__ -/* where MSVC puts unlink() */ -# include <io.h> -#else -# include <unistd.h> -#endif -#if defined _MSC_VER || defined __MINGW32__ -#include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif #include <errno.h> #include <limits.h> /* for LONG_MAX */ #include <math.h> /* for floor() */ #include <stdio.h> /* for FILE etc. */ #include <stdlib.h> /* for malloc */ #include <string.h> /* for strcmp(), strerror() */ +#include <time.h> /* for clock() */ +#include <sys/stat.h> #include "FLAC/all.h" #include "share/alloc.h" #include "share/grabbag.h" +#include "share/compat.h" +#include "share/private.h" +#include "share/safe_str.h" +#include "share/endswap.h" #include "encode.h" #ifdef min @@ -53,10 +47,32 @@ #endif #define max(x,y) ((x)>(y)?(x):(y)) -/* this MUST be >= 588 so that sector aligning can take place with one read */ +/* this MUST be < 2^sizeof(size_t) / ( FLAC__MAX_CHANNELS * (FLAC__MAX_BITS_PER_SAMPLE/8) ) */ #define CHUNK_OF_SAMPLES 2048 typedef struct { + uint32_t sample_rate; + uint32_t channels; + uint32_t bits_per_sample; /* width of sample point, including 'shift' bits, valid bps is bits_per_sample-shift */ + uint32_t shift; /* # of LSBs samples have been shifted left by */ + uint32_t bytes_per_wide_sample; /* for convenience, always == channels*((bps+7)/8), or 0 if N/A to input format (like FLAC) */ + FLAC__bool is_unsigned_samples; + FLAC__bool is_big_endian; + FLAC__uint32 channel_mask; +} SampleInfo; + +/* this is the client_data attached to the FLAC decoder when encoding from a FLAC file */ +typedef struct { + FLAC__off_t filesize; + const FLAC__byte *lookahead; + uint32_t lookahead_length; + size_t num_metadata_blocks; + FLAC__StreamMetadata *metadata_blocks[1024]; /*@@@ BAD MAGIC number */ + FLAC__uint64 samples_left_to_process; + FLAC__bool fatal_error; +} FLACDecoderData; + +typedef struct { #if FLAC__HAS_OGG FLAC__bool use_ogg; #endif @@ -67,73 +83,75 @@ typedef struct { const char *infilename; const char *outfilename; - FLAC__uint64 skip; - FLAC__uint64 until; /* a value of 0 mean end-of-stream (i.e. --until=-0) */ FLAC__bool treat_warnings_as_errors; FLAC__bool continue_through_decode_errors; FLAC__bool replay_gain; - unsigned channels; - unsigned bits_per_sample; - unsigned sample_rate; - FLAC__uint64 unencoded_size; - FLAC__uint64 total_samples_to_encode; + FLAC__uint64 total_samples_to_encode; /* (i.e. "wide samples" aka "sample frames") WATCHOUT: may be 0 to mean 'unknown' */ + FLAC__uint64 unencoded_size; /* an estimate of the input size, only used in the progress indicator */ FLAC__uint64 bytes_written; FLAC__uint64 samples_written; - unsigned stats_mask; +#if 0 /* in case time.h with clock() isn't available for some reason */ + uint32_t stats_frames_interval; + uint32_t old_frames_written; +#else + clock_t old_clock_t; +#endif + + SampleInfo info; + + FileFormat format; + union { + struct { + FLAC__uint64 data_bytes; + } iff; + struct { + FLAC__StreamDecoder *decoder; + FLACDecoderData client_data; + } flac; + } fmt; FLAC__StreamEncoder *encoder; FILE *fin; FLAC__StreamMetadata *seek_table_template; + double progress, compression_ratio; } EncoderSession; -/* this is data attached to the FLAC decoder when encoding from a FLAC file */ -typedef struct { - EncoderSession *encoder_session; - off_t filesize; - const FLAC__byte *lookahead; - unsigned lookahead_length; - size_t num_metadata_blocks; - FLAC__StreamMetadata *metadata_blocks[1024]; /*@@@ BAD MAGIC number */ - FLAC__uint64 samples_left_to_process; - FLAC__bool fatal_error; -} FLACDecoderData; - const int FLAC_ENCODE__DEFAULT_PADDING = 8192; static FLAC__bool is_big_endian_host_; -static unsigned char ucbuffer_[CHUNK_OF_SAMPLES*FLAC__MAX_CHANNELS*((FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE+7)/8)]; -static signed char *scbuffer_ = (signed char *)ucbuffer_; -static FLAC__uint16 *usbuffer_ = (FLAC__uint16 *)ucbuffer_; -static FLAC__int16 *ssbuffer_ = (FLAC__int16 *)ucbuffer_; +#define UBUFFER_INT8_SIZE 0x10000 + +static union { + FLAC__int8 s8[UBUFFER_INT8_SIZE]; + FLAC__uint8 u8[UBUFFER_INT8_SIZE]; + FLAC__int16 s16[UBUFFER_INT8_SIZE/2]; + FLAC__uint16 u16[UBUFFER_INT8_SIZE/2]; + FLAC__int32 s32[UBUFFER_INT8_SIZE/4]; + FLAC__uint32 u32[UBUFFER_INT8_SIZE/4]; +} ubuffer; + static FLAC__int32 in_[FLAC__MAX_CHANNELS][CHUNK_OF_SAMPLES]; static FLAC__int32 *input_[FLAC__MAX_CHANNELS]; /* - * unpublished debug routines from the FLAC libs - */ -extern FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); -extern FLAC__bool FLAC__stream_encoder_disable_fixed_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); -extern FLAC__bool FLAC__stream_encoder_disable_verbatim_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value); -extern FLAC__bool FLAC__stream_encoder_set_do_md5(FLAC__StreamEncoder *encoder, FLAC__bool value); - -/* * local routines */ -static FLAC__bool EncoderSession_construct(EncoderSession *e, FLAC__bool use_ogg, FLAC__bool verify, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FILE *infile, const char *infilename, const char *outfilename); +static FLAC__bool EncoderSession_construct(EncoderSession *e, encode_options_t options, FLAC__off_t infilesize, FILE *infile, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, uint32_t lookahead_length); static void EncoderSession_destroy(EncoderSession *e); -static int EncoderSession_finish_ok(EncoderSession *e, int info_align_carry, int info_align_zero, foreign_metadata_t *foreign_metadata); +static int EncoderSession_finish_ok(EncoderSession *e, foreign_metadata_t *foreign_metadata, FLAC__bool error_on_compression_fail); static int EncoderSession_finish_error(EncoderSession *e); -static FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t options, FLAC__uint32 channel_mask, unsigned channels, unsigned bps, unsigned sample_rate, const foreign_metadata_t *foreign_metadata, FLACDecoderData *flac_decoder_data); -static FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], unsigned samples); +static FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t options); +static FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], uint32_t samples); +static FLAC__bool EncoderSession_format_is_iff(const EncoderSession *e); static FLAC__bool convert_to_seek_table_template(const char *requested_seek_points, int num_requested_seek_points, FLAC__StreamMetadata *cuesheet, EncoderSession *e); -static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input); -static FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, unsigned num_metadata); -static FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned shift, size_t *channel_map); -static void encoder_progress_callback(const FLAC__StreamEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data); +static FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, uint32_t sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input); +static FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, uint32_t num_metadata); +static FLAC__bool format_input(FLAC__int32 *dest[], uint32_t wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, uint32_t channels, uint32_t bps, uint32_t shift, size_t *channel_map); +static void 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); static FLAC__StreamDecoderReadStatus flac_decoder_read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); static FLAC__StreamDecoderSeekStatus flac_decoder_seek_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data); static FLAC__StreamDecoderTellStatus flac_decoder_tell_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data); @@ -142,530 +160,121 @@ static FLAC__bool flac_decoder_eof_callback(const FLAC__StreamDecoder *decoder, static FLAC__StreamDecoderWriteStatus flac_decoder_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data); static void flac_decoder_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data); static void flac_decoder_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); -static FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors); +static FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, uint32_t sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors); static void print_stats(const EncoderSession *encoder_session); static void print_error_with_init_status(const EncoderSession *e, const char *message, FLAC__StreamEncoderInitStatus init_status); static void print_error_with_state(const EncoderSession *e, const char *message); static void print_verify_error(EncoderSession *e); -static FLAC__bool read_little_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ok, const char *fn); -static FLAC__bool read_little_endian_uint32(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn); -static FLAC__bool read_big_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ok, const char *fn); -static FLAC__bool read_big_endian_uint32(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn); -static FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn); +static FLAC__bool read_bytes(FILE *f, FLAC__byte *buf, size_t n, FLAC__bool eof_ok, const char *fn); +static FLAC__bool read_uint16(FILE *f, FLAC__bool big_endian, FLAC__uint16 *val, const char *fn); +static FLAC__bool read_uint32(FILE *f, FLAC__bool big_endian, FLAC__uint32 *val, const char *fn); +static FLAC__bool read_uint64(FILE *f, FLAC__bool big_endian, FLAC__uint64 *val, const char *fn); +static FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, const char *fn); static FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset); -static unsigned count_channel_mask_bits(FLAC__uint32 mask); -#if 0 -static FLAC__uint32 limit_channel_mask(FLAC__uint32 mask, unsigned channels); -#endif +static uint32_t count_channel_mask_bits(FLAC__uint32 mask); -/* - * public routines - */ -int flac__encode_aif(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options, FLAC__bool is_aifc) +static FLAC__bool get_sample_info_raw(EncoderSession *e, encode_options_t options) { - EncoderSession encoder_session; - FLAC__uint16 x; - FLAC__uint32 xx; - unsigned int channels= 0U, bps= 0U, shift= 0U, sample_rate= 0U, sample_frames= 0U; - size_t channel_map[FLAC__MAX_CHANNELS]; - FLAC__bool got_comm_chunk= false, got_ssnd_chunk= false; - int info_align_carry= -1, info_align_zero= -1; - FLAC__bool is_big_endian_pcm = true; + e->info.sample_rate = options.format_options.raw.sample_rate; + e->info.channels = options.format_options.raw.channels; + e->info.bits_per_sample = options.format_options.raw.bps; + e->info.shift = 0; + e->info.bytes_per_wide_sample = options.format_options.raw.channels * ((options.format_options.raw.bps+7)/8); + e->info.is_unsigned_samples = options.format_options.raw.is_unsigned_samples; + e->info.is_big_endian = options.format_options.raw.is_big_endian; + e->info.channel_mask = 0; - (void)infilesize; /* silence compiler warning about unused parameter */ - (void)lookahead; /* silence compiler warning about unused parameter */ - (void)lookahead_length; /* silence compiler warning about unused parameter */ + return true; +} - if(! - EncoderSession_construct( - &encoder_session, -#if FLAC__HAS_OGG - options.common.use_ogg, -#else - /*use_ogg=*/false, -#endif - options.common.verify, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - infile, - infilename, - outfilename - ) - ) - return 1; +static FLAC__bool get_sample_info_wave(EncoderSession *e, encode_options_t options) +{ + FLAC__bool got_fmt_chunk = false, got_data_chunk = false, got_ds64_chunk = false; + uint32_t sample_rate = 0, channels = 0, bps = 0, shift = 0, block_align = 0; + FLAC__uint32 channel_mask = 0; + FLAC__uint64 ds64_data_size = 0; - /* initialize default channel map that preserves channel order */ - { - size_t i; - for(i = 0; i < sizeof(channel_map)/sizeof(channel_map[0]); i++) - channel_map[i] = i; - } + e->info.is_unsigned_samples = false; + e->info.is_big_endian = false; - if(options.foreign_metadata) { - const char *error; - if(!flac__foreign_metadata_read_from_aiff(options.foreign_metadata, infilename, &error)) { - flac__utils_printf(stderr, 1, "%s: ERROR reading foreign metadata: %s\n", encoder_session.inbasefilename, error); - return EncoderSession_finish_error(&encoder_session); + if(e->format == FORMAT_WAVE64) { + /* + * lookahead[] already has "riff\x2E\x91\xCF\x11\xA5\xD6\x28\xDB", skip over remaining header + */ + if(!fskip_ahead(e->fin, 16+8+16-12)) { /* riff GUID + riff size + WAVE GUID - lookahead */ + flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over remaining \"riff\" header\n", e->inbasefilename); + return false; } } + /* else lookahead[] already has "RIFFxxxxWAVE" or "RF64xxxxWAVE" */ - /* lookahead[] already has "FORMxxxxAIFF", do sub-chunks */ - - while(1) { - size_t c= 0U; - char chunk_id[5] = { '\0', '\0', '\0', '\0', '\0' }; /* one extra byte for terminating NUL so we can also treat it like a C string */ - - /* chunk identifier; really conservative about behavior of fread() and feof() */ - if(feof(infile) || ((c= fread(chunk_id, 1U, 4U, infile)), c==0U && feof(infile))) - break; - else if(c<4U || feof(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR: incomplete chunk identifier\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - if(got_comm_chunk==false && !memcmp(chunk_id, "COMM", 4)) { /* common chunk */ - unsigned long skip; - const FLAC__uint32 minimum_comm_size = (is_aifc? 22 : 18); + while(!feof(e->fin) && !got_data_chunk) { + /* chunk IDs are 4 bytes for WAVE/RF64, 16 for Wave64 */ + /* for WAVE/RF64 we want the 5th char zeroed so we can treat it like a C string */ + char chunk_id[16] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' }; - /* COMM chunk size */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else if(xx<minimum_comm_size) { - flac__utils_printf(stderr, 1, "%s: ERROR: non-standard %s 'COMM' chunk has length = %u\n", encoder_session.inbasefilename, is_aifc? "AIFF-C" : "AIFF", (unsigned int)xx); - return EncoderSession_finish_error(&encoder_session); - } - else if(!is_aifc && xx!=minimum_comm_size) { - flac__utils_printf(stderr, 1, "%s: WARNING: non-standard %s 'COMM' chunk has length = %u, expected %u\n", encoder_session.inbasefilename, is_aifc? "AIFF-C" : "AIFF", (unsigned int)xx, minimum_comm_size); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - skip= (xx-minimum_comm_size)+(xx & 1U); - - /* number of channels */ - if(!read_big_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else if(x==0U || x>FLAC__MAX_CHANNELS) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number channels %u\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - else if(x>2U && !options.common.channel_map_none) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number channels %u for AIFF\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && x!=2U) { - flac__utils_printf(stderr, 1, "%s: ERROR: file has %u channels, must be 2 for --sector-align\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - channels= x; - - /* number of sample frames */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - sample_frames= xx; - - /* bits per sample */ - if(!read_big_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else if(x<4U || x>24U) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported bits-per-sample %u\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && x!=16U) { - flac__utils_printf(stderr, 1, "%s: ERROR: file has %u bits-per-sample, must be 16 for --sector-align\n", encoder_session.inbasefilename, (unsigned int)x); - return EncoderSession_finish_error(&encoder_session); - } - bps= x; - shift= (bps%8)? 8-(bps%8) : 0; /* SSND data is always byte-aligned, left-justified but format_input() will double-check */ - bps+= shift; - - /* sample rate */ - if(!read_sane_extended(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else if(!FLAC__format_sample_rate_is_valid(xx)) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported sample rate %u\n", encoder_session.inbasefilename, (unsigned int)xx); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && xx!=44100U) { - flac__utils_printf(stderr, 1, "%s: ERROR: file's sample rate is %u, must be 44100 for --sector-align\n", encoder_session.inbasefilename, (unsigned int)xx); - return EncoderSession_finish_error(&encoder_session); - } - sample_rate= xx; - - /* check compression type for AIFF-C */ - if(is_aifc) { - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(xx == 0x736F7774) /* "sowt" */ - is_big_endian_pcm = false; - else if(xx == 0x4E4F4E45) /* "NONE" */ - ; /* nothing to do, we already default to big-endian */ - else { - flac__utils_printf(stderr, 1, "%s: ERROR: can't handle AIFF-C compression type \"%c%c%c%c\"\n", encoder_session.inbasefilename, (char)(xx>>24), (char)((xx>>16)&8), (char)((xx>>8)&8), (char)(xx&8)); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* set channel mapping */ - /* FLAC order follows SMPTE and WAVEFORMATEXTENSIBLE but with fewer channels, which are: */ - /* front left, front right, center, LFE, back left, back right, surround left, surround right */ - /* specs say the channel ordering is: - * 1 2 3 4 5 6 - * ___________________________________________________ - * 2 stereo l r - * 3 l r c - * 4 l c r S - * quad (ambiguous with 4ch) Fl Fr Bl Br - * 5 Fl Fr Fc Sl Sr - * 6 l lc c r rc S - * l:left r:right c:center Fl:front-left Fr:front-right Bl:back-left Br:back-right Lc:left-center Rc:right-center S:surround - * so we only have unambiguous mappings for 2, 3, and 5 channels - */ - if( - options.common.channel_map_none || - channels == 1 || /* 1 channel: (mono) */ - channels == 2 || /* 2 channels: left, right */ - channels == 3 || /* 3 channels: left, right, center */ - channels == 5 /* 5 channels: front left, front right, center, surround left, surround right */ - ) { - /* keep default channel order */ - } - else { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number channels %u for AIFF\n", encoder_session.inbasefilename, channels); - return EncoderSession_finish_error(&encoder_session); - } - - /* skip any extra data in the COMM chunk */ - if(!fskip_ahead(infile, skip)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over extra COMM data\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - /* - * now that we know the sample rate, canonicalize the - * --skip string to a number of samples: - */ - flac__utils_canonicalize_skip_until_specification(&options.common.skip_specification, sample_rate); - FLAC__ASSERT(options.common.skip_specification.value.samples >= 0); - encoder_session.skip = (FLAC__uint64)options.common.skip_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.skip == 0); - - got_comm_chunk= true; + if(!read_bytes(e->fin, (FLAC__byte*)chunk_id, e->format==FORMAT_WAVE64?16:4, /*eof_ok=*/true, e->inbasefilename)) { + flac__utils_printf(stderr, 1, "%s: ERROR: incomplete chunk identifier\n", e->inbasefilename); + return false; } - else if(got_ssnd_chunk==false && !memcmp(chunk_id, "SSND", 4)) { /* sound data chunk */ - unsigned int offset= 0U, block_size= 0U, align_remainder= 0U, data_bytes; - const size_t bytes_per_frame= channels*(bps>>3); - FLAC__uint64 total_samples_in_input, trim = 0; - FLAC__bool pad= false; - - if(got_comm_chunk==false) { - flac__utils_printf(stderr, 1, "%s: ERROR: got 'SSND' chunk before 'COMM' chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - /* SSND chunk size */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(options.common.ignore_chunk_sizes) { - FLAC__ASSERT(!options.common.sector_align); - data_bytes = (unsigned)(-(int)bytes_per_frame); /* max out data_bytes; we'll use EOF as signal to stop reading */ - } - else { - data_bytes= xx; - data_bytes-= 8U; /* discount the offset and block size fields */ - } - pad= (data_bytes & 1U) ? true : false; - - /* offset */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - offset= xx; - data_bytes-= offset; - - /* block size */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else if(xx!=0U) { - flac__utils_printf(stderr, 1, "%s: ERROR: block size is %u; must be 0\n", encoder_session.inbasefilename, (unsigned int)xx); - return EncoderSession_finish_error(&encoder_session); - } - block_size= xx; - - /* skip any SSND offset bytes */ - FLAC__ASSERT(offset<=LONG_MAX); - if(!fskip_ahead(infile, offset)) { - flac__utils_printf(stderr, 1, "%s: ERROR: skipping offset in SSND chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - if(data_bytes!=(sample_frames*bytes_per_frame)) { - flac__utils_printf(stderr, 1, "%s: ERROR: SSND chunk size inconsistent with sample frame count\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - /* *options.common.align_reservoir_samples will be 0 unless --sector-align is used */ - FLAC__ASSERT(options.common.sector_align || *options.common.align_reservoir_samples == 0); - total_samples_in_input = data_bytes / bytes_per_frame + *options.common.align_reservoir_samples; - - /* - * now that we know the input size, canonicalize the - * --until string to an absolute sample number: - */ - if(!canonicalize_until_specification(&options.common.until_specification, encoder_session.inbasefilename, sample_rate, encoder_session.skip, total_samples_in_input)) - return EncoderSession_finish_error(&encoder_session); - encoder_session.until = (FLAC__uint64)options.common.until_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.until == 0); - - if(encoder_session.skip>0U) { - if(!fskip_ahead(infile, encoder_session.skip*bytes_per_frame)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - - data_bytes-= (unsigned int)encoder_session.skip*bytes_per_frame; /*@@@ WATCHOUT: 4GB limit */ - if(options.common.ignore_chunk_sizes) { - encoder_session.total_samples_to_encode= 0; - flac__utils_printf(stderr, 2, "(No runtime statistics possible; please wait for encoding to finish...)\n"); - FLAC__ASSERT(0 == encoder_session.until); - } - else { - encoder_session.total_samples_to_encode= total_samples_in_input - encoder_session.skip; - } - if(encoder_session.until > 0) { - trim = total_samples_in_input - encoder_session.until; - FLAC__ASSERT(total_samples_in_input > 0); - FLAC__ASSERT(!options.common.sector_align); - data_bytes-= (unsigned int)trim*bytes_per_frame; - encoder_session.total_samples_to_encode-= trim; - } - if(options.common.sector_align) { - align_remainder= (unsigned int)(encoder_session.total_samples_to_encode % 588U); - if(options.common.is_last_file) - encoder_session.total_samples_to_encode+= (588U-align_remainder); /* will pad with zeroes */ - else - encoder_session.total_samples_to_encode-= align_remainder; /* will stop short and carry over to next file */ - } - - /* +54 for the size of the AIFF headers; this is just an estimate for the progress indicator and doesn't need to be exact */ - encoder_session.unencoded_size= encoder_session.total_samples_to_encode*bytes_per_frame+54; - - if(!EncoderSession_init_encoder(&encoder_session, options.common, /*channel_mask=*/0, channels, bps-shift, sample_rate, options.foreign_metadata, /*flac_decoder_data=*/0)) - return EncoderSession_finish_error(&encoder_session); - - /* first do any samples in the reservoir */ - if(options.common.sector_align && *options.common.align_reservoir_samples>0U) { + if(feof(e->fin)) + break; - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 *const *)options.common.align_reservoir, *options.common.align_reservoir_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } + if(e->format == FORMAT_RF64 && !memcmp(chunk_id, "ds64", 4)) { /* RF64 64-bit sizes chunk */ + FLAC__uint32 xx, data_bytes; - /* decrement the data_bytes counter if we need to align the file */ - if(options.common.sector_align) { - if(options.common.is_last_file) - *options.common.align_reservoir_samples= 0U; - else { - *options.common.align_reservoir_samples= align_remainder; - data_bytes-= (*options.common.align_reservoir_samples)*bytes_per_frame; - } + if(got_ds64_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: file has multiple 'ds64' chunks\n", e->inbasefilename); + return false; } - - /* now do from the file */ - while(data_bytes>0) { - size_t bytes_read= fread(ucbuffer_, 1U, min(data_bytes, CHUNK_OF_SAMPLES*bytes_per_frame), infile); - - if(bytes_read==0U) { - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(feof(infile)) { - if(options.common.ignore_chunk_sizes) { - flac__utils_printf(stderr, 1, "%s: INFO: hit EOF with --ignore-chunk-sizes, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.samples_written); - } - else { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - data_bytes= 0; - } - } - else { - if(bytes_read % bytes_per_frame != 0U) { - flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else { - unsigned int frames= bytes_read/bytes_per_frame; - if(!format_input(input_, frames, is_big_endian_pcm, /*is_unsigned_samples=*/false, channels, bps, shift, channel_map)) - return EncoderSession_finish_error(&encoder_session); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 *const *)input_, frames)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - else - data_bytes-= bytes_read; - } - } + if(got_fmt_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: 'ds64' chunk appears after 'fmt ' or 'data' chunk\n", e->inbasefilename); + return false; } - if(trim>0) { - FLAC__ASSERT(!options.common.sector_align); - if(!fskip_ahead(infile, trim*bytes_per_frame)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } + /* ds64 chunk size */ + if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename)) + return false; + data_bytes = xx; + if(data_bytes < 28) { + flac__utils_printf(stderr, 1, "%s: ERROR: non-standard 'ds64' chunk has length = %u\n", e->inbasefilename, (uint32_t)data_bytes); + return false; } + if(data_bytes & 1) /* should never happen, but enforce WAVE alignment rules */ + data_bytes++; - /* now read unaligned samples into reservoir or pad with zeroes if necessary */ - if(options.common.sector_align) { - if(options.common.is_last_file) { - unsigned int pad_frames= 588U-align_remainder; - - if(pad_frames<588U) { - unsigned int i; - - info_align_zero= pad_frames; - for(i= 0U; i<channels; ++i) - memset(input_[i], 0, sizeof(input_[0][0])*pad_frames); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 *const *)input_, pad_frames)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } - } - else { - if(*options.common.align_reservoir_samples > 0) { - size_t bytes_read= fread(ucbuffer_, 1U, (*options.common.align_reservoir_samples)*bytes_per_frame, infile); + /* RIFF 64-bit size, lo/hi */ + if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename)) + return false; + if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename)) + return false; - FLAC__ASSERT(CHUNK_OF_SAMPLES>=588U); - if(bytes_read==0U && ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(bytes_read != (*options.common.align_reservoir_samples) * bytes_per_frame) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned int)bytes_read, (unsigned int)encoder_session.total_samples_to_encode, (unsigned int)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - else { - info_align_carry= *options.common.align_reservoir_samples; - if(!format_input(options.common.align_reservoir, *options.common.align_reservoir_samples, is_big_endian_pcm, /*is_unsigned_samples=*/false, channels, bps, shift, channel_map)) - return EncoderSession_finish_error(&encoder_session); - } - } - } - } + /* 'data' 64-bit size */ + if(!read_uint64(e->fin, /*big_endian=*/false, &ds64_data_size, e->inbasefilename)) + return false; - if(pad==true) { - unsigned char tmp; + data_bytes -= 16; - if(fread(&tmp, 1U, 1U, infile)<1U) { - flac__utils_printf(stderr, 1, "%s: ERROR during read of SSND pad byte\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } + /* skip any extra data in the ds64 chunk */ + if(!fskip_ahead(e->fin, data_bytes)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over extra 'ds64' data\n", e->inbasefilename); + return false; } - got_ssnd_chunk= true; + got_ds64_chunk = true; } - else { /* other chunk */ - if(!options.foreign_metadata) { - if(!memcmp(chunk_id, "COMM", 4)) - flac__utils_printf(stderr, 1, "%s: WARNING: skipping extra 'COMM' chunk (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename); - else if(!memcmp(chunk_id, "SSND", 4)) - flac__utils_printf(stderr, 1, "%s: WARNING: skipping extra 'SSND' chunk (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename); - else if(!options.foreign_metadata) - flac__utils_printf(stderr, 1, "%s: WARNING: skipping unknown chunk '%s' (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename, chunk_id); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - - /* chunk size */ - if(!read_big_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else { - unsigned long skip= xx+(xx & 1U); - - FLAC__ASSERT(skip<=LONG_MAX); - if(!fskip_ahead(infile, skip)) { - fprintf(stderr, "%s: ERROR during read while skipping over unknown chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } + else if( + !memcmp(chunk_id, "fmt ", 4) && + (e->format!=FORMAT_WAVE64 || !memcmp(chunk_id, "fmt \xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 16)) + ) { /* format chunk */ + FLAC__uint16 x; + FLAC__uint32 xx, data_bytes; + FLAC__uint16 wFormatTag; /* wFormatTag word from the 'fmt ' chunk */ + + if(got_fmt_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: file has multiple 'fmt ' chunks\n", e->inbasefilename); + return false; } - } - } - - if(got_ssnd_chunk==false && sample_frames!=0U) { - flac__utils_printf(stderr, 1, "%s: ERROR: missing SSND chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - return EncoderSession_finish_ok(&encoder_session, info_align_carry, info_align_zero, options.foreign_metadata); -} - -int flac__encode_wav(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options) -{ - EncoderSession encoder_session; - FLAC__bool is_unsigned_samples = false; - unsigned channels = 0, bps = 0, sample_rate = 0, shift = 0; - size_t bytes_read; - size_t channel_map[FLAC__MAX_CHANNELS]; - FLAC__uint16 x, format; /* format is the wFormatTag word from the 'fmt ' chunk */ - FLAC__uint32 xx, channel_mask = 0; - FLAC__bool got_fmt_chunk = false, got_data_chunk = false; - unsigned align_remainder = 0; - int info_align_carry = -1, info_align_zero = -1; - - (void)infilesize; - (void)lookahead; - (void)lookahead_length; - - if(! - EncoderSession_construct( - &encoder_session, -#if FLAC__HAS_OGG - options.common.use_ogg, -#else - /*use_ogg=*/false, -#endif - options.common.verify, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - infile, - infilename, - outfilename - ) - ) - return 1; - - /* initialize default channel map that preserves channel order */ - { - size_t i; - for(i = 0; i < sizeof(channel_map)/sizeof(channel_map[0]); i++) - channel_map[i] = i; - } - - if(options.foreign_metadata) { - const char *error; - if(!flac__foreign_metadata_read_from_wave(options.foreign_metadata, infilename, &error)) { - flac__utils_printf(stderr, 1, "%s: ERROR reading foreign metadata: %s\n", encoder_session.inbasefilename, error); - return EncoderSession_finish_error(&encoder_session); - } - } - - /* - * lookahead[] already has "RIFFxxxxWAVE", do sub-chunks - */ - while(!feof(infile)) { - if(!read_little_endian_uint32(infile, &xx, true, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(feof(infile)) - break; - if(xx == 0x20746d66 && !got_fmt_chunk) { /* "fmt " */ - unsigned block_align, data_bytes; /* see * http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html @@ -673,7 +282,7 @@ int flac__encode_wav(FILE *infile, off_t infilesize, const char *infilename, con * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/audio_r/hh/Audio_r/aud-prop_d40f094e-44f9-4baa-8a15-03e4fb369501.xml.asp * * WAVEFORMAT is - * 4 byte: subchunk size + * 4 byte: chunk size * 2 byte: format type: 1 for WAVE_FORMAT_PCM, 65534 for WAVE_FORMAT_EXTENSIBLE * 2 byte: # channels * 4 byte: sample rate (Hz) @@ -695,910 +304,1071 @@ int flac__encode_wav(FILE *infile, off_t infilesize, const char *infilename, con * If the channel mask has more set bits than # of channels, the extra MSBs are ignored. * If the channel mask has less set bits than # of channels, the extra channels are unassigned to any speaker. * - * Data is supposed to be unsigned for bps <= 8 else signed. + * Data is supposed to be uint32_t for bps <= 8 else signed. */ - /* fmt sub-chunk size */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); + /* fmt chunk size */ + if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename)) + return false; data_bytes = xx; - if(data_bytes < 16) { - flac__utils_printf(stderr, 1, "%s: ERROR: found non-standard 'fmt ' sub-chunk which has length = %u\n", encoder_session.inbasefilename, data_bytes); - return EncoderSession_finish_error(&encoder_session); + if(e->format == FORMAT_WAVE64) { + /* other half of the size field should be 0 */ + if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename)) + return false; + if(xx) { + flac__utils_printf(stderr, 1, "%s: ERROR: freakishly large Wave64 'fmt ' chunk has length = 0x%08X%08X\n", e->inbasefilename, (uint32_t)xx, (uint32_t)data_bytes); + return false; + } + /* subtract size of header */ + if (data_bytes < 16+8) { + flac__utils_printf(stderr, 1, "%s: ERROR: freakishly small Wave64 'fmt ' chunk has length = 0x%08X%08X\n", e->inbasefilename, (uint32_t)xx, (uint32_t)data_bytes); + return false; + } + data_bytes -= (16+8); } - /* format code */ - if(!read_little_endian_uint16(infile, &format, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(format != 1 /*WAVE_FORMAT_PCM*/ && format != 65534 /*WAVE_FORMAT_EXTENSIBLE*/) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported format type %u\n", encoder_session.inbasefilename, (unsigned)format); - return EncoderSession_finish_error(&encoder_session); + if(data_bytes < 16 || data_bytes > (UINT32_MAX-8)) { + flac__utils_printf(stderr, 1, "%s: ERROR: non-standard 'fmt ' chunk has length = %u\n", e->inbasefilename, (uint32_t)data_bytes); + return false; } - /* number of channels */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - channels = (unsigned)x; - if(channels == 0 || channels > FLAC__MAX_CHANNELS) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number of channels %u\n", encoder_session.inbasefilename, channels); - return EncoderSession_finish_error(&encoder_session); + if(e->format != FORMAT_WAVE64) { + if(data_bytes & 1) /* should never happen, but enforce WAVE alignment rules */ + data_bytes++; } - else if(options.common.sector_align && channels != 2) { - flac__utils_printf(stderr, 1, "%s: ERROR: file has %u channels, must be 2 for --sector-align\n", encoder_session.inbasefilename, channels); - return EncoderSession_finish_error(&encoder_session); + else { /* Wave64 */ + data_bytes = (data_bytes+7) & (~7u); /* should never happen, but enforce Wave64 alignment rules */ + } + + /* format code */ + if(!read_uint16(e->fin, /*big_endian=*/false, &wFormatTag, e->inbasefilename)) + return false; + if(wFormatTag != 1 /*WAVE_FORMAT_PCM*/ && wFormatTag != 65534 /*WAVE_FORMAT_EXTENSIBLE*/) { + flac__utils_printf(stderr, 1, "%s: ERROR: unsupported format type %u\n", e->inbasefilename, (uint32_t)wFormatTag); + return false; } + + /* number of channels */ + if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename)) + return false; + channels = (uint32_t)x; + /* sample rate */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); + if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename)) + return false; sample_rate = xx; - if(!FLAC__format_sample_rate_is_valid(sample_rate)) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported sample rate %u\n", encoder_session.inbasefilename, sample_rate); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && sample_rate != 44100) { - flac__utils_printf(stderr, 1, "%s: ERROR: file's sample rate is %u, must be 44100 for --sector-align\n", encoder_session.inbasefilename, sample_rate); - return EncoderSession_finish_error(&encoder_session); - } + /* avg bytes per second (ignored) */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); + if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename)) + return false; /* block align */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - block_align = (unsigned)x; + if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename)) + return false; + block_align = x; /* bits per sample */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - bps = (unsigned)x; - is_unsigned_samples = (bps <= 8); - if(format == 1) { + if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename)) + return false; + bps = (uint32_t)x; + + e->info.is_unsigned_samples = (bps <= 8); + + if(wFormatTag == 1) { if(bps != 8 && bps != 16) { if(bps == 24 || bps == 32) { /* let these slide with a warning since they're unambiguous */ - flac__utils_printf(stderr, 1, "%s: WARNING: legacy WAVE file has format type %u but bits-per-sample=%u\n", encoder_session.inbasefilename, (unsigned)format, bps); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); + flac__utils_printf(stderr, 1, "%s: WARNING: legacy WAVE file has format type %u but bits-per-sample=%u\n", e->inbasefilename, (uint32_t)wFormatTag, bps); + if(e->treat_warnings_as_errors) + return false; } else { /* @@@ we could add an option to specify left- or right-justified blocks so we knew how to set 'shift' */ - flac__utils_printf(stderr, 1, "%s: ERROR: legacy WAVE file has format type %u but bits-per-sample=%u\n", encoder_session.inbasefilename, (unsigned)format, bps); - return EncoderSession_finish_error(&encoder_session); - } - } -#if 0 /* @@@ reinstate once we can get an answer about whether the samples are left- or right-justified */ - if((bps+7)/8 * channels == block_align) { - if(bps % 8) { - /* assume legacy file is byte aligned with some LSBs zero; this is double-checked in format_input() */ - flac__utils_printf(stderr, 1, "%s: WARNING: legacy WAVE file (format type %d) has block alignment=%u, bits-per-sample=%u, channels=%u\n", encoder_session.inbasefilename, (unsigned)format, block_align, bps, channels); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - shift = 8 - (bps % 8); - bps += shift; + flac__utils_printf(stderr, 1, "%s: ERROR: legacy WAVE file has format type %u but bits-per-sample=%u\n", e->inbasefilename, (uint32_t)wFormatTag, bps); + return false; } - else - shift = 0; } - else { - flac__utils_printf(stderr, 1, "%s: ERROR: illegal WAVE file (format type %d) has block alignment=%u, bits-per-sample=%u, channels=%u\n", encoder_session.inbasefilename, (unsigned)format, block_align, bps, channels); - return EncoderSession_finish_error(&encoder_session); + if((bps+7)/8 * channels != block_align) { + flac__utils_printf(stderr, 1, "%s: ERROR: legacy WAVE file has block alignment=%u, bits-per-sample=%u, channels=%u\n", e->inbasefilename, (uint32_t)wFormatTag, block_align, bps, channels); + return false; } -#else - shift = 0; -#endif - if(channels > 2 && !options.common.channel_map_none) { - flac__utils_printf(stderr, 1, "%s: ERROR: WAVE has >2 channels but is not WAVE_FORMAT_EXTENSIBLE; cannot assign channels\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); + if(channels > 2 && !options.channel_map_none) { + flac__utils_printf(stderr, 1, "%s: ERROR: WAVE has >2 channels but is not WAVE_FORMAT_EXTENSIBLE; cannot assign channels\n", e->inbasefilename); + return false; } FLAC__ASSERT(data_bytes >= 16); data_bytes -= 16; } else { if(data_bytes < 40) { - flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with size %u\n", encoder_session.inbasefilename, data_bytes); - return EncoderSession_finish_error(&encoder_session); + flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with size %u\n", e->inbasefilename, (uint32_t)data_bytes); + return false; } /* cbSize */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); + if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename)) + return false; if(x < 22) { - flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with cbSize %u\n", encoder_session.inbasefilename, (unsigned)x); - return EncoderSession_finish_error(&encoder_session); + flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with cbSize %u\n", e->inbasefilename, (uint32_t)x); + return false; } /* valid bps */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if((unsigned)x > bps) { - flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with wValidBitsPerSample (%u) > wBitsPerSample (%u)\n", encoder_session.inbasefilename, (unsigned)x, bps); - return EncoderSession_finish_error(&encoder_session); + if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename)) + return false; + if((uint32_t)x > bps) { + flac__utils_printf(stderr, 1, "%s: ERROR: invalid WAVEFORMATEXTENSIBLE chunk with wValidBitsPerSample (%u) > wBitsPerSample (%u)\n", e->inbasefilename, (uint32_t)x, bps); + return false; } - shift = bps - (unsigned)x; + shift = bps - (uint32_t)x; /* channel mask */ - if(!read_little_endian_uint32(infile, &channel_mask, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - /* for mono/stereo and unassigned channels, we fake the mask */ - if(channel_mask == 0) { - if(channels == 1) - channel_mask = 0x0001; - else if(channels == 2) - channel_mask = 0x0003; - } - /* set channel mapping */ - /* FLAC order follows SMPTE and WAVEFORMATEXTENSIBLE but with fewer channels, which are: */ - /* front left, front right, center, LFE, back left, back right, surround left, surround right */ - /* the default mapping is sufficient for 1-6 channels and 7-8 are currently unspecified anyway */ -#if 0 - /* @@@ example for dolby/vorbis order, for reference later in case it becomes important */ - if( - options.common.channel_map_none || - channel_mask == 0x0001 || /* 1 channel: (mono) */ - channel_mask == 0x0003 || /* 2 channels: front left, front right */ - channel_mask == 0x0033 || /* 4 channels: front left, front right, back left, back right */ - channel_mask == 0x0603 /* 4 channels: front left, front right, side left, side right */ - ) { - /* keep default channel order */ - } - else if( - channel_mask == 0x0007 || /* 3 channels: front left, front right, front center */ - channel_mask == 0x0037 || /* 5 channels: front left, front right, front center, back left, back right */ - channel_mask == 0x0607 /* 5 channels: front left, front right, front center, side left, side right */ - ) { - /* to dolby order: front left, center, front right [, surround left, surround right ] */ - channel_map[1] = 2; - channel_map[2] = 1; - } - else if( - channel_mask == 0x003f || /* 6 channels: front left, front right, front center, LFE, back left, back right */ - channel_mask == 0x060f /* 6 channels: front left, front right, front center, LFE, side left, side right */ - ) { - /* to dolby order: front left, center, front right, surround left, surround right, LFE */ - channel_map[1] = 2; - channel_map[2] = 1; - channel_map[3] = 5; - channel_map[4] = 3; - channel_map[5] = 4; - } -#else - if( - options.common.channel_map_none || - channel_mask == 0x0001 || /* 1 channel: (mono) */ - channel_mask == 0x0003 || /* 2 channels: front left, front right */ - channel_mask == 0x0007 || /* 3 channels: front left, front right, front center */ - channel_mask == 0x0033 || /* 4 channels: front left, front right, back left, back right */ - channel_mask == 0x0603 || /* 4 channels: front left, front right, side left, side right */ - channel_mask == 0x0037 || /* 5 channels: front left, front right, front center, back left, back right */ - channel_mask == 0x0607 || /* 5 channels: front left, front right, front center, side left, side right */ - channel_mask == 0x003f || /* 6 channels: front left, front right, front center, LFE, back left, back right */ - channel_mask == 0x060f /* 6 channels: front left, front right, front center, LFE, side left, side right */ - ) { - /* keep default channel order */ - } -#endif - else { - flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk with unsupported channel mask=0x%04X\n", encoder_session.inbasefilename, (unsigned)channel_mask); - return EncoderSession_finish_error(&encoder_session); - } - if(!options.common.channel_map_none) { - if(count_channel_mask_bits(channel_mask) < channels) { - flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk: channel mask 0x%04X has unassigned channels (#channels=%u)\n", encoder_session.inbasefilename, (unsigned)channel_mask, channels); - return EncoderSession_finish_error(&encoder_session); - } -#if 0 - /* supporting this is too difficult with channel mapping; e.g. what if mask is 0x003f but #channels=4? - * there would be holes in the order that would have to be filled in, or the mask would have to be - * limited and the logic above rerun to see if it still fits into the FLAC mapping. - */ - else if(count_channel_mask_bits(channel_mask) > channels) - channel_mask = limit_channel_mask(channel_mask, channels); -#else - else if(count_channel_mask_bits(channel_mask) > channels) { - flac__utils_printf(stderr, 1, "%s: ERROR: WAVEFORMATEXTENSIBLE chunk: channel mask 0x%04X has extra bits for non-existant channels (#channels=%u)\n", encoder_session.inbasefilename, (unsigned)channel_mask, channels); - return EncoderSession_finish_error(&encoder_session); - } -#endif + if(!read_uint32(e->fin, /*big_endian=*/false, &channel_mask, e->inbasefilename)) + return false; + + if(count_channel_mask_bits(channel_mask) > channels) { + flac__utils_printf(stderr, 1, "%s: WARNING: WAVEFORMATEXTENSIBLE chunk: channel mask 0x%04X has extra bits for non-existant channels (#channels=%u)\n", e->inbasefilename, (uint32_t)channel_mask, channels); + if(e->treat_warnings_as_errors) + return false; } /* first part of GUID */ - if(!read_little_endian_uint16(infile, &x, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); + if(!read_uint16(e->fin, /*big_endian=*/false, &x, e->inbasefilename)) + return false; if(x != 1) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported WAVEFORMATEXTENSIBLE chunk with non-PCM format %u\n", encoder_session.inbasefilename, (unsigned)x); - return EncoderSession_finish_error(&encoder_session); + flac__utils_printf(stderr, 1, "%s: ERROR: unsupported WAVEFORMATEXTENSIBLE chunk with non-PCM format %u\n", e->inbasefilename, (uint32_t)x); + return false; } data_bytes -= 26; } - if(bps-shift < 4 || bps-shift > 24) { - flac__utils_printf(stderr, 1, "%s: ERROR: unsupported bits-per-sample %u\n", encoder_session.inbasefilename, bps-shift); - return EncoderSession_finish_error(&encoder_session); - } - else if(options.common.sector_align && bps-shift != 16) { - flac__utils_printf(stderr, 1, "%s: ERROR: file has %u bits-per-sample, must be 16 for --sector-align\n", encoder_session.inbasefilename, bps-shift); - return EncoderSession_finish_error(&encoder_session); - } + e->info.bytes_per_wide_sample = channels * (bps / 8); - /* skip any extra data in the fmt sub-chunk */ - if(!fskip_ahead(infile, data_bytes)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over extra 'fmt' data\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); + /* skip any extra data in the fmt chunk */ + if(!fskip_ahead(e->fin, data_bytes)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over extra 'fmt' data\n", e->inbasefilename); + return false; } - /* - * now that we know the sample rate, canonicalize the - * --skip string to a number of samples: - */ - flac__utils_canonicalize_skip_until_specification(&options.common.skip_specification, sample_rate); - FLAC__ASSERT(options.common.skip_specification.value.samples >= 0); - encoder_session.skip = (FLAC__uint64)options.common.skip_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.skip == 0); - got_fmt_chunk = true; } - else if(xx == 0x61746164 && !got_data_chunk && got_fmt_chunk) { /* "data" */ - FLAC__uint64 total_samples_in_input, trim = 0; - FLAC__bool pad = false; - const size_t bytes_per_wide_sample = channels * (bps >> 3); - unsigned data_bytes; + else if( + !memcmp(chunk_id, "data", 4) && + (e->format!=FORMAT_WAVE64 || !memcmp(chunk_id, "data\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 16)) + ) { /* data chunk */ + FLAC__uint32 xx; + FLAC__uint64 data_bytes; + + if(!got_fmt_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: got 'data' chunk before 'fmt' chunk\n", e->inbasefilename); + return false; + } /* data size */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - if(options.common.ignore_chunk_sizes) { - FLAC__ASSERT(!options.common.sector_align); - data_bytes = (unsigned)(-(int)bytes_per_wide_sample); /* max out data_bytes; we'll use EOF as signal to stop reading */ - } - else { + if(e->format != FORMAT_WAVE64) { + if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename)) + return false; data_bytes = xx; - if(0 == data_bytes) { - flac__utils_printf(stderr, 1, "%s: ERROR: 'data' subchunk has size of 0\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - pad = (data_bytes & 1U) ? true : false; - - /* *options.common.align_reservoir_samples will be 0 unless --sector-align is used */ - FLAC__ASSERT(options.common.sector_align || *options.common.align_reservoir_samples == 0); - total_samples_in_input = data_bytes / bytes_per_wide_sample + *options.common.align_reservoir_samples; - - /* - * now that we know the input size, canonicalize the - * --until string to an absolute sample number: - */ - if(!canonicalize_until_specification(&options.common.until_specification, encoder_session.inbasefilename, sample_rate, encoder_session.skip, total_samples_in_input)) - return EncoderSession_finish_error(&encoder_session); - encoder_session.until = (FLAC__uint64)options.common.until_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.until == 0); - - if(encoder_session.skip > 0) { - if(!fskip_ahead(infile, encoder_session.skip * bytes_per_wide_sample)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - - data_bytes -= (unsigned)encoder_session.skip * bytes_per_wide_sample; /*@@@ WATCHOUT: 4GB limit */ - if(options.common.ignore_chunk_sizes) { - encoder_session.total_samples_to_encode = 0; - flac__utils_printf(stderr, 2, "(No runtime statistics possible; please wait for encoding to finish...)\n"); - FLAC__ASSERT(0 == encoder_session.until); - } - else { - encoder_session.total_samples_to_encode = total_samples_in_input - encoder_session.skip; - } - if(encoder_session.until > 0) { - trim = total_samples_in_input - encoder_session.until; - FLAC__ASSERT(total_samples_in_input > 0); - FLAC__ASSERT(!options.common.sector_align); - data_bytes -= (unsigned int)trim * bytes_per_wide_sample; - encoder_session.total_samples_to_encode -= trim; - } - if(options.common.sector_align) { - align_remainder = (unsigned)(encoder_session.total_samples_to_encode % 588); - if(options.common.is_last_file) - encoder_session.total_samples_to_encode += (588-align_remainder); /* will pad with zeroes */ - else - encoder_session.total_samples_to_encode -= align_remainder; /* will stop short and carry over to next file */ - } - - /* +44 for the size of the WAV headers; this is just an estimate for the progress indicator and doesn't need to be exact */ - encoder_session.unencoded_size = encoder_session.total_samples_to_encode * bytes_per_wide_sample + 44; - - if(!EncoderSession_init_encoder(&encoder_session, options.common, channel_mask, channels, bps-shift, sample_rate, options.foreign_metadata, /*flac_decoder_data=*/0)) - return EncoderSession_finish_error(&encoder_session); - - /* - * first do any samples in the reservoir - */ - if(options.common.sector_align && *options.common.align_reservoir_samples > 0) { - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)options.common.align_reservoir, *options.common.align_reservoir_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } } - - /* - * decrement the data_bytes counter if we need to align the file - */ - if(options.common.sector_align) { - if(options.common.is_last_file) { - *options.common.align_reservoir_samples = 0; - } - else { - *options.common.align_reservoir_samples = align_remainder; - data_bytes -= (*options.common.align_reservoir_samples) * bytes_per_wide_sample; + else { /* Wave64 */ + if(!read_uint64(e->fin, /*big_endian=*/false, &data_bytes, e->inbasefilename)) + return false; + /* subtract size of header */ + if (data_bytes < 16+8) { + flac__utils_printf(stderr, 1, "%s: ERROR: freakishly small Wave64 'data' chunk has length = 0x00000000%08X\n", e->inbasefilename, (uint32_t)data_bytes); + return false; } + data_bytes -= (16+8); } - - /* - * now do from the file - */ - while(data_bytes > 0) { - bytes_read = fread(ucbuffer_, sizeof(unsigned char), min(data_bytes, CHUNK_OF_SAMPLES * bytes_per_wide_sample), infile); - if(bytes_read == 0) { - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(feof(infile)) { - if(options.common.ignore_chunk_sizes) { - flac__utils_printf(stderr, 1, "%s: INFO: hit EOF with --ignore-chunk-sizes, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.samples_written); - } - else { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - data_bytes = 0; - } - } - else { - if(bytes_read % bytes_per_wide_sample != 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else { - unsigned wide_samples = bytes_read / bytes_per_wide_sample; - if(!format_input(input_, wide_samples, /*is_big_endian=*/false, is_unsigned_samples, channels, bps, shift, channel_map)) - return EncoderSession_finish_error(&encoder_session); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - data_bytes -= bytes_read; - } + if(e->format == FORMAT_RF64) { + if(!got_ds64_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: RF64 file has no 'ds64' chunk before 'data' chunk\n", e->inbasefilename); + return false; } + if(data_bytes == 0xffffffff) + data_bytes = ds64_data_size; } - - if(trim > 0) { - FLAC__ASSERT(!options.common.sector_align); - if(!fskip_ahead(infile, trim * bytes_per_wide_sample)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); + if(options.ignore_chunk_sizes) { + if(data_bytes) { + flac__utils_printf(stderr, 1, "%s: WARNING: 'data' chunk has non-zero size, using --ignore-chunk-sizes is probably a bad idea\n", e->inbasefilename, chunk_id); + if(e->treat_warnings_as_errors) + return false; } + data_bytes = (FLAC__uint64)0 - (FLAC__uint64)e->info.bytes_per_wide_sample; /* max out data_bytes; we'll use EOF as signal to stop reading */ } - - /* - * now read unaligned samples into reservoir or pad with zeroes if necessary - */ - if(options.common.sector_align) { - if(options.common.is_last_file) { - unsigned wide_samples = 588 - align_remainder; - if(wide_samples < 588) { - unsigned channel; - - info_align_zero = wide_samples; - for(channel = 0; channel < channels; channel++) - memset(input_[channel], 0, sizeof(input_[0][0]) * wide_samples); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } - } - else { - if(*options.common.align_reservoir_samples > 0) { - FLAC__ASSERT(CHUNK_OF_SAMPLES >= 588); - bytes_read = fread(ucbuffer_, sizeof(unsigned char), (*options.common.align_reservoir_samples) * bytes_per_wide_sample, infile); - if(bytes_read == 0 && ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(bytes_read != (*options.common.align_reservoir_samples) * bytes_per_wide_sample) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)bytes_read, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - else { - info_align_carry = *options.common.align_reservoir_samples; - if(!format_input(options.common.align_reservoir, *options.common.align_reservoir_samples, /*is_big_endian=*/false, is_unsigned_samples, channels, bps, shift, channel_map)) - return EncoderSession_finish_error(&encoder_session); - } - } - } + else if(0 == data_bytes) { + flac__utils_printf(stderr, 1, "%s: ERROR: 'data' chunk has size of 0\n", e->inbasefilename); + return false; } - if(pad == true) { - unsigned char tmp; - - if(fread(&tmp, 1U, 1U, infile) < 1U) { - flac__utils_printf(stderr, 1, "%s: ERROR during read of data pad byte\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } + e->fmt.iff.data_bytes = data_bytes; got_data_chunk = true; + break; } else { - if(xx == 0x61746164 && !got_fmt_chunk) { /* "data" */ - flac__utils_printf(stderr, 1, "%s: ERROR: got 'data' sub-chunk before 'fmt' sub-chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - - if(!options.foreign_metadata) { - if(xx == 0x20746d66 && got_fmt_chunk) /* "fmt " */ - flac__utils_printf(stderr, 1, "%s: WARNING: skipping extra 'fmt ' sub-chunk (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename); - else if(xx == 0x61746164) /* "data" */ - flac__utils_printf(stderr, 1, "%s: WARNING: skipping extra 'data' sub-chunk (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename); + FLAC__uint32 xx; + FLAC__uint64 skip; + if(!options.format_options.iff.foreign_metadata) { + if(e->format != FORMAT_WAVE64) + flac__utils_printf(stderr, 1, "%s: WARNING: skipping unknown chunk '%s' (use --keep-foreign-metadata to keep)\n", e->inbasefilename, chunk_id); else - flac__utils_printf(stderr, 1, "%s: WARNING: skipping unknown sub-chunk '%c%c%c%c' (use --keep-foreign-metadata to keep)\n", encoder_session.inbasefilename, (char)(xx&255), (char)((xx>>8)&255), (char)((xx>>16)&255), (char)(xx>>24)); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); + flac__utils_printf(stderr, 1, "%s: WARNING: skipping unknown chunk %02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X (use --keep-foreign-metadata to keep)\n", + e->inbasefilename, + (uint32_t)((const uint8_t *)chunk_id)[3], + (uint32_t)((const uint8_t *)chunk_id)[2], + (uint32_t)((const uint8_t *)chunk_id)[1], + (uint32_t)((const uint8_t *)chunk_id)[0], + (uint32_t)((const uint8_t *)chunk_id)[5], + (uint32_t)((const uint8_t *)chunk_id)[4], + (uint32_t)((const uint8_t *)chunk_id)[7], + (uint32_t)((const uint8_t *)chunk_id)[6], + (uint32_t)((const uint8_t *)chunk_id)[9], + (uint32_t)((const uint8_t *)chunk_id)[8], + (uint32_t)((const uint8_t *)chunk_id)[10], + (uint32_t)((const uint8_t *)chunk_id)[11], + (uint32_t)((const uint8_t *)chunk_id)[12], + (uint32_t)((const uint8_t *)chunk_id)[13], + (uint32_t)((const uint8_t *)chunk_id)[14], + (uint32_t)((const uint8_t *)chunk_id)[15] + ); + if(e->treat_warnings_as_errors) + return false; } - /* sub-chunk size */ - if(!read_little_endian_uint32(infile, &xx, false, encoder_session.inbasefilename)) - return EncoderSession_finish_error(&encoder_session); - else { - unsigned long skip = xx+(xx & 1U); - - FLAC__ASSERT(skip<=LONG_MAX); - if(!fskip_ahead(infile, skip)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over unsupported sub-chunk\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); + /* chunk size */ + if(e->format != FORMAT_WAVE64) { + if(!read_uint32(e->fin, /*big_endian=*/false, &xx, e->inbasefilename)) + return false; + skip = xx; + skip += skip & 1; + } + else { /* Wave64 */ + if(!read_uint64(e->fin, /*big_endian=*/false, &skip, e->inbasefilename)) + return false; + skip = (skip+7) & (~(FLAC__uint64)7); + /* subtract size of header */ + if (skip < 16+8) { + flac__utils_printf(stderr, 1, "%s: ERROR: freakishly small Wave64 chunk has length = 0x00000000%08X\n", e->inbasefilename, (uint32_t)skip); + return false; + } + skip -= (16+8); + } + if(skip) { + if(!fskip_ahead(e->fin, skip)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over chunk\n", e->inbasefilename); + return false; } } } } - return EncoderSession_finish_ok(&encoder_session, info_align_carry, info_align_zero, options.foreign_metadata); + if(!got_fmt_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: didn't find fmt chunk\n", e->inbasefilename); + return false; + } + if(!got_data_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: didn't find data chunk\n", e->inbasefilename); + return false; + } + + e->info.sample_rate = sample_rate; + e->info.channels = channels; + e->info.bits_per_sample = bps; + e->info.shift = shift; + e->info.channel_mask = channel_mask; + + return true; } -int flac__encode_raw(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, raw_encode_options_t options) +static FLAC__bool get_sample_info_aiff(EncoderSession *e, encode_options_t options) { - EncoderSession encoder_session; - size_t bytes_read; - const size_t bytes_per_wide_sample = options.channels * (options.bps >> 3); - unsigned align_remainder = 0; - int info_align_carry = -1, info_align_zero = -1; - FLAC__uint64 total_samples_in_input = 0; - - FLAC__ASSERT(!options.common.sector_align || options.channels == 2); - FLAC__ASSERT(!options.common.sector_align || options.bps == 16); - FLAC__ASSERT(!options.common.sector_align || options.sample_rate == 44100); - FLAC__ASSERT(!options.common.sector_align || infilesize >= 0); - FLAC__ASSERT(!options.common.replay_gain || options.channels <= 2); - FLAC__ASSERT(!options.common.replay_gain || grabbag__replaygain_is_valid_sample_frequency(options.sample_rate)); - - if(! - EncoderSession_construct( - &encoder_session, -#if FLAC__HAS_OGG - options.common.use_ogg, -#else - /*use_ogg=*/false, -#endif - options.common.verify, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - infile, - infilename, - outfilename - ) - ) - return 1; + FLAC__bool got_comm_chunk = false, got_ssnd_chunk = false; + uint32_t sample_rate = 0, channels = 0, bps = 0, shift = 0; + FLAC__uint64 sample_frames = 0; + FLAC__uint32 channel_mask = 0; + + e->info.is_unsigned_samples = false; + e->info.is_big_endian = true; /* - * now that we know the sample rate, canonicalize the - * --skip string to a number of samples: + * lookahead[] already has "FORMxxxxAIFF", do chunks */ - flac__utils_canonicalize_skip_until_specification(&options.common.skip_specification, options.sample_rate); - FLAC__ASSERT(options.common.skip_specification.value.samples >= 0); - encoder_session.skip = (FLAC__uint64)options.common.skip_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.skip == 0); + while(!feof(e->fin) && !got_ssnd_chunk) { + char chunk_id[5] = { '\0', '\0', '\0', '\0', '\0' }; /* one extra byte for terminating NUL so we can also treat it like a C string */ + if(!read_bytes(e->fin, (FLAC__byte*)chunk_id, 4, /*eof_ok=*/true, e->inbasefilename)) { + flac__utils_printf(stderr, 1, "%s: ERROR: incomplete chunk identifier\n", e->inbasefilename); + return false; + } + if(feof(e->fin)) + break; - if(infilesize < 0) - total_samples_in_input = 0; - else { - /* *options.common.align_reservoir_samples will be 0 unless --sector-align is used */ - FLAC__ASSERT(options.common.sector_align || *options.common.align_reservoir_samples == 0); - total_samples_in_input = (FLAC__uint64)infilesize / bytes_per_wide_sample + *options.common.align_reservoir_samples; - } + if(!memcmp(chunk_id, "COMM", 4)) { /* common chunk */ + FLAC__uint16 x; + FLAC__uint32 xx; + uint64_t skip; + const FLAC__bool is_aifc = e->format == FORMAT_AIFF_C; + const FLAC__uint32 minimum_comm_size = (is_aifc? 22 : 18); - /* - * now that we know the input size, canonicalize the - * --until strings to a number of samples: - */ - if(!canonicalize_until_specification(&options.common.until_specification, encoder_session.inbasefilename, options.sample_rate, encoder_session.skip, total_samples_in_input)) - return EncoderSession_finish_error(&encoder_session); - encoder_session.until = (FLAC__uint64)options.common.until_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align || encoder_session.until == 0); - - infilesize -= (off_t)encoder_session.skip * bytes_per_wide_sample; - encoder_session.total_samples_to_encode = total_samples_in_input - encoder_session.skip; - if(encoder_session.until > 0) { - const FLAC__uint64 trim = total_samples_in_input - encoder_session.until; - FLAC__ASSERT(total_samples_in_input > 0); - FLAC__ASSERT(!options.common.sector_align); - infilesize -= (off_t)trim * bytes_per_wide_sample; - encoder_session.total_samples_to_encode -= trim; - } - if(infilesize >= 0 && options.common.sector_align) { - FLAC__ASSERT(encoder_session.skip == 0); - align_remainder = (unsigned)(encoder_session.total_samples_to_encode % 588); - if(options.common.is_last_file) - encoder_session.total_samples_to_encode += (588-align_remainder); /* will pad with zeroes */ - else - encoder_session.total_samples_to_encode -= align_remainder; /* will stop short and carry over to next file */ - } - encoder_session.unencoded_size = encoder_session.total_samples_to_encode * bytes_per_wide_sample; + if(got_comm_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: file has multiple 'COMM' chunks\n", e->inbasefilename); + return false; + } - if(encoder_session.total_samples_to_encode <= 0) - flac__utils_printf(stderr, 2, "(No runtime statistics possible; please wait for encoding to finish...)\n"); + /* COMM chunk size */ + if(!read_uint32(e->fin, /*big_endian=*/true, &xx, e->inbasefilename)) + return false; + else if(xx < minimum_comm_size) { + flac__utils_printf(stderr, 1, "%s: ERROR: non-standard %s 'COMM' chunk has length = %u\n", e->inbasefilename, is_aifc? "AIFF-C" : "AIFF", (uint32_t)xx); + return false; + } + else if(!is_aifc && xx != minimum_comm_size) { + flac__utils_printf(stderr, 1, "%s: WARNING: non-standard %s 'COMM' chunk has length = %u, expected %u\n", e->inbasefilename, is_aifc? "AIFF-C" : "AIFF", (uint32_t)xx, minimum_comm_size); + if(e->treat_warnings_as_errors) + return false; + } + skip = (xx-minimum_comm_size)+(xx & 1); - if(encoder_session.skip > 0) { - unsigned skip_bytes = bytes_per_wide_sample * (unsigned)encoder_session.skip; - if(skip_bytes > lookahead_length) { - skip_bytes -= lookahead_length; - lookahead_length = 0; - if(!fskip_ahead(infile, skip_bytes)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); + /* number of channels */ + if(!read_uint16(e->fin, /*big_endian=*/true, &x, e->inbasefilename)) + return false; + channels = (uint32_t)x; + if(channels > 2 && !options.channel_map_none) { + flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number of channels %u for AIFF\n", e->inbasefilename, channels); + return false; } - } - else { - lookahead += skip_bytes; - lookahead_length -= skip_bytes; - } - } - if(!EncoderSession_init_encoder(&encoder_session, options.common, /*channel_mask=*/0, options.channels, options.bps, options.sample_rate, /*foreign_metadata=*/0, /*flac_decoder_data=*/0)) - return EncoderSession_finish_error(&encoder_session); + /* number of sample frames */ + if(!read_uint32(e->fin, /*big_endian=*/true, &xx, e->inbasefilename)) + return false; + sample_frames = xx; - /* - * first do any samples in the reservoir - */ - if(options.common.sector_align && *options.common.align_reservoir_samples > 0) { - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)options.common.align_reservoir, *options.common.align_reservoir_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - } + /* bits per sample */ + if(!read_uint16(e->fin, /*big_endian=*/true, &x, e->inbasefilename)) + return false; + bps = (uint32_t)x; + shift = (bps%8)? 8-(bps%8) : 0; /* SSND data is always byte-aligned, left-justified but format_input() will double-check */ + bps += shift; - /* - * decrement infilesize if we need to align the file - */ - if(options.common.sector_align) { - FLAC__ASSERT(infilesize >= 0); - if(options.common.is_last_file) { - *options.common.align_reservoir_samples = 0; - } - else { - *options.common.align_reservoir_samples = align_remainder; - infilesize -= (off_t)((*options.common.align_reservoir_samples) * bytes_per_wide_sample); - FLAC__ASSERT(infilesize >= 0); - } - } + /* sample rate */ + if(!read_sane_extended(e->fin, &xx, e->inbasefilename)) + return false; + sample_rate = xx; - /* - * now do from the file - */ - if(infilesize < 0) { - while(!feof(infile)) { - if(lookahead_length > 0) { - FLAC__ASSERT(lookahead_length < CHUNK_OF_SAMPLES * bytes_per_wide_sample); - memcpy(ucbuffer_, lookahead, lookahead_length); - bytes_read = fread(ucbuffer_+lookahead_length, sizeof(unsigned char), CHUNK_OF_SAMPLES * bytes_per_wide_sample - lookahead_length, infile) + lookahead_length; - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); + /* check compression type for AIFF-C */ + if(is_aifc) { + if(!read_uint32(e->fin, /*big_endian=*/true, &xx, e->inbasefilename)) + return false; + if(xx == 0x736F7774) /* "sowt" */ + e->info.is_big_endian = false; + else if(xx == 0x4E4F4E45) /* "NONE" */ + ; /* nothing to do, we already default to big-endian */ + else { + flac__utils_printf(stderr, 1, "%s: ERROR: can't handle AIFF-C compression type \"%c%c%c%c\"\n", e->inbasefilename, (char)(xx>>24), (char)((xx>>16)&8), (char)((xx>>8)&8), (char)(xx&8)); + return false; } - lookahead_length = 0; } - else - bytes_read = fread(ucbuffer_, sizeof(unsigned char), CHUNK_OF_SAMPLES * bytes_per_wide_sample, infile); - if(bytes_read == 0) { - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - else if(bytes_read % bytes_per_wide_sample != 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); + /* set channel mapping */ + /* FLAC order follows SMPTE and WAVEFORMATEXTENSIBLE but with fewer channels, which are: */ + /* front left, front right, center, LFE, back left, back right, surround left, surround right */ + /* specs say the channel ordering is: + * 1 2 3 4 5 6 + * ___________________________________________________ + * 2 stereo l r + * 3 l r c + * 4 l c r S + * quad (ambiguous with 4ch) Fl Fr Bl Br + * 5 Fl Fr Fc Sl Sr + * 6 l lc c r rc S + * l:left r:right c:center Fl:front-left Fr:front-right Bl:back-left Br:back-right Lc:left-center Rc:right-center S:surround + * so we only have unambiguous mappings for 2, 3, and 5 channels + */ + if( + options.channel_map_none || + channels == 1 || /* 1 channel: (mono) */ + channels == 2 || /* 2 channels: left, right */ + channels == 3 || /* 3 channels: left, right, center */ + channels == 5 /* 5 channels: front left, front right, center, surround left, surround right */ + ) { + /* keep default channel order */ } else { - unsigned wide_samples = bytes_read / bytes_per_wide_sample; - if(!format_input(input_, wide_samples, options.is_big_endian, options.is_unsigned_samples, options.channels, options.bps, /*shift=*/0, /*channel_map=*/0)) - return EncoderSession_finish_error(&encoder_session); + flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number of channels %u for AIFF\n", e->inbasefilename, channels); + return false; + } - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } + e->info.bytes_per_wide_sample = channels * (bps / 8); + + /* skip any extra data in the COMM chunk */ + if(!fskip_ahead(e->fin, skip)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over extra COMM data\n", e->inbasefilename); + return false; } + + got_comm_chunk = true; } - } - else { - const FLAC__uint64 max_input_bytes = infilesize; - FLAC__uint64 total_input_bytes_read = 0; - while(total_input_bytes_read < max_input_bytes) { - { - size_t wanted = (CHUNK_OF_SAMPLES * bytes_per_wide_sample); - wanted = (size_t) min((FLAC__uint64)wanted, max_input_bytes - total_input_bytes_read); - - if(lookahead_length > 0) { - FLAC__ASSERT(lookahead_length <= wanted); - memcpy(ucbuffer_, lookahead, lookahead_length); - wanted -= lookahead_length; - bytes_read = lookahead_length; - if(wanted > 0) { - bytes_read += fread(ucbuffer_+lookahead_length, sizeof(unsigned char), wanted, infile); - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - } - lookahead_length = 0; - } - else - bytes_read = fread(ucbuffer_, sizeof(unsigned char), wanted, infile); + else if(!memcmp(chunk_id, "SSND", 4) && !got_ssnd_chunk) { /* sound data chunk */ + FLAC__uint32 xx; + FLAC__uint64 data_bytes; + uint32_t offset = 0; + + if(!got_comm_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: got 'SSND' chunk before 'COMM' chunk\n", e->inbasefilename); + return false; } - if(bytes_read == 0) { - if(ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(feof(infile)) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - total_input_bytes_read = max_input_bytes; + /* SSND chunk size */ + if(!read_uint32(e->fin, /*big_endian=*/true, &xx, e->inbasefilename)) + return false; + data_bytes = xx; + if(options.ignore_chunk_sizes) { + if(data_bytes) { + flac__utils_printf(stderr, 1, "%s: WARNING: 'SSND' chunk has non-zero size, using --ignore-chunk-sizes is probably a bad idea\n", e->inbasefilename, chunk_id); + if(e->treat_warnings_as_errors) + return false; } + data_bytes = (FLAC__uint64)0 - (FLAC__uint64)e->info.bytes_per_wide_sample; /* max out data_bytes; we'll use EOF as signal to stop reading */ + } + else if(data_bytes <= 8) { + flac__utils_printf(stderr, 1, "%s: ERROR: 'SSND' chunk has size <= 8\n", e->inbasefilename); + return false; } else { - if(bytes_read % bytes_per_wide_sample != 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else { - unsigned wide_samples = bytes_read / bytes_per_wide_sample; - if(!format_input(input_, wide_samples, options.is_big_endian, options.is_unsigned_samples, options.channels, options.bps, /*shift=*/0, /*channel_map=*/0)) - return EncoderSession_finish_error(&encoder_session); + data_bytes -= 8; /* discount the offset and block size fields */ + } - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } - total_input_bytes_read += bytes_read; + /* offset */ + if(!read_uint32(e->fin, /*big_endian=*/true, &xx, e->inbasefilename)) + return false; + offset = xx; + data_bytes -= offset; + + /* block size */ + if(!read_uint32(e->fin, /*big_endian=*/true, &xx, e->inbasefilename)) + return false; + if(xx && !options.ignore_chunk_sizes) + data_bytes -= (xx - (data_bytes % xx)); + if(options.ignore_chunk_sizes) { + if(xx) { + flac__utils_printf(stderr, 1, "%s: WARNING: 'SSND' chunk has non-zero blocksize, using --ignore-chunk-sizes is probably a bad idea\n", e->inbasefilename, chunk_id); + if(e->treat_warnings_as_errors) + return false; } } - } - } - /* - * now read unaligned samples into reservoir or pad with zeroes if necessary - */ - if(options.common.sector_align) { - if(options.common.is_last_file) { - unsigned wide_samples = 588 - align_remainder; - if(wide_samples < 588) { - unsigned channel; - - info_align_zero = wide_samples; - for(channel = 0; channel < options.channels; channel++) - memset(input_[channel], 0, sizeof(input_[0][0]) * wide_samples); - - if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { - print_error_with_state(&encoder_session, "ERROR during encoding"); - return EncoderSession_finish_error(&encoder_session); - } + /* skip any SSND offset bytes */ + if(!fskip_ahead(e->fin, offset)) { + flac__utils_printf(stderr, 1, "%s: ERROR: skipping offset in SSND chunk\n", e->inbasefilename); + return false; } + + e->fmt.iff.data_bytes = data_bytes; + + got_ssnd_chunk = true; } else { - if(*options.common.align_reservoir_samples > 0) { - FLAC__ASSERT(CHUNK_OF_SAMPLES >= 588); - bytes_read = fread(ucbuffer_, sizeof(unsigned char), (*options.common.align_reservoir_samples) * bytes_per_wide_sample, infile); - if(bytes_read == 0 && ferror(infile)) { - flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } - else if(bytes_read != (*options.common.align_reservoir_samples) * bytes_per_wide_sample) { - flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; read %u bytes; expected %u samples, got %u samples\n", encoder_session.inbasefilename, (unsigned)bytes_read, (unsigned)encoder_session.total_samples_to_encode, (unsigned)encoder_session.samples_written); - if(encoder_session.treat_warnings_as_errors) - return EncoderSession_finish_error(&encoder_session); - } - else { - info_align_carry = *options.common.align_reservoir_samples; - if(!format_input(options.common.align_reservoir, *options.common.align_reservoir_samples, options.is_big_endian, options.is_unsigned_samples, options.channels, options.bps, /*shift=*/0, /*channel_map=*/0)) - return EncoderSession_finish_error(&encoder_session); + FLAC__uint32 xx; + if(!options.format_options.iff.foreign_metadata) { + flac__utils_printf(stderr, 1, "%s: WARNING: skipping unknown chunk '%s' (use --keep-foreign-metadata to keep)\n", e->inbasefilename, chunk_id); + if(e->treat_warnings_as_errors) + return false; + } + + /* chunk size */ + if(!read_uint32(e->fin, /*big_endian=*/true, &xx, e->inbasefilename)) + return false; + else { + uint64_t skip = xx + (xx & 1); + + FLAC__ASSERT(skip <= LONG_MAX); + if(!fskip_ahead(e->fin, skip)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping over chunk\n", e->inbasefilename); + return false; } } } } - return EncoderSession_finish_ok(&encoder_session, info_align_carry, info_align_zero, /*foreign_metadata=*/0); -} + if(!got_comm_chunk) { + flac__utils_printf(stderr, 1, "%s: ERROR: didn't find COMM chunk\n", e->inbasefilename); + return false; + } + if(!got_ssnd_chunk && sample_frames) { + flac__utils_printf(stderr, 1, "%s: ERROR: didn't find SSND chunk\n", e->inbasefilename); + return false; + } -int flac__encode_flac(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, flac_encode_options_t options, FLAC__bool input_is_ogg) -{ - EncoderSession encoder_session; - FLAC__StreamDecoder *decoder = 0; - FLACDecoderData decoder_data; - size_t i; - int retval; - - if(! - EncoderSession_construct( - &encoder_session, -#if FLAC__HAS_OGG - options.common.use_ogg, -#else - /*use_ogg=*/false, -#endif - options.common.verify, - options.common.treat_warnings_as_errors, - options.common.continue_through_decode_errors, - infile, - infilename, - outfilename - ) - ) - return 1; + e->info.sample_rate = sample_rate; + e->info.channels = channels; + e->info.bits_per_sample = bps; + e->info.shift = shift; + e->info.channel_mask = channel_mask; - decoder_data.encoder_session = &encoder_session; - decoder_data.filesize = (infilesize == (off_t)(-1)? 0 : infilesize); - decoder_data.lookahead = lookahead; - decoder_data.lookahead_length = lookahead_length; - decoder_data.num_metadata_blocks = 0; - decoder_data.samples_left_to_process = 0; - decoder_data.fatal_error = false; + return true; +} - /* - * set up FLAC decoder for the input - */ - if (0 == (decoder = FLAC__stream_decoder_new())) { - flac__utils_printf(stderr, 1, "%s: ERROR: creating decoder for FLAC input\n", encoder_session.inbasefilename); - return EncoderSession_finish_error(&encoder_session); - } +static FLAC__bool get_sample_info_flac(EncoderSession *e) +{ if (!( - FLAC__stream_decoder_set_md5_checking(decoder, false) && - FLAC__stream_decoder_set_metadata_respond_all(decoder) + FLAC__stream_decoder_set_md5_checking(e->fmt.flac.decoder, false) && + FLAC__stream_decoder_set_metadata_respond_all(e->fmt.flac.decoder) )) { - flac__utils_printf(stderr, 1, "%s: ERROR: setting up decoder for FLAC input\n", encoder_session.inbasefilename); - goto fubar1; /*@@@ yuck */ + flac__utils_printf(stderr, 1, "%s: ERROR: setting up decoder for FLAC input\n", e->inbasefilename); + return false; } - if (input_is_ogg) { - if (FLAC__stream_decoder_init_ogg_stream(decoder, flac_decoder_read_callback, flac_decoder_seek_callback, flac_decoder_tell_callback, flac_decoder_length_callback, flac_decoder_eof_callback, flac_decoder_write_callback, flac_decoder_metadata_callback, flac_decoder_error_callback, /*client_data=*/&decoder_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - flac__utils_printf(stderr, 1, "%s: ERROR: initializing decoder for Ogg FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar1; /*@@@ yuck */ + if (e->format == FORMAT_OGGFLAC) { + if (FLAC__stream_decoder_init_ogg_stream(e->fmt.flac.decoder, flac_decoder_read_callback, flac_decoder_seek_callback, flac_decoder_tell_callback, flac_decoder_length_callback, flac_decoder_eof_callback, flac_decoder_write_callback, flac_decoder_metadata_callback, flac_decoder_error_callback, /*client_data=*/e) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { + flac__utils_printf(stderr, 1, "%s: ERROR: initializing decoder for Ogg FLAC input, state = %s\n", e->inbasefilename, FLAC__stream_decoder_get_resolved_state_string(e->fmt.flac.decoder)); + return false; } } - else if (FLAC__stream_decoder_init_stream(decoder, flac_decoder_read_callback, flac_decoder_seek_callback, flac_decoder_tell_callback, flac_decoder_length_callback, flac_decoder_eof_callback, flac_decoder_write_callback, flac_decoder_metadata_callback, flac_decoder_error_callback, /*client_data=*/&decoder_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - flac__utils_printf(stderr, 1, "%s: ERROR: initializing decoder for FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar1; /*@@@ yuck */ + else if (FLAC__stream_decoder_init_stream(e->fmt.flac.decoder, flac_decoder_read_callback, flac_decoder_seek_callback, flac_decoder_tell_callback, flac_decoder_length_callback, flac_decoder_eof_callback, flac_decoder_write_callback, flac_decoder_metadata_callback, flac_decoder_error_callback, /*client_data=*/e) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { + flac__utils_printf(stderr, 1, "%s: ERROR: initializing decoder for FLAC input, state = %s\n", e->inbasefilename, FLAC__stream_decoder_get_resolved_state_string(e->fmt.flac.decoder)); + return false; } - if (!FLAC__stream_decoder_process_until_end_of_metadata(decoder) || decoder_data.fatal_error) { - if (decoder_data.fatal_error) - flac__utils_printf(stderr, 1, "%s: ERROR: out of memory or too many metadata blocks while reading metadata in FLAC input\n", encoder_session.inbasefilename); + if (!FLAC__stream_decoder_process_until_end_of_metadata(e->fmt.flac.decoder) || e->fmt.flac.client_data.fatal_error) { + if (e->fmt.flac.client_data.fatal_error) + flac__utils_printf(stderr, 1, "%s: ERROR: out of memory or too many metadata blocks while reading metadata in FLAC input\n", e->inbasefilename); else - flac__utils_printf(stderr, 1, "%s: ERROR: reading metadata in FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar1; /*@@@ yuck */ + flac__utils_printf(stderr, 1, "%s: ERROR: reading metadata in FLAC input, state = %s\n", e->inbasefilename, FLAC__stream_decoder_get_resolved_state_string(e->fmt.flac.decoder)); + return false; } - if (decoder_data.num_metadata_blocks == 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: reading metadata in FLAC input, got no metadata blocks\n", encoder_session.inbasefilename); - goto fubar2; /*@@@ yuck */ + if (e->fmt.flac.client_data.num_metadata_blocks == 0) { + flac__utils_printf(stderr, 1, "%s: ERROR: reading metadata in FLAC input, got no metadata blocks\n", e->inbasefilename); + return false; } - else if (decoder_data.metadata_blocks[0]->type != FLAC__METADATA_TYPE_STREAMINFO) { - flac__utils_printf(stderr, 1, "%s: ERROR: reading metadata in FLAC input, first metadata block is not STREAMINFO\n", encoder_session.inbasefilename); - goto fubar2; /*@@@ yuck */ + else if (e->fmt.flac.client_data.metadata_blocks[0]->type != FLAC__METADATA_TYPE_STREAMINFO) { + flac__utils_printf(stderr, 1, "%s: ERROR: reading metadata in FLAC input, first metadata block is not STREAMINFO\n", e->inbasefilename); + return false; } - else if (decoder_data.metadata_blocks[0]->data.stream_info.total_samples == 0) { - flac__utils_printf(stderr, 1, "%s: ERROR: FLAC input has STREAMINFO with unknown total samples which is not supported\n", encoder_session.inbasefilename); - goto fubar2; /*@@@ yuck */ + else if (e->fmt.flac.client_data.metadata_blocks[0]->data.stream_info.total_samples == 0) { + flac__utils_printf(stderr, 1, "%s: ERROR: FLAC input has STREAMINFO with unknown total samples which is not supported\n", e->inbasefilename); + return false; } - /* - * now that we have the STREAMINFO and know the sample rate, - * canonicalize the --skip string to a number of samples: - */ - flac__utils_canonicalize_skip_until_specification(&options.common.skip_specification, decoder_data.metadata_blocks[0]->data.stream_info.sample_rate); - FLAC__ASSERT(options.common.skip_specification.value.samples >= 0); - encoder_session.skip = (FLAC__uint64)options.common.skip_specification.value.samples; - FLAC__ASSERT(!options.common.sector_align); /* --sector-align with FLAC input is not supported */ + e->info.sample_rate = e->fmt.flac.client_data.metadata_blocks[0]->data.stream_info.sample_rate; + e->info.channels = e->fmt.flac.client_data.metadata_blocks[0]->data.stream_info.channels; + e->info.bits_per_sample = e->fmt.flac.client_data.metadata_blocks[0]->data.stream_info.bits_per_sample; + e->info.shift = 0; + e->info.bytes_per_wide_sample = 0; + e->info.is_unsigned_samples = false; /* not applicable for FLAC input */ + e->info.is_big_endian = false; /* not applicable for FLAC input */ + e->info.channel_mask = 0; + + return true; +} + +/* + * public routines + */ +int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, uint32_t lookahead_length, encode_options_t options) +{ + EncoderSession encoder_session; + size_t channel_map[FLAC__MAX_CHANNELS]; + + if(!EncoderSession_construct(&encoder_session, options, infilesize, infile, infilename, outfilename, lookahead, lookahead_length)) + return 1; + + /* initialize default channel map that preserves channel order */ + { + size_t i; + for(i = 0; i < sizeof(channel_map)/sizeof(channel_map[0]); i++) + channel_map[i] = i; + } + + /* read foreign metadata if requested */ + if(EncoderSession_format_is_iff(&encoder_session) && options.format_options.iff.foreign_metadata) { + const char *error; + if(!( + options.format == FORMAT_WAVE || options.format == FORMAT_RF64? + flac__foreign_metadata_read_from_wave(options.format_options.iff.foreign_metadata, infilename, &error) : + options.format == FORMAT_WAVE64? + flac__foreign_metadata_read_from_wave64(options.format_options.iff.foreign_metadata, infilename, &error) : + flac__foreign_metadata_read_from_aiff(options.format_options.iff.foreign_metadata, infilename, &error) + )) { + if(options.relaxed_foreign_metadata_handling) { + flac__utils_printf(stderr, 1, "%s: WARNING reading foreign metadata: %s\n", encoder_session.inbasefilename, error); + if(encoder_session.treat_warnings_as_errors) + return EncoderSession_finish_error(&encoder_session); + } + else { + flac__utils_printf(stderr, 1, "%s: ERROR reading foreign metadata: %s\n", encoder_session.inbasefilename, error); + return EncoderSession_finish_error(&encoder_session); + } + } + } + + /* initialize encoder session with info about the audio (channels/bps/resolution/endianness/etc) */ + switch(options.format) { + case FORMAT_RAW: + if(!get_sample_info_raw(&encoder_session, options)) + return EncoderSession_finish_error(&encoder_session); + break; + case FORMAT_WAVE: + case FORMAT_WAVE64: + case FORMAT_RF64: + if(!get_sample_info_wave(&encoder_session, options)) + return EncoderSession_finish_error(&encoder_session); + break; + case FORMAT_AIFF: + case FORMAT_AIFF_C: + if(!get_sample_info_aiff(&encoder_session, options)) + return EncoderSession_finish_error(&encoder_session); + break; + case FORMAT_FLAC: + case FORMAT_OGGFLAC: + /* + * set up FLAC decoder for the input + */ + if (0 == (encoder_session.fmt.flac.decoder = FLAC__stream_decoder_new())) { + flac__utils_printf(stderr, 1, "%s: ERROR: creating decoder for FLAC input\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + if(!get_sample_info_flac(&encoder_session)) + return EncoderSession_finish_error(&encoder_session); + break; + default: + FLAC__ASSERT(0); + /* double protection */ + return EncoderSession_finish_error(&encoder_session); + } + + /* some more checks */ + if(encoder_session.info.channels == 0 || encoder_session.info.channels > FLAC__MAX_CHANNELS) { + flac__utils_printf(stderr, 1, "%s: ERROR: unsupported number of channels %u\n", encoder_session.inbasefilename, encoder_session.info.channels); + return EncoderSession_finish_error(&encoder_session); + } + if(!FLAC__format_sample_rate_is_valid(encoder_session.info.sample_rate)) { + flac__utils_printf(stderr, 1, "%s: ERROR: unsupported sample rate %u\n", encoder_session.inbasefilename, encoder_session.info.sample_rate); + return EncoderSession_finish_error(&encoder_session); + } + if(encoder_session.info.bits_per_sample-encoder_session.info.shift < 4 || encoder_session.info.bits_per_sample-encoder_session.info.shift > 32) { + flac__utils_printf(stderr, 1, "%s: ERROR: unsupported bits-per-sample %u\n", encoder_session.inbasefilename, encoder_session.info.bits_per_sample-encoder_session.info.shift); + return EncoderSession_finish_error(&encoder_session); + } { - FLAC__uint64 total_samples_in_input, trim = 0; + FLAC__uint64 total_samples_in_input; /* WATCHOUT: may be 0 to mean "unknown" */ + FLAC__uint64 skip; + FLAC__uint64 until; /* a value of 0 mean end-of-stream (i.e. --until=-0) */ + uint32_t consecutive_eos_count = 0; + + switch(options.format) { + case FORMAT_RAW: + if(infilesize < 0) + total_samples_in_input = 0; + else + total_samples_in_input = (FLAC__uint64)infilesize / encoder_session.info.bytes_per_wide_sample; + break; + case FORMAT_WAVE: + case FORMAT_WAVE64: + case FORMAT_RF64: + case FORMAT_AIFF: + case FORMAT_AIFF_C: + /* truncation in the division removes any padding byte that was counted in encoder_session.fmt.iff.data_bytes */ + total_samples_in_input = encoder_session.fmt.iff.data_bytes / encoder_session.info.bytes_per_wide_sample; + + /* check for chunks trailing the audio data */ + if(!options.ignore_chunk_sizes && !options.format_options.iff.foreign_metadata + && infilesize != (FLAC__off_t)(-1)) { + FLAC__off_t current_position = ftello(encoder_session.fin); + if(current_position > 0) { + FLAC__uint64 end_of_data_chunk = current_position + encoder_session.fmt.iff.data_bytes; + if(end_of_data_chunk < (FLAC__uint64)infilesize) { + flac__utils_printf(stderr, 1, "%s: WARNING: there is data trailing the audio data. Use --keep-foreign-metadata or --ignore-chunk-sizes to keep it\n", encoder_session.inbasefilename); + if(encoder_session.treat_warnings_as_errors) + return EncoderSession_finish_error(&encoder_session); + } + else if(end_of_data_chunk > (FLAC__uint64)infilesize) { + flac__utils_printf(stderr, 1, "%s: WARNING: the length of the data chunk overruns the end of the file. Please consult the manual on the --ignore-chunk-sizes option\n", encoder_session.inbasefilename); + if(encoder_session.treat_warnings_as_errors) + return EncoderSession_finish_error(&encoder_session); + } + } + } + break; + case FORMAT_FLAC: + case FORMAT_OGGFLAC: + total_samples_in_input = encoder_session.fmt.flac.client_data.metadata_blocks[0]->data.stream_info.total_samples; + break; + default: + FLAC__ASSERT(0); + /* double protection */ + return EncoderSession_finish_error(&encoder_session); + } - total_samples_in_input = decoder_data.metadata_blocks[0]->data.stream_info.total_samples; + /* + * now that we know the sample rate, canonicalize the + * --skip string to an absolute sample number: + */ + if(!flac__utils_canonicalize_skip_until_specification(&options.skip_specification, encoder_session.info.sample_rate)) { + flac__utils_printf(stderr, 1, "%s: ERROR: value of --skip is too large\n", encoder_session.inbasefilename, encoder_session.info.bits_per_sample-encoder_session.info.shift); + return EncoderSession_finish_error(&encoder_session); + } + FLAC__ASSERT(options.skip_specification.value.samples >= 0); + skip = (FLAC__uint64)options.skip_specification.value.samples; /* - * now that we know the input size, canonicalize the + * now that we possibly know the input size, canonicalize the * --until string to an absolute sample number: */ - if(!canonicalize_until_specification(&options.common.until_specification, encoder_session.inbasefilename, decoder_data.metadata_blocks[0]->data.stream_info.sample_rate, encoder_session.skip, total_samples_in_input)) - goto fubar2; /*@@@ yuck */ - encoder_session.until = (FLAC__uint64)options.common.until_specification.value.samples; - - encoder_session.total_samples_to_encode = total_samples_in_input - encoder_session.skip; - if(encoder_session.until > 0) { - trim = total_samples_in_input - encoder_session.until; + if(!canonicalize_until_specification(&options.until_specification, encoder_session.inbasefilename, encoder_session.info.sample_rate, skip, total_samples_in_input)) + return EncoderSession_finish_error(&encoder_session); + until = (FLAC__uint64)options.until_specification.value.samples; + + /* adjust encoding parameters based on skip and until values */ + switch(options.format) { + case FORMAT_RAW: + FLAC__ASSERT(sizeof(FLAC__off_t) == 8); + if(skip >= INT64_MAX / encoder_session.info.bytes_per_wide_sample) { + flac__utils_printf(stderr, 1, "%s: ERROR: value of --skip is too large\n", encoder_session.inbasefilename, encoder_session.info.bits_per_sample-encoder_session.info.shift); + return EncoderSession_finish_error(&encoder_session); + } + infilesize -= (FLAC__off_t)skip * encoder_session.info.bytes_per_wide_sample; + encoder_session.total_samples_to_encode = total_samples_in_input - skip; + break; + case FORMAT_WAVE: + case FORMAT_WAVE64: + case FORMAT_RF64: + case FORMAT_AIFF: + case FORMAT_AIFF_C: + FLAC__ASSERT(sizeof(FLAC__off_t) == 8); + if(skip >= INT64_MAX / encoder_session.info.bytes_per_wide_sample) { + flac__utils_printf(stderr, 1, "%s: ERROR: value of --skip is too large\n", encoder_session.inbasefilename, encoder_session.info.bits_per_sample-encoder_session.info.shift); + return EncoderSession_finish_error(&encoder_session); + } + encoder_session.fmt.iff.data_bytes -= skip * encoder_session.info.bytes_per_wide_sample; + if(options.ignore_chunk_sizes) { + encoder_session.total_samples_to_encode = 0; + FLAC__ASSERT(0 == until); + } + else { + encoder_session.total_samples_to_encode = total_samples_in_input - skip; + } + break; + case FORMAT_FLAC: + case FORMAT_OGGFLAC: + encoder_session.total_samples_to_encode = total_samples_in_input - skip; + break; + default: + FLAC__ASSERT(0); + /* double protection */ + return EncoderSession_finish_error(&encoder_session); + } + if(until > 0) { + const FLAC__uint64 trim = total_samples_in_input - until; FLAC__ASSERT(total_samples_in_input > 0); + if(options.format == FORMAT_RAW) + infilesize -= (FLAC__off_t)trim * encoder_session.info.bytes_per_wide_sample; + else if(EncoderSession_format_is_iff(&encoder_session)) + encoder_session.fmt.iff.data_bytes -= trim * encoder_session.info.bytes_per_wide_sample; encoder_session.total_samples_to_encode -= trim; } + switch(options.format) { + case FORMAT_RAW: + encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample; + break; + case FORMAT_WAVE: + /* +44 for the size of the WAVE headers; this is just an estimate for the progress indicator and doesn't need to be exact */ + encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 44; + break; + case FORMAT_WAVE64: + /* +44 for the size of the WAVE headers; this is just an estimate for the progress indicator and doesn't need to be exact */ + encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 104; + break; + case FORMAT_RF64: + /* +72 for the size of the RF64 headers; this is just an estimate for the progress indicator and doesn't need to be exact */ + encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 80; + break; + case FORMAT_AIFF: + case FORMAT_AIFF_C: + /* +54 for the size of the AIFF headers; this is just an estimate for the progress indicator and doesn't need to be exact */ + encoder_session.unencoded_size = encoder_session.total_samples_to_encode * encoder_session.info.bytes_per_wide_sample + 54; + break; + case FORMAT_FLAC: + case FORMAT_OGGFLAC: + if(infilesize < 0) + /* if we don't know, use 0 as hint to progress indicator (which is the only place this is used): */ + encoder_session.unencoded_size = 0; + else if(skip == 0 && until == 0) + encoder_session.unencoded_size = (FLAC__uint64)infilesize; + else if(total_samples_in_input) + encoder_session.unencoded_size = (FLAC__uint64)infilesize * encoder_session.total_samples_to_encode / total_samples_in_input; + else + encoder_session.unencoded_size = (FLAC__uint64)infilesize; + break; + default: + FLAC__ASSERT(0); + /* double protection */ + return EncoderSession_finish_error(&encoder_session); + } + + if(encoder_session.total_samples_to_encode == 0) { + encoder_session.unencoded_size = 0; + flac__utils_printf(stderr, 2, "(No runtime statistics possible; please wait for encoding to finish...)\n"); + } - encoder_session.unencoded_size = decoder_data.filesize; + if(options.format == FORMAT_FLAC || options.format == FORMAT_OGGFLAC) + encoder_session.fmt.flac.client_data.samples_left_to_process = encoder_session.total_samples_to_encode; - /* (channel mask will get copied over from the source VORBIS_COMMENT if it exists) */ - if(!EncoderSession_init_encoder(&encoder_session, options.common, /*channel_mask=*/0, decoder_data.metadata_blocks[0]->data.stream_info.channels, decoder_data.metadata_blocks[0]->data.stream_info.bits_per_sample, decoder_data.metadata_blocks[0]->data.stream_info.sample_rate, /*foreign_metadata=*/0, &decoder_data)) - goto fubar2; /*@@@ yuck */ + stats_new_file(); + /* init the encoder */ + if(!EncoderSession_init_encoder(&encoder_session, options)) + return EncoderSession_finish_error(&encoder_session); - /* - * have to wait until the FLAC encoder is set up for writing - * before any seeking in the input FLAC file, because the seek - * itself will usually call the decoder's write callback, and - * our decoder's write callback passes samples to our FLAC - * encoder - */ - decoder_data.samples_left_to_process = encoder_session.total_samples_to_encode; - if(encoder_session.skip > 0) { - if(!FLAC__stream_decoder_seek_absolute(decoder, encoder_session.skip)) { - flac__utils_printf(stderr, 1, "%s: ERROR while skipping samples, FLAC decoder state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar2; /*@@@ yuck */ + /* skip over any samples as requested */ + if(skip > 0) { + switch(options.format) { + case FORMAT_RAW: + { + uint32_t skip_bytes = encoder_session.info.bytes_per_wide_sample * (uint32_t)skip; + if(skip_bytes > lookahead_length) { + skip_bytes -= lookahead_length; + lookahead_length = 0; + if(!fskip_ahead(encoder_session.fin, skip_bytes)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + } + else { + lookahead += skip_bytes; + lookahead_length -= skip_bytes; + } + } + break; + case FORMAT_WAVE: + case FORMAT_WAVE64: + case FORMAT_RF64: + case FORMAT_AIFF: + case FORMAT_AIFF_C: + if(!fskip_ahead(encoder_session.fin, skip * encoder_session.info.bytes_per_wide_sample)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read while skipping samples\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + break; + case FORMAT_FLAC: + case FORMAT_OGGFLAC: + /* + * have to wait until the FLAC encoder is set up for writing + * before any seeking in the input FLAC file, because the seek + * itself will usually call the decoder's write callback, and + * our decoder's write callback passes samples to our FLAC + * encoder + */ + if(!FLAC__stream_decoder_seek_absolute(encoder_session.fmt.flac.decoder, skip)) { + flac__utils_printf(stderr, 1, "%s: ERROR while skipping samples, FLAC decoder state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(encoder_session.fmt.flac.decoder)); + return EncoderSession_finish_error(&encoder_session); + } + break; + default: + FLAC__ASSERT(0); + /* double protection */ + return EncoderSession_finish_error(&encoder_session); } } /* * now do samples from the file */ - while(!decoder_data.fatal_error && decoder_data.samples_left_to_process > 0) { - /* We can also hit the end of stream without samples_left_to_process - * going to 0 if there are errors and continue_through_decode_errors - * is on, so we want to break in that case too: - */ - if(encoder_session.continue_through_decode_errors && FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_END_OF_STREAM) + switch(options.format) { + case FORMAT_RAW: + if(infilesize < 0) { + size_t bytes_read; + while(!feof(infile)) { + if(lookahead_length > 0) { + FLAC__ASSERT(lookahead_length < CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample); + memcpy(ubuffer.u8, lookahead, lookahead_length); + bytes_read = fread(ubuffer.u8+lookahead_length, sizeof(uint8_t), CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample - lookahead_length, infile) + lookahead_length; + if(ferror(infile)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + lookahead_length = 0; + } + else + bytes_read = fread(ubuffer.u8, sizeof(uint8_t), CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample, infile); + + if(bytes_read == 0) { + if(ferror(infile)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + } + else if(bytes_read % encoder_session.info.bytes_per_wide_sample != 0) { + flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + else { + uint32_t wide_samples = bytes_read / encoder_session.info.bytes_per_wide_sample; + if(!format_input(input_, wide_samples, encoder_session.info.is_big_endian, encoder_session.info.is_unsigned_samples, encoder_session.info.channels, encoder_session.info.bits_per_sample, encoder_session.info.shift, channel_map)) + return EncoderSession_finish_error(&encoder_session); + + if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { + print_error_with_state(&encoder_session, "ERROR during encoding"); + return EncoderSession_finish_error(&encoder_session); + } + } + } + } + else { + size_t bytes_read; + const FLAC__uint64 max_input_bytes = infilesize; + FLAC__uint64 total_input_bytes_read = 0; + while(total_input_bytes_read < max_input_bytes) { + { + size_t wanted = (CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample); + wanted = (size_t) min((FLAC__uint64)wanted, max_input_bytes - total_input_bytes_read); + + if(lookahead_length > 0) { + if(lookahead_length <= wanted) { + memcpy(ubuffer.u8, lookahead, lookahead_length); + wanted -= lookahead_length; + bytes_read = lookahead_length; + } + else { + /* This happens when --until is used on a very short file */ + FLAC__ASSERT(lookahead_length < CHUNK_OF_SAMPLES * encoder_session.info.bytes_per_wide_sample); + memcpy(ubuffer.u8, lookahead, wanted); + wanted = 0; + bytes_read = wanted; + } + if(wanted > 0) { + bytes_read += fread(ubuffer.u8+lookahead_length, sizeof(uint8_t), wanted, infile); + if(ferror(infile)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + } + lookahead_length = 0; + } + else + bytes_read = fread(ubuffer.u8, sizeof(uint8_t), wanted, infile); + } + + if(bytes_read == 0) { + if(ferror(infile)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + else if(feof(infile)) { + flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %" PRIu64 " samples, got %" PRIu64 " samples\n", encoder_session.inbasefilename, encoder_session.total_samples_to_encode, encoder_session.samples_written); + if(encoder_session.treat_warnings_as_errors) + return EncoderSession_finish_error(&encoder_session); + total_input_bytes_read = max_input_bytes; + } + } + else { + if(bytes_read % encoder_session.info.bytes_per_wide_sample != 0) { + flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + else { + uint32_t wide_samples = bytes_read / encoder_session.info.bytes_per_wide_sample; + if(!format_input(input_, wide_samples, encoder_session.info.is_big_endian, encoder_session.info.is_unsigned_samples, encoder_session.info.channels, encoder_session.info.bits_per_sample, encoder_session.info.shift, channel_map)) + return EncoderSession_finish_error(&encoder_session); + + if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { + print_error_with_state(&encoder_session, "ERROR during encoding"); + return EncoderSession_finish_error(&encoder_session); + } + total_input_bytes_read += bytes_read; + } + } + } + } break; - if(!FLAC__stream_decoder_process_single(decoder)) { - flac__utils_printf(stderr, 1, "%s: ERROR: while decoding FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar2; /*@@@ yuck */ - } - } - if(decoder_data.fatal_error) { - flac__utils_printf(stderr, 1, "%s: ERROR: while decoding FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(decoder)); - goto fubar2; /*@@@ yuck */ + case FORMAT_WAVE: + case FORMAT_WAVE64: + case FORMAT_RF64: + case FORMAT_AIFF: + case FORMAT_AIFF_C: + while(encoder_session.fmt.iff.data_bytes > 0) { + const size_t bytes_to_read = + (size_t) min (sizeof (ubuffer.u8), + min (encoder_session.fmt.iff.data_bytes, + CHUNK_OF_SAMPLES * (uint64_t) encoder_session.info.bytes_per_wide_sample)); + size_t bytes_read = fread(ubuffer.u8, sizeof(uint8_t), bytes_to_read, infile); + if(bytes_read == 0) { + if(ferror(infile)) { + flac__utils_printf(stderr, 1, "%s: ERROR during read\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + else if(feof(infile)) { + if(options.ignore_chunk_sizes) { + flac__utils_printf(stderr, 1, "%s: INFO: hit EOF with --ignore-chunk-sizes, got %" PRIu64 " samples\n", encoder_session.inbasefilename, encoder_session.samples_written); + } + else { + flac__utils_printf(stderr, 1, "%s: WARNING: unexpected EOF; expected %" PRIu64 " samples, got %" PRIu64 " samples\n", encoder_session.inbasefilename, encoder_session.total_samples_to_encode, encoder_session.samples_written); + if(encoder_session.treat_warnings_as_errors) + return EncoderSession_finish_error(&encoder_session); + } + encoder_session.fmt.iff.data_bytes = 0; + } + } + else { + if(bytes_read % encoder_session.info.bytes_per_wide_sample != 0) { + flac__utils_printf(stderr, 1, "%s: ERROR: got partial sample\n", encoder_session.inbasefilename); + return EncoderSession_finish_error(&encoder_session); + } + else { + uint32_t wide_samples = bytes_read / encoder_session.info.bytes_per_wide_sample; + if(!format_input(input_, wide_samples, encoder_session.info.is_big_endian, encoder_session.info.is_unsigned_samples, encoder_session.info.channels, encoder_session.info.bits_per_sample, encoder_session.info.shift, channel_map)) + return EncoderSession_finish_error(&encoder_session); + + if(!EncoderSession_process(&encoder_session, (const FLAC__int32 * const *)input_, wide_samples)) { + print_error_with_state(&encoder_session, "ERROR during encoding"); + return EncoderSession_finish_error(&encoder_session); + } + encoder_session.fmt.iff.data_bytes -= bytes_read; + } + } + } + break; + case FORMAT_FLAC: + case FORMAT_OGGFLAC: + consecutive_eos_count = 0; + while(!encoder_session.fmt.flac.client_data.fatal_error && encoder_session.fmt.flac.client_data.samples_left_to_process > 0) { + FLAC__StreamDecoderState decoder_state; + /* We can also hit the end of stream without samples_left_to_process + * going to 0 if there are errors and continue_through_decode_errors + * is on, so we want to break in that case too: + */ + decoder_state = FLAC__stream_decoder_get_state(encoder_session.fmt.flac.decoder); + if(encoder_session.continue_through_decode_errors && decoder_state == FLAC__STREAM_DECODER_END_OF_STREAM) + break; + + consecutive_eos_count = decoder_state == FLAC__STREAM_DECODER_END_OF_STREAM ? consecutive_eos_count + 1 : 0; + + /* Exit loop if we get two or more consecutive FLAC__STREAM_DECODER_END_OF_STREAM events. */ + if(consecutive_eos_count >= 2) { + flac__utils_printf(stderr, 1, "%s: ERROR: %d consecutive FLAC__STREAM_DECODER_END_OF_STREAM events.\n", encoder_session.inbasefilename, consecutive_eos_count); + break; + } + + if(decoder_state == FLAC__STREAM_DECODER_ABORTED || !FLAC__stream_decoder_process_single(encoder_session.fmt.flac.decoder)) { + flac__utils_printf(stderr, 1, "%s: ERROR: while decoding FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(encoder_session.fmt.flac.decoder)); + return EncoderSession_finish_error(&encoder_session); + } + } + if(encoder_session.fmt.flac.client_data.fatal_error) { + flac__utils_printf(stderr, 1, "%s: ERROR: while decoding FLAC input, state = %s\n", encoder_session.inbasefilename, FLAC__stream_decoder_get_resolved_state_string(encoder_session.fmt.flac.decoder)); + return EncoderSession_finish_error(&encoder_session); + } + break; + default: + FLAC__ASSERT(0); + /* double protection */ + return EncoderSession_finish_error(&encoder_session); } - } - FLAC__stream_decoder_delete(decoder); - retval = EncoderSession_finish_ok(&encoder_session, -1, -1, /*foreign_metadata=*/0); - /* have to wail until encoder is completely finished before deleting because of the final step of writing the seekpoint offsets */ - for(i = 0; i < decoder_data.num_metadata_blocks; i++) - FLAC__metadata_object_delete(decoder_data.metadata_blocks[i]); - return retval; + } -fubar2: - for(i = 0; i < decoder_data.num_metadata_blocks; i++) - FLAC__metadata_object_delete(decoder_data.metadata_blocks[i]); -fubar1: - FLAC__stream_decoder_delete(decoder); - return EncoderSession_finish_error(&encoder_session); + return EncoderSession_finish_ok( + &encoder_session, + EncoderSession_format_is_iff(&encoder_session)? options.format_options.iff.foreign_metadata : 0, + options.error_on_compression_fail + ); } -FLAC__bool EncoderSession_construct(EncoderSession *e, FLAC__bool use_ogg, FLAC__bool verify, FLAC__bool treat_warnings_as_errors, FLAC__bool continue_through_decode_errors, FILE *infile, const char *infilename, const char *outfilename) +FLAC__bool EncoderSession_construct(EncoderSession *e, encode_options_t options, FLAC__off_t infilesize, FILE *infile, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, uint32_t lookahead_length) { - unsigned i; + uint32_t i; FLAC__uint32 test = 1; /* @@ -1616,13 +1386,11 @@ FLAC__bool EncoderSession_construct(EncoderSession *e, FLAC__bool use_ogg, FLAC_ */ #if FLAC__HAS_OGG - e->use_ogg = use_ogg; -#else - (void)use_ogg; + e->use_ogg = options.use_ogg; #endif - e->verify = verify; - e->treat_warnings_as_errors = treat_warnings_as_errors; - e->continue_through_decode_errors = continue_through_decode_errors; + e->verify = options.verify; + e->treat_warnings_as_errors = options.treat_warnings_as_errors; + e->continue_through_decode_errors = options.continue_through_decode_errors; e->is_stdout = (0 == strcmp(outfilename, "-")); e->outputfile_opened = false; @@ -1631,12 +1399,49 @@ FLAC__bool EncoderSession_construct(EncoderSession *e, FLAC__bool use_ogg, FLAC_ e->infilename = infilename; e->outfilename = outfilename; - e->skip = 0; /* filled in later after the sample_rate is known */ - e->unencoded_size = 0; e->total_samples_to_encode = 0; + e->unencoded_size = 0; e->bytes_written = 0; e->samples_written = 0; - e->stats_mask = 0; +#if 0 /* in case time.h with clock() isn't available for some reason */ + e->stats_frames_interval = 0; + e->old_frames_written = 0; +#else + e->old_clock_t = 0; +#endif + e->compression_ratio = 0.0; + + memset(&e->info, 0, sizeof(e->info)); + + e->format = options.format; + + switch(options.format) { + case FORMAT_RAW: + break; + case FORMAT_WAVE: + case FORMAT_WAVE64: + case FORMAT_RF64: + case FORMAT_AIFF: + case FORMAT_AIFF_C: + e->fmt.iff.data_bytes = 0; + break; + case FORMAT_FLAC: + case FORMAT_OGGFLAC: + e->fmt.flac.decoder = 0; + e->fmt.flac.client_data.filesize = infilesize; + e->fmt.flac.client_data.lookahead = lookahead; + e->fmt.flac.client_data.lookahead_length = lookahead_length; + e->fmt.flac.client_data.num_metadata_blocks = 0; + e->fmt.flac.client_data.samples_left_to_process = 0; + e->fmt.flac.client_data.fatal_error = false; + break; + default: +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + FLAC__ASSERT(0); +#endif + /* double protection */ + return false; + } e->encoder = 0; @@ -1660,6 +1465,16 @@ FLAC__bool EncoderSession_construct(EncoderSession *e, FLAC__bool use_ogg, FLAC_ void EncoderSession_destroy(EncoderSession *e) { + if(e->format == FORMAT_FLAC || e->format == FORMAT_OGGFLAC) { + size_t i; + if(e->fmt.flac.decoder) + FLAC__stream_decoder_delete(e->fmt.flac.decoder); + e->fmt.flac.decoder = 0; + for(i = 0; i < e->fmt.flac.client_data.num_metadata_blocks; i++) + FLAC__metadata_object_delete(e->fmt.flac.client_data.metadata_blocks[i]); + e->fmt.flac.client_data.num_metadata_blocks = 0; + } + if(e->fin != stdin) fclose(e->fin); @@ -1674,7 +1489,7 @@ void EncoderSession_destroy(EncoderSession *e) } } -int EncoderSession_finish_ok(EncoderSession *e, int info_align_carry, int info_align_zero, foreign_metadata_t *foreign_metadata) +int EncoderSession_finish_ok(EncoderSession *e, foreign_metadata_t *foreign_metadata, FLAC__bool error_on_compression_fail) { FLAC__StreamEncoderState fse_state = FLAC__STREAM_ENCODER_OK; int ret = 0; @@ -1700,14 +1515,6 @@ int EncoderSession_finish_ok(EncoderSession *e, int info_align_carry, int info_a print_verify_error(e); ret = 1; } - else { - if(info_align_carry >= 0) { - flac__utils_printf(stderr, 1, "%s: INFO: sector alignment causing %d samples to be carried over\n", e->inbasefilename, info_align_carry); - } - if(info_align_zero >= 0) { - flac__utils_printf(stderr, 1, "%s: INFO: sector alignment causing %d zero samples to be appended\n", e->inbasefilename, info_align_zero); - } - } /*@@@@@@ should this go here or somewhere else? */ if(ret == 0 && foreign_metadata) { @@ -1718,6 +1525,22 @@ int EncoderSession_finish_ok(EncoderSession *e, int info_align_carry, int info_a } } + if (e->compression_ratio >= 1.0 && error_on_compression_fail) { + flac__utils_printf(stderr, 1, + "FAILURE: Compression failed (ratio %0.3f, should be < 1.0).\n" + "This happens for some files for one or more of the following reasons:\n" + " * Recompressing an existing FLAC from a higher to a lower compression setting.\n" + " * Insufficient input data (e.g. very short files, < 10000 frames).\n" + " * The audio data is not compressible (e.g. a full range white noise signal).\n" + , e->compression_ratio); + ret = 1; + } + +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* Always delete output file when fuzzing */ + flac_unlink(e->outfilename); +#endif + EncoderSession_destroy(e); return ret; @@ -1730,19 +1553,24 @@ int EncoderSession_finish_error(EncoderSession *e) if(e->total_samples_to_encode > 0) flac__utils_printf(stderr, 2, "\n"); - if(FLAC__stream_encoder_get_state(e->encoder) == FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA) + if(FLAC__stream_encoder_get_state(e->encoder) == FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA) { print_verify_error(e); - else if(e->outputfile_opened) + EncoderSession_destroy(e); + } + else if(e->outputfile_opened) { /* only want to delete the file if we opened it; otherwise it could be an existing file and our overwrite failed */ - unlink(e->outfilename); - - EncoderSession_destroy(e); + /* Windows cannot unlink an open file, so close it first */ + EncoderSession_destroy(e); + flac_unlink(e->outfilename); + } + else + EncoderSession_destroy(e); return 1; } typedef struct { - unsigned num_metadata; + uint32_t num_metadata; FLAC__bool *needs_delete; FLAC__StreamMetadata **metadata; FLAC__StreamMetadata *cuesheet; /* always needs to be deleted */ @@ -1758,7 +1586,7 @@ static void static_metadata_init(static_metadata_t *m) static void static_metadata_clear(static_metadata_t *m) { - unsigned i; + uint32_t i; for(i = 0; i < m->num_metadata; i++) if(m->needs_delete[i]) FLAC__metadata_object_delete(m->metadata[i]); @@ -1774,10 +1602,10 @@ static void static_metadata_clear(static_metadata_t *m) static FLAC__bool static_metadata_append(static_metadata_t *m, FLAC__StreamMetadata *d, FLAC__bool needs_delete) { void *x; - if(0 == (x = safe_realloc_muladd2_(m->metadata, sizeof(*m->metadata), /*times (*/m->num_metadata, /*+*/1/*)*/))) + if(0 == (x = safe_realloc_nofree_muladd2_(m->metadata, sizeof(*m->metadata), /*times (*/m->num_metadata, /*+*/1/*)*/))) return false; m->metadata = (FLAC__StreamMetadata**)x; - if(0 == (x = safe_realloc_muladd2_(m->needs_delete, sizeof(*m->needs_delete), /*times (*/m->num_metadata, /*+*/1/*)*/))) + if(0 == (x = safe_realloc_nofree_muladd2_(m->needs_delete, sizeof(*m->needs_delete), /*times (*/m->num_metadata, /*+*/1/*)*/))) return false; m->needs_delete = (FLAC__bool*)x; m->metadata[m->num_metadata] = d; @@ -1786,12 +1614,16 @@ static FLAC__bool static_metadata_append(static_metadata_t *m, FLAC__StreamMetad return true; } -FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t options, FLAC__uint32 channel_mask, unsigned channels, unsigned bps, unsigned sample_rate, const foreign_metadata_t *foreign_metadata, FLACDecoderData *flac_decoder_data) +FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t options) { + const uint32_t channels = e->info.channels; + const uint32_t bps = e->info.bits_per_sample - e->info.shift; + const uint32_t sample_rate = e->info.sample_rate; + FLACDecoderData *flac_decoder_data = (e->format == FORMAT_FLAC || e->format == FORMAT_OGGFLAC)? &e->fmt.flac.client_data : 0; FLAC__StreamMetadata padding; FLAC__StreamMetadata **metadata = 0; static_metadata_t static_metadata; - unsigned num_metadata = 0, i; + uint32_t num_metadata = 0, ic; FLAC__StreamEncoderInitStatus init_status; const FLAC__bool is_cdda = (channels == 1 || channels == 2) && (bps == 16) && (sample_rate == 44100); char apodizations[2000]; @@ -1801,9 +1633,6 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio static_metadata_init(&static_metadata); e->replay_gain = options.replay_gain; - e->channels = channels; - e->bits_per_sample = bps; - e->sample_rate = sample_rate; apodizations[0] = '\0'; @@ -1824,7 +1653,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio } } - if(!parse_cuesheet(&static_metadata.cuesheet, options.cuesheet_filename, e->inbasefilename, is_cdda, e->total_samples_to_encode, e->treat_warnings_as_errors)) + if(!parse_cuesheet(&static_metadata.cuesheet, options.cuesheet_filename, e->inbasefilename, sample_rate, is_cdda, e->total_samples_to_encode, e->treat_warnings_as_errors)) return false; if(!convert_to_seek_table_template(options.requested_seek_points, options.num_requested_seek_points, options.cued_seekpoints? static_metadata.cuesheet : 0, e)) { @@ -1840,6 +1669,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio * metadata as the basis for the encoded file */ { + uint32_t i; /* * first handle pictures: simple append any --pictures * specified. @@ -1869,7 +1699,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio if(flac_decoder_data->metadata_blocks[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) vc_found = true; if(flac_decoder_data->metadata_blocks[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT && options.vorbis_comment->data.vorbis_comment.num_comments > 0) { - (void) flac__utils_get_channel_mask_tag(flac_decoder_data->metadata_blocks[i], &channel_mask); + (void) flac__utils_get_channel_mask_tag(flac_decoder_data->metadata_blocks[i], &e->info.channel_mask); flac__utils_printf(stderr, 1, "%s: WARNING, replacing tags from input FLAC file with those given on the command-line\n", e->inbasefilename); if(e->treat_warnings_as_errors) { static_metadata_clear(&static_metadata); @@ -1885,7 +1715,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio if((!vc_found || options.vorbis_comment->data.vorbis_comment.num_comments > 0) && flac_decoder_data->num_metadata_blocks < sizeof(flac_decoder_data->metadata_blocks)/sizeof(flac_decoder_data->metadata_blocks[0])) { /* prepend ours */ FLAC__StreamMetadata *vc = FLAC__metadata_object_clone(options.vorbis_comment); - if(0 == vc || (channel_mask && !flac__utils_set_channel_mask_tag(vc, channel_mask))) { + if(0 == vc || (e->info.channel_mask && !flac__utils_set_channel_mask_tag(vc, e->info.channel_mask))) { flac__utils_printf(stderr, 1, "%s: ERROR allocating memory for VORBIS_COMMENT block\n", e->inbasefilename); static_metadata_clear(&static_metadata); return false; @@ -1916,7 +1746,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio } existing_cuesheet_is_bad = true; } - else if(e->total_samples_to_encode != cs->tracks[cs->num_tracks-1].offset) { + else if(cs->num_tracks > 0 && e->total_samples_to_encode != cs->tracks[cs->num_tracks-1].offset) { flac__utils_printf(stderr, 1, "%s: WARNING, lead-out offset of cuesheet in input FLAC file does not match input length, dropping existing cuesheet...\n", e->inbasefilename); if(e->treat_warnings_as_errors) { static_metadata_clear(&static_metadata); @@ -2036,8 +1866,15 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio flac_decoder_data->num_metadata_blocks = j; if(options.padding > 0) p = options.padding; - if(p < 0) - p = e->total_samples_to_encode / e->sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8; + if(p < 0) { + if(sample_rate == 0) + p = FLAC_ENCODE__DEFAULT_PADDING; + else + p = e->total_samples_to_encode / sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8; + } + if(p > 0) + p += (e->replay_gain ? GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED : 0); + p = min(p, (int)((1u << FLAC__STREAM_METADATA_LENGTH_LEN) - 1)); if(options.padding != 0) { if(p > 0 && flac_decoder_data->num_metadata_blocks < sizeof(flac_decoder_data->metadata_blocks)/sizeof(flac_decoder_data->metadata_blocks[0])) { flac_decoder_data->metadata_blocks[flac_decoder_data->num_metadata_blocks] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); @@ -2060,20 +1897,26 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio * we're not encoding from FLAC so we will build the metadata * from scratch */ + const foreign_metadata_t *foreign_metadata = EncoderSession_format_is_iff(e)? options.format_options.iff.foreign_metadata : 0; + uint32_t i; + if(e->seek_table_template->data.seek_table.num_points > 0) { e->seek_table_template->is_last = false; /* the encoder will set this for us */ static_metadata_append(&static_metadata, e->seek_table_template, /*needs_delete=*/false); } if(0 != static_metadata.cuesheet) static_metadata_append(&static_metadata, static_metadata.cuesheet, /*needs_delete=*/false); - if(channel_mask) { - if(!flac__utils_set_channel_mask_tag(options.vorbis_comment, channel_mask)) { + if(e->info.channel_mask) { + options.vorbis_comment_with_channel_mask_tag = FLAC__metadata_object_clone(options.vorbis_comment); + if(!flac__utils_set_channel_mask_tag(options.vorbis_comment_with_channel_mask_tag, e->info.channel_mask)) { flac__utils_printf(stderr, 1, "%s: ERROR adding channel mask tag\n", e->inbasefilename); static_metadata_clear(&static_metadata); return false; } + static_metadata_append(&static_metadata, options.vorbis_comment_with_channel_mask_tag, /*needs_delete=*/true); } - static_metadata_append(&static_metadata, options.vorbis_comment, /*needs_delete=*/false); + else + static_metadata_append(&static_metadata, options.vorbis_comment, /*needs_delete=*/false); for(i = 0; i < options.num_pictures; i++) static_metadata_append(&static_metadata, options.pictures[i], /*needs_delete=*/false); if(foreign_metadata) { @@ -2086,13 +1929,16 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio } static_metadata_append(&static_metadata, p, /*needs_delete=*/true); static_metadata.metadata[static_metadata.num_metadata-1]->length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8 + foreign_metadata->blocks[i].size; -/*fprintf(stderr,"@@@@@@ add PADDING=%u\n",static_metadata.metadata[static_metadata.num_metadata-1]->length);*/ } } if(options.padding != 0) { padding.is_last = false; /* the encoder will set this for us */ padding.type = FLAC__METADATA_TYPE_PADDING; - padding.length = (unsigned)(options.padding>0? options.padding : (e->total_samples_to_encode / e->sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8)); + if(sample_rate == 0) + padding.length = (uint32_t)(options.padding>0? options.padding : FLAC_ENCODE__DEFAULT_PADDING) + (e->replay_gain ? GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED : 0); + else + padding.length = (uint32_t)(options.padding>0? options.padding : (e->total_samples_to_encode / sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8)) + (e->replay_gain ? GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED : 0); + padding.length = min(padding.length, (1u << FLAC__STREAM_METADATA_LENGTH_LEN) - 1); static_metadata_append(&static_metadata, &padding, /*needs_delete=*/false); } metadata = static_metadata.metadata; @@ -2114,62 +1960,71 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio FLAC__stream_encoder_set_channels(e->encoder, channels); FLAC__stream_encoder_set_bits_per_sample(e->encoder, bps); FLAC__stream_encoder_set_sample_rate(e->encoder, sample_rate); - for(i = 0; i < options.num_compression_settings; i++) { - switch(options.compression_settings[i].type) { + for(ic = 0; ic < options.num_compression_settings; ic++) { + switch(options.compression_settings[ic].type) { case CST_BLOCKSIZE: - FLAC__stream_encoder_set_blocksize(e->encoder, options.compression_settings[i].value.t_unsigned); + FLAC__stream_encoder_set_blocksize(e->encoder, options.compression_settings[ic].value.t_unsigned); break; case CST_COMPRESSION_LEVEL: - FLAC__stream_encoder_set_compression_level(e->encoder, options.compression_settings[i].value.t_unsigned); + FLAC__stream_encoder_set_compression_level(e->encoder, options.compression_settings[ic].value.t_unsigned); apodizations[0] = '\0'; break; case CST_DO_MID_SIDE: - FLAC__stream_encoder_set_do_mid_side_stereo(e->encoder, options.compression_settings[i].value.t_bool); + FLAC__stream_encoder_set_do_mid_side_stereo(e->encoder, options.compression_settings[ic].value.t_bool); break; case CST_LOOSE_MID_SIDE: - FLAC__stream_encoder_set_loose_mid_side_stereo(e->encoder, options.compression_settings[i].value.t_bool); + FLAC__stream_encoder_set_loose_mid_side_stereo(e->encoder, options.compression_settings[ic].value.t_bool); break; case CST_APODIZATION: - if(strlen(apodizations)+strlen(options.compression_settings[i].value.t_string)+2 >= sizeof(apodizations)) { + if(strlen(apodizations)+strlen(options.compression_settings[ic].value.t_string)+2 >= sizeof(apodizations)) { flac__utils_printf(stderr, 1, "%s: ERROR: too many apodization functions requested\n", e->inbasefilename); static_metadata_clear(&static_metadata); return false; } else { - strcat(apodizations, options.compression_settings[i].value.t_string); - strcat(apodizations, ";"); + safe_strncat(apodizations, options.compression_settings[ic].value.t_string, sizeof(apodizations)); + safe_strncat(apodizations, ";", sizeof(apodizations)); } break; case CST_MAX_LPC_ORDER: - FLAC__stream_encoder_set_max_lpc_order(e->encoder, options.compression_settings[i].value.t_unsigned); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + FLAC__stream_encoder_set_max_lpc_order(e->encoder, options.compression_settings[ic].value.t_unsigned); +#endif break; case CST_QLP_COEFF_PRECISION: - FLAC__stream_encoder_set_qlp_coeff_precision(e->encoder, options.compression_settings[i].value.t_unsigned); + FLAC__stream_encoder_set_qlp_coeff_precision(e->encoder, options.compression_settings[ic].value.t_unsigned); break; case CST_DO_QLP_COEFF_PREC_SEARCH: - FLAC__stream_encoder_set_do_qlp_coeff_prec_search(e->encoder, options.compression_settings[i].value.t_bool); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + FLAC__stream_encoder_set_do_qlp_coeff_prec_search(e->encoder, options.compression_settings[ic].value.t_bool); +#endif break; case CST_DO_ESCAPE_CODING: - FLAC__stream_encoder_set_do_escape_coding(e->encoder, options.compression_settings[i].value.t_bool); + FLAC__stream_encoder_set_do_escape_coding(e->encoder, options.compression_settings[ic].value.t_bool); break; case CST_DO_EXHAUSTIVE_MODEL_SEARCH: - FLAC__stream_encoder_set_do_exhaustive_model_search(e->encoder, options.compression_settings[i].value.t_bool); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + FLAC__stream_encoder_set_do_exhaustive_model_search(e->encoder, options.compression_settings[ic].value.t_bool); +#endif break; case CST_MIN_RESIDUAL_PARTITION_ORDER: - FLAC__stream_encoder_set_min_residual_partition_order(e->encoder, options.compression_settings[i].value.t_unsigned); + FLAC__stream_encoder_set_min_residual_partition_order(e->encoder, options.compression_settings[ic].value.t_unsigned); break; case CST_MAX_RESIDUAL_PARTITION_ORDER: - FLAC__stream_encoder_set_max_residual_partition_order(e->encoder, options.compression_settings[i].value.t_unsigned); + FLAC__stream_encoder_set_max_residual_partition_order(e->encoder, options.compression_settings[ic].value.t_unsigned); break; case CST_RICE_PARAMETER_SEARCH_DIST: - FLAC__stream_encoder_set_rice_parameter_search_dist(e->encoder, options.compression_settings[i].value.t_unsigned); + FLAC__stream_encoder_set_rice_parameter_search_dist(e->encoder, options.compression_settings[ic].value.t_unsigned); break; } } +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION if(*apodizations) FLAC__stream_encoder_set_apodization(e->encoder, apodizations); +#endif FLAC__stream_encoder_set_total_samples_estimate(e->encoder, e->total_samples_to_encode); FLAC__stream_encoder_set_metadata(e->encoder, (num_metadata > 0)? metadata : 0, num_metadata); + FLAC__stream_encoder_set_limit_min_bitrate(e->encoder, options.limit_min_bitrate); FLAC__stream_encoder_disable_constant_subframes(e->encoder, options.debug.disable_constant_subframes); FLAC__stream_encoder_disable_fixed_subframes(e->encoder, options.debug.disable_fixed_subframes); @@ -2182,6 +2037,13 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio } FLAC__stream_encoder_set_do_md5(e->encoder, false); } + else if(e->is_stdout) { + flac__utils_printf(stderr, 1, "%s: WARNING, cannot write back MD5 sum when encoding to stdout\n", e->inbasefilename); + if(e->treat_warnings_as_errors) { + static_metadata_clear(&static_metadata); + return false; + } + } #if FLAC__HAS_OGG if(e->use_ogg) { @@ -2205,20 +2067,22 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio else e->outputfile_opened = true; - e->stats_mask = - (FLAC__stream_encoder_get_do_exhaustive_model_search(e->encoder) && FLAC__stream_encoder_get_do_qlp_coeff_prec_search(e->encoder))? 0x07 : - (FLAC__stream_encoder_get_do_exhaustive_model_search(e->encoder) || FLAC__stream_encoder_get_do_qlp_coeff_prec_search(e->encoder))? 0x0f : - 0x3f; +#if 0 /* in case time.h with clock() isn't available for some reason */ + e->stats_frames_interval = + (FLAC__stream_encoder_get_do_exhaustive_model_search(e->encoder) && FLAC__stream_encoder_get_do_qlp_coeff_prec_search(e->encoder))? 0x1f : + (FLAC__stream_encoder_get_do_exhaustive_model_search(e->encoder) || FLAC__stream_encoder_get_do_qlp_coeff_prec_search(e->encoder))? 0x3f : + 0xff; +#endif static_metadata_clear(&static_metadata); return true; } -FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], unsigned samples) +FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const buffer[], uint32_t samples) { if(e->replay_gain) { - if(!grabbag__replaygain_analyze(buffer, e->channels==2, e->bits_per_sample, samples)) { + if(!grabbag__replaygain_analyze(buffer, e->info.channels==2, e->info.bits_per_sample, samples)) { flac__utils_printf(stderr, 1, "%s: WARNING, error while calculating ReplayGain\n", e->inbasefilename); if(e->treat_warnings_as_errors) return false; @@ -2228,6 +2092,16 @@ FLAC__bool EncoderSession_process(EncoderSession *e, const FLAC__int32 * const b return FLAC__stream_encoder_process(e->encoder, buffer, samples); } +FLAC__bool EncoderSession_format_is_iff(const EncoderSession *e) +{ + return + e->format == FORMAT_WAVE || + e->format == FORMAT_WAVE64 || + e->format == FORMAT_RF64 || + e->format == FORMAT_AIFF || + e->format == FORMAT_AIFF_C; +} + FLAC__bool convert_to_seek_table_template(const char *requested_seek_points, int num_requested_seek_points, FLAC__StreamMetadata *cuesheet, EncoderSession *e) { const FLAC__bool only_placeholders = e->is_stdout; @@ -2236,24 +2110,23 @@ FLAC__bool convert_to_seek_table_template(const char *requested_seek_points, int if(num_requested_seek_points == 0 && 0 == cuesheet) return true; - if(num_requested_seek_points < 0) { #if FLAC__HAS_OGG - /*@@@@@@ workaround ogg bug: too many seekpoints makes table not fit in one page */ - if(e->use_ogg && e->total_samples_to_encode > 0 && e->total_samples_to_encode / e->sample_rate / 10 > 230) - requested_seek_points = "230x;"; - else + if(e->use_ogg) + return true; #endif - requested_seek_points = "10s;"; + + if(num_requested_seek_points < 0) { + requested_seek_points = "10s;"; num_requested_seek_points = 1; } if(num_requested_seek_points > 0) { - if(!grabbag__seektable_convert_specification_to_template(requested_seek_points, only_placeholders, e->total_samples_to_encode, e->sample_rate, e->seek_table_template, &has_real_points)) + if(!grabbag__seektable_convert_specification_to_template(requested_seek_points, only_placeholders, e->total_samples_to_encode, e->info.sample_rate, e->seek_table_template, &has_real_points)) return false; } if(0 != cuesheet) { - unsigned i, j; + uint32_t i, j; const FLAC__StreamMetadata_CueSheet *cs = &cuesheet->data.cue_sheet; for(i = 0; i < cs->num_tracks; i++) { const FLAC__StreamMetadata_CueSheet_Track *tr = cs->tracks+i; @@ -2279,10 +2152,13 @@ FLAC__bool convert_to_seek_table_template(const char *requested_seek_points, int return true; } -FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, unsigned sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input) +FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, const char *inbasefilename, uint32_t sample_rate, FLAC__uint64 skip, FLAC__uint64 total_samples_in_input) { /* convert from mm:ss.sss to sample number if necessary */ - flac__utils_canonicalize_skip_until_specification(spec, sample_rate); + if(!flac__utils_canonicalize_skip_until_specification(spec, sample_rate)) { + flac__utils_printf(stderr, 1, "%s: ERROR, value of --until is too large\n", inbasefilename); + return false; + } /* special case: if "--until=-0", use the special value '0' to mean "end-of-stream" */ if(spec->is_relative && spec->value.samples == 0) { @@ -2324,11 +2200,11 @@ FLAC__bool canonicalize_until_specification(utils__SkipUntilSpecification *spec, return true; } -FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, unsigned num_metadata) +FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metadata, uint32_t num_metadata) { FLAC__bool metadata_picture_has_type1 = false; FLAC__bool metadata_picture_has_type2 = false; - unsigned i; + uint32_t i; FLAC__ASSERT(0 != metadata); for(i = 0; i < num_metadata; i++) { @@ -2371,9 +2247,9 @@ FLAC__bool verify_metadata(const EncoderSession *e, FLAC__StreamMetadata **metad return true; } -FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, unsigned channels, unsigned bps, unsigned shift, size_t *channel_map) +FLAC__bool format_input(FLAC__int32 *dest[], uint32_t wide_samples, FLAC__bool is_big_endian, FLAC__bool is_unsigned_samples, uint32_t channels, uint32_t bps, uint32_t shift, size_t *channel_map) { - unsigned wide_sample, sample, channel, byte; + uint32_t wide_sample, sample, channel; FLAC__int32 *out[FLAC__MAX_CHANNELS]; if(0 == channel_map) { @@ -2387,67 +2263,130 @@ FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool i if(bps == 8) { if(is_unsigned_samples) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - out[channel][wide_sample] = (FLAC__int32)ucbuffer_[sample] - 0x80; + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = (FLAC__int32)ubuffer.u8[sample] - 0x80; } else { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - out[channel][wide_sample] = (FLAC__int32)scbuffer_[sample]; + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = (FLAC__int32)ubuffer.s8[sample]; } } else if(bps == 16) { - if(is_big_endian != is_big_endian_host_) { - unsigned char tmp; - const unsigned bytes = wide_samples * channels * (bps >> 3); - for(byte = 0; byte < bytes; byte += 2) { - tmp = ucbuffer_[byte]; - ucbuffer_[byte] = ucbuffer_[byte+1]; - ucbuffer_[byte+1] = tmp; - } - } if(is_unsigned_samples) { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - out[channel][wide_sample] = (FLAC__int32)usbuffer_[sample] - 0x8000; + if(is_big_endian != is_big_endian_host_) { + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = (FLAC__int32)(ENDSWAP_16(ubuffer.u16[sample])) - 0x8000; + } + else { + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = (FLAC__int32)ubuffer.u16[sample] - 0x8000; + } } else { - for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) - out[channel][wide_sample] = (FLAC__int32)ssbuffer_[sample]; + if(is_big_endian != is_big_endian_host_) { + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = (int16_t)(ENDSWAP_16(ubuffer.s16[sample])); + + } + else { + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = ubuffer.s16[sample]; + } } } else if(bps == 24) { if(!is_big_endian) { - unsigned char tmp; - const unsigned bytes = wide_samples * channels * (bps >> 3); - for(byte = 0; byte < bytes; byte += 3) { - tmp = ucbuffer_[byte]; - ucbuffer_[byte] = ucbuffer_[byte+2]; - ucbuffer_[byte+2] = tmp; + if(is_unsigned_samples) { + for(channel = 0; channel < channels; channel++) { + uint32_t b = 3*channel; + for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) { + uint32_t t; + t = ubuffer.u8[b]; + t |= (uint32_t)(ubuffer.u8[b+1]) << 8; + t |= (uint32_t)(ubuffer.u8[b+2]) << 16; + out[channel][wide_sample] = (FLAC__int32)t - 0x800000; + b += 3*channels; + } + } } - } - if(is_unsigned_samples) { - for(byte = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) { - out[channel][wide_sample] = ucbuffer_[byte++]; out[channel][wide_sample] <<= 8; - out[channel][wide_sample] |= ucbuffer_[byte++]; out[channel][wide_sample] <<= 8; - out[channel][wide_sample] |= ucbuffer_[byte++]; - out[channel][wide_sample] -= 0x800000; + else { + for(channel = 0; channel < channels; channel++) { + uint32_t b = 3*channel; + for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) { + uint32_t t; + t = ubuffer.u8[b]; + t |= (uint32_t)(ubuffer.u8[b+1]) << 8; + t |= (uint32_t)((int32_t)(ubuffer.s8[b+2])) << 16; + out[channel][wide_sample] = t; + b += 3*channels; + } } + } } else { - for(byte = sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) - for(channel = 0; channel < channels; channel++, sample++) { - out[channel][wide_sample] = scbuffer_[byte++]; out[channel][wide_sample] <<= 8; - out[channel][wide_sample] |= ucbuffer_[byte++]; out[channel][wide_sample] <<= 8; - out[channel][wide_sample] |= ucbuffer_[byte++]; + if(is_unsigned_samples) { + for(channel = 0; channel < channels; channel++) { + uint32_t b = 3*channel; + for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) { + uint32_t t; + t = ubuffer.u8[b]; t <<= 8; + t |= ubuffer.u8[b+1]; t <<= 8; + t |= ubuffer.u8[b+2]; + out[channel][wide_sample] = (FLAC__int32)t - 0x800000; + b += 3*channels; + } + } + } + else { + for(channel = 0; channel < channels; channel++) { + uint32_t b = 3*channel; + for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) { + uint32_t t; + t = ubuffer.s8[b]; t <<= 8; + t |= ubuffer.u8[b+1]; t <<= 8; + t |= ubuffer.u8[b+2]; + out[channel][wide_sample] = t; + b += 3*channels; + } } + } + } + } + else if(bps == 32) { + if(is_unsigned_samples) { + if(is_big_endian != is_big_endian_host_) { + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = ENDSWAP_32(ubuffer.u32[sample]) - 0x80000000; + } + else { + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = ubuffer.u32[sample] - 0x80000000; + } + } + else { + if(is_big_endian != is_big_endian_host_) { + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = ENDSWAP_32(ubuffer.s32[sample]); + } + else { + for(channel = 0; channel < channels; channel++) + for(sample = channel, wide_sample = 0; wide_sample < wide_samples; wide_sample++, sample+=channels) + out[channel][wide_sample] = ubuffer.s32[sample]; + } } } else { - FLAC__ASSERT(0); + flac__utils_printf(stderr, 1, "ERROR: unsupported input format\n"); + return false; } if(shift > 0) { FLAC__int32 mask = (1<<shift)-1; @@ -2463,23 +2402,40 @@ FLAC__bool format_input(FLAC__int32 *dest[], unsigned wide_samples, FLAC__bool i return true; } -void encoder_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_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) { - EncoderSession *encoder_session = (EncoderSession*)client_data; + EncoderSession *e = (EncoderSession*)client_data; + + const FLAC__uint64 uesize = e->unencoded_size; - (void)encoder, (void)total_frames_estimate; + (void)encoder, (void)total_frames_estimate, (void) frames_written; - encoder_session->bytes_written = bytes_written; - encoder_session->samples_written = samples_written; + e->bytes_written = bytes_written; + e->samples_written = samples_written; - if(encoder_session->total_samples_to_encode > 0 && !((frames_written-1) & encoder_session->stats_mask)) - print_stats(encoder_session); + e->progress = e->total_samples_to_encode ? (double)samples_written / (double)e->total_samples_to_encode : 0; + e->compression_ratio = (e->progress && uesize) ? (double)e->bytes_written / ((double)uesize * min(1.0, e->progress)) : 0; + +#if 0 /* in case time.h with clock() isn't available for some reason */ + if(e->total_samples_to_encode > 0 && frames_written - e->old_frames_written > e->stats_frames_interval) { + print_stats(e); + e->old_frames_written = frames_written; + } +#else + if(e->total_samples_to_encode > 0 && (clock() - e->old_clock_t) > (CLOCKS_PER_SEC/4)) { + print_stats(e); + e->old_clock_t = clock(); + } + +#endif } FLAC__StreamDecoderReadStatus flac_decoder_read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) { size_t n = 0; - FLACDecoderData *data = (FLACDecoderData*)client_data; + EncoderSession *e = (EncoderSession*)client_data; + FLACDecoderData *data = &e->fmt.flac.client_data; + (void)decoder; if (data->fatal_error) @@ -2496,8 +2452,8 @@ FLAC__StreamDecoderReadStatus flac_decoder_read_callback(const FLAC__StreamDecod /* get the rest from file */ if (*bytes > n) { - *bytes = n + fread(buffer, 1, *bytes-n, data->encoder_session->fin); - if(ferror(data->encoder_session->fin)) + *bytes = n + fread(buffer, 1, *bytes-n, e->fin); + if(ferror(e->fin)) return FLAC__STREAM_DECODER_READ_STATUS_ABORT; else if(0 == *bytes) return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; @@ -2510,10 +2466,10 @@ FLAC__StreamDecoderReadStatus flac_decoder_read_callback(const FLAC__StreamDecod FLAC__StreamDecoderSeekStatus flac_decoder_seek_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) { - FLACDecoderData *data = (FLACDecoderData*)client_data; + EncoderSession *e = (EncoderSession*)client_data; (void)decoder; - if(fseeko(data->encoder_session->fin, (off_t)absolute_byte_offset, SEEK_SET) < 0) + if(fseeko(e->fin, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0) return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; else return FLAC__STREAM_DECODER_SEEK_STATUS_OK; @@ -2521,11 +2477,11 @@ FLAC__StreamDecoderSeekStatus flac_decoder_seek_callback(const FLAC__StreamDecod FLAC__StreamDecoderTellStatus flac_decoder_tell_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) { - FLACDecoderData *data = (FLACDecoderData*)client_data; - off_t pos; + EncoderSession *e = (EncoderSession*)client_data; + FLAC__off_t pos; (void)decoder; - if((pos = ftello(data->encoder_session->fin)) < 0) + if((pos = ftello(e->fin)) < 0) return FLAC__STREAM_DECODER_TELL_STATUS_ERROR; else { *absolute_byte_offset = (FLAC__uint64)pos; @@ -2535,10 +2491,11 @@ FLAC__StreamDecoderTellStatus flac_decoder_tell_callback(const FLAC__StreamDecod FLAC__StreamDecoderLengthStatus flac_decoder_length_callback(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) { - FLACDecoderData *data = (FLACDecoderData*)client_data; + const EncoderSession *e = (EncoderSession*)client_data; + const FLACDecoderData *data = &e->fmt.flac.client_data; (void)decoder; - if(0 == data->filesize) + if(data->filesize < 0) return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; else { *stream_length = (FLAC__uint64)data->filesize; @@ -2548,20 +2505,33 @@ FLAC__StreamDecoderLengthStatus flac_decoder_length_callback(const FLAC__StreamD FLAC__bool flac_decoder_eof_callback(const FLAC__StreamDecoder *decoder, void *client_data) { - FLACDecoderData *data = (FLACDecoderData*)client_data; + EncoderSession *e = (EncoderSession*)client_data; (void)decoder; - return feof(data->encoder_session->fin)? true : false; + return feof(e->fin)? true : false; } FLAC__StreamDecoderWriteStatus flac_decoder_write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) { - FLACDecoderData *data = (FLACDecoderData*)client_data; + EncoderSession *e = (EncoderSession*)client_data; + FLACDecoderData *data = &e->fmt.flac.client_data; FLAC__uint64 n = min(data->samples_left_to_process, frame->header.blocksize); (void)decoder; - if(!EncoderSession_process(data->encoder_session, buffer, (unsigned)n)) { - print_error_with_state(data->encoder_session, "ERROR during encoding"); + /* Do some checks */ + if(frame->header.channels != e->info.channels) { + print_error_with_state(e, "ERROR: number of channels of input changed mid-stream"); + data->fatal_error = true; + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } + if(frame->header.bits_per_sample > e->info.bits_per_sample) { + print_error_with_state(e, "ERROR: bits-per-sample of input changed mid-stream"); + data->fatal_error = true; + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } + + if(!EncoderSession_process(e, buffer, (uint32_t)n)) { + print_error_with_state(e, "ERROR during encoding"); data->fatal_error = true; return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; } @@ -2572,7 +2542,8 @@ FLAC__StreamDecoderWriteStatus flac_decoder_write_callback(const FLAC__StreamDec void flac_decoder_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) { - FLACDecoderData *data = (FLACDecoderData*)client_data; + EncoderSession *e = (EncoderSession*)client_data; + FLACDecoderData *data = &e->fmt.flac.client_data; (void)decoder; if (data->fatal_error) @@ -2589,18 +2560,20 @@ void flac_decoder_metadata_callback(const FLAC__StreamDecoder *decoder, const FL void flac_decoder_error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) { - FLACDecoderData *data = (FLACDecoderData*)client_data; + EncoderSession *e = (EncoderSession*)client_data; + FLACDecoderData *data = &e->fmt.flac.client_data; (void)decoder; - flac__utils_printf(stderr, 1, "%s: ERROR got %s while decoding FLAC input\n", data->encoder_session->inbasefilename, FLAC__StreamDecoderErrorStatusString[status]); - if(!data->encoder_session->continue_through_decode_errors) + stats_print_name(1, e->inbasefilename); + flac__utils_printf(stderr, 1, "ERROR got %s while decoding FLAC input\n", FLAC__StreamDecoderErrorStatusString[status]); + if(!e->continue_through_decode_errors) data->fatal_error = true; } -FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors) +FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_filename, const char *inbasefilename, uint32_t sample_rate, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset, FLAC__bool treat_warnings_as_errors) { FILE *f; - unsigned last_line_read; + uint32_t last_line_read; const char *error_message; if(0 == cuesheet_filename) @@ -2611,12 +2584,12 @@ FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_ return false; } - if(0 == (f = fopen(cuesheet_filename, "r"))) { + if(0 == (f = flac_fopen(cuesheet_filename, "r"))) { flac__utils_printf(stderr, 1, "%s: ERROR opening cuesheet \"%s\" for reading: %s\n", inbasefilename, cuesheet_filename, strerror(errno)); return false; } - *cuesheet = grabbag__cuesheet_parse(f, &error_message, &last_line_read, is_cdda, lead_out_offset); + *cuesheet = grabbag__cuesheet_parse(f, &error_message, &last_line_read, sample_rate, is_cdda, lead_out_offset); fclose(f); @@ -2641,30 +2614,30 @@ FLAC__bool parse_cuesheet(FLAC__StreamMetadata **cuesheet, const char *cuesheet_ return true; } -void print_stats(const EncoderSession *encoder_session) +static void print_stats(const EncoderSession *encoder_session) { - const FLAC__uint64 samples_written = min(encoder_session->total_samples_to_encode, encoder_session->samples_written); -#if defined _MSC_VER || defined __MINGW32__ - /* with MSVC you have to spoon feed it the casting */ - const double progress = (double)(FLAC__int64)samples_written / (double)(FLAC__int64)encoder_session->total_samples_to_encode; - const double ratio = (double)(FLAC__int64)encoder_session->bytes_written / ((double)(FLAC__int64)encoder_session->unencoded_size * min(1.0, progress)); -#else - const double progress = (double)samples_written / (double)encoder_session->total_samples_to_encode; - const double ratio = (double)encoder_session->bytes_written / ((double)encoder_session->unencoded_size * min(1.0, progress)); -#endif + if(flac__utils_verbosity_ >= 2) { + char ratiostr[16]; - FLAC__ASSERT(encoder_session->total_samples_to_encode > 0); + FLAC__ASSERT(encoder_session->total_samples_to_encode > 0); - if(samples_written == encoder_session->total_samples_to_encode) { - flac__utils_printf(stderr, 2, "\r%s:%s wrote %u bytes, ratio=%0.3f", - encoder_session->inbasefilename, - encoder_session->verify? " Verify OK," : "", - (unsigned)encoder_session->bytes_written, - ratio - ); - } - else { - flac__utils_printf(stderr, 2, "\r%s: %u%% complete, ratio=%0.3f", encoder_session->inbasefilename, (unsigned)floor(progress * 100.0 + 0.5), ratio); + if (encoder_session->compression_ratio > 0.0) + flac_snprintf(ratiostr, sizeof(ratiostr), "%0.3f", encoder_session->compression_ratio); + else + flac_snprintf(ratiostr, sizeof(ratiostr), "N/A"); + + if(encoder_session->samples_written == encoder_session->total_samples_to_encode) { + stats_print_name(2, encoder_session->inbasefilename); + stats_print_info(2, "%swrote %" PRIu64 " bytes, ratio=%s", + encoder_session->verify? "Verify OK, " : "", + encoder_session->bytes_written, + ratiostr + ); + } + else { + stats_print_name(2, encoder_session->inbasefilename); + stats_print_info(2, "%u%% complete, ratio=%s", (uint32_t)floor(encoder_session->progress * 100.0 + 0.5), ratiostr); + } } } @@ -2694,7 +2667,12 @@ void print_error_with_init_status(const EncoderSession *e, const char *message, "\n" "An error occurred opening the output file; it is likely that the output\n" "directory does not exist or is not writable, the output file already exists and\n" +#ifdef _WIN32 + "is not writeable, the disk is full or the file has a filename that exceeds the\n" + "path length limit.\n" +#else "is not writable, or the disk is full.\n" +#endif ); } } @@ -2704,7 +2682,7 @@ void print_error_with_init_status(const EncoderSession *e, const char *message, "The encoding parameters specified do not conform to the FLAC Subset and may not\n" "be streamable or playable in hardware devices. If you really understand the\n" "consequences, you can add --lax to the command-line options to encode with\n" - "these parameters anyway. See http://flac.sourceforge.net/format.html#subset\n" + "these parameters anyway. See http://xiph.org/flac/format.html#subset\n" ); } } @@ -2732,33 +2710,33 @@ void print_error_with_state(const EncoderSession *e, const char *message) void print_verify_error(EncoderSession *e) { FLAC__uint64 absolute_sample; - unsigned frame_number; - unsigned channel; - unsigned sample; + uint32_t frame_number; + uint32_t channel; + uint32_t sample; FLAC__int32 expected; FLAC__int32 got; FLAC__stream_encoder_get_verify_decoder_error_stats(e->encoder, &absolute_sample, &frame_number, &channel, &sample, &expected, &got); flac__utils_printf(stderr, 1, "%s: ERROR: mismatch in decoded data, verify FAILED!\n", e->inbasefilename); - flac__utils_printf(stderr, 1, " Absolute sample=%u, frame=%u, channel=%u, sample=%u, expected %d, got %d\n", (unsigned)absolute_sample, frame_number, channel, sample, expected, got); + flac__utils_printf(stderr, 1, " Absolute sample=%" PRIu64 ", frame=%u, channel=%u, sample=%u, expected %d, got %d\n", absolute_sample, frame_number, channel, sample, expected, got); flac__utils_printf(stderr, 1, " In all known cases, verify errors are caused by hardware problems,\n"); flac__utils_printf(stderr, 1, " usually overclocking or bad RAM. Delete %s\n", e->outfilename); flac__utils_printf(stderr, 1, " and repeat the flac command exactly as before. If it does not give a\n"); flac__utils_printf(stderr, 1, " verify error in the exact same place each time you try it, then there is\n"); flac__utils_printf(stderr, 1, " a problem with your hardware; please see the FAQ:\n"); - flac__utils_printf(stderr, 1, " http://flac.sourceforge.net/faq.html#tools__hardware_prob\n"); + flac__utils_printf(stderr, 1, " http://xiph.org/flac/faq.html#tools__hardware_prob\n"); flac__utils_printf(stderr, 1, " If it does fail in the exact same place every time, keep\n"); flac__utils_printf(stderr, 1, " %s and submit a bug report to:\n", e->outfilename); - flac__utils_printf(stderr, 1, " https://sourceforge.net/bugs/?func=addbug&group_id=13478\n"); + flac__utils_printf(stderr, 1, " https://github.com/xiph/flac/issues\n"); flac__utils_printf(stderr, 1, " Make sure to upload the FLAC file and use the \"Monitor\" feature to\n"); flac__utils_printf(stderr, 1, " monitor the bug status.\n"); flac__utils_printf(stderr, 1, "Verify FAILED! Do not trust %s\n", e->outfilename); } -FLAC__bool read_little_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ok, const char *fn) +FLAC__bool read_bytes(FILE *f, FLAC__byte *buf, size_t n, FLAC__bool eof_ok, const char *fn) { - size_t bytes_read = fread(val, 1, 2, f); + size_t bytes_read = fread(buf, 1, n, f); if(bytes_read == 0) { if(!eof_ok) { @@ -2768,148 +2746,102 @@ FLAC__bool read_little_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ else return true; } - else if(bytes_read < 2) { + if(bytes_read < n) { flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); return false; } - else { - if(is_big_endian_host_) { - FLAC__byte tmp, *b = (FLAC__byte*)val; - tmp = b[1]; b[1] = b[0]; b[0] = tmp; - } - return true; - } + return true; } -FLAC__bool read_little_endian_uint32(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn) +FLAC__bool read_uint16(FILE *f, FLAC__bool big_endian, FLAC__uint16 *val, const char *fn) { - size_t bytes_read = fread(val, 1, 4, f); - - if(bytes_read == 0) { - if(!eof_ok) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); - return false; - } - else - return true; - } - else if(bytes_read < 4) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); + if(!read_bytes(f, (FLAC__byte*)val, 2, /*eof_ok=*/false, fn)) return false; + if(is_big_endian_host_ != big_endian) { + FLAC__byte tmp, *b = (FLAC__byte*)val; + tmp = b[1]; b[1] = b[0]; b[0] = tmp; } - else { - if(is_big_endian_host_) { - FLAC__byte tmp, *b = (FLAC__byte*)val; - tmp = b[3]; b[3] = b[0]; b[0] = tmp; - tmp = b[2]; b[2] = b[1]; b[1] = tmp; - } - return true; - } + return true; } -FLAC__bool read_big_endian_uint16(FILE *f, FLAC__uint16 *val, FLAC__bool eof_ok, const char *fn) +FLAC__bool read_uint32(FILE *f, FLAC__bool big_endian, FLAC__uint32 *val, const char *fn) { - unsigned char buf[4]; - size_t bytes_read= fread(buf, 1, 2, f); - - if(bytes_read==0U && eof_ok) - return true; - else if(bytes_read<2U) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); + if(!read_bytes(f, (FLAC__byte*)val, 4, /*eof_ok=*/false, fn)) return false; + if(is_big_endian_host_ != big_endian) { + FLAC__byte tmp, *b = (FLAC__byte*)val; + tmp = b[3]; b[3] = b[0]; b[0] = tmp; + tmp = b[2]; b[2] = b[1]; b[1] = tmp; } - - /* this is independent of host endianness */ - *val= (FLAC__uint16)(buf[0])<<8 | buf[1]; - return true; } -FLAC__bool read_big_endian_uint32(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn) +FLAC__bool read_uint64(FILE *f, FLAC__bool big_endian, FLAC__uint64 *val, const char *fn) { - unsigned char buf[4]; - size_t bytes_read= fread(buf, 1, 4, f); - - if(bytes_read==0U && eof_ok) - return true; - else if(bytes_read<4U) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); + if(!read_bytes(f, (FLAC__byte*)val, 8, /*eof_ok=*/false, fn)) return false; + if(is_big_endian_host_ != big_endian) { + FLAC__byte tmp, *b = (FLAC__byte*)val; + tmp = b[7]; b[7] = b[0]; b[0] = tmp; + tmp = b[6]; b[6] = b[1]; b[1] = tmp; + tmp = b[5]; b[5] = b[2]; b[2] = tmp; + tmp = b[4]; b[4] = b[3]; b[3] = tmp; } - - /* this is independent of host endianness */ - *val= (FLAC__uint32)(buf[0])<<24 | (FLAC__uint32)(buf[1])<<16 | - (FLAC__uint32)(buf[2])<<8 | buf[3]; - return true; } -FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, FLAC__bool eof_ok, const char *fn) +FLAC__bool read_sane_extended(FILE *f, FLAC__uint32 *val, const char *fn) /* Read an IEEE 754 80-bit (aka SANE) extended floating point value from 'f', * convert it into an integral value and store in 'val'. Return false if only - * between 1 and 9 bytes remain in 'f', if 0 bytes remain in 'f' and 'eof_ok' is - * false, or if the value is negative, between zero and one, or too large to be - * represented by 'val'; return true otherwise. + * between 1 and 9 bytes remain in 'f', if 0 bytes remain in 'f', or if the + * value is negative, between zero and one, or too large to be represented by + * 'val'; return true otherwise. */ { - unsigned int i; - unsigned char buf[10]; - size_t bytes_read= fread(buf, 1U, 10U, f); - FLAC__int16 e= ((FLAC__uint16)(buf[0])<<8 | (FLAC__uint16)(buf[1]))-0x3FFF; - FLAC__int16 shift= 63-e; - FLAC__uint64 p= 0U; - - if(bytes_read==0U && eof_ok) - return true; - else if(bytes_read<10U) { - flac__utils_printf(stderr, 1, "%s: ERROR: unexpected EOF\n", fn); + uint32_t i; + FLAC__byte buf[10]; + FLAC__uint64 p = 0; + FLAC__int16 e; + FLAC__int16 shift; + + if(!read_bytes(f, buf, sizeof(buf), /*eof_ok=*/false, fn)) return false; - } - else if((buf[0]>>7)==1U || e<0 || e>63) { + e = ((FLAC__uint16)(buf[0])<<8 | (FLAC__uint16)(buf[1]))-0x3FFF; + shift = 63-e; + if((buf[0]>>7)==1U || e<0 || e>=63) { flac__utils_printf(stderr, 1, "%s: ERROR: invalid floating-point value\n", fn); return false; } - for(i= 0U; i<8U; ++i) - p|= (FLAC__uint64)(buf[i+2])<<(56U-i*8); - *val= (FLAC__uint32)((p>>shift)+(p>>(shift-1) & 0x1)); + for(i = 0; i < 8; ++i) + p |= (FLAC__uint64)(buf[i+2])<<(56U-i*8); + *val = (FLAC__uint32)((p>>shift)+(p>>(shift-1) & 0x1)); return true; } FLAC__bool fskip_ahead(FILE *f, FLAC__uint64 offset) { - static unsigned char dump[8192]; - -#ifdef _MSC_VER - if(f == stdin) { - /* MS' stdio impl can't even seek forward on stdin, have to use pure non-fseek() version: */ - while(offset > 0) { - const long need = (long)min(offset, sizeof(dump)); - if((long)fread(dump, 1, need, f) < need) - return false; - offset -= need; - } - } - else -#endif + static uint8_t dump[8192]; + struct flac_stat_s stb; + + if(flac_fstat(fileno(f), &stb) == 0 && (stb.st_mode & S_IFMT) == S_IFREG) { - while(offset > 0) { - long need = (long)min(offset, LONG_MAX); - if(fseeko(f, need, SEEK_CUR) < 0) { - need = (long)min(offset, sizeof(dump)); - if((long)fread(dump, 1, need, f) < need) - return false; - } - offset -= need; - } + if(fseeko(f, offset, SEEK_CUR) == 0) + return true; + } + while(offset > 0) { + const long need = (long)min(offset, sizeof(dump)); + if((long)fread(dump, 1, need, f) < need) + return false; + offset -= need; } return true; } -unsigned count_channel_mask_bits(FLAC__uint32 mask) +uint32_t count_channel_mask_bits(FLAC__uint32 mask) { - unsigned count = 0; + uint32_t count = 0; while(mask) { if(mask & 1) count++; @@ -2918,19 +2850,3 @@ unsigned count_channel_mask_bits(FLAC__uint32 mask) return count; } -#if 0 -FLAC__uint32 limit_channel_mask(FLAC__uint32 mask, unsigned channels) -{ - FLAC__uint32 x = 0x80000000; - unsigned count = count_channel_mask_bits(mask); - while(x && count > channels) { - if(mask & x) { - mask &= ~x; - count--; - } - x >>= 1; - } - FLAC__ASSERT(count_channel_mask_bits(mask) == channels); - return mask; -} -#endif diff --git a/3rdparty/libflac/src/flac/encode.h b/3rdparty/libflac/src/flac/encode.h index 13ee7d39a02..2d65c506899 100644 --- a/3rdparty/libflac/src/flac/encode.h +++ b/3rdparty/libflac/src/flac/encode.h @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,21 +12,22 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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__encode_h #define flac__encode_h -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include "FLAC/metadata.h" #include "foreign_metadata.h" #include "utils.h" +#include "share/compat.h" extern const int FLAC_ENCODE__DEFAULT_PADDING; @@ -74,19 +76,33 @@ typedef struct { FLAC__bool cued_seekpoints; FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */ - /* options related to --replay-gain and --sector-align */ FLAC__bool is_first_file; FLAC__bool is_last_file; - FLAC__int32 **align_reservoir; - unsigned *align_reservoir_samples; FLAC__bool replay_gain; FLAC__bool ignore_chunk_sizes; - FLAC__bool sector_align; + FLAC__bool error_on_compression_fail; + FLAC__bool limit_min_bitrate; + FLAC__bool relaxed_foreign_metadata_handling; FLAC__StreamMetadata *vorbis_comment; + FLAC__StreamMetadata *vorbis_comment_with_channel_mask_tag; FLAC__StreamMetadata *pictures[64]; unsigned num_pictures; + FileFormat format; + union { + struct { + FLAC__bool is_big_endian; + FLAC__bool is_unsigned_samples; + unsigned channels; + unsigned bps; + unsigned sample_rate; + } raw; + struct { + foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */ + } iff; + } format_options; + struct { FLAC__bool disable_constant_subframes; FLAC__bool disable_fixed_subframes; @@ -95,28 +111,6 @@ typedef struct { } debug; } encode_options_t; -typedef struct { - encode_options_t common; - foreign_metadata_t *foreign_metadata; /* NULL unless --keep-foreign-metadata requested */ -} wav_encode_options_t; - -typedef struct { - encode_options_t common; - - FLAC__bool is_big_endian; - FLAC__bool is_unsigned_samples; - unsigned channels; - unsigned bps; - unsigned sample_rate; -} raw_encode_options_t; - -typedef struct { - encode_options_t common; -} flac_encode_options_t; - -int flac__encode_aif(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options, FLAC__bool is_aifc); -int flac__encode_wav(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, wav_encode_options_t options); -int flac__encode_raw(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, raw_encode_options_t options); -int flac__encode_flac(FILE *infile, off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, unsigned lookahead_length, flac_encode_options_t options, FLAC__bool input_is_ogg); +int flac__encode_file(FILE *infile, FLAC__off_t infilesize, const char *infilename, const char *outfilename, const FLAC__byte *lookahead, uint32_t lookahead_length, encode_options_t options); #endif diff --git a/3rdparty/libflac/src/flac/flac.dsp b/3rdparty/libflac/src/flac/flac.dsp deleted file mode 100644 index ae2ad597d00..00000000000 --- a/3rdparty/libflac/src/flac/flac.dsp +++ /dev/null @@ -1,156 +0,0 @@ -# Microsoft Developer Studio Project File - Name="flac" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=flac - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "flac.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "flac.mak" CFG="flac - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "flac - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "flac - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "flac - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\replaygain_synthesis_static.lib ..\..\obj\release\lib\getopt_static.lib ..\..\obj\release\lib\utf8_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "flac - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\replaygain_synthesis_static.lib ..\..\obj\debug\lib\getopt_static.lib ..\..\obj\debug\lib\utf8_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "flac - Win32 Release" -# Name "flac - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\analyze.c -# End Source File -# Begin Source File - -SOURCE=.\decode.c -# End Source File -# Begin Source File - -SOURCE=.\encode.c -# End Source File -# Begin Source File - -SOURCE=.\foreign_metadata.c -# End Source File -# Begin Source File - -SOURCE=.\main.c -# End Source File -# Begin Source File - -SOURCE=.\local_string_utils.c -# End Source File -# Begin Source File - -SOURCE=.\utils.c -# End Source File -# Begin Source File - -SOURCE=.\vorbiscomment.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\analyze.h -# End Source File -# Begin Source File - -SOURCE=.\decode.h -# End Source File -# Begin Source File - -SOURCE=.\encode.h -# End Source File -# Begin Source File - -SOURCE=.\foreign_metadata.h -# End Source File -# Begin Source File - -SOURCE=.\local_string_utils.h -# End Source File -# Begin Source File - -SOURCE=.\utils.h -# End Source File -# Begin Source File - -SOURCE=.\vorbiscomment.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/flac/flac.vcproj b/3rdparty/libflac/src/flac/flac.vcproj deleted file mode 100644 index 0680364335e..00000000000 --- a/3rdparty/libflac/src/flac/flac.vcproj +++ /dev/null @@ -1,260 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="flac" - ProjectGUID="{4cefbc7d-c215-11db-8314-0800200c9a66}" - RootNamespace="flac" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\analyze.h" - > - </File> - <File - RelativePath=".\decode.h" - > - </File> - <File - RelativePath=".\encode.h" - > - </File> - <File - RelativePath=".\foreign_metadata.h" - > - </File> - <File - RelativePath=".\local_string_utils.h" - > - </File> - <File - RelativePath=".\utils.h" - > - </File> - <File - RelativePath=".\vorbiscomment.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\analyze.c" - > - </File> - <File - RelativePath=".\decode.c" - > - </File> - <File - RelativePath=".\encode.c" - > - </File> - <File - RelativePath=".\foreign_metadata.c" - > - </File> - <File - RelativePath=".\local_string_utils.c" - > - </File> - <File - RelativePath=".\main.c" - > - </File> - <File - RelativePath=".\utils.c" - > - </File> - <File - RelativePath=".\vorbiscomment.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/flac/foreign_metadata.c b/3rdparty/libflac/src/flac/foreign_metadata.c index 3fc5310bbf4..f63fc3e60a5 100644 --- a/3rdparty/libflac/src/flac/foreign_metadata.c +++ b/3rdparty/libflac/src/flac/foreign_metadata.c @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,28 +12,22 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif -#if defined _MSC_VER || defined __MINGW32__ -#include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif #include <stdio.h> /* for FILE etc. */ #include <stdlib.h> /* for calloc() etc. */ #include <string.h> /* for memcmp() etc. */ #include "FLAC/assert.h" #include "FLAC/metadata.h" #include "share/alloc.h" +#include "share/compat.h" #include "foreign_metadata.h" #ifdef min @@ -40,8 +35,7 @@ #endif #define min(x,y) ((x)<(y)?(x):(y)) - -static const char *FLAC__FOREIGN_METADATA_APPLICATION_ID[2] = { "aiff" , "riff" }; +const char *FLAC__FOREIGN_METADATA_APPLICATION_ID[FLAC__FOREIGN_METADATA_NUMBER_OF_RECOGNIZED_APPLICATION_IDS] = { "aiff" , "riff", "w64 " }; static FLAC__uint32 unpack32be_(const FLAC__byte *b) { @@ -53,9 +47,15 @@ static FLAC__uint32 unpack32le_(const FLAC__byte *b) return (FLAC__uint32)b[0] + ((FLAC__uint32)b[1]<<8) + ((FLAC__uint32)b[2]<<16) + ((FLAC__uint32)b[3]<<24); } +static FLAC__uint64 unpack64le_(const FLAC__byte *b) +{ + return (FLAC__uint64)b[0] + ((FLAC__uint64)b[1]<<8) + ((FLAC__uint64)b[2]<<16) + ((FLAC__uint64)b[3]<<24) + ((FLAC__uint64)b[4]<<32) + ((FLAC__uint64)b[5]<<40) + ((FLAC__uint64)b[6]<<48) + ((FLAC__uint64)b[7]<<56); +} + +/* copies 'size' bytes from file 'fin' to 'fout', filling in *error with 'read_error' or 'write_error' as necessary */ static FLAC__bool copy_data_(FILE *fin, FILE *fout, size_t size, const char **error, const char * const read_error, const char * const write_error) { - static FLAC__byte buffer[4096]; + FLAC__byte buffer[4096]; size_t left; for(left = size; left > 0; ) { size_t need = min(sizeof(buffer), left); @@ -72,9 +72,39 @@ static FLAC__bool copy_data_(FILE *fin, FILE *fout, size_t size, const char **er return true; } -static FLAC__bool append_block_(foreign_metadata_t *fm, off_t offset, FLAC__uint32 size, const char **error) +/* compare 'size' bytes from file 'fin' to 'fout', filling in *error with 'read_error' or 'write_error' as necessary */ +static FLAC__bool compare_data_(FILE *fin, FILE *fout, size_t size, const char **error, const char * const read_error, const char * const write_error, const char * const compare_error) { - foreign_block_t *fb = safe_realloc_muladd2_(fm->blocks, sizeof(foreign_block_t), /*times (*/fm->num_blocks, /*+*/1/*)*/); + FLAC__byte buffer_in[4096]; + FLAC__byte buffer_out[4096]; /* sizes need to be the same */ + size_t left; + for(left = size; left > 0; ) { + size_t need = min(sizeof(buffer_in), left); + if(fread(buffer_in, 1, need, fin) < need) { + if(error) *error = read_error; + return false; + } + if(fread(buffer_out, 1, need, fout) < need) { + if(error) *error = write_error; + return false; + } + if(memcmp(buffer_in, buffer_out, need)) { + if(error) *error = compare_error; + return false; + } + left -= need; + } + return true; +} + +static FLAC__bool append_block_(foreign_metadata_t *fm, FLAC__off_t offset, FLAC__uint32 size, const char **error) +{ + foreign_block_t *fb; + if(size >= ((1u << FLAC__STREAM_METADATA_LENGTH_LEN) - FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)) { + if(error) *error = "found foreign metadata chunk is too large (max is 16MiB per chunk)"; + return false; + } + fb = safe_realloc_nofree_muladd2_(fm->blocks, sizeof(foreign_block_t), /*times (*/fm->num_blocks, /*+*/1/*)*/); if(fb) { fb[fm->num_blocks].offset = offset; fb[fm->num_blocks].size = size; @@ -89,7 +119,7 @@ static FLAC__bool append_block_(foreign_metadata_t *fm, off_t offset, FLAC__uint static FLAC__bool read_from_aiff_(foreign_metadata_t *fm, FILE *f, const char **error) { FLAC__byte buffer[12]; - off_t offset, eof_offset; + FLAC__off_t offset, eof_offset; if((offset = ftello(f)) < 0) { if(error) *error = "ftello() error (001)"; return false; @@ -100,7 +130,7 @@ static FLAC__bool read_from_aiff_(foreign_metadata_t *fm, FILE *f, const char ** } if(!append_block_(fm, offset, 12, error)) return false; - eof_offset = 8 + unpack32be_(buffer+4); + eof_offset = (FLAC__off_t)8 + (FLAC__off_t)unpack32be_(buffer+4); while(!feof(f)) { FLAC__uint32 size; if((offset = ftello(f)) < 0) { @@ -148,9 +178,15 @@ static FLAC__bool read_from_aiff_(foreign_metadata_t *fm, FILE *f, const char ** if(error) *error = "invalid AIFF file: seek error (010)"; return false; } + /* WATCHOUT: For SSND we ignore the blockSize and are not saving any + * unaligned part at the end of the chunk. In retrospect it is pretty + * pointless to save the unaligned data before the PCM but now it is + * done and cast in stone. + */ } if(!append_block_(fm, offset, 8 + (memcmp(buffer, "SSND", 4)? size : 8 + fm->ssnd_offset_size), error)) return false; + /* skip to next chunk */ if(fseeko(f, size, SEEK_CUR) < 0) { if(error) *error = "invalid AIFF file: seek error (011)"; return false; @@ -174,20 +210,30 @@ static FLAC__bool read_from_aiff_(foreign_metadata_t *fm, FILE *f, const char ** static FLAC__bool read_from_wave_(foreign_metadata_t *fm, FILE *f, const char **error) { FLAC__byte buffer[12]; - off_t offset, eof_offset; + FLAC__off_t offset, eof_offset = -1, ds64_data_size = -1; if((offset = ftello(f)) < 0) { if(error) *error = "ftello() error (001)"; return false; } - if(fread(buffer, 1, 12, f) < 12 || memcmp(buffer, "RIFF", 4) || memcmp(buffer+8, "WAVE", 4)) { + if(fread(buffer, 1, 12, f) < 12 || (memcmp(buffer, "RIFF", 4) && memcmp(buffer, "RF64", 4)) || memcmp(buffer+8, "WAVE", 4)) { if(error) *error = "unsupported RIFF layout (002)"; return false; } + if(!memcmp(buffer, "RF64", 4)) + fm->is_rf64 = true; + if(fm->is_rf64 && sizeof(FLAC__off_t) < 8) { + if(error) *error = "RF64 is not supported on this compile (r00)"; + return false; + } if(!append_block_(fm, offset, 12, error)) return false; - eof_offset = 8 + unpack32le_(buffer+4); + if(!fm->is_rf64 || unpack32le_(buffer+4) != 0xffffffff) { + eof_offset = (FLAC__off_t)8 + (FLAC__off_t)unpack32le_(buffer+4); + if(eof_offset & 1) /* fix odd RIFF size */ + eof_offset++; + } while(!feof(f)) { - FLAC__uint32 size; + FLAC__off_t size; if((offset = ftello(f)) < 0) { if(error) *error = "ftello() error (003)"; return false; @@ -223,14 +269,77 @@ static FLAC__bool read_from_wave_(foreign_metadata_t *fm, FILE *f, const char ** return false; } fm->audio_block = fm->num_blocks; + if(fm->is_rf64 && fm->num_blocks < 2) { + if(error) *error = "invalid RF64 file: \"data\" chunk before \"ds64\" chunk (r01)"; + return false; + } } if(!append_block_(fm, offset, 8 + (memcmp(buffer, "data", 4)? size : 0), error)) return false; - if(fseeko(f, size, SEEK_CUR) < 0) { - if(error) *error = "invalid WAVE file: seek error (009)"; - return false; + /* parse ds64 chunk if necessary */ + if(fm->is_rf64 && fm->num_blocks == 2) { + FLAC__byte buffer2[7*4]; + if(memcmp(buffer, "ds64", 4)) { + if(error) *error = "invalid RF64 file: \"ds64\" chunk does not immediately follow \"WAVE\" marker (r02)"; + return false; + } + /* unpack the size again since we don't want the padding byte effect */ + size = unpack32le_(buffer+4); + if(size < (FLAC__off_t)sizeof(buffer2)) { + if(error) *error = "invalid RF64 file: \"ds64\" chunk size is < 28 (r03)"; + return false; + } + if(size > (FLAC__off_t)sizeof(buffer2)) { + if(error) *error = "RF64 file has \"ds64\" chunk with extra size table, which is not currently supported (r04)"; + return false; + } + if(fread(buffer2, 1, sizeof(buffer2), f) < sizeof(buffer2)) { + if(error) *error = "unexpected EOF reading \"ds64\" chunk data in RF64 file (r05)"; + return false; + } + ds64_data_size = (FLAC__off_t)unpack64le_(buffer2+8); + if(ds64_data_size == (FLAC__off_t)(-1)) { + if(error) *error = "RF64 file has \"ds64\" chunk with data size == -1 (r08)"; + return false; + } + /* check if pad byte needed */ + if(ds64_data_size & 1) + ds64_data_size++; + /* @@@ [2^63 limit] */ + if(ds64_data_size < 0) { + if(error) *error = "RF64 file too large (r09)"; + return false; + } + if(unpack32le_(buffer2+24)) { + if(error) *error = "RF64 file has \"ds64\" chunk with extra size table, which is not currently supported (r06)"; + return false; + } + eof_offset = (FLAC__off_t)8 + (FLAC__off_t)unpack64le_(buffer2); + /* @@@ [2^63 limit] */ + if((FLAC__off_t)unpack64le_(buffer2) < 0 || eof_offset < 0) { + if(error) *error = "RF64 file too large (r07)"; + return false; + } + } + else { /* skip to next chunk */ + if(fm->is_rf64 && !memcmp(buffer, "data", 4) && unpack32le_(buffer+4) == 0xffffffff) { + if(fseeko(f, ds64_data_size, SEEK_CUR) < 0) { + if(error) *error = "invalid RF64 file: seek error (r10)"; + return false; + } + } + else { + if(fseeko(f, size, SEEK_CUR) < 0) { + if(error) *error = "invalid WAVE file: seek error (009)"; + return false; + } + } } } + if(fm->is_rf64 && eof_offset == (FLAC__off_t)(-1)) { + if(error) *error = "invalid RF64 file: all RIFF sizes are -1 (r11)"; + return false; + } if(eof_offset != ftello(f)) { if(error) *error = "invalid WAVE file: unexpected EOF (010)"; return false; @@ -246,10 +355,98 @@ static FLAC__bool read_from_wave_(foreign_metadata_t *fm, FILE *f, const char ** return true; } +static FLAC__bool read_from_wave64_(foreign_metadata_t *fm, FILE *f, const char **error) +{ + FLAC__byte buffer[40]; + FLAC__off_t offset, eof_offset = -1; + if((offset = ftello(f)) < 0) { + if(error) *error = "ftello() error (001)"; + return false; + } + if( + fread(buffer, 1, 40, f) < 40 || + /* RIFF GUID 66666972-912E-11CF-A5D6-28DB04C10000 */ + memcmp(buffer, "\x72\x69\x66\x66\x2E\x91\xCF\x11\xA5\xD6\x28\xDB\x04\xC1\x00\x00", 16) || + /* WAVE GUID 65766177-ACF3-11D3-8CD1-00C04F8EDB8A */ + memcmp(buffer+24, "\x77\x61\x76\x65\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 16) + ) { + if(error) *error = "unsupported Wave64 layout (002)"; + return false; + } + if(sizeof(FLAC__off_t) < 8) { + if(error) *error = "Wave64 is not supported on this compile (r00)"; + return false; + } + if(!append_block_(fm, offset, 40, error)) + return false; + eof_offset = (FLAC__off_t)unpack64le_(buffer+16); /*@@@ [2^63 limit] */ + while(!feof(f)) { + FLAC__uint64 size; + if((offset = ftello(f)) < 0) { + if(error) *error = "ftello() error (003)"; + return false; + } + if((size = fread(buffer, 1, 24, f)) < 24) { + if(size == 0 && feof(f)) + break; + if(error) *error = "invalid Wave64 file (004)"; + return false; + } + size = unpack64le_(buffer+16); + /* check if pad bytes needed */ + if(size & 7) + size = (size+7) & (~((FLAC__uint64)7)); + /* fmt GUID 20746D66-ACF3-11D3-8CD1-00C04F8EDB8A */ + if(!memcmp(buffer, "\x66\x6D\x74\x20\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 16)) { + if(fm->format_block) { + if(error) *error = "invalid Wave64 file: multiple \"fmt \" chunks (005)"; + return false; + } + if(fm->audio_block) { + if(error) *error = "invalid Wave64 file: \"data\" chunk before \"fmt \" chunk (006)"; + return false; + } + fm->format_block = fm->num_blocks; + } + /* data GUID 61746164-ACF3-11D3-8CD1-00C04F8EDB8A */ + else if(!memcmp(buffer, "\x64\x61\x74\x61\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 16)) { + if(fm->audio_block) { + if(error) *error = "invalid Wave64 file: multiple \"data\" chunks (007)"; + return false; + } + if(!fm->format_block) { + if(error) *error = "invalid Wave64 file: \"data\" chunk before \"fmt \" chunk (008)"; + return false; + } + fm->audio_block = fm->num_blocks; + } + if(!append_block_(fm, offset, memcmp(buffer, "\x64\x61\x74\x61\xF3\xAC\xD3\x11\x8C\xD1\x00\xC0\x4F\x8E\xDB\x8A", 16)? (FLAC__uint32)size : 16+8, error)) + return false; + /* skip to next chunk */ + if(fseeko(f, size-24, SEEK_CUR) < 0) { + if(error) *error = "invalid Wave64 file: seek error (009)"; + return false; + } + } + if(eof_offset != ftello(f)) { + if(error) *error = "invalid Wave64 file: unexpected EOF (010)"; + return false; + } + if(!fm->format_block) { + if(error) *error = "invalid Wave64 file: missing \"fmt \" chunk (011)"; + return false; + } + if(!fm->audio_block) { + if(error) *error = "invalid Wave64 file: missing \"data\" chunk (012)"; + return false; + } + return true; +} + static FLAC__bool write_to_flac_(foreign_metadata_t *fm, FILE *fin, FILE *fout, FLAC__Metadata_SimpleIterator *it, const char **error) { FLAC__byte buffer[4]; - const unsigned ID_LEN = FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8; + const uint32_t ID_LEN = FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8; size_t block_num = 0; FLAC__ASSERT(sizeof(buffer) >= ID_LEN); while(block_num < fm->num_blocks) { @@ -304,9 +501,10 @@ static FLAC__bool write_to_flac_(foreign_metadata_t *fm, FILE *fin, FILE *fout, static FLAC__bool read_from_flac_(foreign_metadata_t *fm, FILE *f, FLAC__Metadata_SimpleIterator *it, const char **error) { - FLAC__byte id[4], buffer[12]; - off_t offset; - FLAC__bool type_found = false; + FLAC__byte id[4], buffer[32]; + FLAC__off_t offset; + FLAC__uint32 length; + FLAC__bool first_block = true, type_found = false, ds64_found = false; FLAC__ASSERT(FLAC__STREAM_METADATA_APPLICATION_ID_LEN == sizeof(id)*8); @@ -314,29 +512,54 @@ static FLAC__bool read_from_flac_(foreign_metadata_t *fm, FILE *f, FLAC__Metadat if(FLAC__metadata_simple_iterator_get_block_type(it) != FLAC__METADATA_TYPE_APPLICATION) continue; if(!FLAC__metadata_simple_iterator_get_application_id(it, id)) { - if(error) *error = "FLAC__metadata_simple_iterator_get_application_id() error (003)"; + if(error) *error = "FLAC__metadata_simple_iterator_get_application_id() error (002)"; return false; } - if(memcmp(id, FLAC__FOREIGN_METADATA_APPLICATION_ID[fm->type], sizeof(id))) + if(first_block) { + uint32_t i; + for(i = 0; i < FLAC__FOREIGN_METADATA_NUMBER_OF_RECOGNIZED_APPLICATION_IDS; i++) + if(memcmp(id, FLAC__FOREIGN_METADATA_APPLICATION_ID[i], sizeof(id)) == 0) { + fm->type = i; + first_block = false; + } + if(first_block) /* means no first foreign metadata block was found yet */ + continue; + } + else if(memcmp(id, FLAC__FOREIGN_METADATA_APPLICATION_ID[fm->type], sizeof(id))) continue; offset = FLAC__metadata_simple_iterator_get_block_offset(it); + length = FLAC__metadata_simple_iterator_get_block_length(it); /* skip over header and app ID */ offset += (FLAC__STREAM_METADATA_IS_LAST_LEN + FLAC__STREAM_METADATA_TYPE_LEN + FLAC__STREAM_METADATA_LENGTH_LEN) / 8; offset += sizeof(id); /* look for format or audio blocks */ - if(fseek(f, offset, SEEK_SET) < 0) { - if(error) *error = "seek error (004)"; + if(fseeko(f, offset, SEEK_SET) < 0) { + if(error) *error = "seek error (003)"; return false; } if(fread(buffer, 1, 4, f) != 4) { - if(error) *error = "read error (005)"; + if(error) *error = "read error (004)"; return false; } - if(fm->num_blocks == 0) { - if(fm->type == FOREIGN_BLOCK_TYPE__RIFF && 0 == memcmp(buffer, "RIFF", 4)) + if(fm->num_blocks == 0) { /* first block? */ + /* Initialize bools */ + fm->is_wavefmtex = 0; + fm->is_aifc = 0; + fm->is_sowt = 0; + fm->is_rf64 = 0 == memcmp(buffer, "RF64", 4); + + if(fm->type == FOREIGN_BLOCK_TYPE__RIFF && (0 == memcmp(buffer, "RIFF", 4) || fm->is_rf64)) + type_found = true; + else if(fm->type == FOREIGN_BLOCK_TYPE__WAVE64 && 0 == memcmp(buffer, "riff", 4)) /* use first 4 bytes instead of whole GUID */ type_found = true; - else if(fm->type == FOREIGN_BLOCK_TYPE__AIFF && 0 == memcmp(buffer, "FORM", 4)) + else if(fm->type == FOREIGN_BLOCK_TYPE__AIFF && 0 == memcmp(buffer, "FORM", 4)) { type_found = true; + if(fread(buffer+4, 1, 8, f) != 8) { + if(error) *error = "read error (020)"; + return false; + } + fm->is_aifc = 0 == memcmp(buffer+8, "AIFC", 4); + } else { if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (005)"; return false; @@ -359,6 +582,11 @@ static FLAC__bool read_from_flac_(foreign_metadata_t *fm, FILE *f, FLAC__Metadat return false; } fm->format_block = fm->num_blocks; + if(fread(buffer+4, 1, 8, f) != 8) { + if(error) *error = "read error (020)"; + return false; + } + fm->is_wavefmtex = 0 == memcmp(buffer+8, "\xfe\xff", 2); } else if(!memcmp(buffer, "data", 4)) { if(fm->audio_block) { @@ -371,32 +599,71 @@ static FLAC__bool read_from_flac_(foreign_metadata_t *fm, FILE *f, FLAC__Metadat } fm->audio_block = fm->num_blocks; } + else if(fm->is_rf64 && fm->num_blocks == 1) { + if(memcmp(buffer, "ds64", 4)) { + if(error) *error = "invalid RF64 metadata: second chunk is not \"ds64\" (011)"; + return false; + } + ds64_found = true; + } + } + else if(fm->type == FOREIGN_BLOCK_TYPE__WAVE64) { + if(!memcmp(buffer, "fmt ", 4)) { /* use first 4 bytes instead of whole GUID */ + if(fm->format_block) { + if(error) *error = "invalid Wave64 metadata: multiple \"fmt \" chunks (012)"; + return false; + } + if(fm->audio_block) { + if(error) *error = "invalid Wave64 metadata: \"data\" chunk before \"fmt \" chunk (013)"; + return false; + } + fm->format_block = fm->num_blocks; + } + else if(!memcmp(buffer, "data", 4)) { /* use first 4 bytes instead of whole GUID */ + if(fm->audio_block) { + if(error) *error = "invalid Wave64 metadata: multiple \"data\" chunks (014)"; + return false; + } + if(!fm->format_block) { + if(error) *error = "invalid Wave64 metadata: \"data\" chunk before \"fmt \" chunk (015)"; + return false; + } + fm->audio_block = fm->num_blocks; + } } else if(fm->type == FOREIGN_BLOCK_TYPE__AIFF) { if(!memcmp(buffer, "COMM", 4)) { if(fm->format_block) { - if(error) *error = "invalid AIFF metadata: multiple \"COMM\" chunks (011)"; + if(error) *error = "invalid AIFF metadata: multiple \"COMM\" chunks (016)"; return false; } if(fm->audio_block) { - if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (012)"; + if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (017)"; return false; } fm->format_block = fm->num_blocks; + if(fm->is_aifc) { + if(fread(buffer+4, 1, 26, f) != 26) { + if(error) *error = "read error (020)"; + return false; + } + fm->is_sowt = 0 == memcmp(buffer+26, "sowt", 2); + fm->aifc_comm_length = length; + } } else if(!memcmp(buffer, "SSND", 4)) { if(fm->audio_block) { - if(error) *error = "invalid AIFF metadata: multiple \"SSND\" chunks (013)"; + if(error) *error = "invalid AIFF metadata: multiple \"SSND\" chunks (018)"; return false; } if(!fm->format_block) { - if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (014)"; + if(error) *error = "invalid AIFF metadata: \"SSND\" chunk before \"COMM\" chunk (019)"; return false; } fm->audio_block = fm->num_blocks; /* read SSND offset size */ if(fread(buffer+4, 1, 8, f) != 8) { - if(error) *error = "read error (015)"; + if(error) *error = "read error (020)"; return false; } fm->ssnd_offset_size = unpack32be_(buffer+8); @@ -405,64 +672,126 @@ static FLAC__bool read_from_flac_(foreign_metadata_t *fm, FILE *f, FLAC__Metadat else { FLAC__ASSERT(0); /* double protection: */ - if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (016)"; + if(error) *error = "unsupported foreign metadata found, may need newer FLAC decoder (021)"; return false; } if(!append_block_(fm, offset, FLAC__metadata_simple_iterator_get_block_length(it)-sizeof(id), error)) return false; } - if(!type_found) { - if(error) *error = "no foreign metadata found (017)"; + if(fm->is_rf64 && !ds64_found) { + if(error) *error = "invalid RF64 file: second chunk is not \"ds64\" (023)"; return false; } if(!fm->format_block) { - if(error) *error = fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"fmt \" chunk (018)" : "invalid AIFF file: missing \"COMM\" chunk (018)"; + if(error) + *error = + fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"fmt \" chunk (024)" : + fm->type==FOREIGN_BLOCK_TYPE__WAVE64? "invalid Wave64 file: missing \"fmt \" chunk (025)" : + "invalid AIFF file: missing \"COMM\" chunk (026)"; return false; } if(!fm->audio_block) { - if(error) *error = fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"data\" chunk (019)" : "invalid AIFF file: missing \"SSND\" chunk (019)"; + if(error) + *error = + fm->type==FOREIGN_BLOCK_TYPE__RIFF? "invalid WAVE file: missing \"data\" chunk (027)" : + fm->type==FOREIGN_BLOCK_TYPE__WAVE64? "invalid Wave64 file: missing \"data\" chunk (028)" : + "invalid AIFF file: missing \"SSND\" chunk (029)"; return false; } return true; } -static FLAC__bool write_to_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fout, off_t offset1, off_t offset2, off_t offset3, const char **error) +static FLAC__bool write_to_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fout, FLAC__off_t offset1, FLAC__off_t offset2, FLAC__off_t offset3, const char **error) { size_t i; if(fseeko(fout, offset1, SEEK_SET) < 0) { - if(error) *error = "seek failed in WAVE/AIFF file (002)"; + if(error) *error = "seek failed in WAVE/AIFF file"; return false; } - for(i = 1; i < fm->format_block; i++) { + + /* don't write first (RIFF/RF64/FORM) chunk, or ds64 chunk in the case of RF64 */ + for(i = fm->is_rf64?2:1; i < fm->format_block; i++) { if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) { - if(error) *error = "seek failed in FLAC file (003)"; + if(error) *error = "seek failed in FLAC file"; return false; } - if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (004)", "write failed in FLAC file (005)")) + if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in FLAC file", "write failed in WAVE/AIFF file")) return false; } + + if(fm->is_aifc) { + /* Need to restore compression type name */ + if(fseeko(fout, 30, SEEK_CUR) < 0) { + if(error) *error = "seek failed in AIFF-C file"; + return false; + } + if(fseeko(fin, fm->blocks[i].offset+30, SEEK_SET) < 0) { + if(error) *error = "seek failed in FLAC file"; + return false; + } + if(!copy_data_(fin, fout, fm->aifc_comm_length-34, error, "read failed in FLAC file", "write failed in WAVE/AIFF file")) + return false; + /* Now seek back */ + if(fseeko(fout, ((FLAC__int32)(fm->aifc_comm_length) * -1) + 4, SEEK_CUR) < 0) { + if(error) *error = "seek failed in AIFF-C file"; + return false; + } + } if(fseeko(fout, offset2, SEEK_SET) < 0) { if(error) *error = "seek failed in WAVE/AIFF file (006)"; return false; } for(i = fm->format_block+1; i < fm->audio_block; i++) { if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) { - if(error) *error = "seek failed in FLAC file (007)"; + if(error) *error = "seek failed in FLAC file"; return false; } - if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (008)", "write failed in FLAC file (009)")) + if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in FLAC file", "write failed in WAVE/AIFF file")) return false; } if(fseeko(fout, offset3, SEEK_SET) < 0) { - if(error) *error = "seek failed in WAVE/AIFF file (010)"; + if(error) *error = "seek failed in WAVE/AIFF file"; return false; } for(i = fm->audio_block+1; i < fm->num_blocks; i++) { if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) { - if(error) *error = "seek failed in FLAC file (011)"; + if(error) *error = "seek failed in FLAC file"; + return false; + } + if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in FLAC file", "write failed in WAVE/AIFF file")) + return false; + } + return true; +} + +static FLAC__bool compare_with_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fout, FLAC__off_t offset3, const char **error) +{ + size_t i; + + /* Compare blocks before audio data */ + for(i = 0; i <= (fm->audio_block); i++) { + if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) { + if(error) *error = "seek failed in FLAC file"; + return false; + } + if(!compare_data_(fin, fout, fm->blocks[i].size, error, "read failed in FLAC file", "read failed in WAVE/AIFF file", + i==0?"stored main chunk length differs from written length":( + i==fm->format_block?"stored foreign format block differs from written block. Perhaps the file is being restored to a different format than that of the original file":( + i==fm->audio_block?"stored audio length differs from written length. Perhaps the file changed in length after being originally encoded":"restore of foreign metadata failed")))) + return false; + } + + /* Seek beyond audio */ + if(fseeko(fout, offset3, SEEK_SET) < 0) { + if(error) *error = "seek failed in WAVE/AIFF file"; + return false; + } + for(; i < fm->num_blocks; i++) { + if(fseeko(fin, fm->blocks[i].offset, SEEK_SET) < 0) { + if(error) *error = "seek failed in FLAC file"; return false; } - if(!copy_data_(fin, fout, fm->blocks[i].size, error, "read failed in WAVE/AIFF file (012)", "write failed in FLAC file (013)")) + if(!compare_data_(fin, fout, fm->blocks[i].size, error, "read failed in FLAC file", "read failed in WAVE/AIFF file", "restore of foreign metadata failed")) return false; } return true; @@ -470,9 +799,12 @@ static FLAC__bool write_to_iff_(foreign_metadata_t *fm, FILE *fin, FILE *fout, o foreign_metadata_t *flac__foreign_metadata_new(foreign_block_type_t type) { - foreign_metadata_t *x = (foreign_metadata_t*)calloc(sizeof(foreign_metadata_t), 1); - if(x) + /* calloc() to zero all the member variables */ + foreign_metadata_t *x = calloc(sizeof(foreign_metadata_t), 1); + if(x) { x->type = type; + x->is_rf64 = false; + } return x; } @@ -488,7 +820,7 @@ void flac__foreign_metadata_delete(foreign_metadata_t *fm) FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const char *filename, const char **error) { FLAC__bool ok; - FILE *f = fopen(filename, "rb"); + FILE *f = flac_fopen(filename, "rb"); if(!f) { if(error) *error = "can't open AIFF file for reading (000)"; return false; @@ -501,7 +833,7 @@ FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const c FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const char *filename, const char **error) { FLAC__bool ok; - FILE *f = fopen(filename, "rb"); + FILE *f = flac_fopen(filename, "rb"); if(!f) { if(error) *error = "can't open WAVE file for reading (000)"; return false; @@ -511,6 +843,19 @@ FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const c return ok; } +FLAC__bool flac__foreign_metadata_read_from_wave64(foreign_metadata_t *fm, const char *filename, const char **error) +{ + FLAC__bool ok; + FILE *f = flac_fopen(filename, "rb"); + if(!f) { + if(error) *error = "can't open Wave64 file for reading (000)"; + return false; + } + ok = read_from_wave64_(fm, f, error); + fclose(f); + return ok; +} + FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const char *infilename, const char *outfilename, const char **error) { FLAC__bool ok; @@ -525,12 +870,12 @@ FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const ch FLAC__metadata_simple_iterator_delete(it); return false; } - if(0 == (fin = fopen(infilename, "rb"))) { + if(0 == (fin = flac_fopen(infilename, "rb"))) { if(error) *error = "can't open WAVE/AIFF file for reading (002)"; FLAC__metadata_simple_iterator_delete(it); return false; } - if(0 == (fout = fopen(outfilename, "r+b"))) { + if(0 == (fout = flac_fopen(outfilename, "r+b"))) { if(error) *error = "can't open FLAC file for updating (003)"; FLAC__metadata_simple_iterator_delete(it); fclose(fin); @@ -557,7 +902,7 @@ FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const c FLAC__metadata_simple_iterator_delete(it); return false; } - if(0 == (f = fopen(filename, "rb"))) { + if(0 == (f = flac_fopen(filename, "rb"))) { if(error) *error = "can't open FLAC file for reading (002)"; FLAC__metadata_simple_iterator_delete(it); return false; @@ -568,15 +913,15 @@ FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const c return ok; } -FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, off_t offset1, off_t offset2, off_t offset3, const char **error) +FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, FLAC__off_t offset1, FLAC__off_t offset2, FLAC__off_t offset3, const char **error) { FLAC__bool ok; FILE *fin, *fout; - if(0 == (fin = fopen(infilename, "rb"))) { + if(0 == (fin = flac_fopen(infilename, "rb"))) { if(error) *error = "can't open FLAC file for reading (000)"; return false; } - if(0 == (fout = fopen(outfilename, "r+b"))) { + if(0 == (fout = flac_fopen(outfilename, "r+b"))) { if(error) *error = "can't open WAVE/AIFF file for updating (001)"; fclose(fin); return false; @@ -586,3 +931,22 @@ FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const cha fclose(fout); return ok; } + +FLAC__bool flac__foreign_metadata_compare_with_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, FLAC__off_t offset3, const char **error) +{ + FLAC__bool ok; + FILE *fin, *fout; + if(0 == (fin = flac_fopen(infilename, "rb"))) { + if(error) *error = "can't open FLAC file for reading"; + return false; + } + if(0 == (fout = flac_fopen(outfilename, "rb"))) { + if(error) *error = "can't open WAVE/AIFF file for comparing"; + fclose(fin); + return false; + } + ok = compare_with_iff_(fm, fin, fout, offset3, error); + fclose(fin); + fclose(fout); + return ok; +} diff --git a/3rdparty/libflac/src/flac/foreign_metadata.h b/3rdparty/libflac/src/flac/foreign_metadata.h index baeda20e9cd..fa68d46f5d9 100644 --- a/3rdparty/libflac/src/flac/foreign_metadata.h +++ b/3rdparty/libflac/src/flac/foreign_metadata.h @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,37 +12,58 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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__foreign_metadata_h #define flac__foreign_metadata_h -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include "FLAC/metadata.h" #include "utils.h" +#include "share/compat.h" + +#define FLAC__FOREIGN_METADATA_NUMBER_OF_RECOGNIZED_APPLICATION_IDS 3 + +extern const char *FLAC__FOREIGN_METADATA_APPLICATION_ID[FLAC__FOREIGN_METADATA_NUMBER_OF_RECOGNIZED_APPLICATION_IDS]; /* WATCHOUT: these enums are used to index internal arrays */ -typedef enum { FOREIGN_BLOCK_TYPE__AIFF = 0, FOREIGN_BLOCK_TYPE__RIFF = 1 } foreign_block_type_t; +typedef enum { + FOREIGN_BLOCK_TYPE__AIFF = 0, /* for AIFF and AIFF-C */ + FOREIGN_BLOCK_TYPE__RIFF = 1, /* for WAVE and RF64 */ + FOREIGN_BLOCK_TYPE__WAVE64 = 2 /* only for Sony's flavor */ +} foreign_block_type_t; typedef struct { /* for encoding, this will be the offset in the WAVE/AIFF file of the chunk */ /* for decoding, this will be the offset in the FLAC file of the chunk data inside the APPLICATION block */ - off_t offset; + FLAC__off_t offset; + /* size is the actual size in bytes of the chunk to be stored/recreated. */ + /* It includes the 8 bytes of chunk type and size, and any padding byte for alignment. */ + /* For 'data'/'SSND' chunks, the size does not include the actual sound or padding bytes */ + /* because these are not stored, they are recreated from the compressed FLAC stream. */ + /* So for RIFF 'data', size is 8, and for AIFF 'SSND', size is 8 + 8 + ssnd_offset_size */ + /* 32 bit size is OK because we only care about the non-sound data and FLAC metadata */ + /* only supports a few megs anyway. */ FLAC__uint32 size; } foreign_block_t; typedef struct { - foreign_block_type_t type; /* currently we don't support multiple foreign types in a stream (an maybe never will) */ + foreign_block_type_t type; /* currently we don't support multiple foreign types in a stream (and maybe never will) */ foreign_block_t *blocks; size_t num_blocks; size_t format_block; /* block number of 'fmt ' or 'COMM' chunk */ size_t audio_block; /* block number of 'data' or 'SSND' chunk */ + FLAC__bool is_rf64; /* always false if type!=RIFF */ + FLAC__bool is_wavefmtex; /* always false if type!=RIFF */ + FLAC__bool is_aifc; /* always false if type!=AIFF */ + FLAC__bool is_sowt; /* always false if type!=AIFF */ + FLAC__uint32 aifc_comm_length; FLAC__uint32 ssnd_offset_size; /* 0 if type!=AIFF */ } foreign_metadata_t; @@ -51,9 +73,11 @@ void flac__foreign_metadata_delete(foreign_metadata_t *fm); FLAC__bool flac__foreign_metadata_read_from_aiff(foreign_metadata_t *fm, const char *filename, const char **error); FLAC__bool flac__foreign_metadata_read_from_wave(foreign_metadata_t *fm, const char *filename, const char **error); +FLAC__bool flac__foreign_metadata_read_from_wave64(foreign_metadata_t *fm, const char *filename, const char **error); FLAC__bool flac__foreign_metadata_write_to_flac(foreign_metadata_t *fm, const char *infilename, const char *outfilename, const char **error); FLAC__bool flac__foreign_metadata_read_from_flac(foreign_metadata_t *fm, const char *filename, const char **error); -FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, off_t offset1, off_t offset2, off_t offset3, const char **error); +FLAC__bool flac__foreign_metadata_write_to_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, FLAC__off_t offset1, FLAC__off_t offset2, FLAC__off_t offset3, const char **error); +FLAC__bool flac__foreign_metadata_compare_with_iff(foreign_metadata_t *fm, const char *infilename, const char *outfilename, FLAC__off_t offset3, const char **error); #endif diff --git a/3rdparty/libflac/src/flac/iffscan.c b/3rdparty/libflac/src/flac/iffscan.c index d03b65bc8b9..a5472e0c0cf 100644 --- a/3rdparty/libflac/src/flac/iffscan.c +++ b/3rdparty/libflac/src/flac/iffscan.c @@ -1,5 +1,6 @@ /* iffscan - Simple AIFF/RIFF chunk scanner - * Copyright (C) 2007 Josh Coalson + * Copyright (C) 2007-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,25 +12,19 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include <stdio.h> #include <stdlib.h> #include <string.h> -#if defined _MSC_VER || defined __MINGW32__ -#include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif +#include "share/compat.h" #include "foreign_metadata.h" static FLAC__uint32 unpack32be_(const FLAC__byte *b) @@ -42,6 +37,11 @@ static FLAC__uint32 unpack32le_(const FLAC__byte *b) return (FLAC__uint32)b[0] + ((FLAC__uint32)b[1]<<8) + ((FLAC__uint32)b[2]<<16) + ((FLAC__uint32)b[3]<<24); } +static FLAC__uint64 unpack64le_(const FLAC__byte *b) +{ + return (FLAC__uint64)b[0] + ((FLAC__uint64)b[1]<<8) + ((FLAC__uint64)b[2]<<16) + ((FLAC__uint64)b[3]<<24) + ((FLAC__uint64)b[4]<<32) + ((FLAC__uint64)b[5]<<40) + ((FLAC__uint64)b[6]<<48) + ((FLAC__uint64)b[7]<<56); +} + static FLAC__uint32 unpack32_(const FLAC__byte *b, foreign_block_type_t type) { if(type == FOREIGN_BLOCK_TYPE__AIFF) @@ -53,57 +53,74 @@ static FLAC__uint32 unpack32_(const FLAC__byte *b, foreign_block_type_t type) int main(int argc, char *argv[]) { FILE *f; - char buf[12]; + char buf[36]; foreign_metadata_t *fm; const char *fn, *error; size_t i; FLAC__uint32 size; +#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 != 2) { - fprintf(stderr, "usage: %s { file.wav | file.aif }\n", argv[0]); + flac_fprintf(stderr, "usage: %s { file.wav | file.aif }\n", argv[0]); return 1; } fn = argv[1]; - if(0 == (f = fopen(fn, "rb")) || fread(buf, 1, 4, f) != 4) { - fprintf(stderr, "ERROR opening %s for reading\n", fn); + if(0 == (f = flac_fopen(fn, "rb")) || fread(buf, 1, 4, f) != 4) { + flac_fprintf(stderr, "ERROR opening %s for reading\n", fn); return 1; } fclose(f); - if(0 == (fm = flac__foreign_metadata_new(memcmp(buf, "RIFF", 4)? FOREIGN_BLOCK_TYPE__AIFF : FOREIGN_BLOCK_TYPE__RIFF))) { - fprintf(stderr, "ERROR: out of memory\n"); + if(0 == (fm = flac__foreign_metadata_new(memcmp(buf, "RIFF", 4) && memcmp(buf, "RF64", 4)? FOREIGN_BLOCK_TYPE__AIFF : FOREIGN_BLOCK_TYPE__RIFF))) { + flac_fprintf(stderr, "ERROR: out of memory\n"); return 1; } if(fm->type == FOREIGN_BLOCK_TYPE__AIFF) { if(!flac__foreign_metadata_read_from_aiff(fm, fn, &error)) { - fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error); + flac_fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error); return 1; } } else { if(!flac__foreign_metadata_read_from_wave(fm, fn, &error)) { - fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error); + flac_fprintf(stderr, "ERROR reading chunks from %s: %s\n", fn, error); return 1; } } - if(0 == (f = fopen(fn, "rb"))) { - fprintf(stderr, "ERROR opening %s for reading\n", fn); + if(0 == (f = flac_fopen(fn, "rb"))) { + flac_fprintf(stderr, "ERROR opening %s for reading\n", fn); return 1; } for(i = 0; i < fm->num_blocks; i++) { if(fseeko(f, fm->blocks[i].offset, SEEK_SET) < 0) { - fprintf(stderr, "ERROR seeking in %s\n", fn); + flac_fprintf(stderr, "ERROR seeking in %s\n", fn); return 1; } - if(fread(buf, 1, 12, f) != 12) { - fprintf(stderr, "ERROR reading %s\n", fn); + if(fread(buf, 1, i==0?12:8, f) != (i==0?12:8)) { + flac_fprintf(stderr, "ERROR reading %s\n", fn); return 1; } - size = unpack32_((const FLAC__byte*)buf+4, fm->type); + size = unpack32_((FLAC__byte*)buf+4, fm->type); printf("block:[%c%c%c%c] size=%08x=(%10u)", buf[0], buf[1], buf[2], buf[3], size, size); if(i == 0) printf(" type:[%c%c%c%c]", buf[8], buf[9], buf[10], buf[11]); else if(fm->type == FOREIGN_BLOCK_TYPE__AIFF && i == fm->audio_block) printf(" offset size=%08x=(%10u)", fm->ssnd_offset_size, fm->ssnd_offset_size); + else if(fm->type == FOREIGN_BLOCK_TYPE__RIFF && i == 1 && !memcmp(buf, "ds64", 4)) { + if(fread(buf+8, 1, 36-8, f) != 36-8) { + flac_fprintf(stderr, "ERROR reading %s\n", fn); + return 1; + } + printf("\n RIFF size=%016" PRIx64 "=(%20" PRIu64 ")", unpack64le_((FLAC__byte*)buf+8), unpack64le_((FLAC__byte*)buf+8)); + printf("\n data size=%016" PRIx64 "=(%20" PRIu64 ")", unpack64le_((FLAC__byte*)buf+16), unpack64le_((FLAC__byte*)buf+16)); + printf("\n sample count=%016" PRIx64 "=(%20" PRIu64 ")", unpack64le_((FLAC__byte*)buf+24), unpack64le_((FLAC__byte*)buf+24)); + printf("\n table size=%08x=(%10u)", unpack32le_((FLAC__byte*)buf+32), unpack32le_((FLAC__byte*)buf+32)); + } printf("\n"); } fclose(f); diff --git a/3rdparty/libflac/src/flac/iffscan.dsp b/3rdparty/libflac/src/flac/iffscan.dsp deleted file mode 100644 index f3d0e4120f0..00000000000 --- a/3rdparty/libflac/src/flac/iffscan.dsp +++ /dev/null @@ -1,108 +0,0 @@ -# Microsoft Developer Studio Project File - Name="iffscan" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=iffscan - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "iffscan.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "iffscan.mak" CFG="iffscan - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "iffscan - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "iffscan - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "iffscan - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "iffscan - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "iffscan - Win32 Release" -# Name "iffscan - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\iffscan.c -# End Source File -# Begin Source File - -SOURCE=.\foreign_metadata.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\foreign_metadata.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/flac/iffscan.vcproj b/3rdparty/libflac/src/flac/iffscan.vcproj deleted file mode 100644 index 0651666b1db..00000000000 --- a/3rdparty/libflac/src/flac/iffscan.vcproj +++ /dev/null @@ -1,212 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="iffscan" - ProjectGUID="{4cefbc94-c215-11db-8314-0800200c9a66}" - RootNamespace="iffscan" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-6E5FBE522BFB}" - > - <File - RelativePath=".\foreign_metadata.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2D32A752A2FF}" - > - <File - RelativePath=".\foreign_metadata.c" - > - </File> - <File - RelativePath=".\iffscan.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/flac/local_string_utils.c b/3rdparty/libflac/src/flac/local_string_utils.c index d0f8ed3499d..7e252334a72 100644 --- a/3rdparty/libflac/src/flac/local_string_utils.c +++ b/3rdparty/libflac/src/flac/local_string_utils.c @@ -1,7 +1,7 @@ /* flac - Command-line FLAC encoder/decoder */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif diff --git a/3rdparty/libflac/src/flac/local_string_utils.h b/3rdparty/libflac/src/flac/local_string_utils.h index e43041bad28..01f891f7967 100644 --- a/3rdparty/libflac/src/flac/local_string_utils.h +++ b/3rdparty/libflac/src/flac/local_string_utils.h @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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__local_string_utils_h diff --git a/3rdparty/libflac/src/flac/main.c b/3rdparty/libflac/src/flac/main.c index f3716a8097f..c22e602c1e9 100644 --- a/3rdparty/libflac/src/flac/main.c +++ b/3rdparty/libflac/src/flac/main.c @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -36,6 +37,9 @@ #include "FLAC/all.h" #include "share/alloc.h" #include "share/grabbag.h" +#include "share/compat.h" +#include "share/endswap.h" +#include "share/safe_str.h" #include "analyze.h" #include "decode.h" #include "encode.h" @@ -43,12 +47,6 @@ #include "utils.h" #include "vorbiscomment.h" -#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ -#define FLAC__STRCASECMP stricmp -#else -#define FLAC__STRCASECMP strcasecmp -#endif - #if 0 /*[JEC] was:#if HAVE_GETOPT_LONG*/ /*[JEC] see flac/include/share/getopt.h as to why the change */ @@ -57,8 +55,6 @@ # include "share/getopt.h" #endif -typedef enum { RAW, WAV, AIF, FLAC, OGGFLAC } FileFormat; - static int do_it(void); static FLAC__bool init_options(void); @@ -67,7 +63,7 @@ static int parse_option(int short_option, const char *long_option, const char *o static void free_options(void); static void add_compression_setting_bool(compression_setting_type_t type, FLAC__bool value); static void add_compression_setting_string(compression_setting_type_t type, const char *value); -static void add_compression_setting_unsigned(compression_setting_type_t type, unsigned value); +static void add_compression_setting_uint32_t(compression_setting_type_t type, uint32_t value); static int usage_error(const char *message, ...); static void short_usage(void); @@ -80,17 +76,12 @@ static int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__b static int decode_file(const char *infilename); static const char *get_encoded_outfilename(const char *infilename); -static const char *get_decoded_outfilename(const char *infilename); +static const char *get_decoded_outfilename(const char *infilename, const FileFormat format); static const char *get_outfilename(const char *infilename, const char *suffix); static void die(const char *message); static int conditional_fclose(FILE *f); static char *local_strdup(const char *source); -#ifdef _MSC_VER -/* There's no strtoll() in MSVC6 so we just write a specialized one */ -static FLAC__int64 local__strtoll(const char *src, char **endptr); -#endif - /* * share__getopt format struct; note that for long options with no @@ -100,24 +91,26 @@ static struct share__option long_options_[] = { /* * general options */ - { "help" , share__no_argument, 0, 'h' }, - { "explain" , share__no_argument, 0, 'H' }, - { "version" , share__no_argument, 0, 'v' }, - { "decode" , share__no_argument, 0, 'd' }, - { "analyze" , share__no_argument, 0, 'a' }, - { "test" , share__no_argument, 0, 't' }, - { "stdout" , share__no_argument, 0, 'c' }, - { "silent" , share__no_argument, 0, 's' }, - { "totally-silent" , share__no_argument, 0, 0 }, - { "warnings-as-errors" , share__no_argument, 0, 'w' }, - { "force" , share__no_argument, 0, 'f' }, - { "delete-input-file" , share__no_argument, 0, 0 }, - { "keep-foreign-metadata" , share__no_argument, 0, 0 }, - { "output-prefix" , share__required_argument, 0, 0 }, - { "output-name" , share__required_argument, 0, 'o' }, - { "skip" , share__required_argument, 0, 0 }, - { "until" , share__required_argument, 0, 0 }, - { "channel-map" , share__required_argument, 0, 0 }, /* undocumented */ + { "help" , share__no_argument, 0, 'h' }, + { "explain" , share__no_argument, 0, 'H' }, + { "version" , share__no_argument, 0, 'v' }, + { "decode" , share__no_argument, 0, 'd' }, + { "analyze" , share__no_argument, 0, 'a' }, + { "test" , share__no_argument, 0, 't' }, + { "stdout" , share__no_argument, 0, 'c' }, + { "silent" , share__no_argument, 0, 's' }, + { "totally-silent" , share__no_argument, 0, 0 }, + { "warnings-as-errors" , share__no_argument, 0, 'w' }, + { "force" , share__no_argument, 0, 'f' }, + { "delete-input-file" , share__no_argument, 0, 0 }, + { "preserve-modtime" , share__no_argument, 0, 0 }, + { "keep-foreign-metadata" , share__no_argument, 0, 0 }, + { "keep-foreign-metadata-if-present" , share__no_argument, 0, 0 }, + { "output-prefix" , share__required_argument, 0, 0 }, + { "output-name" , share__required_argument, 0, 'o' }, + { "skip" , share__required_argument, 0, 0 }, + { "until" , share__required_argument, 0, 0 }, + { "channel-map" , share__required_argument, 0, 0 }, /* undocumented */ /* * decoding options @@ -147,12 +140,17 @@ static struct share__option long_options_[] = { { "best" , share__no_argument, 0, '8' }, { "fast" , share__no_argument, 0, '0' }, { "verify" , share__no_argument, 0, 'V' }, - { "force-aiff-format" , share__no_argument, 0, 0 }, { "force-raw-format" , share__no_argument, 0, 0 }, + { "force-aiff-format" , share__no_argument, 0, 0 }, + { "force-rf64-format" , share__no_argument, 0, 0 }, + { "force-wave64-format" , share__no_argument, 0, 0 }, + { "force-legacy-wave-format" , share__no_argument, 0, 0 }, + { "force-extensible-wave-format",share__no_argument,0, 0 }, + { "force-aiff-c-none-format" , share__no_argument, 0, 0 }, + { "force-aiff-c-sowt-format" , share__no_argument, 0, 0 }, { "lax" , share__no_argument, 0, 0 }, { "replay-gain" , share__no_argument, 0, 0 }, { "ignore-chunk-sizes" , share__no_argument, 0, 0 }, - { "sector-align" , share__no_argument, 0, 0 }, { "seekpoint" , share__required_argument, 0, 'S' }, { "padding" , share__required_argument, 0, 'P' }, #if FLAC__HAS_OGG @@ -174,6 +172,8 @@ static struct share__option long_options_[] = { { "sample-rate" , share__required_argument, 0, 0 }, { "sign" , share__required_argument, 0, 0 }, { "input-size" , share__required_argument, 0, 0 }, + { "error-on-compression-fail" , share__no_argument, 0, 0 }, + { "limit-min-bitrate" , share__no_argument, 0, 0 }, /* * analysis options @@ -184,6 +184,7 @@ static struct share__option long_options_[] = { /* * negatives */ + { "no-preserve-modtime" , share__no_argument, 0, 0 }, { "no-decode-through-errors" , share__no_argument, 0, 0 }, { "no-silent" , share__no_argument, 0, 0 }, { "no-force" , share__no_argument, 0, 0 }, @@ -192,7 +193,6 @@ static struct share__option long_options_[] = { { "no-keep-foreign-metadata" , share__no_argument, 0, 0 }, { "no-replay-gain" , share__no_argument, 0, 0 }, { "no-ignore-chunk-sizes" , share__no_argument, 0, 0 }, - { "no-sector-align" , share__no_argument, 0, 0 }, { "no-utf8-convert" , share__no_argument, 0, 0 }, { "no-lax" , share__no_argument, 0, 0 }, #if FLAC__HAS_OGG @@ -207,6 +207,7 @@ static struct share__option long_options_[] = { { "no-warnings-as-errors" , share__no_argument, 0, 0 }, { "no-residual-gnuplot" , share__no_argument, 0, 0 }, { "no-residual-text" , share__no_argument, 0, 0 }, + { "no-error-on-compression-fail", share__no_argument, 0, 0 }, /* * undocumented debugging options for the test suite */ @@ -240,13 +241,20 @@ static struct { FLAC__bool has_serial_number; /* true iff --serial-number was used */ long serial_number; /* this is the Ogg serial number and is unused for native FLAC */ FLAC__bool force_to_stdout; - FLAC__bool force_aiff_format; FLAC__bool force_raw_format; + FLAC__bool force_aiff_format; + FLAC__bool force_rf64_format; + FLAC__bool force_wave64_format; + FLAC__bool force_legacy_wave_format; + FLAC__bool force_extensible_wave_format; + FLAC__bool force_aiff_c_none_format; + FLAC__bool force_aiff_c_sowt_format; FLAC__bool delete_input; + FLAC__bool preserve_modtime; FLAC__bool keep_foreign_metadata; + FLAC__bool keep_foreign_metadata_if_present; FLAC__bool replay_gain; FLAC__bool ignore_chunk_sizes; - FLAC__bool sector_align; FLAC__bool utf8_convert; /* true by default, to convert tag strings from locale to utf-8, false if --no-utf8-convert used */ const char *cmdline_forced_outfilename; const char *output_prefix; @@ -262,19 +270,21 @@ static struct { int format_channels; int format_bps; int format_sample_rate; - off_t format_input_size; + FLAC__off_t format_input_size; char requested_seek_points[5000]; /* bad MAGIC NUMBER but buffer overflow is checked */ int num_requested_seek_points; /* -1 => no -S options were given, 0 => -S- was given */ const char *cuesheet_filename; FLAC__bool cued_seekpoints; FLAC__bool channel_map_none; /* --channel-map=none specified, eventually will expand to take actual channel map */ + FLAC__bool error_on_compression_fail; + FLAC__bool limit_min_bitrate; - unsigned num_files; + uint32_t num_files; char **filenames; FLAC__StreamMetadata *vorbis_comment; FLAC__StreamMetadata *pictures[64]; - unsigned num_pictures; + uint32_t num_pictures; struct { FLAC__bool disable_constant_subframes; @@ -289,12 +299,12 @@ static struct { * miscellaneous globals */ -static FLAC__int32 align_reservoir_0[588], align_reservoir_1[588]; /* for carrying over samples from --sector-align */ -static FLAC__int32 *align_reservoir[2] = { align_reservoir_0, align_reservoir_1 }; -static unsigned align_reservoir_samples = 0; /* 0 .. 587 */ - +#ifndef FUZZ_TOOL_FLAC int main(int argc, char *argv[]) +#else +static int main_to_fuzz(int argc, char *argv[]) +#endif { int retval = 0; @@ -302,9 +312,28 @@ int main(int argc, char *argv[]) _response(&argc, &argv); _wildcard(&argc, &argv); #endif +#ifdef _WIN32 + if (get_utf8_argv(&argc, &argv) != 0) { + fprintf(stderr, "ERROR: failed to convert command line parameters to UTF-8\n"); + return 1; + } +#endif - srand((unsigned)time(0)); + srand((uint32_t)time(0)); +#ifdef _WIN32 + { + const char *var; + var = getenv("LC_ALL"); + if (!var) + var = getenv("LC_NUMERIC"); + if (!var) + var = getenv("LANG"); + if (!var || strcmp(var, "C") != 0) + setlocale(LC_ALL, ""); + } +#else setlocale(LC_ALL, ""); +#endif if(!init_options()) { flac__utils_printf(stderr, 1, "ERROR: allocating memory\n"); retval = 1; @@ -366,19 +395,27 @@ int do_it(void) return usage_error("ERROR: --cue may not be combined with --skip or --until\n"); if(option_values.format_channels >= 0) { - if(option_values.format_channels == 0 || (unsigned)option_values.format_channels > FLAC__MAX_CHANNELS) + if(option_values.format_channels == 0 || (uint32_t)option_values.format_channels > FLAC__MAX_CHANNELS) return usage_error("ERROR: invalid number of channels '%u', must be > 0 and <= %u\n", option_values.format_channels, FLAC__MAX_CHANNELS); } if(option_values.format_bps >= 0) { - if(option_values.format_bps != 8 && option_values.format_bps != 16 && option_values.format_bps != 24) - return usage_error("ERROR: invalid bits per sample '%u' (must be 8/16/24)\n", option_values.format_bps); + if(option_values.format_bps != 8 && option_values.format_bps != 16 && option_values.format_bps != 24 && option_values.format_bps != 32) + return usage_error("ERROR: invalid bits per sample '%u' (must be 8/16/24/32)\n", option_values.format_bps); } if(option_values.format_sample_rate >= 0) { if(!FLAC__format_sample_rate_is_valid(option_values.format_sample_rate)) return usage_error("ERROR: invalid sample rate '%u', must be > 0 and <= %u\n", option_values.format_sample_rate, FLAC__MAX_SAMPLE_RATE); } - if(option_values.force_raw_format && option_values.force_aiff_format) - return usage_error("ERROR: only one of --force-raw-format and --force-aiff-format allowed\n"); + if((option_values.force_raw_format?1:0) + + (option_values.force_aiff_format?1:0) + + (option_values.force_rf64_format?1:0) + + (option_values.force_wave64_format?1:0) + + (option_values.force_legacy_wave_format?1:0) + + (option_values.force_extensible_wave_format?1:0) + + (option_values.force_aiff_c_none_format?1:0) + + (option_values.force_aiff_c_sowt_format?1:0) + > 1) + return usage_error("ERROR: only one of force format options allowed\n"); if(option_values.mode_decode) { if(!option_values.force_raw_format) { if(option_values.format_is_big_endian >= 0) @@ -397,8 +434,6 @@ int do_it(void) if(option_values.ignore_chunk_sizes) { if(option_values.mode_decode) return usage_error("ERROR: --ignore-chunk-sizes only allowed for encoding\n"); - if(0 != option_values.sector_align) - return usage_error("ERROR: --ignore-chunk-sizes not allowed with --sector-align\n"); if(0 != option_values.until_specification) return usage_error("ERROR: --ignore-chunk-sizes not allowed with --until\n"); if(0 != option_values.cue_specification) @@ -406,22 +441,6 @@ int do_it(void) if(0 != option_values.cuesheet_filename) return usage_error("ERROR: --ignore-chunk-sizes not allowed with --cuesheet\n"); } - if(option_values.sector_align) { - if(option_values.mode_decode) - return usage_error("ERROR: --sector-align only allowed for encoding\n"); - if(0 != option_values.skip_specification) - return usage_error("ERROR: --sector-align not allowed with --skip\n"); - if(0 != option_values.until_specification) - return usage_error("ERROR: --sector-align not allowed with --until\n"); - if(0 != option_values.cue_specification) - return usage_error("ERROR: --sector-align not allowed with --cue\n"); - if(option_values.format_channels >= 0 && option_values.format_channels != 2) - return usage_error("ERROR: --sector-align can only be done with stereo input\n"); - if(option_values.format_bps >= 0 && option_values.format_bps != 16) - return usage_error("ERROR: --sector-align can only be done with 16-bit samples\n"); - if(option_values.format_sample_rate >= 0 && option_values.format_sample_rate != 44100) - return usage_error("ERROR: --sector-align can only be done with a sample rate of 44100\n"); - } if(option_values.replay_gain) { if(option_values.force_to_stdout) return usage_error("ERROR: --replay-gain not allowed with -c/--stdout\n"); @@ -431,20 +450,11 @@ int do_it(void) return usage_error("ERROR: --replay-gain can only be done with mono/stereo input\n"); if(option_values.format_sample_rate >= 0 && !grabbag__replaygain_is_valid_sample_frequency(option_values.format_sample_rate)) return usage_error("ERROR: invalid sample rate used with --replay-gain\n"); - /* - * We want to reserve padding space for the ReplayGain - * tags that we will set later, to avoid rewriting the - * whole file. - */ if( (option_values.padding >= 0 && option_values.padding < (int)GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED) || (option_values.padding < 0 && FLAC_ENCODE__DEFAULT_PADDING < (int)GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED) ) { flac__utils_printf(stderr, 1, "NOTE: --replay-gain may leave a small PADDING block even with --no-padding\n"); - option_values.padding = GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED; - } - else { - option_values.padding += GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED; } } if(option_values.num_files > 1 && option_values.cmdline_forced_outfilename) { @@ -456,7 +466,7 @@ int do_it(void) if(!option_values.mode_decode && 0 != option_values.cuesheet_filename && option_values.num_files > 1) { return usage_error("ERROR: --cuesheet cannot be used when encoding multiple files\n"); } - if(option_values.keep_foreign_metadata) { + if(option_values.keep_foreign_metadata || option_values.keep_foreign_metadata_if_present) { /* we're not going to try and support the re-creation of broken WAVE files */ if(option_values.ignore_chunk_sizes) return usage_error("ERROR: using --keep-foreign-metadata cannot be used with --ignore-chunk-sizes\n"); @@ -464,15 +474,13 @@ int do_it(void) return usage_error("ERROR: --keep-foreign-metadata is not allowed in test mode\n"); if(option_values.analyze) return usage_error("ERROR: --keep-foreign-metadata is not allowed in analyis mode\n"); - /*@@@@@@*/ - if(option_values.delete_input) - return usage_error("ERROR: using --delete-input-file with --keep-foreign-metadata has been disabled until more testing has been done.\n"); flac__utils_printf(stderr, 1, "NOTE: --keep-foreign-metadata is a new feature; make sure to test the output file before deleting the original.\n"); } } flac__utils_printf(stderr, 2, "\n"); - flac__utils_printf(stderr, 2, "flac %s, Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n", FLAC__VERSION_STRING); + flac__utils_printf(stderr, 2, "flac %s\n", FLAC__VERSION_STRING); + flac__utils_printf(stderr, 2, "Copyright (C) 2000-2009 Josh Coalson, 2011-2023 Xiph.Org Foundation\n"); flac__utils_printf(stderr, 2, "flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are\n"); flac__utils_printf(stderr, 2, "welcome to redistribute it under certain conditions. Type `flac' for details.\n\n"); @@ -483,7 +491,7 @@ int do_it(void) retval = decode_file("-"); } else { - unsigned i; + uint32_t i; if(option_values.num_files > 1) option_values.cmdline_forced_outfilename = 0; for(i = 0, retval = 0; i < option_values.num_files; i++) { @@ -504,14 +512,16 @@ int do_it(void) retval = encode_file("-", first, true); } else { - unsigned i; + uint32_t i; if(option_values.num_files > 1) option_values.cmdline_forced_outfilename = 0; for(i = 0, retval = 0; i < option_values.num_files; i++) { if(0 == strcmp(option_values.filenames[i], "-") && !first) continue; - retval |= encode_file(option_values.filenames[i], first, i == (option_values.num_files-1)); - first = false; + if(encode_file(option_values.filenames[i], first, i == (option_values.num_files-1))) + retval = 1; + else + first = false; } if(option_values.replay_gain && retval == 0) { float album_gain, album_peak; @@ -522,13 +532,7 @@ int do_it(void) flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", option_values.filenames[i]); return 1; } - if(0 == strcmp(option_values.filenames[i], "-")) { - FLAC__ASSERT(0); - /* double protection */ - flac__utils_printf(stderr, 1, "internal error\n"); - return 2; - } - if(0 != (error = grabbag__replaygain_store_to_file_album(outfilename, album_gain, album_peak, /*preserve_modtime=*/true))) { + if(0 != (error = grabbag__replaygain_store_to_file_album(outfilename, album_gain, album_peak, option_values.preserve_modtime))) { flac__utils_printf(stderr, 1, "%s: ERROR writing ReplayGain album tags (%s)\n", outfilename, error); retval = 1; } @@ -544,6 +548,7 @@ FLAC__bool init_options(void) { option_values.show_help = false; option_values.show_explain = false; + option_values.show_version = false; option_values.mode_decode = false; option_values.verify = false; option_values.treat_warnings_as_errors = false; @@ -561,13 +566,20 @@ FLAC__bool init_options(void) option_values.has_serial_number = false; option_values.serial_number = 0; option_values.force_to_stdout = false; - option_values.force_aiff_format = false; option_values.force_raw_format = false; + option_values.force_aiff_format = false; + option_values.force_rf64_format = false; + option_values.force_wave64_format = false; + option_values.force_legacy_wave_format = false; + option_values.force_extensible_wave_format = false; + option_values.force_aiff_c_none_format = false; + option_values.force_aiff_c_sowt_format = false; option_values.delete_input = false; + option_values.preserve_modtime = true; option_values.keep_foreign_metadata = false; + option_values.keep_foreign_metadata_if_present = false; option_values.replay_gain = false; option_values.ignore_chunk_sizes = false; - option_values.sector_align = false; option_values.utf8_convert = true; option_values.cmdline_forced_outfilename = 0; option_values.output_prefix = 0; @@ -585,12 +597,14 @@ FLAC__bool init_options(void) option_values.format_channels = -1; option_values.format_bps = -1; option_values.format_sample_rate = -1; - option_values.format_input_size = (off_t)(-1); + option_values.format_input_size = (FLAC__off_t)(-1); option_values.requested_seek_points[0] = '\0'; option_values.num_requested_seek_points = -1; option_values.cuesheet_filename = 0; option_values.cued_seekpoints = true; option_values.channel_map_none = false; + option_values.error_on_compression_fail = false; + option_values.limit_min_bitrate = false; option_values.num_files = 0; option_values.filenames = 0; @@ -638,8 +652,8 @@ int parse_options(int argc, char *argv[]) option_values.num_files = argc - share__optind; if(option_values.num_files > 0) { - unsigned i = 0; - if(0 == (option_values.filenames = (char**)malloc(sizeof(char*) * option_values.num_files))) + uint32_t i = 0; + if(0 == (option_values.filenames = malloc(sizeof(char*) * option_values.num_files))) die("out of memory allocating space for file names list"); while(share__optind < argc) option_values.filenames[i++] = local_strdup(argv[share__optind++]); @@ -651,8 +665,6 @@ int parse_options(int argc, char *argv[]) int parse_option(int short_option, const char *long_option, const char *option_argument) { const char *violation; - char *p; - int i; if(short_option == 0) { FLAC__ASSERT(0 != long_option); @@ -662,9 +674,15 @@ int parse_option(int short_option, const char *long_option, const char *option_a else if(0 == strcmp(long_option, "delete-input-file")) { option_values.delete_input = true; } + else if(0 == strcmp(long_option, "preserve-modtime")) { + option_values.preserve_modtime = true; + } else if(0 == strcmp(long_option, "keep-foreign-metadata")) { option_values.keep_foreign_metadata = true; } + else if(0 == strcmp(long_option, "keep-foreign-metadata-if-present")) { + option_values.keep_foreign_metadata_if_present = true; + } else if(0 == strcmp(long_option, "output-prefix")) { FLAC__ASSERT(0 != option_argument); option_values.output_prefix = option_argument; @@ -681,17 +699,12 @@ int parse_option(int short_option, const char *long_option, const char *option_a FLAC__ASSERT(0 != option_argument); { char *end; -#ifdef _MSC_VER - FLAC__int64 i; - i = local__strtoll(option_argument, &end); -#else - long long i; - i = strtoll(option_argument, &end, 10); -#endif + FLAC__int64 ix; + ix = strtoll(option_argument, &end, 10); if(0 == strlen(option_argument) || *end) return usage_error("ERROR: --%s must be a number\n", long_option); - option_values.format_input_size = (off_t)i; - if(option_values.format_input_size != i) /* check if off_t is smaller than long long */ + option_values.format_input_size = (FLAC__off_t)ix; + if(option_values.format_input_size != ix) /* check if FLAC__off_t is smaller than long long */ return usage_error("ERROR: --%s too large; this build of flac does not support filesizes over 2GB\n", long_option); if(option_values.format_input_size <= 0) return usage_error("ERROR: --%s must be > 0\n", long_option); @@ -736,7 +749,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a option_values.cuesheet_filename = option_argument; } else if(0 == strcmp(long_option, "picture")) { - const unsigned max_pictures = sizeof(option_values.pictures)/sizeof(option_values.pictures[0]); + const uint32_t max_pictures = sizeof(option_values.pictures)/sizeof(option_values.pictures[0]); FLAC__ASSERT(0 != option_argument); if(option_values.num_pictures >= max_pictures) return usage_error("ERROR: too many --picture arguments, only %u allowed\n", max_pictures); @@ -752,11 +765,29 @@ int parse_option(int short_option, const char *long_option, const char *option_a else if(0 == strcmp(long_option, "no-cued-seekpoints")) { option_values.cued_seekpoints = false; } + else if(0 == strcmp(long_option, "force-raw-format")) { + option_values.force_raw_format = true; + } else if(0 == strcmp(long_option, "force-aiff-format")) { option_values.force_aiff_format = true; } - else if(0 == strcmp(long_option, "force-raw-format")) { - option_values.force_raw_format = true; + else if(0 == strcmp(long_option, "force-rf64-format")) { + option_values.force_rf64_format = true; + } + else if(0 == strcmp(long_option, "force-wave64-format")) { + option_values.force_wave64_format = true; + } + else if(0 == strcmp(long_option, "force-legacy-wave-format")) { + option_values.force_legacy_wave_format = true; + } + else if(0 == strcmp(long_option, "force-extensible-wave-format")) { + option_values.force_extensible_wave_format = true; + } + else if(0 == strcmp(long_option, "force-aiff-c-none-format")) { + option_values.force_aiff_c_none_format = true; + } + else if(0 == strcmp(long_option, "force-aiff-c-sowt-format")) { + option_values.force_aiff_c_sowt_format = true; } else if(0 == strcmp(long_option, "lax")) { option_values.lax = true; @@ -767,9 +798,6 @@ int parse_option(int short_option, const char *long_option, const char *option_a else if(0 == strcmp(long_option, "ignore-chunk-sizes")) { option_values.ignore_chunk_sizes = true; } - else if(0 == strcmp(long_option, "sector-align")) { - option_values.sector_align = true; - } #if FLAC__HAS_OGG else if(0 == strcmp(long_option, "ogg")) { option_values.use_ogg = true; @@ -815,14 +843,22 @@ int parse_option(int short_option, const char *long_option, const char *option_a else if(0 == strcmp(long_option, "residual-text")) { option_values.aopts.do_residual_text = true; } + else if(0 == strcmp(long_option, "limit-min-bitrate")) { + option_values.limit_min_bitrate = true; + } /* * negatives */ + else if(0 == strcmp(long_option, "no-preserve-modtime")) { + option_values.preserve_modtime = false; + } else if(0 == strcmp(long_option, "no-decode-through-errors")) { option_values.continue_through_decode_errors = false; } else if(0 == strcmp(long_option, "no-silent")) { +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION flac__utils_verbosity_ = 2; +#endif } else if(0 == strcmp(long_option, "no-force")) { option_values.force_file_overwrite = false; @@ -836,6 +872,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a } else if(0 == strcmp(long_option, "no-keep-foreign-metadata")) { option_values.keep_foreign_metadata = false; + option_values.keep_foreign_metadata_if_present = false; } else if(0 == strcmp(long_option, "no-replay-gain")) { option_values.replay_gain = false; @@ -843,9 +880,6 @@ int parse_option(int short_option, const char *long_option, const char *option_a else if(0 == strcmp(long_option, "no-ignore-chunk-sizes")) { option_values.ignore_chunk_sizes = false; } - else if(0 == strcmp(long_option, "no-sector-align")) { - option_values.sector_align = false; - } else if(0 == strcmp(long_option, "no-utf8-convert")) { option_values.utf8_convert = false; } @@ -898,6 +932,12 @@ int parse_option(int short_option, const char *long_option, const char *option_a else if(0 == strcmp(long_option, "no-md5-sum")) { option_values.debug.do_md5 = false; } + else if(0 == strcmp(long_option, "no-error-on-compression-fail")) { + option_values.error_on_compression_fail = false; + } + else if(0 == strcmp(long_option, "error-on-compression-fail")) { + option_values.error_on_compression_fail = true; + } } else { switch(short_option) { @@ -925,7 +965,9 @@ int parse_option(int short_option, const char *long_option, const char *option_a option_values.force_to_stdout = true; break; case 's': +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION flac__utils_verbosity_ = 1; +#endif break; case 'f': option_values.force_file_overwrite = true; @@ -951,7 +993,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a case '6': case '7': case '8': - add_compression_setting_unsigned(CST_COMPRESSION_LEVEL, short_option-'0'); + add_compression_setting_uint32_t(CST_COMPRESSION_LEVEL, short_option-'0'); break; case '9': return usage_error("ERROR: compression level '9' is reserved\n"); @@ -975,8 +1017,8 @@ int parse_option(int short_option, const char *long_option, const char *option_a return usage_error("ERROR: too many seekpoints requested\n"); } else { - strcat(option_values.requested_seek_points, option_argument); - strcat(option_values.requested_seek_points, ";"); + size_t len = strlen(option_values.requested_seek_points); + flac_snprintf(option_values.requested_seek_points+len, sizeof(option_values.requested_seek_points) - len, "%s;", option_argument); } } break; @@ -987,11 +1029,14 @@ int parse_option(int short_option, const char *long_option, const char *option_a return usage_error("ERROR: argument to -%c must be >= 0; for no padding use -%c-\n", short_option, short_option); break; case 'b': - FLAC__ASSERT(0 != option_argument); - i = atoi(option_argument); - if((i < (int)FLAC__MIN_BLOCK_SIZE || i > (int)FLAC__MAX_BLOCK_SIZE)) - return usage_error("ERROR: invalid blocksize (-%c) '%d', must be >= %u and <= %u\n", short_option, i, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); - add_compression_setting_unsigned(CST_BLOCKSIZE, (unsigned)i); + { + uint32_t i ; + FLAC__ASSERT(0 != option_argument); + i = atoi(option_argument); + if((i < (int)FLAC__MIN_BLOCK_SIZE || i > (int)FLAC__MAX_BLOCK_SIZE)) + return usage_error("ERROR: invalid blocksize (-%c) '%d', must be >= %u and <= %u\n", short_option, i, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); + add_compression_setting_uint32_t(CST_BLOCKSIZE, (uint32_t)i); + } break; case 'e': add_compression_setting_bool(CST_DO_EXHAUSTIVE_MODEL_SEARCH, true); @@ -1000,11 +1045,14 @@ int parse_option(int short_option, const char *long_option, const char *option_a add_compression_setting_bool(CST_DO_ESCAPE_CODING, true); break; case 'l': - FLAC__ASSERT(0 != option_argument); - i = atoi(option_argument); - if((i < 0 || i > (int)FLAC__MAX_LPC_ORDER)) - return usage_error("ERROR: invalid LPC order (-%c) '%d', must be >= %u and <= %u\n", short_option, i, 0, FLAC__MAX_LPC_ORDER); - add_compression_setting_unsigned(CST_MAX_LPC_ORDER, (unsigned)i); + { + uint32_t i ; + FLAC__ASSERT(0 != option_argument); + i = atoi(option_argument); + if(i > FLAC__MAX_LPC_ORDER) + return usage_error("ERROR: invalid LPC order (-%c) '%d', must be >= %u and <= %u\n", short_option, i, 0, FLAC__MAX_LPC_ORDER); + add_compression_setting_uint32_t(CST_MAX_LPC_ORDER, i); + } break; case 'A': FLAC__ASSERT(0 != option_argument); @@ -1022,38 +1070,46 @@ int parse_option(int short_option, const char *long_option, const char *option_a add_compression_setting_bool(CST_DO_QLP_COEFF_PREC_SEARCH, true); break; case 'q': - FLAC__ASSERT(0 != option_argument); - i = atoi(option_argument); - if(i < 0 || (i > 0 && (i < (int)FLAC__MIN_QLP_COEFF_PRECISION || i > (int)FLAC__MAX_QLP_COEFF_PRECISION))) - return usage_error("ERROR: invalid value '%d' for qlp coeff precision (-%c), must be 0 or between %u and %u, inclusive\n", i, short_option, FLAC__MIN_QLP_COEFF_PRECISION, FLAC__MAX_QLP_COEFF_PRECISION); - add_compression_setting_unsigned(CST_QLP_COEFF_PRECISION, (unsigned)i); - break; - case 'r': - FLAC__ASSERT(0 != option_argument); - p = strchr(option_argument, ','); - if(0 == p) { - add_compression_setting_unsigned(CST_MIN_RESIDUAL_PARTITION_ORDER, 0); + { + uint32_t i ; + FLAC__ASSERT(0 != option_argument); i = atoi(option_argument); - if(i < 0) - return usage_error("ERROR: invalid value '%d' for residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); - add_compression_setting_unsigned(CST_MAX_RESIDUAL_PARTITION_ORDER, (unsigned)i); + if((i > 0 && (i < FLAC__MIN_QLP_COEFF_PRECISION || i > FLAC__MAX_QLP_COEFF_PRECISION))) + return usage_error("ERROR: invalid value '%d' for qlp coeff precision (-%c), must be 0 or between %u and %u, inclusive\n", i, short_option, FLAC__MIN_QLP_COEFF_PRECISION, FLAC__MAX_QLP_COEFF_PRECISION); + add_compression_setting_uint32_t(CST_QLP_COEFF_PRECISION, i); } - else { - i = atoi(option_argument); - if(i < 0) - return usage_error("ERROR: invalid value '%d' for min residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); - add_compression_setting_unsigned(CST_MIN_RESIDUAL_PARTITION_ORDER, (unsigned)i); - i = atoi(++p); - if(i < 0) - return usage_error("ERROR: invalid value '%d' for max residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); - add_compression_setting_unsigned(CST_MAX_RESIDUAL_PARTITION_ORDER, (unsigned)i); + break; + case 'r': + { + uint32_t i; + char * p; + FLAC__ASSERT(0 != option_argument); + p = strchr(option_argument, ','); + if(0 == p) { + add_compression_setting_uint32_t(CST_MIN_RESIDUAL_PARTITION_ORDER, 0); + i = atoi(option_argument); + if(i > FLAC__MAX_RICE_PARTITION_ORDER) + return usage_error("ERROR: invalid value '%d' for residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); + add_compression_setting_uint32_t(CST_MAX_RESIDUAL_PARTITION_ORDER, i); + } + else { + i = atoi(option_argument); + if(i > FLAC__MAX_RICE_PARTITION_ORDER) + return usage_error("ERROR: invalid value '%d' for min residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); + add_compression_setting_uint32_t(CST_MIN_RESIDUAL_PARTITION_ORDER, i); + i = atoi(++p); + if(i > FLAC__MAX_RICE_PARTITION_ORDER) + return usage_error("ERROR: invalid value '%d' for max residual partition order (-%c), must be between 0 and %u, inclusive\n", i, short_option, FLAC__MAX_RICE_PARTITION_ORDER); + add_compression_setting_uint32_t(CST_MAX_RESIDUAL_PARTITION_ORDER, i); + } } break; case 'R': - i = atoi(option_argument); - if(i < 0) - return usage_error("ERROR: invalid value '%d' for Rice parameter search distance (-%c), must be >= 0\n", i, short_option); - add_compression_setting_unsigned(CST_RICE_PARAMETER_SEARCH_DIST, (unsigned)i); + { + uint32_t i; + i = atoi(option_argument); + add_compression_setting_uint32_t(CST_RICE_PARAMETER_SEARCH_DIST, i); + } break; default: FLAC__ASSERT(0); @@ -1065,7 +1121,7 @@ int parse_option(int short_option, const char *long_option, const char *option_a void free_options(void) { - unsigned i; + uint32_t i; if(0 != option_values.filenames) { for(i = 0; i < option_values.num_files; i++) { if(0 != option_values.filenames[i]) @@ -1082,7 +1138,11 @@ void free_options(void) void add_compression_setting_bool(compression_setting_type_t type, FLAC__bool value) { if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0])) +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION die("too many compression settings"); +#else + return; +#endif option_values.compression_settings[option_values.num_compression_settings].type = type; option_values.compression_settings[option_values.num_compression_settings].value.t_bool = value; option_values.num_compression_settings++; @@ -1091,19 +1151,34 @@ void add_compression_setting_bool(compression_setting_type_t type, FLAC__bool va void add_compression_setting_string(compression_setting_type_t type, const char *value) { if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0])) +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION die("too many compression settings"); +#else + return; +#endif option_values.compression_settings[option_values.num_compression_settings].type = type; option_values.compression_settings[option_values.num_compression_settings].value.t_string = value; option_values.num_compression_settings++; } -void add_compression_setting_unsigned(compression_setting_type_t type, unsigned value) +void add_compression_setting_uint32_t(compression_setting_type_t type, uint32_t value) { if(option_values.num_compression_settings >= sizeof(option_values.compression_settings)/sizeof(option_values.compression_settings[0])) +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION die("too many compression settings"); - option_values.compression_settings[option_values.num_compression_settings].type = type; - option_values.compression_settings[option_values.num_compression_settings].value.t_unsigned = value; - option_values.num_compression_settings++; +#else + return; +#endif + if(type == CST_COMPRESSION_LEVEL) { + /* Compression level always goes first */ + option_values.compression_settings[0].type = type; + option_values.compression_settings[0].value.t_unsigned = value; + } + else { + option_values.compression_settings[option_values.num_compression_settings].type = type; + option_values.compression_settings[option_values.num_compression_settings].value.t_unsigned = value; + option_values.num_compression_settings++; + } } int usage_error(const char *message, ...) @@ -1115,7 +1190,9 @@ int usage_error(const char *message, ...) va_start(args, message); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION (void) vfprintf(stderr, message, args); +#endif va_end(args); @@ -1134,7 +1211,8 @@ static void usage_header(void) { printf("===============================================================================\n"); printf("flac - Command-line FLAC encoder/decoder version %s\n", FLAC__VERSION_STRING); - printf("Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n"); + printf("Copyright (C) 2000-2009 Josh Coalson\n"); + printf("Copyright (C) 2011-2023 Xiph.Org Foundation\n"); printf("\n"); printf("This program is free software; you can redistribute it and/or\n"); printf("modify it under the terms of the GNU General Public License\n"); @@ -1146,9 +1224,9 @@ static void usage_header(void) printf("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); printf("GNU General Public License for more details.\n"); printf("\n"); - printf("You should have received a copy of the GNU General Public License\n"); - printf("along with this program; if not, write to the Free Software\n"); - printf("Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"); + printf("You should have received a copy of the GNU General Public License along\n"); + printf("with this program; if not, write to the Free Software Foundation, Inc.,\n"); + printf("51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n"); printf("===============================================================================\n"); } @@ -1156,10 +1234,13 @@ static void usage_summary(void) { printf("Usage:\n"); printf("\n"); - printf(" Encoding: flac [<general-options>] [<encoding/format-options>] [INPUTFILE [...]]\n"); - printf(" Decoding: flac -d [<general-options>] [<format-options>] [FLACFILE [...]]\n"); - printf(" Testing: flac -t [<general-options>] [FLACFILE [...]]\n"); - printf("Analyzing: flac -a [<general-options>] [<analysis-options>] [FLACFILE [...]]\n"); + printf(" Encoding: flac [<general/encoding/format options>] [INPUTFILE [...]]\n"); + printf(" Decoding: flac -d [<general/decoding/format options>] [FLACFILE [...]]\n"); + printf(" Testing: flac -t [<general options>] [FLACFILE [...]]\n"); + printf("Analyzing: flac -a [<general/analysis options>] [FLACFILE [...]]\n"); + printf("\n"); + printf("Be sure to read the list of known bugs at:\n"); + printf("http://xiph.org/flac/documentation_bugs.html\n"); printf("\n"); } @@ -1170,6 +1251,9 @@ void short_usage(void) printf("This is the short help; for all options use 'flac --help'; for even more\n"); printf("instructions use 'flac --explain'\n"); printf("\n"); + printf("Be sure to read the list of known bugs at:\n"); + printf("http://xiph.org/flac/documentation_bugs.html\n"); + printf("\n"); printf("To encode:\n"); printf(" flac [-#] [INPUTFILE [...]]\n"); printf("\n"); @@ -1202,7 +1286,10 @@ void show_help(void) printf(" -o, --output-name=FILENAME Force the output file name\n"); printf(" --output-prefix=STRING Prepend STRING to output names\n"); printf(" --delete-input-file Deletes after a successful encode/decode\n"); + printf(" --preserve-modtime Output files keep timestamp of input (default)\n"); printf(" --keep-foreign-metadata Save/restore WAVE or AIFF non-audio chunks\n"); + printf(" --keep-foreign-metadata-if-present Save/restore WAVE or AIFF non-audio\n"); + printf(" but not return an error when no such chunks are found\n"); printf(" --skip={#|mm:ss.ss} Skip the given initial samples for each input\n"); printf(" --until={#|[+|-]mm:ss.ss} Stop at the given sample for each input file\n"); #if FLAC__HAS_OGG @@ -1218,10 +1305,7 @@ void show_help(void) printf("encoding options:\n"); printf(" -V, --verify Verify a correct encoding\n"); printf(" --lax Allow encoder to generate non-Subset files\n"); -#if 0 /*@@@ currently undocumented */ printf(" --ignore-chunk-sizes Ignore data chunk sizes in WAVE/AIFF files\n"); -#endif - printf(" --sector-align Align multiple files on sector boundaries\n"); printf(" --replay-gain Calculate ReplayGain & store in FLAC tags\n"); printf(" --cuesheet=FILENAME Import cuesheet and store in CUESHEET block\n"); printf(" --picture=SPECIFICATION Import picture and store in PICTURE block\n"); @@ -1236,8 +1320,11 @@ void show_help(void) printf(" -4, --compression-level-4 Synonymous with -l 8 -b 4096 -M -r 4\n"); printf(" -5, --compression-level-5 Synonymous with -l 8 -b 4096 -m -r 5\n"); printf(" -6, --compression-level-6 Synonymous with -l 8 -b 4096 -m -r 6\n"); - printf(" -7, --compression-level-7 Synonymous with -l 8 -b 4096 -m -e -r 6\n"); - printf(" -8, --compression-level-8, --best Synonymous with -l 12 -b 4096 -m -e -r 6\n"); + printf(" -A subdivide_tukey(2)\n"); + printf(" -7, --compression-level-7 Synonymous with -l 12 -b 4096 -m -r 6\n"); + printf(" -A subdivide_tukey(2)\n"); + printf(" -8, --compression-level-8, --best Synonymous with -l 12 -b 4096 -m -r 6\n"); + printf(" -A subdivide_tukey(3)\n"); printf(" -b, --blocksize=# Specify blocksize in samples\n"); printf(" -m, --mid-side Try mid-side coding for each frame\n"); printf(" -M, --adaptive-mid-side Adaptive mid-side coding for all frames\n"); @@ -1247,19 +1334,30 @@ void show_help(void) printf(" -p, --qlp-coeff-precision-search Exhaustively search LP coeff quantization\n"); printf(" -q, --qlp-coeff-precision=# Specify precision in bits\n"); printf(" -r, --rice-partition-order=[#,]# Set [min,]max residual partition order\n"); + printf(" --limit-min-bitrate Limit minimum bitrate (for streaming)\n"); printf("format options:\n"); + printf(" --force-raw-format Treat input or output as raw samples\n"); + printf(" --force-aiff-format Decode to AIFF format\n"); + printf(" --force-rf64-format Decode to RF64 format\n"); + printf(" --force-wave64-format Decode to Wave64 format\n"); + printf(" --force-legacy-wave-format Decode to legacy wave format\n"); + printf(" --force-extensible-wave-format Decode to extensible wave format\n"); + printf(" --force-aiff-c-none-format Decode to AIFF-C NONE format\n"); + printf(" --force-aiff-c-sowt-format Decode to AIFF-C sowt format\n"); + printf("raw format options:\n"); printf(" --endian={big|little} Set byte order for samples\n"); printf(" --channels=# Number of channels\n"); printf(" --bps=# Number of bits per sample\n"); printf(" --sample-rate=# Sample rate in Hz\n"); printf(" --sign={signed|unsigned} Sign of samples\n"); printf(" --input-size=# Size of the raw input in bytes\n"); - printf(" --force-aiff-format Force decoding to AIFF format\n"); - printf(" --force-raw-format Treat input or output as raw samples\n"); printf("negative options:\n"); printf(" --no-adaptive-mid-side\n"); + printf(" --no-cued-seekpoints\n"); printf(" --no-decode-through-errors\n"); printf(" --no-delete-input-file\n"); + printf(" --no-error-on-compression-fail\n"); + printf(" --no-preserve-modtime\n"); printf(" --no-keep-foreign-metadata\n"); printf(" --no-exhaustive-model-search\n"); printf(" --no-lax\n"); @@ -1272,10 +1370,7 @@ void show_help(void) printf(" --no-replay-gain\n"); printf(" --no-residual-gnuplot\n"); printf(" --no-residual-text\n"); -#if 0 /*@@@ currently undocumented */ printf(" --no-ignore-chunk-sizes\n"); -#endif - printf(" --no-sector-align\n"); printf(" --no-seektable\n"); printf(" --no-silent\n"); printf(" --no-force\n"); @@ -1288,9 +1383,9 @@ void show_explain(void) usage_header(); usage_summary(); printf("For encoding:\n"); - printf(" The input file(s) may be a PCM WAVE file, AIFF (or uncompressed AIFF-C)\n"); - printf(" file, or raw samples.\n"); - printf(" The output file(s) will be in native FLAC or Ogg FLAC format\n"); + printf(" The input file(s) may be a PCM WAVE, Wave64, RF64 file, AIFF (or uncompressed\n"); + printf(" AIFF-C) file, or raw samples. The output file(s) will be in native FLAC\n"); + printf(" or Ogg FLAC format\n"); printf("For decoding, the reverse is true.\n"); printf("\n"); printf("A single INPUTFILE may be - for stdin. No INPUTFILE implies stdin. Use of\n"); @@ -1301,12 +1396,6 @@ void show_explain(void) printf("since the former allows flac to seek backwards to write the STREAMINFO or\n"); printf("WAVE/AIFF header contents when necessary.\n"); printf("\n"); - printf("flac checks for the presence of a AIFF/WAVE header to decide whether or not to\n"); - printf("treat an input file as AIFF/WAVE format or raw samples. If any input file is\n"); - printf("raw you must specify the format options {-fb|fl} -fc -fp and -fs, which will\n"); - printf("apply to all raw files. You can force AIFF/WAVE files to be treated as raw\n"); - printf("files using -fr.\n"); - printf("\n"); printf("general options:\n"); printf(" -v, --version Show the flac version number\n"); printf(" -h, --help Show basic usage a list of all options\n"); @@ -1338,6 +1427,11 @@ void show_explain(void) printf(" successful encode or decode. If there was an\n"); printf(" error (including a verify error) the input file\n"); printf(" is left intact.\n"); + printf(" --preserve-modtime Output files have their timestamps/permissions\n"); + printf(" set to match those of their inputs (this is\n"); + printf(" default). Use --no-preserve-modtime to make\n"); + printf(" output files have the current time and default\n"); + printf(" permissions.\n"); printf(" --keep-foreign-metadata If encoding, save WAVE or AIFF non-audio chunks\n"); printf(" in FLAC metadata. If decoding, restore any saved\n"); printf(" non-audio chunks from FLAC metadata when writing\n"); @@ -1345,6 +1439,14 @@ void show_explain(void) printf(" transcoded, e.g. WAVE chunks saved in a FLAC file\n"); printf(" cannot be restored when decoding to AIFF. Input\n"); printf(" and output must be regular files, not stdin/out.\n"); + printf(" With this option, FLAC will pick the right\n"); + printf(" output format on decoding.\n"); + printf(" --keep-foreign-metadata-if-present As previous option, but do not throw\n"); + printf(" an error in case no foreign metadata is found,\n"); + printf(" the wrong kind of foreign metadata is found (on\n"); + printf(" decoding) or if the foreign could not be parsed,\n"); + printf(" i.e. all foreign metadata related errors are\n"); + printf(" treated as warnings.\n"); printf(" --skip={#|mm:ss.ss} Skip the first # samples of each input file; can\n"); printf(" be used both for encoding and decoding. The\n"); printf(" alternative form mm:ss.ss can be used to specify\n"); @@ -1408,22 +1510,22 @@ void show_explain(void) printf(" output in parallel and comparing to the\n"); printf(" original\n"); printf(" --lax Allow encoder to generate non-Subset files\n"); -#if 0 /*@@@ currently undocumented */ printf(" --ignore-chunk-sizes Ignore data chunk sizes in WAVE/AIFF files;\n"); printf(" useful when piping data from programs which\n"); printf(" generate bogus data chunk sizes.\n"); -#endif - printf(" --sector-align Align encoding of multiple CD format WAVE files\n"); - printf(" on sector boundaries.\n"); printf(" --replay-gain Calculate ReplayGain values and store them as\n"); printf(" FLAC tags. Title gains/peaks will be computed\n"); printf(" for each file, and an album gain/peak will be\n"); printf(" computed for all files. All input files must\n"); printf(" have the same resolution, sample rate, and\n"); - printf(" number of channels. The sample rate must be\n"); - printf(" one of 8, 11.025, 12, 16, 22.05, 24, 32, 44.1,\n"); - printf(" or 48 kHz. NOTE: this option may also leave a\n"); - printf(" few extra bytes in the PADDING block.\n"); + printf(" number of channels. Only mono and stereo files\n"); + printf(" are allowed, and the sample rate must be 8,\n"); + printf(" 11.025, 12, 16, 18.9, 22.05, 24, 28, 32, 36,\n"); + printf(" 37.8, 44.1, 48, 56, 64, 72, 75.6, 88.2, 96, 112,\n"); + printf(" 128, 144, 151.2, 176.4, 192, 224, 256, 288,\n"); + printf(" 302.4, 352.8, 384, 448, 512, 576, or 604.8 kHz.\n"); + printf(" NOTE: this option may also leave a few extra\n"); + printf(" bytes in the PADDING block.\n"); printf(" --cuesheet=FILENAME Import the given cuesheet file and store it in\n"); printf(" a CUESHEET metadata block. This option may only\n"); printf(" be used when encoding a single file. A\n"); @@ -1469,7 +1571,7 @@ void show_explain(void) printf(" mean that FILE is actually a URL to an image, though this use is\n"); printf(" discouraged.\n"); printf(" DESCRIPTION is optional; the default is an empty string\n"); - printf(" The next part specfies the resolution and color information. If\n"); + printf(" The next part specifies the resolution and color information. If\n"); printf(" the MIME-TYPE is image/jpeg, image/png, or image/gif, you can\n"); printf(" usually leave this empty and they can be detected from the file.\n"); printf(" Otherwise, you must specify the width in pixels, height in pixels,\n"); @@ -1518,20 +1620,25 @@ void show_explain(void) printf(" block of 8192 bytes by default, or 65536 bytes\n"); printf(" if the input audio is more than 20 minutes long.\n"); printf(" -b, --blocksize=# Specify the blocksize in samples; the default is\n"); - printf(" 1152 for -l 0, else 4096; must be one of 192,\n"); - printf(" 576, 1152, 2304, 4608, 256, 512, 1024, 2048,\n"); - printf(" 4096 (and 8192 or 16384 if the sample rate is\n"); - printf(" >48kHz) for Subset streams.\n"); + printf(" 1152 for -l 0, else 4096; for subset streams this\n"); + printf(" must be <= 4608 if the samplerate <= 48kHz,\n"); + printf(" for subset streams with a higher samplerates it\n"); + printf(" must be <= 16384.\n"); printf(" -0, --compression-level-0, --fast Synonymous with -l 0 -b 1152 -r 3\n"); + printf(" --no-mid-side\n"); printf(" -1, --compression-level-1 Synonymous with -l 0 -b 1152 -M -r 3\n"); printf(" -2, --compression-level-2 Synonymous with -l 0 -b 1152 -m -r 3\n"); printf(" -3, --compression-level-3 Synonymous with -l 6 -b 4096 -r 4\n"); + printf(" --no-mid-side\n"); printf(" -4, --compression-level-4 Synonymous with -l 8 -b 4096 -M -r 4\n"); printf(" -5, --compression-level-5 Synonymous with -l 8 -b 4096 -m -r 5\n"); printf(" -5 is the default setting\n"); printf(" -6, --compression-level-6 Synonymous with -l 8 -b 4096 -m -r 6\n"); - printf(" -7, --compression-level-7 Synonymous with -l 8 -b 4096 -m -e -r 6\n"); - printf(" -8, --compression-level-8, --best Synonymous with -l 12 -b 4096 -m -e -r 6\n"); + printf(" -A subdivide_tukey(2)\n"); + printf(" -7, --compression-level-7 Synonymous with -l 12 -b 4096 -m -r 6\n"); + printf(" -A subdivide_tukey(2)\n"); + printf(" -8, --compression-level-8, --best Synonymous with -l 12 -b 4096 -m -r 6\n"); + printf(" -A subdivide_tukey(3)\n"); printf(" -m, --mid-side Try mid-side coding for each frame\n"); printf(" (stereo only)\n"); printf(" -M, --adaptive-mid-side Adaptive mid-side coding for all frames\n"); @@ -1542,12 +1649,13 @@ void show_explain(void) printf(" blackman, blackman_harris_4term_92db,\n"); printf(" connes, flattop, gauss(STDDEV), hamming,\n"); printf(" hann, kaiser_bessel, nuttall, rectangle,\n"); - printf(" triangle, tukey(P), welch. More than one\n"); - printf(" may be specified but encoding time is a\n"); - printf(" multiple of the number of functions since\n"); - printf(" they are each tried in turn. The encoder\n"); - printf(" chooses suitable defaults in the absence\n"); - printf(" of any -A options.\n"); + printf(" triangle, tukey(P), welch, partial_tukey(n)\n"); + printf(" punchout_tukey(n) and subdivide_tukey(n).\n"); + printf(" More than one may be specified but encoding\n"); + printf(" time is a multiple of the number of\n"); + printf(" functions since they are each tried in \n"); + printf(" turn. The encoder chooses suitable\n"); + printf(" defaults in the absence of any -A options.\n"); printf(" -l, --max-lpc-order=# Max LPC order; 0 => only fixed predictors.\n"); printf(" Must be <= 12 for Subset streams if sample\n"); printf(" rate is <=48kHz.\n"); @@ -1556,38 +1664,63 @@ void show_explain(void) printf(" does nothing if using -l 0\n"); printf(" -q, --qlp-coeff-precision=# Specify precision in bits of quantized\n"); printf(" linear-predictor coefficients; 0 => let\n"); - printf(" encoder decide (the minimun is %u, the\n", FLAC__MIN_QLP_COEFF_PRECISION); + printf(" encoder decide (the minimum is %u, the\n", FLAC__MIN_QLP_COEFF_PRECISION); printf(" default is -q 0)\n"); printf(" -r, --rice-partition-order=[#,]# Set [min,]max residual partition order\n"); - printf(" (# is 0..16; min defaults to 0; the\n"); - printf(" default is -r 0; above 4 doesn't usually\n"); - printf(" help much)\n"); + printf(" (# is 0 to 15 inclusive; min defaults to 0;\n"); + printf(" the default is -r 0; above 4 does not\n"); + printf(" usually help much)\n"); + printf(" --limit-min-bitrate Limit minimum bitrate by not allowing\n"); + printf(" frames consisting of only constant\n"); + printf(" subframes. This ensures a bitrate of at\n"); + printf(" least 1 bit/sample, for example 48kbit/s\n"); + printf(" for 48kHz input. This is mostly beneficial\n"); + printf(" for internet streaming.\n"); printf("format options:\n"); + printf(" --force-raw-format Force input (when encoding) or output (when\n"); + printf(" decoding) to be treated as raw samples\n"); + printf(" --force-aiff-format\n"); + printf(" --force-rf64-format\n"); + printf(" --force-wave64-format\n"); + printf(" Force the decoder to output AIFF/RF64/WAVE64 format respectively.\n"); + printf(" This option is not needed if the output filename (as set by -o)\n"); + printf(" ends with *.aif* or *.aiff*, *.rf64* and *.w64* respectively. Also,\n"); + printf(" this option has no effect when encoding since input is\n"); + printf(" auto-detected. When none of these options nor\n"); + printf(" --keep-foreign-metadata are given and no output filename is set,\n"); + printf(" the output format is WAV by default.\n"); + printf(" --force-legacy-wave-format\n"); + printf(" --force-extensible-wave-format\n"); + printf(" Instruct the decoder to output a WAVE file with WAVE_FORMAT_PCM and\n"); + printf(" WAVE_FORMAT_EXTENSIBLE respectively. If none of these options nor\n"); + printf(" --keep-foreign-metadata are given, FLAC outputs WAVE_FORMAT_PCM\n"); + printf(" for mono or stereo with a bit depth of 8 or 16 bits, and\n"); + printf(" WAVE_FORMAT_EXTENSIBLE for all other audio formats.\n"); + printf(" --force-aiff-c-none-format\n"); + printf(" --force-aiff-c-sowt-format\n"); + printf(" Instruct the decoder to output an AIFF-C file with format NONE and\n"); + printf(" sowt respectively.\n"); + printf("raw format options:\n"); printf(" --endian={big|little} Set byte order for samples\n"); printf(" --channels=# Number of channels\n"); printf(" --bps=# Number of bits per sample\n"); printf(" --sample-rate=# Sample rate in Hz\n"); - printf(" --sign={signed|unsigned} Sign of samples (the default is signed)\n"); + printf(" --sign={signed|unsigned} Sign of samples\n"); printf(" --input-size=# Size of the raw input in bytes. If you are\n"); printf(" encoding raw samples from stdin, you must set\n"); printf(" this option in order to be able to use --skip,\n"); - printf(" --until, --cue-sheet, or other options that need\n"); + printf(" --until, --cuesheet, or other options that need\n"); printf(" to know the size of the input beforehand. If\n"); printf(" the size given is greater than what is found in\n"); printf(" the input stream, the encoder will complain\n"); printf(" about an unexpected end-of-file. If the size\n"); printf(" given is less, samples will be truncated.\n"); - printf(" --force-aiff-format Force the decoder to output AIFF format. This\n"); - printf(" option is not needed if the output filename (as\n"); - printf(" set by -o) ends with .aif or .aiff; this option\n"); - printf(" has no effect when encoding since input AIFF is\n"); - printf(" auto-detected.\n"); - printf(" --force-raw-format Force input (when encoding) or output (when\n"); - printf(" decoding) to be treated as raw samples\n"); printf("negative options:\n"); printf(" --no-adaptive-mid-side\n"); + printf(" --no-cued-seekpoints\n"); printf(" --no-decode-through-errors\n"); printf(" --no-delete-input-file\n"); + printf(" --no-preserve-modtime\n"); printf(" --no-keep-foreign-metadata\n"); printf(" --no-exhaustive-model-search\n"); printf(" --no-lax\n"); @@ -1599,10 +1732,7 @@ void show_explain(void) printf(" --no-qlp-coeff-prec-search\n"); printf(" --no-residual-gnuplot\n"); printf(" --no-residual-text\n"); -#if 0 /*@@@ currently undocumented */ printf(" --no-ignore-chunk-sizes\n"); -#endif - printf(" --no-sector-align\n"); printf(" --no-seektable\n"); printf(" --no-silent\n"); printf(" --no-force\n"); @@ -1613,23 +1743,22 @@ void show_explain(void) void format_mistake(const char *infilename, FileFormat wrong, FileFormat right) { /* WATCHOUT: indexed by FileFormat */ - static const char * const ff[] = { "raw", "WAVE", "AIFF", "FLAC", "Ogg FLAC" }; - flac__utils_printf(stderr, 1, "WARNING: %s is not a %s file; treating as a %s file\n", infilename, ff[wrong], ff[right]); + flac__utils_printf(stderr, 1, "WARNING: %s is not a%s file; treating as a%s file\n", infilename, FileFormatString[wrong], FileFormatString[right]); } int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_last_file) { FILE *encode_infile; FLAC__byte lookahead[12]; - unsigned lookahead_length = 0; - FileFormat input_format = RAW; - FLAC__bool is_aifc = false; + uint32_t lookahead_length = 0, master_chunk_size = 0; + FileFormat input_format = FORMAT_RAW; int retval; - off_t infilesize; - encode_options_t common_options; + FLAC__off_t infilesize; + encode_options_t encode_options; const char *outfilename = get_encoded_outfilename(infilename); /* the final name of the encoded file */ /* internal_outfilename is the file we will actually write to; it will be a temporary name if infilename==outfilename */ char *internal_outfilename = 0; /* NULL implies 'use outfilename' */ + size_t infilename_length; if(0 == outfilename) { flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", infilename); @@ -1637,12 +1766,13 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ } if(0 == strcmp(infilename, "-")) { - infilesize = (off_t)(-1); + infilesize = (FLAC__off_t)(-1); encode_infile = grabbag__file_get_binary_stdin(); } - else { + else + { infilesize = grabbag__file_get_filesize(infilename); - if(0 == (encode_infile = fopen(infilename, "rb"))) { + if(0 == (encode_infile = flac_fopen(infilename, "rb"))) { flac__utils_printf(stderr, 1, "ERROR: can't open input file %s: %s\n", infilename, strerror(errno)); return 1; } @@ -1650,69 +1780,102 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ if(!option_values.force_raw_format) { /* first set format based on name */ - if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".wav")) - input_format = WAV; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".aif")) - input_format = AIF; - else if(strlen(infilename) >= 5 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-5), ".aiff")) - input_format = AIF; - else if(strlen(infilename) >= 5 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-5), ".flac")) - input_format = FLAC; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".oga")) - input_format = OGGFLAC; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".ogg")) - input_format = OGGFLAC; + infilename_length = strlen(infilename); + if(infilename_length >= 4 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-4), ".wav")) + input_format = FORMAT_WAVE; + else if(infilename_length >= 5 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-5), ".rf64")) + input_format = FORMAT_RF64; + else if(infilename_length >= 4 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-4), ".w64")) + input_format = FORMAT_WAVE64; + else if(infilename_length >= 4 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-4), ".aif")) + input_format = FORMAT_AIFF; + else if(infilename_length >= 5 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-5), ".aiff")) + input_format = FORMAT_AIFF; + else if(infilename_length >= 5 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-5), ".flac")) + input_format = FORMAT_FLAC; + else if(infilename_length >= 4 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-4), ".oga")) + input_format = FORMAT_OGGFLAC; + else if(infilename_length >= 4 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-4), ".ogg")) + input_format = FORMAT_OGGFLAC; /* attempt to guess the file type based on the first 12 bytes */ if((lookahead_length = fread(lookahead, 1, 12, encode_infile)) < 12) { - if(input_format != RAW) { - format_mistake(infilename, input_format, RAW); + /* all supported non-raw formats have at least 12 bytes of header to read */ + if(input_format != FORMAT_RAW) { + format_mistake(infilename, input_format, FORMAT_RAW); if(option_values.treat_warnings_as_errors) { conditional_fclose(encode_infile); return 1; } } - input_format = RAW; + /* force to raw */ + input_format = FORMAT_RAW; } else { - if(!strncmp((const char *)lookahead, "ID3", 3)) { + if(!memcmp(lookahead, "ID3", 3)) { flac__utils_printf(stderr, 1, "ERROR: input file %s has an ID3v2 tag\n", infilename); + conditional_fclose(encode_infile); return 1; } - else if(!strncmp((const char *)lookahead, "RIFF", 4) && !strncmp((const char *)lookahead+8, "WAVE", 4)) - input_format = WAV; - else if(!strncmp((const char *)lookahead, "FORM", 4) && !strncmp((const char *)lookahead+8, "AIFF", 4)) - input_format = AIF; - else if(!strncmp((const char *)lookahead, "FORM", 4) && !strncmp((const char *)lookahead+8, "AIFC", 4)) { - input_format = AIF; - is_aifc = true; - } + else if(!memcmp(lookahead, "RIFF", 4) && !memcmp(lookahead+8, "WAVE", 4)) + input_format = FORMAT_WAVE; + else if(!memcmp(lookahead, "RF64", 4) && !memcmp(lookahead+8, "WAVE", 4)) + input_format = FORMAT_RF64; + else if(!memcmp(lookahead, "riff\x2E\x91\xCF\x11\xA5\xD6\x28\xDB", 12)) /* just check 1st 12 bytes of GUID */ + input_format = FORMAT_WAVE64; + else if(!memcmp(lookahead, "FORM", 4) && !memcmp(lookahead+8, "AIFF", 4)) + input_format = FORMAT_AIFF; + else if(!memcmp(lookahead, "FORM", 4) && !memcmp(lookahead+8, "AIFC", 4)) + input_format = FORMAT_AIFF_C; else if(!memcmp(lookahead, FLAC__STREAM_SYNC_STRING, sizeof(FLAC__STREAM_SYNC_STRING))) - input_format = FLAC; - /* this could be made more accurate by looking at the first packet */ + input_format = FORMAT_FLAC; + /*@@@ this could be made more accurate by looking at the first packet to make sure it's Ogg FLAC and not, say, Ogg Vorbis. we do catch such problems later though. */ else if(!memcmp(lookahead, "OggS", 4)) - input_format = OGGFLAC; + input_format = FORMAT_OGGFLAC; else { - if(input_format != RAW) { - format_mistake(infilename, input_format, RAW); + /* didn't find header of any supported format */ + if(input_format != FORMAT_RAW) { + format_mistake(infilename, input_format, FORMAT_RAW); if(option_values.treat_warnings_as_errors) { conditional_fclose(encode_infile); return 1; } } - input_format = RAW; + /* force to raw */ + input_format = FORMAT_RAW; } } } - if(option_values.keep_foreign_metadata) { + if(!option_values.ignore_chunk_sizes + && (input_format == FORMAT_WAVE || input_format == FORMAT_AIFF || input_format == FORMAT_AIFF_C) + && infilesize >= UINT32_MAX) { + conditional_fclose(encode_infile); + return usage_error("ERROR: file %s is too large to be valid.\n" + "Please consult the manual on the --ignore-chunk-sizes option\n\n", infilename); + } + + if(input_format == FORMAT_WAVE || input_format == FORMAT_AIFF || input_format == FORMAT_AIFF_C) { + memcpy(&master_chunk_size,lookahead+4,sizeof(master_chunk_size)); + if((input_format != FORMAT_WAVE) != CPU_IS_BIG_ENDIAN /* logical xor */) + /* true for WAVE on big endian CPUs or AIFF/AIFF-C on little endian CPUs */ + master_chunk_size = ENDSWAP_32(master_chunk_size); + + if(infilesize != (FLAC__off_t)(-1) && infilesize > 8 && (infilesize - 8) != master_chunk_size) { + flac__utils_printf(stderr, 1, "WARNING: %s chunk size of file %s does not agree with filesize\n", (input_format == FORMAT_WAVE)?"RIFF":"FORM", infilename); + if(option_values.treat_warnings_as_errors) + return 1; + } + } + + if(option_values.keep_foreign_metadata || option_values.keep_foreign_metadata_if_present) { if(encode_infile == stdin || option_values.force_to_stdout) { conditional_fclose(encode_infile); return usage_error("ERROR: --keep-foreign-metadata cannot be used when encoding from stdin or to stdout\n"); } - if(input_format != WAV && input_format != AIF) { + if(input_format != FORMAT_WAVE && input_format != FORMAT_WAVE64 && input_format != FORMAT_RF64 && input_format != FORMAT_AIFF && input_format != FORMAT_AIFF_C) { conditional_fclose(encode_infile); - return usage_error("ERROR: --keep-foreign-metadata can only be used with WAVE or AIFF input\n"); + return usage_error("ERROR: --keep-foreign-metadata can only be used with WAVE, Wave64, RF64, or AIFF input\n"); } } @@ -1720,8 +1883,8 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ * Error if output file already exists (and -f not used). * Use grabbag__file_get_filesize() as a cheap way to check. */ - if(!option_values.test_only && !option_values.force_file_overwrite && strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (off_t)(-1)) { - if(input_format == FLAC) { + if(!option_values.test_only && !option_values.force_file_overwrite && strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (FLAC__off_t)(-1)) { + if(input_format == FORMAT_FLAC) { /* need more detailed error message when re-flac'ing to avoid confusing the user */ flac__utils_printf(stderr, 1, "ERROR: output file %s already exists.\n\n" @@ -1732,7 +1895,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ outfilename ); } - else if(input_format == OGGFLAC) { + else if(input_format == FORMAT_OGGFLAC) { /* need more detailed error message when re-flac'ing to avoid confusing the user */ flac__utils_printf(stderr, 1, "ERROR: output file %s already exists.\n\n" @@ -1750,7 +1913,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ } if(option_values.format_input_size >= 0) { - if (input_format != RAW || infilesize >= 0) { + if (input_format != FORMAT_RAW || infilesize >= 0) { flac__utils_printf(stderr, 1, "ERROR: can only use --input-size when encoding raw samples from stdin\n"); conditional_fclose(encode_infile); return 1; @@ -1760,25 +1923,20 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ } } - if(option_values.sector_align && (input_format == FLAC || input_format == OGGFLAC)) { - flac__utils_printf(stderr, 1, "ERROR: can't use --sector-align when the input file is FLAC or Ogg FLAC\n"); - conditional_fclose(encode_infile); - return 1; - } - if(option_values.sector_align && input_format == RAW && infilesize < 0) { - flac__utils_printf(stderr, 1, "ERROR: can't use --sector-align when the input size is unknown\n"); - conditional_fclose(encode_infile); - return 1; - } - - if(input_format == RAW) { + if(input_format == FORMAT_RAW) { if(option_values.format_is_big_endian < 0 || option_values.format_is_unsigned_samples < 0 || option_values.format_channels < 0 || option_values.format_bps < 0 || option_values.format_sample_rate < 0) { conditional_fclose(encode_infile); return usage_error("ERROR: for encoding a raw file you must specify a value for --endian, --sign, --channels, --bps, and --sample-rate\n"); } } + else { + if(option_values.format_is_big_endian >= 0 || option_values.format_is_unsigned_samples >= 0 || option_values.format_channels >= 0 || option_values.format_bps >= 0 || option_values.format_sample_rate >= 0) { + conditional_fclose(encode_infile); + return usage_error("ERROR: raw format options (--endian, --sign, --channels, --bps, and --sample-rate) are not allowed for non-raw input\n"); + } + } - if(/*@@@@@@why no stdin?*/encode_infile == stdin || option_values.force_to_stdout) { + if(option_values.force_to_stdout) { if(option_values.replay_gain) { conditional_fclose(encode_infile); return usage_error("ERROR: --replay-gain cannot be used when encoding to stdout\n"); @@ -1789,111 +1947,113 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ return usage_error("ERROR: --replay-gain cannot be used when encoding to Ogg FLAC yet\n"); } - if(!flac__utils_parse_skip_until_specification(option_values.skip_specification, &common_options.skip_specification) || common_options.skip_specification.is_relative) { + if(!flac__utils_parse_skip_until_specification(option_values.skip_specification, &encode_options.skip_specification) || encode_options.skip_specification.is_relative) { conditional_fclose(encode_infile); return usage_error("ERROR: invalid value for --skip\n"); } - if(!flac__utils_parse_skip_until_specification(option_values.until_specification, &common_options.until_specification)) { /*@@@@ more checks: no + without --skip, no - unless known total_samples_to_{en,de}code */ + if(!flac__utils_parse_skip_until_specification(option_values.until_specification, &encode_options.until_specification)) { /*@@@@ more checks: no + without --skip, no - unless known total_samples_to_{en,de}code */ conditional_fclose(encode_infile); return usage_error("ERROR: invalid value for --until\n"); } /* if there is no "--until" we want to default to "--until=-0" */ if(0 == option_values.until_specification) - common_options.until_specification.is_relative = true; + encode_options.until_specification.is_relative = true; - common_options.verify = option_values.verify; - common_options.treat_warnings_as_errors = option_values.treat_warnings_as_errors; + encode_options.verify = option_values.verify; + encode_options.treat_warnings_as_errors = option_values.treat_warnings_as_errors; #if FLAC__HAS_OGG - common_options.use_ogg = option_values.use_ogg; + encode_options.use_ogg = option_values.use_ogg; /* set a random serial number if one has not yet been specified */ if(!option_values.has_serial_number) { option_values.serial_number = rand(); option_values.has_serial_number = true; } - common_options.serial_number = option_values.serial_number++; + encode_options.serial_number = option_values.serial_number++; #endif - common_options.lax = option_values.lax; - common_options.padding = option_values.padding; - common_options.num_compression_settings = option_values.num_compression_settings; - FLAC__ASSERT(sizeof(common_options.compression_settings) >= sizeof(option_values.compression_settings)); - memcpy(common_options.compression_settings, option_values.compression_settings, sizeof(option_values.compression_settings)); - common_options.requested_seek_points = option_values.requested_seek_points; - common_options.num_requested_seek_points = option_values.num_requested_seek_points; - common_options.cuesheet_filename = option_values.cuesheet_filename; - common_options.continue_through_decode_errors = option_values.continue_through_decode_errors; - common_options.cued_seekpoints = option_values.cued_seekpoints; - common_options.channel_map_none = option_values.channel_map_none; - common_options.is_first_file = is_first_file; - common_options.is_last_file = is_last_file; - common_options.align_reservoir = align_reservoir; - common_options.align_reservoir_samples = &align_reservoir_samples; - common_options.replay_gain = option_values.replay_gain; - common_options.ignore_chunk_sizes = option_values.ignore_chunk_sizes; - common_options.sector_align = option_values.sector_align; - common_options.vorbis_comment = option_values.vorbis_comment; - FLAC__ASSERT(sizeof(common_options.pictures) >= sizeof(option_values.pictures)); - memcpy(common_options.pictures, option_values.pictures, sizeof(option_values.pictures)); - common_options.num_pictures = option_values.num_pictures; - common_options.debug.disable_constant_subframes = option_values.debug.disable_constant_subframes; - common_options.debug.disable_fixed_subframes = option_values.debug.disable_fixed_subframes; - common_options.debug.disable_verbatim_subframes = option_values.debug.disable_verbatim_subframes; - common_options.debug.do_md5 = option_values.debug.do_md5; + encode_options.lax = option_values.lax; + encode_options.padding = option_values.padding; + encode_options.num_compression_settings = option_values.num_compression_settings; + FLAC__ASSERT(sizeof(encode_options.compression_settings) >= sizeof(option_values.compression_settings)); + memcpy(encode_options.compression_settings, option_values.compression_settings, sizeof(option_values.compression_settings)); + encode_options.requested_seek_points = option_values.requested_seek_points; + encode_options.num_requested_seek_points = option_values.num_requested_seek_points; + encode_options.cuesheet_filename = option_values.cuesheet_filename; + encode_options.continue_through_decode_errors = option_values.continue_through_decode_errors; + encode_options.cued_seekpoints = option_values.cued_seekpoints; + encode_options.channel_map_none = option_values.channel_map_none; + encode_options.is_first_file = is_first_file; + encode_options.is_last_file = is_last_file; + encode_options.replay_gain = option_values.replay_gain; + encode_options.ignore_chunk_sizes = option_values.ignore_chunk_sizes; + encode_options.vorbis_comment = option_values.vorbis_comment; + FLAC__ASSERT(sizeof(encode_options.pictures) >= sizeof(option_values.pictures)); + memcpy(encode_options.pictures, option_values.pictures, sizeof(option_values.pictures)); + encode_options.num_pictures = option_values.num_pictures; + encode_options.format = input_format; + encode_options.debug.disable_constant_subframes = option_values.debug.disable_constant_subframes; + encode_options.debug.disable_fixed_subframes = option_values.debug.disable_fixed_subframes; + encode_options.debug.disable_verbatim_subframes = option_values.debug.disable_verbatim_subframes; + encode_options.debug.do_md5 = option_values.debug.do_md5; + encode_options.error_on_compression_fail = option_values.error_on_compression_fail; + encode_options.limit_min_bitrate = option_values.limit_min_bitrate; + encode_options.relaxed_foreign_metadata_handling = option_values.keep_foreign_metadata_if_present; /* if infilename and outfilename point to the same file, we need to write to a temporary file */ if(encode_infile != stdin && grabbag__file_are_same(infilename, outfilename)) { static const char *tmp_suffix = ".tmp,fl-ac+en'c"; + size_t dest_len = strlen(outfilename) + strlen(tmp_suffix) + 1; /*@@@@ still a remote possibility that a file with this filename exists */ - if(0 == (internal_outfilename = (char *)safe_malloc_add_3op_(strlen(outfilename), /*+*/strlen(tmp_suffix), /*+*/1))) { + if((internal_outfilename = safe_malloc_(dest_len)) == NULL) { flac__utils_printf(stderr, 1, "ERROR allocating memory for tempfile name\n"); conditional_fclose(encode_infile); return 1; } - strcpy(internal_outfilename, outfilename); - strcat(internal_outfilename, tmp_suffix); + flac_snprintf(internal_outfilename, dest_len, "%s%s", outfilename, tmp_suffix); } - if(input_format == RAW) { - raw_encode_options_t options; - - options.common = common_options; - options.is_big_endian = option_values.format_is_big_endian; - options.is_unsigned_samples = option_values.format_is_unsigned_samples; - options.channels = option_values.format_channels; - options.bps = option_values.format_bps; - options.sample_rate = option_values.format_sample_rate; + if(input_format == FORMAT_RAW) { + encode_options.format_options.raw.is_big_endian = option_values.format_is_big_endian; + encode_options.format_options.raw.is_unsigned_samples = option_values.format_is_unsigned_samples; + encode_options.format_options.raw.channels = option_values.format_channels; + encode_options.format_options.raw.bps = option_values.format_bps; + encode_options.format_options.raw.sample_rate = option_values.format_sample_rate; - retval = flac__encode_raw(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, options); + retval = flac__encode_file(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, encode_options); } - else if(input_format == FLAC || input_format == OGGFLAC) { - flac_encode_options_t options; - - options.common = common_options; - - retval = flac__encode_flac(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, options, input_format==OGGFLAC); + else if(input_format == FORMAT_FLAC || input_format == FORMAT_OGGFLAC) { + retval = flac__encode_file(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, encode_options); } - else { - wav_encode_options_t options; - - options.common = common_options; - options.foreign_metadata = 0; - - /* read foreign metadata if requested */ - if(option_values.keep_foreign_metadata) { - if(0 == (options.foreign_metadata = flac__foreign_metadata_new(input_format==AIF? FOREIGN_BLOCK_TYPE__AIFF : FOREIGN_BLOCK_TYPE__RIFF))) { + else if(input_format == FORMAT_WAVE || input_format == FORMAT_WAVE64 || input_format == FORMAT_RF64 || input_format == FORMAT_AIFF || input_format == FORMAT_AIFF_C) { + encode_options.format_options.iff.foreign_metadata = 0; + + /* initialize foreign metadata if requested */ + if(option_values.keep_foreign_metadata || option_values.keep_foreign_metadata_if_present) { + encode_options.format_options.iff.foreign_metadata = + flac__foreign_metadata_new( + input_format==FORMAT_WAVE || input_format==FORMAT_RF64? + FOREIGN_BLOCK_TYPE__RIFF : + input_format==FORMAT_WAVE64? + FOREIGN_BLOCK_TYPE__WAVE64 : + FOREIGN_BLOCK_TYPE__AIFF + ); + if(0 == encode_options.format_options.iff.foreign_metadata) { flac__utils_printf(stderr, 1, "ERROR: creating foreign metadata object\n"); conditional_fclose(encode_infile); + if(internal_outfilename != 0) + free(internal_outfilename); return 1; } } - if(input_format == AIF) - retval = flac__encode_aif(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, options, is_aifc); - else - retval = flac__encode_wav(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, options); + retval = flac__encode_file(encode_infile, infilesize, infilename, internal_outfilename? internal_outfilename : outfilename, lookahead, lookahead_length, encode_options); - if(options.foreign_metadata) - flac__foreign_metadata_delete(options.foreign_metadata); + if(encode_options.format_options.iff.foreign_metadata) + flac__foreign_metadata_delete(encode_options.format_options.iff.foreign_metadata); + } + else { + FLAC__ASSERT(0); + retval = 1; /* double protection */ } if(retval == 0) { @@ -1903,28 +2063,28 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ const char *error; grabbag__replaygain_get_title(&title_gain, &title_peak); if( - 0 != (error = grabbag__replaygain_store_to_file_reference(internal_outfilename? internal_outfilename : outfilename, /*preserve_modtime=*/true)) || - 0 != (error = grabbag__replaygain_store_to_file_title(internal_outfilename? internal_outfilename : outfilename, title_gain, title_peak, /*preserve_modtime=*/true)) + 0 != (error = grabbag__replaygain_store_to_file_reference(internal_outfilename? internal_outfilename : outfilename, option_values.preserve_modtime)) || + 0 != (error = grabbag__replaygain_store_to_file_title(internal_outfilename? internal_outfilename : outfilename, title_gain, title_peak, option_values.preserve_modtime)) ) { flac__utils_printf(stderr, 1, "%s: ERROR writing ReplayGain reference/title tags (%s)\n", outfilename, error); retval = 1; } } - if(strcmp(infilename, "-")) + if(option_values.preserve_modtime && strcmp(infilename, "-")) grabbag__file_copy_metadata(infilename, internal_outfilename? internal_outfilename : outfilename); } } /* rename temporary file if necessary */ if(retval == 0 && internal_outfilename != 0) { - if(rename(internal_outfilename, outfilename) < 0) { + if(flac_rename(internal_outfilename, outfilename) < 0) { #if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ - /* on some flavors of windows, rename() will fail if the destination already exists, so we unlink and try again */ - if(unlink(outfilename) < 0) { + /* on some flavors of windows, flac_rename() will fail if the destination already exists, so we unlink and try again */ + if(flac_unlink(outfilename) < 0) { flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, keeping both\n", internal_outfilename, outfilename); retval = 1; } - else if(rename(internal_outfilename, outfilename) < 0) { + else if(flac_rename(internal_outfilename, outfilename) < 0) { flac__utils_printf(stderr, 1, "ERROR: moving new FLAC file %s back on top of original FLAC file %s, you must do it\n", internal_outfilename, outfilename); retval = 1; } @@ -1937,7 +2097,7 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_ /* handle --delete-input-file, but don't want to delete if piping from stdin, or if input filename and output filename are the same */ if(retval == 0 && option_values.delete_input && strcmp(infilename, "-") && internal_outfilename == 0) - unlink(infilename); + flac_unlink(infilename); if(internal_outfilename != 0) free(internal_outfilename); @@ -1949,52 +2109,157 @@ int decode_file(const char *infilename) { int retval; FLAC__bool treat_as_ogg = false; - FileFormat output_format = WAV; - decode_options_t common_options; - const char *outfilename = get_decoded_outfilename(infilename); + FileFormat output_format = FORMAT_WAVE; + FileSubFormat output_subformat = SUBFORMAT_UNSPECIFIED; + decode_options_t decode_options; + foreign_metadata_t *foreign_metadata = 0; + const char *outfilename = get_outfilename(infilename, ". "); /* Placeholder until we know what the actual suffix is */ + size_t infilename_length; if(0 == outfilename) { flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", infilename); return 1; } - /* - * Error if output file already exists (and -f not used). - * Use grabbag__file_get_filesize() as a cheap way to check. - */ - if(!option_values.test_only && !option_values.force_file_overwrite && strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (off_t)(-1)) { - flac__utils_printf(stderr, 1, "ERROR: output file %s already exists, use -f to override\n", outfilename); - return 1; + if(!option_values.analyze && !option_values.test_only &&(option_values.keep_foreign_metadata || option_values.keep_foreign_metadata_if_present)) { + const char *error; + if(0 == strcmp(infilename, "-") || 0 == strcmp(outfilename, "-")) + return usage_error("ERROR: --keep-foreign-metadata cannot be used when decoding from stdin or to stdout\n"); + if(output_format == FORMAT_RAW) + return usage_error("ERROR: --keep-foreign-metadata cannot be used with raw output\n"); + decode_options.format_options.iff.foreign_metadata = 0; + /* initialize foreign metadata structure */ + foreign_metadata = flac__foreign_metadata_new(FOREIGN_BLOCK_TYPE__RIFF); /* RIFF is just a placeholder */ + if(0 == foreign_metadata) { + flac__utils_printf(stderr, 1, "ERROR: creating foreign metadata object\n"); + return 1; + } + if(!flac__foreign_metadata_read_from_flac(foreign_metadata, infilename, &error)) { + if(option_values.keep_foreign_metadata_if_present) { + flac__utils_printf(stderr, 1, "%s: WARNING reading foreign metadata: %s\n", infilename, error); + if(option_values.treat_warnings_as_errors) { + flac__foreign_metadata_delete(foreign_metadata); + return 1; + } + else { + /* Couldn't find foreign metadata, stop processing */ + flac__foreign_metadata_delete(foreign_metadata); + foreign_metadata = 0; + } + } + else { + flac__utils_printf(stderr, 1, "%s: ERROR reading foreign metadata: %s\n", infilename, error); + flac__foreign_metadata_delete(foreign_metadata); + return 1; + } + } } if(option_values.force_raw_format) - output_format = RAW; + output_format = FORMAT_RAW; else if( option_values.force_aiff_format || (strlen(outfilename) >= 4 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-4), ".aif")) || (strlen(outfilename) >= 5 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-5), ".aiff")) ) - output_format = AIF; + output_format = FORMAT_AIFF; + else if( + option_values.force_rf64_format || + (strlen(outfilename) >= 5 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-5), ".rf64")) + ) + output_format = FORMAT_RF64; + else if( + option_values.force_wave64_format || + (strlen(outfilename) >= 4 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-4), ".w64")) + ) + output_format = FORMAT_WAVE64; + else if(foreign_metadata != NULL) { + /* Pick a format based on what the foreign metadata contains */ + if(foreign_metadata->type == FOREIGN_BLOCK_TYPE__WAVE64) + output_format = FORMAT_WAVE64; + else if(foreign_metadata->is_rf64) + output_format = FORMAT_RF64; + else if(foreign_metadata->type == FOREIGN_BLOCK_TYPE__AIFF) { + output_format = FORMAT_AIFF; + if(foreign_metadata->is_aifc) { + output_format = FORMAT_AIFF_C; + } + } + else + output_format = FORMAT_WAVE; + } else - output_format = WAV; + output_format = FORMAT_WAVE; + + /* Now do subformats */ + if(option_values.force_legacy_wave_format) + output_subformat = SUBFORMAT_WAVE_PCM; + else if(option_values.force_extensible_wave_format) + output_subformat = SUBFORMAT_WAVE_EXTENSIBLE; + else if(option_values.force_aiff_c_none_format) { + output_format = FORMAT_AIFF_C; + output_subformat = SUBFORMAT_AIFF_C_NONE; + } + else if(option_values.force_aiff_c_sowt_format) { + output_format = FORMAT_AIFF_C; + output_subformat = SUBFORMAT_AIFF_C_SOWT; + } + else if(foreign_metadata != NULL) { + if(foreign_metadata->is_wavefmtex) + output_subformat = SUBFORMAT_WAVE_EXTENSIBLE; + else if(output_format == FORMAT_WAVE) + output_subformat = SUBFORMAT_WAVE_PCM; + else if(foreign_metadata->is_aifc) { + if(foreign_metadata->is_sowt) + output_subformat = SUBFORMAT_AIFF_C_SOWT; + else + output_subformat = SUBFORMAT_AIFF_C_NONE; + } + } - if(!option_values.test_only && !option_values.analyze) { - if(output_format == RAW && (option_values.format_is_big_endian < 0 || option_values.format_is_unsigned_samples < 0)) - return usage_error("ERROR: for decoding to a raw file you must specify a value for --endian and --sign\n"); + + /* Check whether output format agrees with foreign metadata */ + if(foreign_metadata != NULL) { + if((output_format != FORMAT_WAVE && output_format != FORMAT_RF64) && foreign_metadata->type == FOREIGN_BLOCK_TYPE__RIFF) { + flac__foreign_metadata_delete(foreign_metadata); + return usage_error("ERROR: foreign metadata type RIFF cannot be restored to a%s file, only to WAVE and RF64\n",FileFormatString[output_format]); + } + if((output_format != FORMAT_AIFF && output_format != FORMAT_AIFF_C) && foreign_metadata->type == FOREIGN_BLOCK_TYPE__AIFF) { + flac__foreign_metadata_delete(foreign_metadata); + return usage_error("ERROR: foreign metadata type AIFF cannot be restored to a%s file, only to AIFF and AIFF-C\n",FileFormatString[output_format]); + } + if(output_format != FORMAT_WAVE64 && foreign_metadata->type == FOREIGN_BLOCK_TYPE__WAVE64) { + flac__foreign_metadata_delete(foreign_metadata); + return usage_error("ERROR: foreign metadata type Wave64 cannot be restored to a%s file, only to Wave64\n",FileFormatString[output_format]); + } } - if(option_values.keep_foreign_metadata) { - if(0 == strcmp(infilename, "-") || 0 == strcmp(outfilename, "-")) - return usage_error("ERROR: --keep-foreign-metadata cannot be used when decoding from stdin or to stdout\n"); - if(output_format != WAV && output_format != AIF) - return usage_error("ERROR: --keep-foreign-metadata can only be used with WAVE or AIFF output\n"); + /* Now reassemble outfilename */ + get_decoded_outfilename(infilename, output_format); + + /* + * Error if output file already exists (and -f not used). + * Use grabbag__file_get_filesize() as a cheap way to check. + */ + if(!option_values.test_only && !option_values.force_file_overwrite && strcmp(outfilename, "-") && grabbag__file_get_filesize(outfilename) != (FLAC__off_t)(-1)) { + flac__utils_printf(stderr, 1, "ERROR: output file %s already exists, use -f to override\n", outfilename); + flac__foreign_metadata_delete(foreign_metadata); + return 1; } + if(!option_values.test_only && !option_values.analyze) { + if(output_format == FORMAT_RAW && (option_values.format_is_big_endian < 0 || option_values.format_is_unsigned_samples < 0)) { + flac__foreign_metadata_delete(foreign_metadata); + return usage_error("ERROR: for decoding to a raw file you must specify a value for --endian and --sign\n"); + } + } + + infilename_length = strlen(infilename); if(option_values.use_ogg) treat_as_ogg = true; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".oga")) + else if(infilename_length >= 4 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-4), ".oga")) treat_as_ogg = true; - else if(strlen(infilename) >= 4 && 0 == FLAC__STRCASECMP(infilename+(strlen(infilename)-4), ".ogg")) + else if(infilename_length >= 4 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-4), ".ogg")) treat_as_ogg = true; else treat_as_ogg = false; @@ -2002,74 +2267,68 @@ int decode_file(const char *infilename) #if !FLAC__HAS_OGG if(treat_as_ogg) { flac__utils_printf(stderr, 1, "%s: Ogg support has not been built into this copy of flac\n", infilename); + flac__foreign_metadata_delete(foreign_metadata); return 1; } #endif - if(!flac__utils_parse_skip_until_specification(option_values.skip_specification, &common_options.skip_specification) || common_options.skip_specification.is_relative) + if(!flac__utils_parse_skip_until_specification(option_values.skip_specification, &decode_options.skip_specification) || decode_options.skip_specification.is_relative) { + flac__foreign_metadata_delete(foreign_metadata); return usage_error("ERROR: invalid value for --skip\n"); + } - if(!flac__utils_parse_skip_until_specification(option_values.until_specification, &common_options.until_specification)) /*@@@ more checks: no + without --skip, no - unless known total_samples_to_{en,de}code */ + if(!flac__utils_parse_skip_until_specification(option_values.until_specification, &decode_options.until_specification)) { /*@@@ more checks: no + without --skip, no - unless known total_samples_to_{en,de}code */ + flac__foreign_metadata_delete(foreign_metadata); return usage_error("ERROR: invalid value for --until\n"); + } /* if there is no "--until" we want to default to "--until=-0" */ if(0 == option_values.until_specification) - common_options.until_specification.is_relative = true; + decode_options.until_specification.is_relative = true; if(option_values.cue_specification) { - if(!flac__utils_parse_cue_specification(option_values.cue_specification, &common_options.cue_specification)) + if(!flac__utils_parse_cue_specification(option_values.cue_specification, &decode_options.cue_specification)) { + flac__foreign_metadata_delete(foreign_metadata); return usage_error("ERROR: invalid value for --cue\n"); - common_options.has_cue_specification = true; + } + decode_options.has_cue_specification = true; } else - common_options.has_cue_specification = false; + decode_options.has_cue_specification = false; - common_options.treat_warnings_as_errors = option_values.treat_warnings_as_errors; - common_options.continue_through_decode_errors = option_values.continue_through_decode_errors; - common_options.replaygain_synthesis_spec = option_values.replaygain_synthesis_spec; + decode_options.treat_warnings_as_errors = option_values.treat_warnings_as_errors; + decode_options.continue_through_decode_errors = option_values.continue_through_decode_errors; + decode_options.relaxed_foreign_metadata_handling = option_values.keep_foreign_metadata_if_present; + decode_options.replaygain_synthesis_spec = option_values.replaygain_synthesis_spec; + decode_options.force_subformat = output_subformat; #if FLAC__HAS_OGG - common_options.is_ogg = treat_as_ogg; - common_options.use_first_serial_number = !option_values.has_serial_number; - common_options.serial_number = option_values.serial_number; + decode_options.is_ogg = treat_as_ogg; + decode_options.use_first_serial_number = !option_values.has_serial_number; + decode_options.serial_number = option_values.serial_number; #endif - common_options.channel_map_none = option_values.channel_map_none; - - if(output_format == RAW) { - raw_decode_options_t options; + decode_options.channel_map_none = option_values.channel_map_none; + decode_options.format = output_format; - options.common = common_options; - options.is_big_endian = option_values.format_is_big_endian; - options.is_unsigned_samples = option_values.format_is_unsigned_samples; + if(output_format == FORMAT_RAW) { + decode_options.format_options.raw.is_big_endian = option_values.format_is_big_endian; + decode_options.format_options.raw.is_unsigned_samples = option_values.format_is_unsigned_samples; - retval = flac__decode_raw(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, options); + retval = flac__decode_file(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, decode_options); } else { - wav_decode_options_t options; + decode_options.format_options.iff.foreign_metadata = foreign_metadata; - options.common = common_options; - options.foreign_metadata = 0; + retval = flac__decode_file(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, decode_options); - /* read foreign metadata if requested */ - if(option_values.keep_foreign_metadata) { - if(0 == (options.foreign_metadata = flac__foreign_metadata_new(output_format==AIF? FOREIGN_BLOCK_TYPE__AIFF : FOREIGN_BLOCK_TYPE__RIFF))) { - flac__utils_printf(stderr, 1, "ERROR: creating foreign metadata object\n"); - return 1; - } - } - - if(output_format == AIF) - retval = flac__decode_aiff(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, options); - else - retval = flac__decode_wav(infilename, option_values.test_only? 0 : outfilename, option_values.analyze, option_values.aopts, options); - - if(options.foreign_metadata) - flac__foreign_metadata_delete(options.foreign_metadata); } + if(foreign_metadata) + flac__foreign_metadata_delete(foreign_metadata); + if(retval == 0 && strcmp(infilename, "-")) { - if(strcmp(outfilename, "-")) + if(option_values.preserve_modtime && strcmp(outfilename, "-")) grabbag__file_copy_metadata(infilename, outfilename); if(option_values.delete_input && !option_values.test_only && !option_values.analyze) - unlink(infilename); + flac_unlink(infilename); } return retval; @@ -2078,34 +2337,62 @@ int decode_file(const char *infilename) const char *get_encoded_outfilename(const char *infilename) { const char *suffix = (option_values.use_ogg? ".oga" : ".flac"); - return get_outfilename(infilename, suffix); + const char *p; + + if(option_values.output_prefix) { + p = grabbag__file_get_basename(infilename); + } + else { + p = infilename; + } + + return get_outfilename(p, suffix); } -const char *get_decoded_outfilename(const char *infilename) +const char *get_decoded_outfilename(const char *infilename, const FileFormat format) { const char *suffix; + const char *p; + + if(option_values.output_prefix) { + p = grabbag__file_get_basename(infilename); + } + else { + p = infilename; + } + if(option_values.analyze) { suffix = ".ana"; } - else if(option_values.force_raw_format) { + else if(format == FORMAT_RAW) { suffix = ".raw"; } - else if(option_values.force_aiff_format) { + else if(format == FORMAT_AIFF) { suffix = ".aiff"; } + else if(format == FORMAT_AIFF_C) { + suffix = ".aifc"; + } + else if(format == FORMAT_RF64) { + suffix = ".rf64"; + } + else if(format == FORMAT_WAVE64) { + suffix = ".w64"; + } else { suffix = ".wav"; } - return get_outfilename(infilename, suffix); + return get_outfilename(p, suffix); } const char *get_outfilename(const char *infilename, const char *suffix) { if(0 == option_values.cmdline_forced_outfilename) { - static char buffer[4096]; /* @@@ bad MAGIC NUMBER */ + static char buffer[4096]; if(0 == strcmp(infilename, "-") || option_values.force_to_stdout) { - strcpy(buffer, "-"); + buffer [0] = '-'; + buffer [1] = 0; } else { char *p; @@ -2153,29 +2440,3 @@ char *local_strdup(const char *source) die("out of memory during strdup()"); return ret; } - -#ifdef _MSC_VER -/* There's no strtoll() in MSVC6 so we just write a specialized one */ -FLAC__int64 local__strtoll(const char *src, char **endptr) -{ - FLAC__bool neg = false; - FLAC__int64 ret = 0; - int c; - FLAC__ASSERT(0 != src); - if(*src == '-') { - neg = true; - src++; - } - while(0 != (c = *src)) { - c -= '0'; - if(c >= 0 && c <= 9) - ret = (ret * 10) + c; - else - break; - src++; - } - if(endptr) - *endptr = (char*)src; - return neg? -ret : ret; -} -#endif diff --git a/3rdparty/libflac/src/flac/utils.c b/3rdparty/libflac/src/flac/utils.c index bca8af761cc..446150d41de 100644 --- a/3rdparty/libflac/src/flac/utils.c +++ b/3rdparty/libflac/src/flac/utils.c @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,23 +12,36 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif -#include "utils.h" -#include "FLAC/assert.h" -#include "FLAC/metadata.h" #include <math.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "utils.h" +#include "FLAC/assert.h" +#include "FLAC/metadata.h" +#include "share/compat.h" +#ifndef _WIN32 +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE +#endif +#include <wchar.h> +#ifdef HAVE_TERMIOS_H +# include <termios.h> +#endif +#ifdef HAVE_SYS_IOCTL_H +# include <sys/ioctl.h> +#endif +#endif const char *CHANNEL_MASK_TAG = "WAVEFORMATEXTENSIBLE_CHANNEL_MASK"; @@ -42,8 +56,18 @@ static FLAC__bool local__parse_uint64_(const char *s, FLAC__uint64 *value) return false; while('\0' != (c = *s++)) - if(c >= '0' && c <= '9') - ret = ret * 10 + (c - '0'); + if(c >= '0' && c <= '9') { + if(ret > UINT64_MAX / 10) /* check for overflow */ + return false; + else if(ret == UINT64_MAX / 10) { + FLAC__uint64 tmp = ret; + ret = ret * 10 + (c - '0'); + if(ret < tmp) + return false; + } + else + ret = ret * 10 + (c - '0'); + } else return false; @@ -54,8 +78,8 @@ static FLAC__bool local__parse_uint64_(const char *s, FLAC__uint64 *value) static FLAC__bool local__parse_timecode_(const char *s, double *value) { double ret; - unsigned i; - char c; + uint32_t i; + char c, *endptr; /* parse [0-9][0-9]*: */ c = *s++; @@ -74,21 +98,18 @@ static FLAC__bool local__parse_timecode_(const char *s, double *value) /* parse [0-9]*[.,]?[0-9]* i.e. a sign-less rational number (. or , OK for fractional seconds, to support different locales) */ if(strspn(s, "1234567890.,") != strlen(s)) return false; - { - const char *p = strpbrk(s, ".,"); - if(p && 0 != strpbrk(++p, ".,")) - return false; - } - ret += atof(s); + ret += strtod(s, &endptr); + if (endptr == s || *endptr) + return false; *value = ret; return true; } -static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *track, unsigned *index) +static FLAC__bool local__parse_cue_(const char *s, const char *end, uint32_t *track, uint32_t *indx) { FLAC__bool got_track = false, got_index = false; - unsigned t = 0, i = 0; + uint32_t t = 0, i = 0; char c; while(end? s < end : *s != '\0') { @@ -112,7 +133,7 @@ static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *tr return false; } *track = t; - *index = i; + *indx = i; return got_track && got_index; } @@ -121,20 +142,20 @@ static FLAC__bool local__parse_cue_(const char *s, const char *end, unsigned *tr * does not require sorted cuesheets). but if it's not sorted, picking a * nearest cue point has no significance. */ -static FLAC__uint64 local__find_closest_cue_(const FLAC__StreamMetadata_CueSheet *cuesheet, unsigned track, unsigned index, FLAC__uint64 total_samples, FLAC__bool look_forward) +static FLAC__uint64 local__find_closest_cue_(const FLAC__StreamMetadata_CueSheet *cuesheet, uint32_t track, uint32_t indx, FLAC__uint64 total_samples, FLAC__bool look_forward) { int t, i; if(look_forward) { for(t = 0; t < (int)cuesheet->num_tracks; t++) for(i = 0; i < (int)cuesheet->tracks[t].num_indices; i++) - if(cuesheet->tracks[t].number > track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number >= index)) + if(cuesheet->tracks[t].number > track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number >= indx)) return cuesheet->tracks[t].offset + cuesheet->tracks[t].indices[i].offset; return total_samples; } else { for(t = (int)cuesheet->num_tracks - 1; t >= 0; t--) for(i = (int)cuesheet->tracks[t].num_indices - 1; i >= 0; i--) - if(cuesheet->tracks[t].number < track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number <= index)) + if(cuesheet->tracks[t].number < track || (cuesheet->tracks[t].number == track && cuesheet->tracks[t].indices[i].number <= indx)) return cuesheet->tracks[t].offset + cuesheet->tracks[t].indices[i].offset; return 0; } @@ -149,9 +170,109 @@ void flac__utils_printf(FILE *stream, int level, const char *format, ...) va_start(args, format); - (void) vfprintf(stream, format, args); + (void) flac_vfprintf(stream, format, args); + + va_end(args); + +#ifdef _MSC_VER + if(stream == stderr) + fflush(stream); /* for some reason stderr is buffered in at least some if not all MSC libs */ +#endif + } +} + +/* variables and functions for console status output */ +static FLAC__bool is_name_printed; +static int stats_char_count = 0; +static int console_width; +static int console_chars_left; + +int get_console_width(void) +{ + int width = 0; +#if defined _WIN32 + width = win_get_console_width(); +#elif defined __EMX__ + int s[2]; + _scrsize (s); + width = s[0]; +#elif defined TIOCGWINSZ + struct winsize w; + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1) + width = w.ws_col; +#endif + if (width <= 0) + width = 80; + return width; +} + +size_t strlen_console(const char *text) +{ +#ifdef _WIN32 + return strlen_utf8(text); +#elif defined(__DJGPP__) /* workaround for DJGPP missing wcswidth() */ + return strlen(text); +#else + size_t len; + wchar_t *wtmp; + + len = strlen(text)+1; + wtmp = (wchar_t *)malloc(len*sizeof(wchar_t)); + if (wtmp == NULL) return len-1; + mbstowcs(wtmp, text, len); + len = wcswidth(wtmp, len); + free(wtmp); + + return len; +#endif +} + +void stats_new_file(void) +{ + is_name_printed = false; +} + +void stats_clear(void) +{ + while (stats_char_count > 0 && stats_char_count--) + fprintf(stderr, "\b"); +} + +void stats_print_name(int level, const char *name) +{ + int len; + if (flac__utils_verbosity_ >= level) { + stats_clear(); + if(is_name_printed) return; + + console_width = get_console_width(); + len = strlen_console(name)+2; + console_chars_left = console_width - (len % console_width); + flac_fprintf(stderr, "%s: ", name); + is_name_printed = true; + } +} + +void stats_print_info(int level, const char *format, ...) +{ + char tmp[80]; + int len, clear_len; + + if (flac__utils_verbosity_ >= level) { + va_list args; + va_start(args, format); + len = flac_vsnprintf(tmp, sizeof(tmp), format, args); va_end(args); + stats_clear(); + if (len >= console_chars_left) { + clear_len = console_chars_left; + while (clear_len > 0 && clear_len--) fprintf(stderr, " "); + fprintf(stderr, "\n"); + console_chars_left = console_width; + } + stats_char_count = fprintf(stderr, "%s", tmp); + fflush(stderr); } } @@ -189,6 +310,8 @@ FLAC__bool flac__utils_parse_skip_until_specification(const char *s, utils__Skip if(local__parse_uint64_(s, &val)) { spec->value_is_samples = true; + if(val > INT64_MAX) + return false; spec->value.samples = (FLAC__int64)val; if(is_negative) spec->value.samples = -(spec->value.samples); @@ -207,13 +330,17 @@ FLAC__bool flac__utils_parse_skip_until_specification(const char *s, utils__Skip return true; } -void flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, unsigned sample_rate) +FLAC__bool flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, uint32_t sample_rate) { FLAC__ASSERT(0 != spec); if(!spec->value_is_samples) { - spec->value.samples = (FLAC__int64)(spec->value.seconds * (double)sample_rate); + double samples = spec->value.seconds * (double)sample_rate; + if(samples >= (double)INT64_MAX || samples <= (double)INT64_MIN) + return false; + spec->value.samples = (FLAC__int64)(samples); spec->value_is_samples = true; } + return true; } FLAC__bool flac__utils_parse_cue_specification(const char *s, utils__CueSpecification *spec) @@ -281,13 +408,9 @@ FLAC__bool flac__utils_set_channel_mask_tag(FLAC__StreamMetadata *object, FLAC__ FLAC__ASSERT(object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - FLAC__ASSERT(strlen(CHANNEL_MASK_TAG+1+2+16+1) <= sizeof(tag)); /* +1 for =, +2 for 0x, +16 for digits, +1 for NUL */ + FLAC__ASSERT(strlen(CHANNEL_MASK_TAG)+1+2+16+1 <= sizeof(tag)); /* +1 for =, +2 for 0x, +16 for digits, +1 for NUL */ entry.entry = (FLAC__byte*)tag; -#if defined _MSC_VER || defined __MINGW32__ - if((entry.length = _snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (unsigned)channel_mask)) >= sizeof(tag)) -#else - if((entry.length = snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (unsigned)channel_mask)) >= sizeof(tag)) -#endif + if((entry.length = flac_snprintf(tag, sizeof(tag), "%s=0x%04X", CHANNEL_MASK_TAG, (uint32_t)channel_mask)) >= sizeof(tag)) return false; if(!FLAC__metadata_object_vorbiscomment_replace_comment(object, entry, /*all=*/true, /*copy=*/true)) return false; @@ -297,7 +420,7 @@ FLAC__bool flac__utils_set_channel_mask_tag(FLAC__StreamMetadata *object, FLAC__ FLAC__bool flac__utils_get_channel_mask_tag(const FLAC__StreamMetadata *object, FLAC__uint32 *channel_mask) { int offset; - unsigned val; + uint32_t val; char *p; FLAC__ASSERT(object); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); @@ -307,7 +430,7 @@ FLAC__bool flac__utils_get_channel_mask_tag(const FLAC__StreamMetadata *object, return false; if(0 == (p = strchr((const char *)object->data.vorbis_comment.comments[offset].entry, '='))) /* should never happen, but just in case */ return false; - if(strncmp(p, "=0x", 3)) + if(FLAC__STRNCASECMP(p, "=0x", 3)) return false; if(sscanf(p+3, "%x", &val) != 1) return false; diff --git a/3rdparty/libflac/src/flac/utils.h b/3rdparty/libflac/src/flac/utils.h index 74ab29e3e3e..931b4a6e5df 100644 --- a/3rdparty/libflac/src/flac/utils.h +++ b/3rdparty/libflac/src/flac/utils.h @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,15 +12,15 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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__utils_h #define flac__utils_h -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -27,6 +28,12 @@ #include "FLAC/format.h" /* for FLAC__StreamMetadata_CueSheet */ #include <stdio.h> /* for FILE */ +typedef enum { FORMAT_RAW, FORMAT_WAVE, FORMAT_WAVE64, FORMAT_RF64, FORMAT_AIFF, FORMAT_AIFF_C, FORMAT_FLAC, FORMAT_OGGFLAC } FileFormat; +static const char * const FileFormatString[] = { " raw", " WAVE", " Wave64", "n RF64", "n AIFF", "n AIFF-C", " FLAC", "n Ogg FLAC" }; + +typedef enum { SUBFORMAT_UNSPECIFIED = 0, SUBFORMAT_WAVE_PCM, SUBFORMAT_WAVE_EXTENSIBLE, SUBFORMAT_AIFF_C_NONE, SUBFORMAT_AIFF_C_SOWT } FileSubFormat; + + typedef struct { FLAC__bool is_relative; /* i.e. specification string started with + or - */ FLAC__bool value_is_samples; @@ -51,8 +58,15 @@ size_t flac__utils_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stre extern int flac__utils_verbosity_; void flac__utils_printf(FILE *stream, int level, const char *format, ...); +int get_console_width(void); +size_t strlen_console(const char *text); +void stats_new_file(void); +void stats_clear(void); +void stats_print_name(int level, const char *name); +void stats_print_info(int level, const char *format, ...); + FLAC__bool flac__utils_parse_skip_until_specification(const char *s, utils__SkipUntilSpecification *spec); -void flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, unsigned sample_rate); +FLAC__bool flac__utils_canonicalize_skip_until_specification(utils__SkipUntilSpecification *spec, uint32_t sample_rate); FLAC__bool flac__utils_parse_cue_specification(const char *s, utils__CueSpecification *spec); void flac__utils_canonicalize_cue_specification(const utils__CueSpecification *cue_spec, const FLAC__StreamMetadata_CueSheet *cuesheet, FLAC__uint64 total_samples, utils__SkipUntilSpecification *skip_spec, utils__SkipUntilSpecification *until_spec); diff --git a/3rdparty/libflac/src/flac/version.rc b/3rdparty/libflac/src/flac/version.rc new file mode 100644 index 00000000000..00842b924c5 --- /dev/null +++ b/3rdparty/libflac/src/flac/version.rc @@ -0,0 +1,38 @@ +#include <winver.h> +#include "config.h" + +#if (defined GIT_COMMIT_HASH && defined GIT_COMMIT_DATE) +# ifdef GIT_COMMIT_TAG +# define VERSIONSTRING GIT_COMMIT_TAG +# else +# define VERSIONSTRING "git-" GIT_COMMIT_HASH +# endif +#else +# define VERSIONSTRING PACKAGE_VERSION +#endif + +#define xstr(s) str(s) +#define str(s) #s + +VS_VERSION_INFO VERSIONINFO +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0 +FILEOS VOS__WINDOWS32 +FILETYPE VFT_DLL +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "flac command line tool for Windows" + VALUE "ProductName", "Free Lossless Audio Codec" + VALUE "ProductVersion", VERSIONSTRING + VALUE "CompanyName", "Xiph.Org" + VALUE "LegalCopyright", "2000-2009 Josh Coalson, 2011-2023 Xiph.Org Foundation" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/3rdparty/libflac/src/flac/vorbiscomment.c b/3rdparty/libflac/src/flac/vorbiscomment.c index 6b35a1e6359..3941ec24080 100644 --- a/3rdparty/libflac/src/flac/vorbiscomment.c +++ b/3rdparty/libflac/src/flac/vorbiscomment.c @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -29,6 +30,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "share/compat.h" /* @@ -40,7 +42,7 @@ typedef struct { char *field; /* the whole field as passed on the command line, i.e. "NAME=VALUE" */ char *field_name; /* according to the vorbis spec, field values can contain \0 so simple C strings are not enough here */ - unsigned field_value_length; + uint32_t field_value_length; char *field_value; FLAC__bool field_value_from_file; /* true if field_value holds a filename for the value, false for plain value */ } Argument_VcField; @@ -61,7 +63,7 @@ static char *local_strdup(const char *source) return ret; } -static FLAC__bool parse_vorbis_comment_field(const char *field_ref, char **field, char **name, char **value, unsigned *length, const char **violation) +static FLAC__bool parse_vorbis_comment_field(const char *field_ref, char **field, char **name, char **value, uint32_t *length, const char **violation) { static const char * const violations[] = { "field name contains invalid character", @@ -102,7 +104,7 @@ static FLAC__bool parse_vorbis_comment_field(const char *field_ref, char **field static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcField *field, FLAC__bool *needs_write, FLAC__bool raw, const char **violation) { FLAC__StreamMetadata_VorbisComment_Entry entry; - char *converted; + char *converted = NULL; FLAC__ASSERT(0 != block); FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); @@ -113,7 +115,7 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie /* read the file into 'data' */ FILE *f = 0; char *data = 0; - const off_t size = grabbag__file_get_filesize(field->field_value); + const FLAC__off_t size = grabbag__file_get_filesize(field->field_value); if(size < 0) { *violation = "can't open file for tag value"; return false; @@ -125,7 +127,7 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie if(0 == (data = malloc(size+1))) die("out of memory allocating tag value"); data[size] = '\0'; - if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) { + if(0 == (f = flac_fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) { free(data); if(f) fclose(f); @@ -169,6 +171,9 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie } else { FLAC__bool needs_free = false; +#ifdef _WIN32 /* everything in UTF-8 already. Must not alter */ + entry.entry = (FLAC__byte *)field->field; +#else if(raw) { entry.entry = (FLAC__byte *)field->field; } @@ -180,6 +185,7 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie *violation = "error converting comment to UTF-8"; return false; } +#endif entry.length = strlen((const char *)entry.entry); if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) { if(needs_free) @@ -188,7 +194,7 @@ static FLAC__bool set_vc_field(FLAC__StreamMetadata *block, const Argument_VcFie * our previous parsing has already established that the field * name is OK, so it must be the field value */ - *violation = "tag value for is not valid UTF-8"; + *violation = "tag value is not valid UTF-8"; return false; } @@ -237,7 +243,7 @@ FLAC__bool flac__vorbiscomment_add(FLAC__StreamMetadata *block, const char *comm return false; } - if(!set_vc_field(block, &parsed, &dummy, raw, violation)) { + if(parsed.field_value_length > 0 && !set_vc_field(block, &parsed, &dummy, raw, violation)) { free_field(&parsed); return false; } diff --git a/3rdparty/libflac/src/flac/vorbiscomment.h b/3rdparty/libflac/src/flac/vorbiscomment.h index 1ff70067867..a6dcb164bf9 100644 --- a/3rdparty/libflac/src/flac/vorbiscomment.h +++ b/3rdparty/libflac/src/flac/vorbiscomment.h @@ -1,5 +1,6 @@ /* flac - Command-line FLAC encoder/decoder - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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__vorbiscomment_h diff --git a/3rdparty/libflac/src/libFLAC++/CMakeLists.txt b/3rdparty/libflac/src/libFLAC++/CMakeLists.txt new file mode 100644 index 00000000000..3be43ba18f2 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC++/CMakeLists.txt @@ -0,0 +1,41 @@ +add_library(FLAC++ + metadata.cpp + stream_decoder.cpp + stream_encoder.cpp + version.rc) +set_property(TARGET FLAC++ PROPERTY PROJECT_LABEL "libFLAC++") +target_compile_definitions(FLAC++ + PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLACPP_API_EXPORTS> + PUBLIC $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:FLAC__NO_DLL>) +if(NOT WIN32) + target_compile_definitions(FLAC++ PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLAC__USE_VISIBILITY_ATTR>) +endif() +target_include_directories(FLAC++ INTERFACE + "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>" + "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>") +target_link_libraries(FLAC++ PUBLIC FLAC) +if(BUILD_SHARED_LIBS) + set_target_properties(FLAC++ PROPERTIES + VERSION 10.0.1 + SOVERSION 10) + 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/3rdparty/libflac/src/libFLAC++/Makefile.am b/3rdparty/libflac/src/libFLAC++/Makefile.am index 360caa193dd..0b2853b2062 100644 --- a/3rdparty/libflac/src/libFLAC++/Makefile.am +++ b/3rdparty/libflac/src/libFLAC++/Makefile.am @@ -1,5 +1,6 @@ # libFLAC++ - Free Lossless Audio Codec library -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -29,27 +30,39 @@ # 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 = \ - Makefile.lite \ + CMakeLists.txt \ flac++.pc.in \ - libFLAC++_dynamic.dsp \ - libFLAC++_dynamic.vcproj \ - libFLAC++_static.dsp \ - libFLAC++_static.vcproj \ - libFLAC++.m4 - -# see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention -libFLAC___la_LDFLAGS = -version-info 8:0:2 -libFLAC___la_LIBADD = ../libFLAC/libFLAC.la + libFLAC++.m4 \ + version.rc -libFLAC___la_SOURCES = \ +libFLAC___sources = \ metadata.cpp \ stream_decoder.cpp \ stream_encoder.cpp + +if OS_IS_WINDOWS +if HAVE_WINDRES +libFLAC___la_DEPENDENCIES = version.o +windows_resource_link = -Wl,version.o +endif +endif + +# see 'http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning' for numbering convention +libFLAC___la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 10:1:0 $(windows_resource_link) +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 + +.rc.o: + $(RC) $(AM_CPPFLAGS) $< $@ diff --git a/3rdparty/libflac/src/libFLAC++/Makefile.in b/3rdparty/libflac/src/libFLAC++/Makefile.in index 834b46444c2..eff1fca1947 100644 --- a/3rdparty/libflac/src/libFLAC++/Makefile.in +++ b/3rdparty/libflac/src/libFLAC++/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # libFLAC++ - Free Lossless Audio Codec library -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -44,16 +45,68 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -65,12 +118,144 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +@HAVE_WINDRES_FALSE@libFLAC___la_DEPENDENCIES = ../libFLAC/libFLAC.la +@OS_IS_WINDOWS_FALSE@libFLAC___la_DEPENDENCIES = \ +@OS_IS_WINDOWS_FALSE@ ../libFLAC/libFLAC.la +subdir = src/libFLAC++ +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = flac++.pc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(m4datadir)" \ + "$(DESTDIR)$(pkgconfigdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +libFLAC___static_la_DEPENDENCIES = ../libFLAC/libFLAC-static.la +am__objects_1 = metadata.lo stream_decoder.lo stream_encoder.lo +am_libFLAC___static_la_OBJECTS = $(am__objects_1) +libFLAC___static_la_OBJECTS = $(am_libFLAC___static_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am_libFLAC___la_OBJECTS = $(am__objects_1) +libFLAC___la_OBJECTS = $(am_libFLAC___la_OBJECTS) +libFLAC___la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(libFLAC___la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/metadata.Plo \ + ./$(DEPDIR)/stream_decoder.Plo ./$(DEPDIR)/stream_encoder.Plo +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +SOURCES = $(libFLAC___static_la_SOURCES) $(libFLAC___la_SOURCES) +DIST_SOURCES = $(libFLAC___static_la_SOURCES) $(libFLAC___la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(m4data_DATA) $(pkgconfig_DATA) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/flac++.pc.in \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -79,440 +264,437 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ 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 = \ - Makefile.lite \ + CMakeLists.txt \ flac++.pc.in \ - libFLAC++_dynamic.dsp \ - libFLAC++_dynamic.vcproj \ - libFLAC++_static.dsp \ - libFLAC++_static.vcproj \ - libFLAC++.m4 - + libFLAC++.m4 \ + version.rc -# see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention -libFLAC___la_LDFLAGS = -version-info 8:0:2 -libFLAC___la_LIBADD = ../libFLAC/libFLAC.la - -libFLAC___la_SOURCES = \ +libFLAC___sources = \ metadata.cpp \ stream_decoder.cpp \ stream_encoder.cpp -subdir = src/libFLAC++ -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = flac++.pc -LTLIBRARIES = $(lib_LTLIBRARIES) - -libFLAC___la_DEPENDENCIES = ../libFLAC/libFLAC.la -am_libFLAC___la_OBJECTS = metadata.lo stream_decoder.lo \ - stream_encoder.lo -libFLAC___la_OBJECTS = $(am_libFLAC___la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/metadata.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/stream_decoder.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/stream_encoder.Plo -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libFLAC___la_SOURCES) -DATA = $(m4data_DATA) $(pkgconfig_DATA) - -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am flac++.pc.in -SOURCES = $(libFLAC___la_SOURCES) +@HAVE_WINDRES_TRUE@@OS_IS_WINDOWS_TRUE@libFLAC___la_DEPENDENCIES = version.o +@HAVE_WINDRES_TRUE@@OS_IS_WINDOWS_TRUE@windows_resource_link = -Wl,version.o +# see 'http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning' for numbering convention +libFLAC___la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 10:1:0 $(windows_resource_link) +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 all: all-am .SUFFIXES: -.SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libFLAC++/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -flac++.pc: $(top_builddir)/config.status flac++.pc.in +.SUFFIXES: .cpp .lo .o .obj .rc +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC++/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC++/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +flac++.pc: $(top_builddir)/config.status $(srcdir)/flac++.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -libLTLIBRARIES_INSTALL = $(INSTALL) + install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + list2="$$list2 $$p"; \ else :; fi; \ - done + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libFLAC++.la: $(libFLAC___la_OBJECTS) $(libFLAC___la_DEPENDENCIES) - $(CXXLINK) -rpath $(libdir) $(libFLAC___la_LDFLAGS) $(libFLAC___la_OBJECTS) $(libFLAC___la_LIBADD) $(LIBS) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libFLAC++-static.la: $(libFLAC___static_la_OBJECTS) $(libFLAC___static_la_DEPENDENCIES) $(EXTRA_libFLAC___static_la_DEPENDENCIES) + $(AM_V_CXXLD)$(CXXLINK) $(libFLAC___static_la_OBJECTS) $(libFLAC___static_la_LIBADD) $(LIBS) + +libFLAC++.la: $(libFLAC___la_OBJECTS) $(libFLAC___la_DEPENDENCIES) $(EXTRA_libFLAC___la_DEPENDENCIES) + $(AM_V_CXXLD)$(libFLAC___la_LINK) -rpath $(libdir) $(libFLAC___la_OBJECTS) $(libFLAC___la_LIBADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_decoder.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_decoder.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .cpp.o: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: -@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -m4dataDATA_INSTALL = $(INSTALL_DATA) install-m4dataDATA: $(m4data_DATA) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(m4datadir) - @list='$(m4data_DATA)'; for p in $$list; do \ + @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(m4datadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(m4datadir)" || exit 1; \ + fi; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(m4dataDATA_INSTALL) $$d$$p $(DESTDIR)$(m4datadir)/$$f"; \ - $(m4dataDATA_INSTALL) $$d$$p $(DESTDIR)$(m4datadir)/$$f; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4datadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(m4datadir)" || exit $$?; \ done uninstall-m4dataDATA: @$(NORMAL_UNINSTALL) - @list='$(m4data_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(m4datadir)/$$f"; \ - rm -f $(DESTDIR)$(m4datadir)/$$f; \ - done -pkgconfigDATA_INSTALL = $(INSTALL_DATA) + @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(m4datadir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir) - @list='$(pkgconfig_DATA)'; for p in $$list; do \ + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(pkgconfigDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgconfigdir)/$$f"; \ - $(pkgconfigDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgconfigdir)/$$f; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(pkgconfigdir)/$$f"; \ - rm -f $(DESTDIR)$(pkgconfigdir)/$$f; \ - done - -ETAGS = etags -ETAGSFLAGS = + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) -CTAGS = ctags -CTAGSFLAGS = +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(DATA) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(m4datadir) $(DESTDIR)$(pkgconfigdir) + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -523,16 +705,22 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -540,34 +728,60 @@ maintainer-clean-generic: clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am + clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/metadata.Plo + -rm -f ./$(DEPDIR)/stream_decoder.Plo + -rm -f ./$(DEPDIR)/stream_encoder.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: install-m4dataDATA install-pkgconfigDATA +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: install-libLTLIBRARIES +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/metadata.Plo + -rm -f ./$(DEPDIR)/stream_decoder.Plo + -rm -f ./$(DEPDIR)/stream_encoder.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -584,24 +798,34 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ - uninstall-m4dataDATA uninstall-pkgconfigDATA +uninstall-am: uninstall-libLTLIBRARIES uninstall-m4dataDATA \ + uninstall-pkgconfigDATA + +.MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libtool ctags distclean \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstLTLIBRARIES cscopelist-am ctags ctags-am distclean \ distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ install-libLTLIBRARIES install-m4dataDATA install-man \ - install-pkgconfigDATA install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-m4dataDATA \ + install-pdf install-pdf-am install-pkgconfigDATA install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am uninstall-libLTLIBRARIES uninstall-m4dataDATA \ uninstall-pkgconfigDATA +.PRECIOUS: Makefile + + +.rc.o: + $(RC) $(AM_CPPFLAGS) $< $@ + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/3rdparty/libflac/src/libFLAC++/Makefile.lite b/3rdparty/libflac/src/libFLAC++/Makefile.lite deleted file mode 100644 index ec1f6781b9a..00000000000 --- a/3rdparty/libflac/src/libFLAC++/Makefile.lite +++ /dev/null @@ -1,47 +0,0 @@ -# libFLAC++ - Free Lossless Audio Codec library -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 = ../.. - -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/3rdparty/libflac/src/libFLAC++/flac++.pc.in b/3rdparty/libflac/src/libFLAC++/flac++.pc.in index f5483117b90..f09c251a64c 100644 --- a/3rdparty/libflac/src/libFLAC++/flac++.pc.in +++ b/3rdparty/libflac/src/libFLAC++/flac++.pc.in @@ -7,5 +7,5 @@ Name: FLAC++ Description: Free Lossless Audio Codec Library (C++ API) Version: @VERSION@ Requires: flac -Libs: -L${libdir} -lFLAC++ -lm -Cflags: -I${includedir}/FLAC++ +Libs: -L${libdir} -lFLAC++ +Cflags: -I${includedir} diff --git a/3rdparty/libflac/src/libFLAC++/libFLAC++.m4 b/3rdparty/libflac/src/libFLAC++/libFLAC++.m4 index bf37529dde6..e5e13450574 100644 --- a/3rdparty/libflac/src/libFLAC++/libFLAC++.m4 +++ b/3rdparty/libflac/src/libFLAC++/libFLAC++.m4 @@ -51,19 +51,16 @@ dnl dnl Now check if the installed libFLAC++ is sufficiently new. dnl rm -f conf.libFLAC++test - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <FLAC++/decoder.h> - -int main () -{ +]],[[ system("touch conf.libFLAC++test"); return 0; -} +]])],[],[no_libFLACPP=yes],[echo $ac_n "cross compiling; assumed OK... $ac_c"]) -],, no_libFLACPP=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" @@ -97,7 +94,7 @@ int main () 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 occured. This usually means libFLAC++ was incorrectly installed" + 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" diff --git a/3rdparty/libflac/src/libFLAC++/libFLAC++_dynamic.dsp b/3rdparty/libflac/src/libFLAC++/libFLAC++_dynamic.dsp deleted file mode 100644 index 4cf8d8adcb8..00000000000 --- a/3rdparty/libflac/src/libFLAC++/libFLAC++_dynamic.dsp +++ /dev/null @@ -1,139 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libFLAC++_dynamic" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=libFLAC++_dynamic - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libFLAC++_dynamic.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libFLAC++_dynamic.mak" CFG="libFLAC++_dynamic - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libFLAC++_dynamic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libFLAC++_dynamic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "libFLAC++" -# PROP Scc_LocalPath "..\.." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libFLAC++_dynamic - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_dynamic" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLACPP_API_EXPORTS" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_USRDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\obj\release\lib\libFLAC.lib /nologo /subsystem:windows /dll /machine:I386 /out:"..\..\obj\release\bin/libFLAC++.dll" - -!ELSEIF "$(CFG)" == "libFLAC++_dynamic - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_dynamic" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I ".\include" /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLACPP_API_EXPORTS" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_USRDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\obj\debug\lib\libFLAC.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"..\..\obj\debug\bin/libFLAC++.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "libFLAC++_dynamic - Win32 Release" -# Name "libFLAC++_dynamic - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp" -# Begin Source File - -SOURCE=.\metadata.cpp -# End Source File -# Begin Source File - -SOURCE=.\stream_decoder.cpp -# End Source File -# Begin Source File - -SOURCE=.\stream_encoder.cpp -# End Source File -# End Group -# Begin Group "Private Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Protected Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE="..\..\include\FLAC++\all.h" -# End Source File -# Begin Source File - -SOURCE="..\..\include\FLAC++\decoder.h" -# End Source File -# Begin Source File - -SOURCE="..\..\include\FLAC++\encoder.h" -# End Source File -# Begin Source File - -SOURCE="..\..\include\FLAC++\export.h" -# End Source File -# Begin Source File - -SOURCE="..\..\include\FLAC++\metadata.h" -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/libFLAC++/libFLAC++_dynamic.vcproj b/3rdparty/libflac/src/libFLAC++/libFLAC++_dynamic.vcproj deleted file mode 100644 index 01aa2ea39fd..00000000000 --- a/3rdparty/libflac/src/libFLAC++/libFLAC++_dynamic.vcproj +++ /dev/null @@ -1,230 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="libFLAC++_dynamic" - ProjectGUID="{4cefbc85-c215-11db-8314-0800200c9a66}" - RootNamespace="libFLAC++_dynamic" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\lib" - IntermediateDirectory="Debug_dynamic" - ConfigurationType="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\lib" - IntermediateDirectory="Release_dynamic" - ConfigurationType="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLACPP_API_EXPORTS" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\metadata.cpp" - > - </File> - <File - RelativePath=".\stream_decoder.cpp" - > - </File> - <File - RelativePath=".\stream_encoder.cpp" - > - </File> - </Filter> - <Filter - Name="Public Header Files" - > - <File - RelativePath="..\..\include\FLAC++\all.h" - > - </File> - <File - RelativePath="..\..\include\FLAC++\decoder.h" - > - </File> - <File - RelativePath="..\..\include\FLAC++\encoder.h" - > - </File> - <File - RelativePath="..\..\include\FLAC++\export.h" - > - </File> - <File - RelativePath="..\..\include\FLAC++\metadata.h" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/libFLAC++/libFLAC++_static.dsp b/3rdparty/libflac/src/libFLAC++/libFLAC++_static.dsp deleted file mode 100644 index f887419e8dc..00000000000 --- a/3rdparty/libflac/src/libFLAC++/libFLAC++_static.dsp +++ /dev/null @@ -1,132 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libFLAC++_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=libFLAC++_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libFLAC++_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libFLAC++_static.mak" CFG="libFLAC++_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libFLAC++_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "libFLAC++_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "libFLAC++" -# PROP Scc_LocalPath "..\.." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libFLAC++_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "libFLAC++_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "libFLAC++_static - Win32 Release" -# Name "libFLAC++_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp" -# Begin Source File - -SOURCE=.\metadata.cpp -# End Source File -# Begin Source File - -SOURCE=.\stream_decoder.cpp -# End Source File -# Begin Source File - -SOURCE=.\stream_encoder.cpp -# End Source File -# End Group -# Begin Group "Private Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Protected Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE="..\..\include\FLAC++\all.h" -# End Source File -# Begin Source File - -SOURCE="..\..\include\FLAC++\decoder.h" -# End Source File -# Begin Source File - -SOURCE="..\..\include\FLAC++\encoder.h" -# End Source File -# Begin Source File - -SOURCE="..\..\include\FLAC++\export.h" -# End Source File -# Begin Source File - -SOURCE="..\..\include\FLAC++\metadata.h" -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/libFLAC++/libFLAC++_static.vcproj b/3rdparty/libflac/src/libFLAC++/libFLAC++_static.vcproj deleted file mode 100644 index 9d752239307..00000000000 --- a/3rdparty/libflac/src/libFLAC++/libFLAC++_static.vcproj +++ /dev/null @@ -1,203 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="libFLAC++_static" - ProjectGUID="{4cefbc86-c215-11db-8314-0800200c9a66}" - RootNamespace="libFLAC++_static" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\lib" - IntermediateDirectory="Debug_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\obj\debug\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\lib" - IntermediateDirectory="Release_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\obj\release\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\metadata.cpp" - > - </File> - <File - RelativePath=".\stream_decoder.cpp" - > - </File> - <File - RelativePath=".\stream_encoder.cpp" - > - </File> - </Filter> - <Filter - Name="Public Header Files" - > - <File - RelativePath="..\..\include\FLAC++\all.h" - > - </File> - <File - RelativePath="..\..\include\FLAC++\decoder.h" - > - </File> - <File - RelativePath="..\..\include\FLAC++\encoder.h" - > - </File> - <File - RelativePath="..\..\include\FLAC++\export.h" - > - </File> - <File - RelativePath="..\..\include\FLAC++\metadata.h" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/libFLAC++/metadata.cpp b/3rdparty/libflac/src/libFLAC++/metadata.cpp index 7039624582f..beab110903c 100644 --- a/3rdparty/libflac/src/libFLAC++/metadata.cpp +++ b/3rdparty/libflac/src/libFLAC++/metadata.cpp @@ -1,5 +1,6 @@ /* libFLAC++ - Free Lossless Audio Codec library - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -30,11 +31,15 @@ */ #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 <stdlib.h> // for malloc(), free() -#include <string.h> // for memcpy() etc. +#include <cstdlib> // for malloc(), free() +#include <cstring> // for memcpy() etc. #ifdef _MSC_VER // warning C4800: 'int' : forcing to bool 'true' or 'false' (performance warning) @@ -50,6 +55,9 @@ namespace FLAC { Prototype *construct_block(::FLAC__StreamMetadata *object) { + if (0 == object) + return 0; + Prototype *ret = 0; switch(object->type) { case FLAC__METADATA_TYPE_STREAMINFO: @@ -80,7 +88,7 @@ namespace FLAC { return ret; } - } + } // namespace local FLACPP_API Prototype *clone(const Prototype *object) { @@ -97,24 +105,23 @@ namespace FLAC { if(0 != streaminfo) return new StreamInfo(*streaminfo); - else if(0 != padding) + if(0 != padding) return new Padding(*padding); - else if(0 != application) + if(0 != application) return new Application(*application); - else if(0 != seektable) + if(0 != seektable) return new SeekTable(*seektable); - else if(0 != vorbiscomment) + if(0 != vorbiscomment) return new VorbisComment(*vorbiscomment); - else if(0 != cuesheet) + if(0 != cuesheet) return new CueSheet(*cuesheet); - else if(0 != picture) + if(0 != picture) return new Picture(*picture); - else if(0 != unknown) + if(0 != unknown) return new Unknown(*unknown); - else { - FLAC__ASSERT(0); - return 0; - } + + FLAC__ASSERT(0); + return 0; } // @@ -198,7 +205,7 @@ namespace FLAC { bool Prototype::get_is_last() const { FLAC__ASSERT(is_valid()); - return (bool)object_->is_last; + return static_cast<bool>(object_->is_last); } FLAC__MetadataType Prototype::get_type() const @@ -207,7 +214,7 @@ namespace FLAC { return object_->type; } - unsigned Prototype::get_length() const + uint32_t Prototype::get_length() const { FLAC__ASSERT(is_valid()); return object_->length; @@ -231,43 +238,43 @@ namespace FLAC { StreamInfo::~StreamInfo() { } - unsigned StreamInfo::get_min_blocksize() const + uint32_t StreamInfo::get_min_blocksize() const { FLAC__ASSERT(is_valid()); return object_->data.stream_info.min_blocksize; } - unsigned StreamInfo::get_max_blocksize() const + uint32_t StreamInfo::get_max_blocksize() const { FLAC__ASSERT(is_valid()); return object_->data.stream_info.max_blocksize; } - unsigned StreamInfo::get_min_framesize() const + uint32_t StreamInfo::get_min_framesize() const { FLAC__ASSERT(is_valid()); return object_->data.stream_info.min_framesize; } - unsigned StreamInfo::get_max_framesize() const + uint32_t StreamInfo::get_max_framesize() const { FLAC__ASSERT(is_valid()); return object_->data.stream_info.max_framesize; } - unsigned StreamInfo::get_sample_rate() const + uint32_t StreamInfo::get_sample_rate() const { FLAC__ASSERT(is_valid()); return object_->data.stream_info.sample_rate; } - unsigned StreamInfo::get_channels() const + uint32_t StreamInfo::get_channels() const { FLAC__ASSERT(is_valid()); return object_->data.stream_info.channels; } - unsigned StreamInfo::get_bits_per_sample() const + uint32_t StreamInfo::get_bits_per_sample() const { FLAC__ASSERT(is_valid()); return object_->data.stream_info.bits_per_sample; @@ -285,7 +292,7 @@ namespace FLAC { return object_->data.stream_info.md5sum; } - void StreamInfo::set_min_blocksize(unsigned value) + void StreamInfo::set_min_blocksize(uint32_t value) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(value >= FLAC__MIN_BLOCK_SIZE); @@ -293,7 +300,7 @@ namespace FLAC { object_->data.stream_info.min_blocksize = value; } - void StreamInfo::set_max_blocksize(unsigned value) + void StreamInfo::set_max_blocksize(uint32_t value) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(value >= FLAC__MIN_BLOCK_SIZE); @@ -301,28 +308,28 @@ namespace FLAC { object_->data.stream_info.max_blocksize = value; } - void StreamInfo::set_min_framesize(unsigned 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(unsigned 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(unsigned 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(unsigned value) + void StreamInfo::set_channels(uint32_t value) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(value > 0); @@ -330,7 +337,7 @@ namespace FLAC { object_->data.stream_info.channels = value; } - void StreamInfo::set_bits_per_sample(unsigned value) + void StreamInfo::set_bits_per_sample(uint32_t value) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(value >= FLAC__MIN_BITS_PER_SAMPLE); @@ -349,7 +356,7 @@ namespace FLAC { { FLAC__ASSERT(is_valid()); FLAC__ASSERT(0 != value); - memcpy(object_->data.stream_info.md5sum, value, 16); + std::memcpy(object_->data.stream_info.md5sum, value, 16); } @@ -361,10 +368,16 @@ namespace FLAC { 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(unsigned length) + void Padding::set_length(uint32_t length) { FLAC__ASSERT(is_valid()); object_->length = length; @@ -398,19 +411,19 @@ namespace FLAC { { FLAC__ASSERT(is_valid()); FLAC__ASSERT(0 != value); - memcpy(object_->data.application.id, value, 4); + std::memcpy(object_->data.application.id, value, 4); } - bool Application::set_data(const FLAC__byte *data, unsigned length) + bool Application::set_data(const FLAC__byte *data, uint32_t length) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_object_application_set_data(object_, (FLAC__byte*)data, length, true); + return static_cast<bool>(::FLAC__metadata_object_application_set_data(object_, const_cast<FLAC__byte*>(data), length, true)); } - bool Application::set_data(FLAC__byte *data, unsigned length, bool copy) + bool Application::set_data(FLAC__byte *data, uint32_t length, bool copy) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_object_application_set_data(object_, data, length, copy); + return static_cast<bool>(::FLAC__metadata_object_application_set_data(object_, data, length, copy)); } @@ -425,44 +438,86 @@ namespace FLAC { SeekTable::~SeekTable() { } - unsigned SeekTable::get_num_points() const + uint32_t SeekTable::get_num_points() const { FLAC__ASSERT(is_valid()); return object_->data.seek_table.num_points; } - ::FLAC__StreamMetadata_SeekPoint SeekTable::get_point(unsigned index) const + ::FLAC__StreamMetadata_SeekPoint SeekTable::get_point(uint32_t indx) const { FLAC__ASSERT(is_valid()); - FLAC__ASSERT(index < object_->data.seek_table.num_points); - return object_->data.seek_table.points[index]; + FLAC__ASSERT(indx < object_->data.seek_table.num_points); + return object_->data.seek_table.points[indx]; } - void SeekTable::set_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point) + bool SeekTable::resize_points(uint32_t new_num_points) { FLAC__ASSERT(is_valid()); - FLAC__ASSERT(index < object_->data.seek_table.num_points); - ::FLAC__metadata_object_seektable_set_point(object_, index, point); + return static_cast<bool>(::FLAC__metadata_object_seektable_resize_points(object_, new_num_points)); } - bool SeekTable::insert_point(unsigned index, const ::FLAC__StreamMetadata_SeekPoint &point) + void SeekTable::set_point(uint32_t indx, const ::FLAC__StreamMetadata_SeekPoint &point) { FLAC__ASSERT(is_valid()); - FLAC__ASSERT(index <= object_->data.seek_table.num_points); - return (bool)::FLAC__metadata_object_seektable_insert_point(object_, index, point); + FLAC__ASSERT(indx < object_->data.seek_table.num_points); + ::FLAC__metadata_object_seektable_set_point(object_, indx, point); } - bool SeekTable::delete_point(unsigned index) + bool SeekTable::insert_point(uint32_t indx, const ::FLAC__StreamMetadata_SeekPoint &point) { FLAC__ASSERT(is_valid()); - FLAC__ASSERT(index < object_->data.seek_table.num_points); - return (bool)::FLAC__metadata_object_seektable_delete_point(object_, index); + FLAC__ASSERT(indx <= object_->data.seek_table.num_points); + return static_cast<bool>(::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<bool>(::FLAC__metadata_object_seektable_delete_point(object_, indx)); } bool SeekTable::is_legal() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_object_seektable_is_legal(object_); + return static_cast<bool>(::FLAC__metadata_object_seektable_is_legal(object_)); + } + + bool SeekTable::template_append_placeholders(uint32_t num) + { + FLAC__ASSERT(is_valid()); + return static_cast<bool>(::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<bool>(::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<bool>(::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<bool>(::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<bool>(::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<bool>(::FLAC__metadata_object_seektable_template_sort(object_, compact)); } @@ -470,47 +525,83 @@ namespace FLAC { // VorbisComment::Entry // - VorbisComment::Entry::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, unsigned field_length) + 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) + 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, unsigned field_value_length) + 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) + 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) + 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((const char *)entry.entry_.entry, entry.entry_.length); + construct(reinterpret_cast<const char *>(entry.entry_.entry), entry.entry_.length); } VorbisComment::Entry &VorbisComment::Entry::operator=(const Entry &entry) { FLAC__ASSERT(entry.is_valid()); clear(); - construct((const char *)entry.entry_.entry, entry.entry_.length); + construct(reinterpret_cast<const char *>(entry.entry_.entry), entry.entry_.length); return *this; } @@ -524,19 +615,19 @@ namespace FLAC { return is_valid_; } - unsigned VorbisComment::Entry::get_field_length() const + uint32_t VorbisComment::Entry::get_field_length() const { FLAC__ASSERT(is_valid()); return entry_.length; } - unsigned VorbisComment::Entry::get_field_name_length() const + uint32_t VorbisComment::Entry::get_field_name_length() const { FLAC__ASSERT(is_valid()); return field_name_length_; } - unsigned VorbisComment::Entry::get_field_value_length() const + uint32_t VorbisComment::Entry::get_field_value_length() const { FLAC__ASSERT(is_valid()); return field_value_length_; @@ -551,7 +642,7 @@ namespace FLAC { const char *VorbisComment::Entry::get_field() const { FLAC__ASSERT(is_valid()); - return (const char *)entry_.entry; + return reinterpret_cast<const char *>(entry_.entry); } const char *VorbisComment::Entry::get_field_name() const @@ -566,22 +657,22 @@ namespace FLAC { return field_value_; } - bool VorbisComment::Entry::set_field(const char *field, unsigned field_length) + 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((const ::FLAC__byte*)field, field_length)) + if(!::FLAC__format_vorbiscomment_entry_is_legal(reinterpret_cast<const ::FLAC__byte*>(field), field_length)) return is_valid_ = false; clear_entry(); - if(0 == (entry_.entry = (FLAC__byte*)safe_malloc_add_2op_(field_length, /*+*/1))) { + if(0 == (entry_.entry = static_cast<FLAC__byte*>(safe_malloc_add_2op_(field_length, /*+*/1)))) { is_valid_ = false; } else { entry_.length = field_length; - memcpy(entry_.entry, field, field_length); + std::memcpy(entry_.entry, field, field_length); entry_.entry[field_length] = '\0'; (void) parse_field(); } @@ -591,7 +682,7 @@ namespace FLAC { bool VorbisComment::Entry::set_field(const char *field) { - return set_field(field, strlen(field)); + return set_field(field, std::strlen(field)); } bool VorbisComment::Entry::set_field_name(const char *field_name) @@ -608,29 +699,29 @@ namespace FLAC { is_valid_ = false; } else { - field_name_length_ = strlen(field_name_); + field_name_length_ = std::strlen(field_name_); compose_field(); } return is_valid_; } - bool VorbisComment::Entry::set_field_value(const char *field_value, unsigned field_value_length) + 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((const FLAC__byte*)field_value, field_value_length)) + if(!::FLAC__format_vorbiscomment_entry_value_is_legal(reinterpret_cast<const FLAC__byte*>(field_value), field_value_length)) return is_valid_ = false; clear_field_value(); - if(0 == (field_value_ = (char *)safe_malloc_add_2op_(field_value_length, /*+*/1))) { + if(0 == (field_value_ = static_cast<char *>(safe_malloc_add_2op_(field_value_length, /*+*/1)))) { is_valid_ = false; } else { field_value_length_ = field_value_length; - memcpy(field_value_, field_value, field_value_length); + std::memcpy(field_value_, field_value, field_value_length); field_value_[field_value_length] = '\0'; compose_field(); } @@ -640,7 +731,7 @@ namespace FLAC { bool VorbisComment::Entry::set_field_value(const char *field_value) { - return set_field_value(field_value, strlen(field_value)); + return set_field_value(field_value, std::strlen(field_value)); } void VorbisComment::Entry::zero() @@ -665,7 +756,7 @@ namespace FLAC { void VorbisComment::Entry::clear_entry() { if(0 != entry_.entry) { - free(entry_.entry); + std::free(entry_.entry); entry_.entry = 0; entry_.length = 0; } @@ -674,7 +765,7 @@ namespace FLAC { void VorbisComment::Entry::clear_field_name() { if(0 != field_name_) { - free(field_name_); + std::free(field_name_); field_name_ = 0; field_name_length_ = 0; } @@ -683,13 +774,13 @@ namespace FLAC { void VorbisComment::Entry::clear_field_value() { if(0 != field_value_) { - free(field_value_); + std::free(field_value_); field_value_ = 0; field_value_length_ = 0; } } - void VorbisComment::Entry::construct(const char *field, unsigned field_length) + void VorbisComment::Entry::construct(const char *field, uint32_t field_length) { if(set_field(field, field_length)) parse_field(); @@ -697,10 +788,10 @@ namespace FLAC { void VorbisComment::Entry::construct(const char *field) { - construct(field, strlen(field)); + construct(field, std::strlen(field)); } - void VorbisComment::Entry::construct(const char *field_name, const char *field_value, unsigned field_value_length) + 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(); @@ -708,22 +799,23 @@ namespace FLAC { void VorbisComment::Entry::construct(const char *field_name, const char *field_value) { - construct(field_name, field_value, strlen(field_value)); + construct(field_name, field_value, std::strlen(field_value)); } void VorbisComment::Entry::compose_field() { clear_entry(); - if(0 == (entry_.entry = (FLAC__byte*)safe_malloc_add_4op_(field_name_length_, /*+*/1, /*+*/field_value_length_, /*+*/1))) { + if(0 == (entry_.entry = static_cast<FLAC__byte*>(safe_malloc_add_4op_(field_name_length_, /*+*/1, /*+*/field_value_length_, /*+*/1)))) { is_valid_ = false; } else { - memcpy(entry_.entry, field_name_, field_name_length_); + std::memcpy(entry_.entry, field_name_, field_name_length_); entry_.length += field_name_length_; - memcpy(entry_.entry + entry_.length, "=", 1); + std::memcpy(entry_.entry + entry_.length, "=", 1); entry_.length += 1; - memcpy(entry_.entry + entry_.length, field_value_, field_value_length_); + 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; @@ -735,33 +827,33 @@ namespace FLAC { clear_field_name(); clear_field_value(); - const char *p = (const char *)memchr(entry_.entry, '=', entry_.length); + const char *p = static_cast<const char *>(std::memchr(entry_.entry, '=', entry_.length)); if(0 == p) - p = (const char *)entry_.entry + entry_.length; + p = reinterpret_cast<const char *>(entry_.entry) + entry_.length; - field_name_length_ = (unsigned)(p - (const char *)entry_.entry); - if(0 == (field_name_ = (char *)safe_malloc_add_2op_(field_name_length_, /*+*/1))) { // +1 for the trailing \0 + field_name_length_ = static_cast<uint32_t>(p - reinterpret_cast<const char *>(entry_.entry)); + if(0 == (field_name_ = static_cast<char *>(safe_malloc_add_2op_(field_name_length_, /*+*/1)))) { // +1 for the trailing \0 is_valid_ = false; return; } - memcpy(field_name_, entry_.entry, field_name_length_); + 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_ = (char *)safe_malloc_(0))) { + if(0 == (field_value_ = static_cast<char *>(safe_malloc_(0)))) { is_valid_ = false; return; } } else { field_value_length_ = entry_.length - field_name_length_ - 1; - if(0 == (field_value_ = (char *)safe_malloc_add_2op_(field_value_length_, /*+*/1))) { // +1 for the trailing \0 + if(0 == (field_value_ = static_cast<char *>(safe_malloc_add_2op_(field_value_length_, /*+*/1)))) { // +1 for the trailing \0 is_valid_ = false; return; } - memcpy(field_value_, ++p, field_value_length_); + std::memcpy(field_value_, ++p, field_value_length_); field_value_[field_value_length_] = '\0'; } @@ -780,7 +872,7 @@ namespace FLAC { VorbisComment::~VorbisComment() { } - unsigned VorbisComment::get_num_comments() const + uint32_t VorbisComment::get_num_comments() const { FLAC__ASSERT(is_valid()); return object_->data.vorbis_comment.num_comments; @@ -792,46 +884,76 @@ namespace FLAC { return object_->data.vorbis_comment.vendor_string.entry; } - VorbisComment::Entry VorbisComment::get_comment(unsigned index) const + VorbisComment::Entry VorbisComment::get_comment(uint32_t indx) const { FLAC__ASSERT(is_valid()); - FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments); - return Entry((const char *)object_->data.vorbis_comment.comments[index].entry, object_->data.vorbis_comment.comments[index].length); + FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments); + return Entry(reinterpret_cast<const char *>(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 = { strlen((const char *)string), (FLAC__byte*)string }; // we can cheat on const-ness because we make a copy below: - return (bool)::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, vendor_string, /*copy=*/true); + const ::FLAC__StreamMetadata_VorbisComment_Entry vendor_string = { static_cast<FLAC__uint32>(std::strlen(reinterpret_cast<const char *>(string))), const_cast<FLAC__byte*>(string) }; // we can cheat on const-ness because we make a copy below: + return static_cast<bool>(::FLAC__metadata_object_vorbiscomment_set_vendor_string(object_, vendor_string, /*copy=*/true)); } - bool VorbisComment::set_comment(unsigned index, const VorbisComment::Entry &entry) + bool VorbisComment::resize_comments(uint32_t new_num_comments) { FLAC__ASSERT(is_valid()); - FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments); - return (bool)::FLAC__metadata_object_vorbiscomment_set_comment(object_, index, entry.get_entry(), /*copy=*/true); + return static_cast<bool>(::FLAC__metadata_object_vorbiscomment_resize_comments(object_, new_num_comments)); } - bool VorbisComment::insert_comment(unsigned index, const VorbisComment::Entry &entry) + bool VorbisComment::set_comment(uint32_t indx, const VorbisComment::Entry &entry) { FLAC__ASSERT(is_valid()); - FLAC__ASSERT(index <= object_->data.vorbis_comment.num_comments); - return (bool)::FLAC__metadata_object_vorbiscomment_insert_comment(object_, index, entry.get_entry(), /*copy=*/true); + FLAC__ASSERT(indx < object_->data.vorbis_comment.num_comments); + return static_cast<bool>(::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<bool>(::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 (bool)::FLAC__metadata_object_vorbiscomment_append_comment(object_, entry.get_entry(), /*copy=*/true); + return static_cast<bool>(::FLAC__metadata_object_vorbiscomment_append_comment(object_, entry.get_entry(), /*copy=*/true)); } - bool VorbisComment::delete_comment(unsigned index) + bool VorbisComment::replace_comment(const VorbisComment::Entry &entry, bool all) { FLAC__ASSERT(is_valid()); - FLAC__ASSERT(index < object_->data.vorbis_comment.num_comments); - return (bool)::FLAC__metadata_object_vorbiscomment_delete_comment(object_, index); + return static_cast<bool>(::FLAC__metadata_object_vorbiscomment_replace_comment(object_, entry.get_entry(), static_cast<FLAC__bool>(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<bool>(::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); } @@ -870,7 +992,7 @@ namespace FLAC { return(0 != object_); } - ::FLAC__StreamMetadata_CueSheet_Index CueSheet::Track::get_index(unsigned i) const + ::FLAC__StreamMetadata_CueSheet_Index CueSheet::Track::get_index(uint32_t i) const { FLAC__ASSERT(is_valid()); FLAC__ASSERT(i < object_->num_indices); @@ -881,22 +1003,22 @@ namespace FLAC { { FLAC__ASSERT(is_valid()); FLAC__ASSERT(0 != value); - memcpy(object_->isrc, value, 12); + std::memcpy(object_->isrc, value, 12); object_->isrc[12] = '\0'; } - void CueSheet::Track::set_type(unsigned value) + void CueSheet::Track::set_type(uint32_t value) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(value <= 1); object_->type = value; } - void CueSheet::Track::set_index(unsigned i, const ::FLAC__StreamMetadata_CueSheet_Index &index) + 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] = index; + object_->indices[i] = indx; } @@ -929,13 +1051,13 @@ namespace FLAC { return object_->data.cue_sheet.is_cd? true : false; } - unsigned CueSheet::get_num_tracks() const + uint32_t CueSheet::get_num_tracks() const { FLAC__ASSERT(is_valid()); return object_->data.cue_sheet.num_tracks; } - CueSheet::Track CueSheet::get_track(unsigned i) const + CueSheet::Track CueSheet::get_track(uint32_t i) const { FLAC__ASSERT(is_valid()); FLAC__ASSERT(i < object_->data.cue_sheet.num_tracks); @@ -946,7 +1068,7 @@ namespace FLAC { { FLAC__ASSERT(is_valid()); FLAC__ASSERT(0 != value); - memcpy(object_->data.cue_sheet.media_catalog_number, value, 128); + std::memcpy(object_->data.cue_sheet.media_catalog_number, value, 128); object_->data.cue_sheet.media_catalog_number[128] = '\0'; } @@ -962,57 +1084,85 @@ namespace FLAC { object_->data.cue_sheet.is_cd = value; } - void CueSheet::set_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index) + 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] = index; + object_->data.cue_sheet.tracks[track_num].indices[index_num] = indx; } - bool CueSheet::insert_index(unsigned track_num, unsigned index_num, const ::FLAC__StreamMetadata_CueSheet_Index &index) + 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<bool>(::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<bool>(::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 (bool)::FLAC__metadata_object_cuesheet_track_insert_index(object_, track_num, index_num, index); + return static_cast<bool>(::FLAC__metadata_object_cuesheet_track_insert_blank_index(object_, track_num, index_num)); } - bool CueSheet::delete_index(unsigned track_num, unsigned 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 (bool)::FLAC__metadata_object_cuesheet_track_delete_index(object_, track_num, index_num); + return static_cast<bool>(::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<bool>(::FLAC__metadata_object_cuesheet_resize_tracks(object_, new_num_tracks)); } - bool CueSheet::set_track(unsigned i, const CueSheet::Track &track) + 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 (bool)::FLAC__metadata_object_cuesheet_set_track(object_, i, const_cast< ::FLAC__StreamMetadata_CueSheet_Track*>(track.get_track()), /*copy=*/true); + return static_cast<bool>(::FLAC__metadata_object_cuesheet_set_track(object_, i, const_cast< ::FLAC__StreamMetadata_CueSheet_Track*>(track.get_track()), /*copy=*/true)); } - bool CueSheet::insert_track(unsigned i, const CueSheet::Track &track) + 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 (bool)::FLAC__metadata_object_cuesheet_insert_track(object_, i, const_cast< ::FLAC__StreamMetadata_CueSheet_Track*>(track.get_track()), /*copy=*/true); + return static_cast<bool>(::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<bool>(::FLAC__metadata_object_cuesheet_insert_blank_track(object_, i)); } - bool CueSheet::delete_track(unsigned i) + bool CueSheet::delete_track(uint32_t i) { FLAC__ASSERT(is_valid()); FLAC__ASSERT(i < object_->data.cue_sheet.num_tracks); - return (bool)::FLAC__metadata_object_cuesheet_delete_track(object_, i); + return static_cast<bool>(::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 (bool)::FLAC__metadata_object_cuesheet_is_legal(object_, check_cd_da_subset, violation); + return static_cast<bool>(::FLAC__metadata_object_cuesheet_is_legal(object_, check_cd_da_subset, violation)); } FLAC__uint32 CueSheet::calculate_cddb_id() const @@ -1097,14 +1247,14 @@ namespace FLAC { { FLAC__ASSERT(is_valid()); // We can safely const_cast since copy=true - return (bool)::FLAC__metadata_object_picture_set_mime_type(object_, const_cast<char*>(string), /*copy=*/true); + return static_cast<bool>(::FLAC__metadata_object_picture_set_mime_type(object_, const_cast<char*>(string), /*copy=*/true)); } bool Picture::set_description(const FLAC__byte *string) { FLAC__ASSERT(is_valid()); // We can safely const_cast since copy=true - return (bool)::FLAC__metadata_object_picture_set_description(object_, const_cast<FLAC__byte*>(string), /*copy=*/true); + return static_cast<bool>(::FLAC__metadata_object_picture_set_description(object_, const_cast<FLAC__byte*>(string), /*copy=*/true)); } void Picture::set_width(FLAC__uint32 value) const @@ -1135,7 +1285,13 @@ namespace FLAC { { FLAC__ASSERT(is_valid()); // We can safely const_cast since copy=true - return (bool)::FLAC__metadata_object_picture_set_data(object_, const_cast<FLAC__byte*>(data), data_length, /*copy=*/true); + return static_cast<bool>(::FLAC__metadata_object_picture_set_data(object_, const_cast<FLAC__byte*>(data), data_length, /*copy=*/true)); + } + + bool Picture::is_legal(const char **violation) + { + FLAC__ASSERT(is_valid()); + return static_cast<bool>(::FLAC__metadata_object_picture_is_legal(object_, violation)); } @@ -1156,16 +1312,16 @@ namespace FLAC { return object_->data.application.data; } - bool Unknown::set_data(const FLAC__byte *data, unsigned length) + bool Unknown::set_data(const FLAC__byte *data, uint32_t length) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_object_application_set_data(object_, (FLAC__byte*)data, length, true); + return static_cast<bool>(::FLAC__metadata_object_application_set_data(object_, const_cast<FLAC__byte*>(data), length, true)); } - bool Unknown::set_data(FLAC__byte *data, unsigned length, bool copy) + bool Unknown::set_data(FLAC__byte *data, uint32_t length, bool copy) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_object_application_set_data(object_, data, length, copy); + return static_cast<bool>(::FLAC__metadata_object_application_set_data(object_, data, length, copy)); } @@ -1249,7 +1405,7 @@ namespace FLAC { 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, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors) + 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); @@ -1265,7 +1421,7 @@ namespace FLAC { 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, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors) + 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); @@ -1306,7 +1462,7 @@ namespace FLAC { { FLAC__ASSERT(0 != filename); FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_simple_iterator_init(iterator_, filename, read_only, preserve_file_stats); + return static_cast<bool>(::FLAC__metadata_simple_iterator_init(iterator_, filename, read_only, preserve_file_stats)); } bool SimpleIterator::is_valid() const @@ -1323,26 +1479,26 @@ namespace FLAC { bool SimpleIterator::is_writable() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_simple_iterator_is_writable(iterator_); + return static_cast<bool>(::FLAC__metadata_simple_iterator_is_writable(iterator_)); } bool SimpleIterator::next() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_simple_iterator_next(iterator_); + return static_cast<bool>(::FLAC__metadata_simple_iterator_next(iterator_)); } bool SimpleIterator::prev() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_simple_iterator_prev(iterator_); + return static_cast<bool>(::FLAC__metadata_simple_iterator_prev(iterator_)); } //@@@@ add to tests bool SimpleIterator::is_last() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_simple_iterator_is_last(iterator_); + return static_cast<bool>(::FLAC__metadata_simple_iterator_is_last(iterator_)); } //@@@@ add to tests @@ -1359,7 +1515,7 @@ namespace FLAC { } //@@@@ add to tests - unsigned SimpleIterator::get_block_length() const + uint32_t SimpleIterator::get_block_length() const { FLAC__ASSERT(is_valid()); return ::FLAC__metadata_simple_iterator_get_block_length(iterator_); @@ -1369,7 +1525,7 @@ namespace FLAC { bool SimpleIterator::get_application_id(FLAC__byte *id) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_simple_iterator_get_application_id(iterator_, id); + return static_cast<bool>(::FLAC__metadata_simple_iterator_get_application_id(iterator_, id)); } Prototype *SimpleIterator::get_block() @@ -1382,20 +1538,20 @@ namespace FLAC { { FLAC__ASSERT(0 != block); FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_simple_iterator_set_block(iterator_, block->object_, use_padding); + return static_cast<bool>(::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 (bool)::FLAC__metadata_simple_iterator_insert_block_after(iterator_, block->object_, use_padding); + return static_cast<bool>(::FLAC__metadata_simple_iterator_insert_block_after(iterator_, block->object_, use_padding)); } bool SimpleIterator::delete_block(bool use_padding) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_simple_iterator_delete_block(iterator_, use_padding); + return static_cast<bool>(::FLAC__metadata_simple_iterator_delete_block(iterator_, use_padding)); } @@ -1437,8 +1593,8 @@ namespace FLAC { FLAC__ASSERT(0 != filename); FLAC__ASSERT(is_valid()); return is_ogg? - (bool)::FLAC__metadata_chain_read_ogg(chain_, filename) : - (bool)::FLAC__metadata_chain_read(chain_, filename) + static_cast<bool>(::FLAC__metadata_chain_read_ogg(chain_, filename)) : + static_cast<bool>(::FLAC__metadata_chain_read(chain_, filename)) ; } @@ -1446,33 +1602,33 @@ namespace FLAC { { FLAC__ASSERT(is_valid()); return is_ogg? - (bool)::FLAC__metadata_chain_read_ogg_with_callbacks(chain_, handle, callbacks) : - (bool)::FLAC__metadata_chain_read_with_callbacks(chain_, handle, callbacks) + static_cast<bool>(::FLAC__metadata_chain_read_ogg_with_callbacks(chain_, handle, callbacks)) : + static_cast<bool>(::FLAC__metadata_chain_read_with_callbacks(chain_, handle, callbacks)) ; } bool Chain::check_if_tempfile_needed(bool use_padding) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_chain_check_if_tempfile_needed(chain_, use_padding); + return static_cast<bool>(::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 (bool)::FLAC__metadata_chain_write(chain_, use_padding, preserve_file_stats); + return static_cast<bool>(::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 (bool)::FLAC__metadata_chain_write_with_callbacks(chain_, use_padding, handle, callbacks); + return static_cast<bool>(::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 (bool)::FLAC__metadata_chain_write_with_callbacks_and_tempfile(chain_, use_padding, handle, callbacks, temp_handle, temp_callbacks); + return static_cast<bool>(::FLAC__metadata_chain_write_with_callbacks_and_tempfile(chain_, use_padding, handle, callbacks, temp_handle, temp_callbacks)); } void Chain::merge_padding() @@ -1519,13 +1675,13 @@ namespace FLAC { bool Iterator::next() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_iterator_next(iterator_); + return static_cast<bool>(::FLAC__metadata_iterator_next(iterator_)); } bool Iterator::prev() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_iterator_prev(iterator_); + return static_cast<bool>(::FLAC__metadata_iterator_prev(iterator_)); } ::FLAC__MetadataType Iterator::get_block_type() const @@ -1547,7 +1703,7 @@ namespace FLAC { { FLAC__ASSERT(0 != block); FLAC__ASSERT(is_valid()); - bool ret = (bool)::FLAC__metadata_iterator_set_block(iterator_, block->object_); + bool ret = static_cast<bool>(::FLAC__metadata_iterator_set_block(iterator_, block->object_)); if(ret) { block->set_reference(true); delete block; @@ -1558,14 +1714,14 @@ namespace FLAC { bool Iterator::delete_block(bool replace_with_padding) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__metadata_iterator_delete_block(iterator_, replace_with_padding); + return static_cast<bool>(::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 = (bool)::FLAC__metadata_iterator_insert_block_before(iterator_, block->object_); + bool ret = static_cast<bool>(::FLAC__metadata_iterator_insert_block_before(iterator_, block->object_)); if(ret) { block->set_reference(true); delete block; @@ -1577,7 +1733,7 @@ namespace FLAC { { FLAC__ASSERT(0 != block); FLAC__ASSERT(is_valid()); - bool ret = (bool)::FLAC__metadata_iterator_insert_block_after(iterator_, block->object_); + bool ret = static_cast<bool>(::FLAC__metadata_iterator_insert_block_after(iterator_, block->object_)); if(ret) { block->set_reference(true); delete block; @@ -1585,5 +1741,5 @@ namespace FLAC { return ret; } - } -} + } // namespace Metadata +} // namespace FLAC diff --git a/3rdparty/libflac/src/libFLAC++/stream_decoder.cpp b/3rdparty/libflac/src/libFLAC++/stream_decoder.cpp index fee69ba0de3..6e351d94b29 100644 --- a/3rdparty/libflac/src/libFLAC++/stream_decoder.cpp +++ b/3rdparty/libflac/src/libFLAC++/stream_decoder.cpp @@ -1,5 +1,6 @@ /* libFLAC++ - Free Lossless Audio Codec library - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,6 +30,10 @@ * 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" @@ -66,49 +71,49 @@ namespace FLAC { bool Stream::set_ogg_serial_number(long value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_set_ogg_serial_number(decoder_, value); + return static_cast<bool>(::FLAC__stream_decoder_set_ogg_serial_number(decoder_, value)); } bool Stream::set_md5_checking(bool value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_set_md5_checking(decoder_, value); + return static_cast<bool>(::FLAC__stream_decoder_set_md5_checking(decoder_, value)); } bool Stream::set_metadata_respond(::FLAC__MetadataType type) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_set_metadata_respond(decoder_, type); + return static_cast<bool>(::FLAC__stream_decoder_set_metadata_respond(decoder_, type)); } bool Stream::set_metadata_respond_application(const FLAC__byte id[4]) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_set_metadata_respond_application(decoder_, id); + return static_cast<bool>(::FLAC__stream_decoder_set_metadata_respond_application(decoder_, id)); } bool Stream::set_metadata_respond_all() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_set_metadata_respond_all(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_set_metadata_respond_all(decoder_)); } bool Stream::set_metadata_ignore(::FLAC__MetadataType type) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_set_metadata_ignore(decoder_, type); + return static_cast<bool>(::FLAC__stream_decoder_set_metadata_ignore(decoder_, type)); } bool Stream::set_metadata_ignore_application(const FLAC__byte id[4]) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_set_metadata_ignore_application(decoder_, id); + return static_cast<bool>(::FLAC__stream_decoder_set_metadata_ignore_application(decoder_, id)); } bool Stream::set_metadata_ignore_all() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_set_metadata_ignore_all(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_set_metadata_ignore_all(decoder_)); } Stream::State Stream::get_state() const @@ -120,7 +125,7 @@ namespace FLAC { bool Stream::get_md5_checking() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_get_md5_checking(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_get_md5_checking(decoder_)); } FLAC__uint64 Stream::get_total_samples() const @@ -129,7 +134,7 @@ namespace FLAC { return ::FLAC__stream_decoder_get_total_samples(decoder_); } - unsigned Stream::get_channels() const + uint32_t Stream::get_channels() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_decoder_get_channels(decoder_); @@ -141,19 +146,19 @@ namespace FLAC { return ::FLAC__stream_decoder_get_channel_assignment(decoder_); } - unsigned Stream::get_bits_per_sample() const + uint32_t Stream::get_bits_per_sample() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_decoder_get_bits_per_sample(decoder_); } - unsigned Stream::get_sample_rate() const + uint32_t Stream::get_sample_rate() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_decoder_get_sample_rate(decoder_); } - unsigned Stream::get_blocksize() const + uint32_t Stream::get_blocksize() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_decoder_get_blocksize(decoder_); @@ -180,49 +185,49 @@ namespace FLAC { bool Stream::finish() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_finish(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_finish(decoder_)); } bool Stream::flush() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_flush(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_flush(decoder_)); } bool Stream::reset() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_reset(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_reset(decoder_)); } bool Stream::process_single() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_process_single(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_process_single(decoder_)); } bool Stream::process_until_end_of_metadata() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_process_until_end_of_metadata(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_process_until_end_of_metadata(decoder_)); } bool Stream::process_until_end_of_stream() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_process_until_end_of_stream(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_process_until_end_of_stream(decoder_)); } bool Stream::skip_single_frame() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_skip_single_frame(decoder_); + return static_cast<bool>(::FLAC__stream_decoder_skip_single_frame(decoder_)); } bool Stream::seek_absolute(FLAC__uint64 sample) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_decoder_seek_absolute(decoder_, sample); + return static_cast<bool>(::FLAC__stream_decoder_seek_absolute(decoder_, sample)); } ::FLAC__StreamDecoderSeekStatus Stream::seek_callback(FLAC__uint64 absolute_byte_offset) @@ -385,5 +390,5 @@ namespace FLAC { return ::FLAC__STREAM_DECODER_READ_STATUS_ABORT; // double protection } - } -} + } // namespace Decoder +} // namespace FLAC diff --git a/3rdparty/libflac/src/libFLAC++/stream_encoder.cpp b/3rdparty/libflac/src/libFLAC++/stream_encoder.cpp index cf65f230661..837712948be 100644 --- a/3rdparty/libflac/src/libFLAC++/stream_encoder.cpp +++ b/3rdparty/libflac/src/libFLAC++/stream_encoder.cpp @@ -1,5 +1,6 @@ /* libFLAC++ - Free Lossless Audio Codec library - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,6 +30,10 @@ * 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" @@ -67,152 +72,149 @@ namespace FLAC { bool Stream::set_ogg_serial_number(long value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_ogg_serial_number(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_ogg_serial_number(encoder_, value)); } bool Stream::set_verify(bool value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_verify(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_verify(encoder_, value)); } bool Stream::set_streamable_subset(bool value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_streamable_subset(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_streamable_subset(encoder_, value)); } - bool Stream::set_channels(unsigned value) + bool Stream::set_channels(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_channels(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_channels(encoder_, value)); } - bool Stream::set_bits_per_sample(unsigned value) + bool Stream::set_bits_per_sample(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_bits_per_sample(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_bits_per_sample(encoder_, value)); } - bool Stream::set_sample_rate(unsigned value) + bool Stream::set_sample_rate(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_sample_rate(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_sample_rate(encoder_, value)); } - bool Stream::set_compression_level(unsigned value) + bool Stream::set_compression_level(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_compression_level(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_compression_level(encoder_, value)); } - bool Stream::set_blocksize(unsigned value) + bool Stream::set_blocksize(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_blocksize(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_blocksize(encoder_, value)); } bool Stream::set_do_mid_side_stereo(bool value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_do_mid_side_stereo(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_do_mid_side_stereo(encoder_, value)); } bool Stream::set_loose_mid_side_stereo(bool value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_loose_mid_side_stereo(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_loose_mid_side_stereo(encoder_, value)); } bool Stream::set_apodization(const char *specification) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_apodization(encoder_, specification); + return static_cast<bool>(::FLAC__stream_encoder_set_apodization(encoder_, specification)); } - bool Stream::set_max_lpc_order(unsigned value) + bool Stream::set_max_lpc_order(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_max_lpc_order(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_max_lpc_order(encoder_, value)); } - bool Stream::set_qlp_coeff_precision(unsigned value) + bool Stream::set_qlp_coeff_precision(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_qlp_coeff_precision(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_qlp_coeff_precision(encoder_, value)); } bool Stream::set_do_qlp_coeff_prec_search(bool value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder_, value)); } bool Stream::set_do_escape_coding(bool value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_do_escape_coding(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_do_escape_coding(encoder_, value)); } bool Stream::set_do_exhaustive_model_search(bool value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_do_exhaustive_model_search(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_do_exhaustive_model_search(encoder_, value)); } - bool Stream::set_min_residual_partition_order(unsigned value) + bool Stream::set_min_residual_partition_order(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_min_residual_partition_order(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_min_residual_partition_order(encoder_, value)); } - bool Stream::set_max_residual_partition_order(unsigned value) + bool Stream::set_max_residual_partition_order(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_max_residual_partition_order(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_max_residual_partition_order(encoder_, value)); } - bool Stream::set_rice_parameter_search_dist(unsigned value) + bool Stream::set_rice_parameter_search_dist(uint32_t value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_rice_parameter_search_dist(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_rice_parameter_search_dist(encoder_, value)); } bool Stream::set_total_samples_estimate(FLAC__uint64 value) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value); + return static_cast<bool>(::FLAC__stream_encoder_set_total_samples_estimate(encoder_, value)); } - bool Stream::set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks) + bool Stream::set_metadata(::FLAC__StreamMetadata **metadata, uint32_t num_blocks) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks); + return static_cast<bool>(::FLAC__stream_encoder_set_metadata(encoder_, metadata, num_blocks)); } - bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, unsigned num_blocks) + bool Stream::set_metadata(FLAC::Metadata::Prototype **metadata, uint32_t num_blocks) { FLAC__ASSERT(is_valid()); -#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __SUNPRO_CC) - // MSVC++ can't handle: - // ::FLAC__StreamMetadata *m[num_blocks]; - // so we do this ugly workaround + // because C++ doesn't have VLA's (variable length arrays) + // this ugly workaround is needed ::FLAC__StreamMetadata **m = new ::FLAC__StreamMetadata*[num_blocks]; -#else - ::FLAC__StreamMetadata *m[num_blocks]; -#endif - for(unsigned i = 0; i < num_blocks; i++) { + 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*>((const ::FLAC__StreamMetadata*)metadata[i]); + m[i] = const_cast< ::FLAC__StreamMetadata*>(static_cast<const ::FLAC__StreamMetadata*>(*metadata[i])); } -#if (defined _MSC_VER) || (defined __BORLANDC__) || (defined __SUNPRO_CC) // complete the hack - const bool ok = (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks); + const bool ok = static_cast<bool>(::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks)); delete [] m; return ok; -#else - return (bool)::FLAC__stream_encoder_set_metadata(encoder_, m, num_blocks); -#endif + } + + bool Stream::set_limit_min_bitrate(bool value) + { + FLAC__ASSERT(is_valid()); + return static_cast<bool>(::FLAC__stream_encoder_set_limit_min_bitrate(encoder_, value)); } Stream::State Stream::get_state() const @@ -227,7 +229,7 @@ namespace FLAC { return Decoder::Stream::State(::FLAC__stream_encoder_get_verify_decoder_state(encoder_)); } - void Stream::get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got) + 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); @@ -236,58 +238,58 @@ namespace FLAC { bool Stream::get_verify() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_get_verify(encoder_); + return static_cast<bool>(::FLAC__stream_encoder_get_verify(encoder_)); } bool Stream::get_streamable_subset() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_get_streamable_subset(encoder_); + return static_cast<bool>(::FLAC__stream_encoder_get_streamable_subset(encoder_)); } bool Stream::get_do_mid_side_stereo() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_get_do_mid_side_stereo(encoder_); + return static_cast<bool>(::FLAC__stream_encoder_get_do_mid_side_stereo(encoder_)); } bool Stream::get_loose_mid_side_stereo() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_get_loose_mid_side_stereo(encoder_); + return static_cast<bool>(::FLAC__stream_encoder_get_loose_mid_side_stereo(encoder_)); } - unsigned Stream::get_channels() const + uint32_t Stream::get_channels() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_encoder_get_channels(encoder_); } - unsigned Stream::get_bits_per_sample() const + uint32_t Stream::get_bits_per_sample() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_encoder_get_bits_per_sample(encoder_); } - unsigned Stream::get_sample_rate() const + uint32_t Stream::get_sample_rate() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_encoder_get_sample_rate(encoder_); } - unsigned Stream::get_blocksize() const + uint32_t Stream::get_blocksize() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_encoder_get_blocksize(encoder_); } - unsigned Stream::get_max_lpc_order() const + uint32_t Stream::get_max_lpc_order() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_encoder_get_max_lpc_order(encoder_); } - unsigned Stream::get_qlp_coeff_precision() const + uint32_t Stream::get_qlp_coeff_precision() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_encoder_get_qlp_coeff_precision(encoder_); @@ -296,34 +298,34 @@ namespace FLAC { bool Stream::get_do_qlp_coeff_prec_search() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder_); + return static_cast<bool>(::FLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder_)); } bool Stream::get_do_escape_coding() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_get_do_escape_coding(encoder_); + return static_cast<bool>(::FLAC__stream_encoder_get_do_escape_coding(encoder_)); } bool Stream::get_do_exhaustive_model_search() const { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_get_do_exhaustive_model_search(encoder_); + return static_cast<bool>(::FLAC__stream_encoder_get_do_exhaustive_model_search(encoder_)); } - unsigned Stream::get_min_residual_partition_order() const + uint32_t Stream::get_min_residual_partition_order() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_encoder_get_min_residual_partition_order(encoder_); } - unsigned Stream::get_max_residual_partition_order() const + uint32_t Stream::get_max_residual_partition_order() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_encoder_get_max_residual_partition_order(encoder_); } - unsigned Stream::get_rice_parameter_search_dist() const + uint32_t Stream::get_rice_parameter_search_dist() const { FLAC__ASSERT(is_valid()); return ::FLAC__stream_encoder_get_rice_parameter_search_dist(encoder_); @@ -335,6 +337,12 @@ namespace FLAC { return ::FLAC__stream_encoder_get_total_samples_estimate(encoder_); } + bool Stream::get_limit_min_bitrate() const + { + FLAC__ASSERT(is_valid()); + return static_cast<bool>(::FLAC__stream_encoder_get_limit_min_bitrate(encoder_)); + } + ::FLAC__StreamEncoderInitStatus Stream::init() { FLAC__ASSERT(is_valid()); @@ -350,19 +358,19 @@ namespace FLAC { bool Stream::finish() { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_finish(encoder_); + return static_cast<bool>(::FLAC__stream_encoder_finish(encoder_)); } - bool Stream::process(const FLAC__int32 * const buffer[], unsigned samples) + bool Stream::process(const FLAC__int32 * const buffer[], uint32_t samples) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_process(encoder_, buffer, samples); + return static_cast<bool>(::FLAC__stream_encoder_process(encoder_, buffer, samples)); } - bool Stream::process_interleaved(const FLAC__int32 buffer[], unsigned samples) + bool Stream::process_interleaved(const FLAC__int32 buffer[], uint32_t samples) { FLAC__ASSERT(is_valid()); - return (bool)::FLAC__stream_encoder_process_interleaved(encoder_, buffer, samples); + return static_cast<bool>(::FLAC__stream_encoder_process_interleaved(encoder_, buffer, samples)); } ::FLAC__StreamEncoderReadStatus Stream::read_callback(FLAC__byte buffer[], size_t *bytes) @@ -397,7 +405,7 @@ namespace FLAC { return instance->read_callback(buffer, bytes); } - ::FLAC__StreamEncoderWriteStatus Stream::write_callback_(const ::FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) + ::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); @@ -486,19 +494,19 @@ namespace FLAC { // 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, unsigned samples, unsigned current_frame) + ::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, unsigned frames_written, unsigned total_frames_estimate) + 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, unsigned frames_written, unsigned total_frames_estimate, void *client_data) + 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); @@ -507,5 +515,5 @@ namespace FLAC { instance->progress_callback(bytes_written, samples_written, frames_written, total_frames_estimate); } - } -} + } // namespace Encoder +} // namespace FLAC diff --git a/3rdparty/libflac/src/libFLAC++/version.rc b/3rdparty/libflac/src/libFLAC++/version.rc new file mode 100644 index 00000000000..14efba068a2 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC++/version.rc @@ -0,0 +1,40 @@ +#include <winver.h> +#include "config.h" +#include "FLAC++/export.h" + +#if (defined GIT_COMMIT_HASH && defined GIT_COMMIT_DATE) +# ifdef GIT_COMMIT_TAG +# define VERSIONSTRING GIT_COMMIT_TAG +# else +# define VERSIONSTRING "git-" GIT_COMMIT_HASH +# endif +#else +# define VERSIONSTRING PACKAGE_VERSION +#endif + +#define xstr(s) str(s) +#define str(s) #s + +VS_VERSION_INFO VERSIONINFO +FILEVERSION FLACPP_API_VERSION_CURRENT,FLACPP_API_VERSION_REVISION,0,0 +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0 +FILEOS VOS__WINDOWS32 +FILETYPE VFT_DLL +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "libFLAC++ for Windows" + VALUE "ProductName", "Free Lossless Audio Codec" + VALUE "ProductVersion", VERSIONSTRING + VALUE "CompanyName", "Xiph.Org" + VALUE "LegalCopyright", "2000-2009 Josh Coalson, 2011-2023 Xiph.Org Foundation" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/3rdparty/libflac/src/libFLAC/CMakeLists.txt b/3rdparty/libflac/src/libFLAC/CMakeLists.txt new file mode 100644 index 00000000000..cf7368f60c2 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/CMakeLists.txt @@ -0,0 +1,126 @@ +option(WITH_ASM "Use any assembly optimization routines" ON) + +check_include_file("cpuid.h" HAVE_CPUID_H) +check_include_file("sys/param.h" HAVE_SYS_PARAM_H) + +set(CMAKE_REQUIRED_LIBRARIES m) +check_function_exists(lround HAVE_LROUND) + +include(CheckCSourceCompiles) +include(CheckCPUArch) +include(CheckA64NEON) + +check_cpu_arch_x64(FLAC__CPU_X86_64) +if(NOT FLAC__CPU_X86_64) + check_cpu_arch_x86(FLAC__CPU_IA32) +endif() + +if(FLAC__CPU_X86_64 OR FLAC__CPU_IA32) + set(FLAC__ALIGN_MALLOC_DATA 1) + option(WITH_AVX "Enable AVX, AVX2 optimizations (with runtime detection, resulting binary does not require AVX2, so only necessary when a compiler doesn't know about AVX)" ON) + if(WITH_AVX AND MSVC) + set_source_files_properties(fixed_intrin_avx2.c lpc_intrin_avx2.c stream_encoder_intrin_avx2.c lpc_intrin_fma.c PROPERTIES COMPILE_FLAGS /arch:AVX2) + endif() +else() + check_cpu_arch_arm64(FLAC__CPU_ARM64) + if(FLAC__CPU_ARM64) + check_a64neon(FLAC__HAS_A64NEONINTRIN) + endif() +endif() + +if(NOT WITH_ASM) + add_definitions(-DFLAC__NO_ASM) +endif() + +include_directories("include") + +add_library(FLAC + bitmath.c + bitreader.c + bitwriter.c + cpu.c + crc.c + fixed.c + fixed_intrin_sse2.c + fixed_intrin_ssse3.c + fixed_intrin_sse42.c + fixed_intrin_avx2.c + float.c + format.c + lpc.c + lpc_intrin_neon.c + lpc_intrin_sse2.c + lpc_intrin_sse41.c + lpc_intrin_avx2.c + lpc_intrin_fma.c + md5.c + memory.c + metadata_iterators.c + metadata_object.c + stream_decoder.c + stream_encoder.c + stream_encoder_intrin_sse2.c + stream_encoder_intrin_ssse3.c + stream_encoder_intrin_avx2.c + stream_encoder_framing.c + version.rc + window.c + $<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h> + $<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c> + $<$<BOOL:${OGG_FOUND}>:ogg_decoder_aspect.c> + $<$<BOOL:${OGG_FOUND}>:ogg_encoder_aspect.c> + $<$<BOOL:${OGG_FOUND}>:ogg_helper.c> + $<$<BOOL:${OGG_FOUND}>:ogg_mapping.c>) +set_property(TARGET FLAC PROPERTY PROJECT_LABEL "libFLAC") +if(TARGET FLAC-asm) + target_sources(FLAC PRIVATE $<TARGET_OBJECTS:FLAC-asm>) +endif() + +target_compile_definitions(FLAC + PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLAC_API_EXPORTS> + PUBLIC $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:FLAC__NO_DLL>) +if(NOT WIN32) + target_compile_definitions(FLAC PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLAC__USE_VISIBILITY_ATTR>) +endif() +target_include_directories(FLAC INTERFACE + "$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>" + "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>") +target_link_libraries(FLAC PUBLIC $<$<BOOL:${HAVE_LROUND}>:m>) +if(TARGET Ogg::ogg) + target_link_libraries(FLAC PUBLIC Ogg::ogg) +endif() +if(BUILD_SHARED_LIBS) + set_target_properties(FLAC PROPERTIES + VERSION 12.1.0 + SOVERSION 12) + if(NOT WIN32) + set_target_properties(FLAC PROPERTIES C_VISIBILITY_PRESET hidden) + endif() +endif() + +check_c_compiler_flag("-fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math" HAVE_ASSOC_MATH) + +if(MSVC) + target_compile_options(FLAC BEFORE PRIVATE "/fp:fast") +else() + if(HAVE_ASSOC_MATH) + target_compile_options(FLAC BEFORE PRIVATE -fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math) + 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/3rdparty/libflac/src/libFLAC/Makefile.am b/3rdparty/libflac/src/libFLAC/Makefile.am index cbfb0acbb4d..618939dfc33 100644 --- a/3rdparty/libflac/src/libFLAC/Makefile.am +++ b/3rdparty/libflac/src/libFLAC/Makefile.am @@ -1,5 +1,6 @@ # libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -28,50 +29,22 @@ # 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_builddir) -I$(srcdir)/include -I$(top_srcdir)/include lib_LTLIBRARIES = libFLAC.la +noinst_LTLIBRARIES = libFLAC-static.la if DEBUG DEBUGCFLAGS = -DFLAC__OVERFLOW_DETECT -endif -if FLaC__CPU_PPC -# The -force_cpusubtype_ALL is needed to insert a ppc64 instruction -# into cpu.c with an asm(). -if FLaC__SYS_DARWIN -#@@@ PPC optimizations temporarily disabled -CPUCFLAGS = -faltivec -force_cpusubtype_ALL -DFLAC__NO_ASM else -# Linux-gcc for PPC does not have -force_cpusubtype_ALL, it is Darwin-specific -#@@@ PPC optimizations temporarily disabled -CPUCFLAGS = -maltivec -mabi=altivec -DFLAC__NO_ASM +if ASSOC_MATH_AVAILABLE +ASSOCMATHCFLAGS = -fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math endif endif -AM_CFLAGS = $(DEBUGCFLAGS) $(CPUCFLAGS) @OGG_CFLAGS@ - -if FLaC__NO_ASM -else -if FLaC__CPU_IA32 -if FLaC__HAS_NASM -ARCH_SUBDIRS = ia32 -LOCAL_EXTRA_LIBADD = ia32/libFLAC-asm.la -endif -endif -if FLaC__CPU_PPC -ARCH_SUBDIRS = ppc -if FLaC__HAS_AS__TEMPORARILY_DISABLED -LOCAL_EXTRA_LIBADD = ppc/as/libFLAC-asm.la -LOCAL_EXTRA_LDFLAGS = "-Wl,-read_only_relocs,warning" -else -if FLaC__HAS_GAS__TEMPORARILY_DISABLED -LOCAL_EXTRA_LIBADD = ppc/gas/libFLAC-asm.la -LOCAL_EXTRA_LDFLAGS = "" -endif -endif -endif -endif +AM_CFLAGS = $(DEBUGCFLAGS) ${ASSOCMATHCFLAGS} @OGG_CFLAGS@ -libFLAC_la_LIBADD = $(LOCAL_EXTRA_LIBADD) @OGG_LIBS@ +libFLAC_la_LIBADD = @OGG_LIBS@ -lm -SUBDIRS = $(ARCH_SUBDIRS) include . +SUBDIRS = include . m4datadir = $(datadir)/aclocal m4data_DATA = libFLAC.m4 @@ -80,13 +53,22 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = flac.pc EXTRA_DIST = \ - Makefile.lite \ + CMakeLists.txt \ flac.pc.in \ - libFLAC_dynamic.dsp \ - libFLAC_dynamic.vcproj \ - libFLAC_static.dsp \ - libFLAC_static.vcproj \ - libFLAC.m4 + libFLAC.m4 \ + version.rc \ + deduplication/bitreader_read_rice_signed_block.c \ + deduplication/lpc_compute_autocorrelation_intrin.c \ + deduplication/lpc_compute_autocorrelation_intrin_sse2.c \ + deduplication/lpc_compute_autocorrelation_intrin_neon.c + +if OS_IS_WINDOWS +windows_unicode_compat = ../share/win_utf8_io/win_utf8_io.c +if HAVE_WINDRES +libFLAC_la_DEPENDENCIES = version.o +windows_resource_link = -Wl,version.o +endif +endif if FLaC__HAS_OGG extra_ogg_sources = \ @@ -95,24 +77,47 @@ extra_ogg_sources = \ ogg_helper.c \ ogg_mapping.c endif -# see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention -libFLAC_la_LDFLAGS = -version-info 10:0:2 -lm $(LOCAL_EXTRA_LDFLAGS) -libFLAC_la_SOURCES = \ + +# see 'http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning' for numbering convention +libFLAC_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 13:0:1 $(windows_resource_link) + +libFLAC_sources = \ bitmath.c \ bitreader.c \ bitwriter.c \ cpu.c \ crc.c \ fixed.c \ + fixed_intrin_sse2.c \ + fixed_intrin_ssse3.c \ + fixed_intrin_sse42.c \ + fixed_intrin_avx2.c \ float.c \ format.c \ lpc.c \ + lpc_intrin_sse2.c \ + lpc_intrin_sse41.c \ + lpc_intrin_avx2.c \ + lpc_intrin_fma.c \ + lpc_intrin_neon.c \ md5.c \ memory.c \ metadata_iterators.c \ metadata_object.c \ stream_decoder.c \ stream_encoder.c \ + stream_encoder_intrin_sse2.c \ + stream_encoder_intrin_ssse3.c \ + stream_encoder_intrin_avx2.c \ stream_encoder_framing.c \ window.c \ + $(windows_unicode_compat) \ $(extra_ogg_sources) + +libFLAC_la_SOURCES = $(libFLAC_sources) + +# needed for test_libFLAC +libFLAC_static_la_SOURCES = $(libFLAC_sources) + +.rc.o: + $(RC) $(AM_CPPFLAGS) $< $@ diff --git a/3rdparty/libflac/src/libFLAC/Makefile.in b/3rdparty/libflac/src/libFLAC/Makefile.in index 75bfbbb215c..47af88812ed 100644 --- a/3rdparty/libflac/src/libFLAC/Makefile.in +++ b/3rdparty/libflac/src/libFLAC/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -44,16 +45,68 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ + VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -65,12 +118,245 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +@HAVE_WINDRES_FALSE@libFLAC_la_DEPENDENCIES = +@OS_IS_WINDOWS_FALSE@libFLAC_la_DEPENDENCIES = +subdir = src/libFLAC +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = flac.pc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(m4datadir)" \ + "$(DESTDIR)$(pkgconfigdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +libFLAC_static_la_LIBADD = +am__libFLAC_static_la_SOURCES_DIST = bitmath.c bitreader.c bitwriter.c \ + cpu.c crc.c fixed.c fixed_intrin_sse2.c fixed_intrin_ssse3.c \ + fixed_intrin_sse42.c fixed_intrin_avx2.c float.c format.c \ + lpc.c lpc_intrin_sse2.c lpc_intrin_sse41.c lpc_intrin_avx2.c \ + lpc_intrin_fma.c lpc_intrin_neon.c md5.c memory.c \ + metadata_iterators.c metadata_object.c stream_decoder.c \ + stream_encoder.c stream_encoder_intrin_sse2.c \ + stream_encoder_intrin_ssse3.c stream_encoder_intrin_avx2.c \ + stream_encoder_framing.c window.c \ + ../share/win_utf8_io/win_utf8_io.c ogg_decoder_aspect.c \ + ogg_encoder_aspect.c ogg_helper.c ogg_mapping.c +am__dirstamp = $(am__leading_dot)dirstamp +@OS_IS_WINDOWS_TRUE@am__objects_1 = \ +@OS_IS_WINDOWS_TRUE@ ../share/win_utf8_io/win_utf8_io.lo +@FLaC__HAS_OGG_TRUE@am__objects_2 = ogg_decoder_aspect.lo \ +@FLaC__HAS_OGG_TRUE@ ogg_encoder_aspect.lo ogg_helper.lo \ +@FLaC__HAS_OGG_TRUE@ ogg_mapping.lo +am__objects_3 = bitmath.lo bitreader.lo bitwriter.lo cpu.lo crc.lo \ + fixed.lo fixed_intrin_sse2.lo fixed_intrin_ssse3.lo \ + fixed_intrin_sse42.lo fixed_intrin_avx2.lo float.lo format.lo \ + lpc.lo lpc_intrin_sse2.lo lpc_intrin_sse41.lo \ + lpc_intrin_avx2.lo lpc_intrin_fma.lo lpc_intrin_neon.lo md5.lo \ + memory.lo metadata_iterators.lo metadata_object.lo \ + stream_decoder.lo stream_encoder.lo \ + stream_encoder_intrin_sse2.lo stream_encoder_intrin_ssse3.lo \ + stream_encoder_intrin_avx2.lo stream_encoder_framing.lo \ + window.lo $(am__objects_1) $(am__objects_2) +am_libFLAC_static_la_OBJECTS = $(am__objects_3) +libFLAC_static_la_OBJECTS = $(am_libFLAC_static_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +am__libFLAC_la_SOURCES_DIST = bitmath.c bitreader.c bitwriter.c cpu.c \ + crc.c fixed.c fixed_intrin_sse2.c fixed_intrin_ssse3.c \ + fixed_intrin_sse42.c fixed_intrin_avx2.c float.c format.c \ + lpc.c lpc_intrin_sse2.c lpc_intrin_sse41.c lpc_intrin_avx2.c \ + lpc_intrin_fma.c lpc_intrin_neon.c md5.c memory.c \ + metadata_iterators.c metadata_object.c stream_decoder.c \ + stream_encoder.c stream_encoder_intrin_sse2.c \ + stream_encoder_intrin_ssse3.c stream_encoder_intrin_avx2.c \ + stream_encoder_framing.c window.c \ + ../share/win_utf8_io/win_utf8_io.c ogg_decoder_aspect.c \ + ogg_encoder_aspect.c ogg_helper.c ogg_mapping.c +am_libFLAC_la_OBJECTS = $(am__objects_3) +libFLAC_la_OBJECTS = $(am_libFLAC_la_OBJECTS) +libFLAC_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libFLAC_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ../share/win_utf8_io/$(DEPDIR)/win_utf8_io.Plo \ + ./$(DEPDIR)/bitmath.Plo ./$(DEPDIR)/bitreader.Plo \ + ./$(DEPDIR)/bitwriter.Plo ./$(DEPDIR)/cpu.Plo \ + ./$(DEPDIR)/crc.Plo ./$(DEPDIR)/fixed.Plo \ + ./$(DEPDIR)/fixed_intrin_avx2.Plo \ + ./$(DEPDIR)/fixed_intrin_sse2.Plo \ + ./$(DEPDIR)/fixed_intrin_sse42.Plo \ + ./$(DEPDIR)/fixed_intrin_ssse3.Plo ./$(DEPDIR)/float.Plo \ + ./$(DEPDIR)/format.Plo ./$(DEPDIR)/lpc.Plo \ + ./$(DEPDIR)/lpc_intrin_avx2.Plo ./$(DEPDIR)/lpc_intrin_fma.Plo \ + ./$(DEPDIR)/lpc_intrin_neon.Plo \ + ./$(DEPDIR)/lpc_intrin_sse2.Plo \ + ./$(DEPDIR)/lpc_intrin_sse41.Plo ./$(DEPDIR)/md5.Plo \ + ./$(DEPDIR)/memory.Plo ./$(DEPDIR)/metadata_iterators.Plo \ + ./$(DEPDIR)/metadata_object.Plo \ + ./$(DEPDIR)/ogg_decoder_aspect.Plo \ + ./$(DEPDIR)/ogg_encoder_aspect.Plo ./$(DEPDIR)/ogg_helper.Plo \ + ./$(DEPDIR)/ogg_mapping.Plo ./$(DEPDIR)/stream_decoder.Plo \ + ./$(DEPDIR)/stream_encoder.Plo \ + ./$(DEPDIR)/stream_encoder_framing.Plo \ + ./$(DEPDIR)/stream_encoder_intrin_avx2.Plo \ + ./$(DEPDIR)/stream_encoder_intrin_sse2.Plo \ + ./$(DEPDIR)/stream_encoder_intrin_ssse3.Plo \ + ./$(DEPDIR)/window.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libFLAC_static_la_SOURCES) $(libFLAC_la_SOURCES) +DIST_SOURCES = $(am__libFLAC_static_la_SOURCES_DIST) \ + $(am__libFLAC_la_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(m4data_DATA) $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/flac.pc.in \ + $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -79,533 +365,453 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include lib_LTLIBRARIES = libFLAC.la +noinst_LTLIBRARIES = libFLAC-static.la @DEBUG_TRUE@DEBUGCFLAGS = -DFLAC__OVERFLOW_DETECT -# The -force_cpusubtype_ALL is needed to insert a ppc64 instruction -# into cpu.c with an asm(). -#@@@ PPC optimizations temporarily disabled -@FLaC__CPU_PPC_TRUE@@FLaC__SYS_DARWIN_TRUE@CPUCFLAGS = -faltivec -force_cpusubtype_ALL -DFLAC__NO_ASM -# Linux-gcc for PPC does not have -force_cpusubtype_ALL, it is Darwin-specific -#@@@ PPC optimizations temporarily disabled -@FLaC__CPU_PPC_TRUE@@FLaC__SYS_DARWIN_FALSE@CPUCFLAGS = -maltivec -mabi=altivec -DFLAC__NO_ASM - -AM_CFLAGS = $(DEBUGCFLAGS) $(CPUCFLAGS) @OGG_CFLAGS@ -@FLaC__CPU_PPC_TRUE@@FLaC__NO_ASM_FALSE@ARCH_SUBDIRS = ppc - -@FLaC__CPU_IA32_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ARCH_SUBDIRS = ia32 -@FLaC__CPU_IA32_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@LOCAL_EXTRA_LIBADD = ia32/libFLAC-asm.la -@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__NO_ASM_FALSE@LOCAL_EXTRA_LIBADD = ppc/as/libFLAC-asm.la -@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__NO_ASM_FALSE@LOCAL_EXTRA_LIBADD = ppc/gas/libFLAC-asm.la -@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__NO_ASM_FALSE@LOCAL_EXTRA_LDFLAGS = "-Wl,-read_only_relocs,warning" -@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__NO_ASM_FALSE@LOCAL_EXTRA_LDFLAGS = "" - -libFLAC_la_LIBADD = $(LOCAL_EXTRA_LIBADD) @OGG_LIBS@ - -SUBDIRS = $(ARCH_SUBDIRS) include . - +@ASSOC_MATH_AVAILABLE_TRUE@@DEBUG_FALSE@ASSOCMATHCFLAGS = -fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math +AM_CFLAGS = $(DEBUGCFLAGS) ${ASSOCMATHCFLAGS} @OGG_CFLAGS@ +libFLAC_la_LIBADD = @OGG_LIBS@ -lm +SUBDIRS = include . m4datadir = $(datadir)/aclocal m4data_DATA = libFLAC.m4 - pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = flac.pc - EXTRA_DIST = \ - Makefile.lite \ + CMakeLists.txt \ flac.pc.in \ - libFLAC_dynamic.dsp \ - libFLAC_dynamic.vcproj \ - libFLAC_static.dsp \ - libFLAC_static.vcproj \ - libFLAC.m4 - - + libFLAC.m4 \ + version.rc \ + deduplication/bitreader_read_rice_signed_block.c \ + deduplication/lpc_compute_autocorrelation_intrin.c \ + deduplication/lpc_compute_autocorrelation_intrin_sse2.c \ + deduplication/lpc_compute_autocorrelation_intrin_neon.c + +@OS_IS_WINDOWS_TRUE@windows_unicode_compat = ../share/win_utf8_io/win_utf8_io.c +@HAVE_WINDRES_TRUE@@OS_IS_WINDOWS_TRUE@libFLAC_la_DEPENDENCIES = version.o +@HAVE_WINDRES_TRUE@@OS_IS_WINDOWS_TRUE@windows_resource_link = -Wl,version.o @FLaC__HAS_OGG_TRUE@extra_ogg_sources = \ @FLaC__HAS_OGG_TRUE@ ogg_decoder_aspect.c \ @FLaC__HAS_OGG_TRUE@ ogg_encoder_aspect.c \ @FLaC__HAS_OGG_TRUE@ ogg_helper.c \ @FLaC__HAS_OGG_TRUE@ ogg_mapping.c -# see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention -libFLAC_la_LDFLAGS = -version-info 10:0:2 -lm $(LOCAL_EXTRA_LDFLAGS) -libFLAC_la_SOURCES = \ + +# see 'http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning' for numbering convention +libFLAC_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined -version-info 13:0:1 $(windows_resource_link) +libFLAC_sources = \ bitmath.c \ bitreader.c \ bitwriter.c \ cpu.c \ crc.c \ fixed.c \ + fixed_intrin_sse2.c \ + fixed_intrin_ssse3.c \ + fixed_intrin_sse42.c \ + fixed_intrin_avx2.c \ float.c \ format.c \ lpc.c \ + lpc_intrin_sse2.c \ + lpc_intrin_sse41.c \ + lpc_intrin_avx2.c \ + lpc_intrin_fma.c \ + lpc_intrin_neon.c \ md5.c \ memory.c \ metadata_iterators.c \ metadata_object.c \ stream_decoder.c \ stream_encoder.c \ + stream_encoder_intrin_sse2.c \ + stream_encoder_intrin_ssse3.c \ + stream_encoder_intrin_avx2.c \ stream_encoder_framing.c \ window.c \ + $(windows_unicode_compat) \ $(extra_ogg_sources) -subdir = src/libFLAC -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = flac.pc -LTLIBRARIES = $(lib_LTLIBRARIES) - -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@ ppc/gas/libFLAC-asm.la -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ppc/gas/libFLAC-asm.la -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@ ppc/as/libFLAC-asm.la -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ppc/as/libFLAC-asm.la -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@ ppc/as/libFLAC-asm.la -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_FALSE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ppc/as/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ia32/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ia32/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ia32/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_FALSE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ia32/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ia32/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@ ppc/gas/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ia32/libFLAC-asm.la \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ppc/gas/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@ ppc/as/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ia32/libFLAC-asm.la \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ppc/as/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_FALSE@@FLaC__NO_ASM_FALSE@ ppc/as/libFLAC-asm.la -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_TRUE@libFLAC_la_DEPENDENCIES = -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@libFLAC_la_DEPENDENCIES = \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ia32/libFLAC-asm.la \ -@FLaC__CPU_IA32_TRUE@@FLaC__CPU_PPC_TRUE@@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@@FLaC__HAS_NASM_TRUE@@FLaC__NO_ASM_FALSE@ ppc/as/libFLAC-asm.la -am__libFLAC_la_SOURCES_DIST = bitmath.c bitreader.c bitwriter.c cpu.c \ - crc.c fixed.c float.c format.c lpc.c md5.c memory.c \ - metadata_iterators.c metadata_object.c stream_decoder.c \ - stream_encoder.c stream_encoder_framing.c window.c \ - ogg_decoder_aspect.c ogg_encoder_aspect.c ogg_helper.c \ - ogg_mapping.c -@FLaC__HAS_OGG_TRUE@am__objects_1 = ogg_decoder_aspect.lo \ -@FLaC__HAS_OGG_TRUE@ ogg_encoder_aspect.lo ogg_helper.lo \ -@FLaC__HAS_OGG_TRUE@ ogg_mapping.lo -am_libFLAC_la_OBJECTS = bitmath.lo bitreader.lo bitwriter.lo cpu.lo \ - crc.lo fixed.lo float.lo format.lo lpc.lo md5.lo memory.lo \ - metadata_iterators.lo metadata_object.lo stream_decoder.lo \ - stream_encoder.lo stream_encoder_framing.lo window.lo \ - $(am__objects_1) -libFLAC_la_OBJECTS = $(am_libFLAC_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/bitmath.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/bitreader.Plo ./$(DEPDIR)/bitwriter.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/cpu.Plo ./$(DEPDIR)/crc.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/fixed.Plo ./$(DEPDIR)/float.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/format.Plo ./$(DEPDIR)/lpc.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/md5.Plo ./$(DEPDIR)/memory.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/metadata_iterators.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/metadata_object.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/ogg_decoder_aspect.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/ogg_encoder_aspect.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/ogg_helper.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/ogg_mapping.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/stream_decoder.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/stream_encoder.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/stream_encoder_framing.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/window.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(am__libFLAC_la_SOURCES_DIST) -DATA = $(m4data_DATA) $(pkgconfig_DATA) - - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am flac.pc.in -DIST_SUBDIRS = ppc ia32 include . -SOURCES = $(libFLAC_la_SOURCES) +libFLAC_la_SOURCES = $(libFLAC_sources) +# needed for test_libFLAC +libFLAC_static_la_SOURCES = $(libFLAC_sources) all: all-recursive .SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libFLAC/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -flac.pc: $(top_builddir)/config.status flac.pc.in +.SUFFIXES: .c .lo .o .obj .rc +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +flac.pc: $(top_builddir)/config.status $(srcdir)/flac.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -libLTLIBRARIES_INSTALL = $(INSTALL) + install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(libdir) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \ + list2="$$list2 $$p"; \ else :; fi; \ - done + done; \ + test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libFLAC.la: $(libFLAC_la_OBJECTS) $(libFLAC_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libFLAC_la_LDFLAGS) $(libFLAC_la_OBJECTS) $(libFLAC_la_LIBADD) $(LIBS) + @list='$(lib_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +../share/win_utf8_io/$(am__dirstamp): + @$(MKDIR_P) ../share/win_utf8_io + @: > ../share/win_utf8_io/$(am__dirstamp) +../share/win_utf8_io/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) ../share/win_utf8_io/$(DEPDIR) + @: > ../share/win_utf8_io/$(DEPDIR)/$(am__dirstamp) +../share/win_utf8_io/win_utf8_io.lo: \ + ../share/win_utf8_io/$(am__dirstamp) \ + ../share/win_utf8_io/$(DEPDIR)/$(am__dirstamp) + +libFLAC-static.la: $(libFLAC_static_la_OBJECTS) $(libFLAC_static_la_DEPENDENCIES) $(EXTRA_libFLAC_static_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libFLAC_static_la_OBJECTS) $(libFLAC_static_la_LIBADD) $(LIBS) + +libFLAC.la: $(libFLAC_la_OBJECTS) $(libFLAC_la_DEPENDENCIES) $(EXTRA_libFLAC_la_DEPENDENCIES) + $(AM_V_CCLD)$(libFLAC_la_LINK) -rpath $(libdir) $(libFLAC_la_OBJECTS) $(libFLAC_la_LIBADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) + -rm -f ../share/win_utf8_io/*.$(OBJEXT) + -rm -f ../share/win_utf8_io/*.lo distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmath.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitreader.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitwriter.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fixed.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/format.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_iterators.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_object.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_decoder_aspect.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_encoder_aspect.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_helper.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_mapping.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_decoder.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder_framing.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@../share/win_utf8_io/$(DEPDIR)/win_utf8_io.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitmath.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitreader.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitwriter.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fixed.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fixed_intrin_avx2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fixed_intrin_sse2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fixed_intrin_sse42.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fixed_intrin_ssse3.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/float.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/format.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc_intrin_avx2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc_intrin_fma.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc_intrin_neon.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc_intrin_sse2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc_intrin_sse41.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_iterators.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_object.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_decoder_aspect.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_encoder_aspect.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_helper.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg_mapping.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_decoder.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder_framing.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder_intrin_avx2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder_intrin_sse2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_encoder_intrin_ssse3.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -m4dataDATA_INSTALL = $(INSTALL_DATA) + -rm -rf ../share/win_utf8_io/.libs ../share/win_utf8_io/_libs install-m4dataDATA: $(m4data_DATA) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(m4datadir) - @list='$(m4data_DATA)'; for p in $$list; do \ + @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(m4datadir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(m4datadir)" || exit 1; \ + fi; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(m4dataDATA_INSTALL) $$d$$p $(DESTDIR)$(m4datadir)/$$f"; \ - $(m4dataDATA_INSTALL) $$d$$p $(DESTDIR)$(m4datadir)/$$f; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4datadir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(m4datadir)" || exit $$?; \ done uninstall-m4dataDATA: @$(NORMAL_UNINSTALL) - @list='$(m4data_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(m4datadir)/$$f"; \ - rm -f $(DESTDIR)$(m4datadir)/$$f; \ - done -pkgconfigDATA_INSTALL = $(INSTALL_DATA) + @list='$(m4data_DATA)'; test -n "$(m4datadir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(m4datadir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(pkgconfigdir) - @list='$(pkgconfig_DATA)'; for p in $$list; do \ + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ + fi; \ + for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(pkgconfigDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgconfigdir)/$$f"; \ - $(pkgconfigDATA_INSTALL) $$d$$p $(DESTDIR)$(pkgconfigdir)/$$f; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; for p in $$list; do \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(pkgconfigdir)/$$f"; \ - rm -f $(DESTDIR)$(pkgconfigdir)/$$f; \ - done + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -613,152 +819,131 @@ $(RECURSIVE_TARGETS): else \ local_target="$$target"; \ fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ + empty_fix=.; \ else \ include_option=--include; \ + empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ @@ -768,8 +953,9 @@ check: check-recursive all-am: Makefile $(LTLIBRARIES) $(DATA) installdirs: installdirs-recursive installdirs-am: - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(m4datadir) $(DESTDIR)$(pkgconfigdir) - + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -780,16 +966,24 @@ install-am: all-am installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f ../share/win_utf8_io/$(DEPDIR)/$(am__dirstamp) + -rm -f ../share/win_utf8_io/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -797,34 +991,122 @@ maintainer-clean-generic: clean: clean-recursive clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am + clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-recursive - -rm -rf ./$(DEPDIR) + -rm -f ../share/win_utf8_io/$(DEPDIR)/win_utf8_io.Plo + -rm -f ./$(DEPDIR)/bitmath.Plo + -rm -f ./$(DEPDIR)/bitreader.Plo + -rm -f ./$(DEPDIR)/bitwriter.Plo + -rm -f ./$(DEPDIR)/cpu.Plo + -rm -f ./$(DEPDIR)/crc.Plo + -rm -f ./$(DEPDIR)/fixed.Plo + -rm -f ./$(DEPDIR)/fixed_intrin_avx2.Plo + -rm -f ./$(DEPDIR)/fixed_intrin_sse2.Plo + -rm -f ./$(DEPDIR)/fixed_intrin_sse42.Plo + -rm -f ./$(DEPDIR)/fixed_intrin_ssse3.Plo + -rm -f ./$(DEPDIR)/float.Plo + -rm -f ./$(DEPDIR)/format.Plo + -rm -f ./$(DEPDIR)/lpc.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_avx2.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_fma.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_neon.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_sse2.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_sse41.Plo + -rm -f ./$(DEPDIR)/md5.Plo + -rm -f ./$(DEPDIR)/memory.Plo + -rm -f ./$(DEPDIR)/metadata_iterators.Plo + -rm -f ./$(DEPDIR)/metadata_object.Plo + -rm -f ./$(DEPDIR)/ogg_decoder_aspect.Plo + -rm -f ./$(DEPDIR)/ogg_encoder_aspect.Plo + -rm -f ./$(DEPDIR)/ogg_helper.Plo + -rm -f ./$(DEPDIR)/ogg_mapping.Plo + -rm -f ./$(DEPDIR)/stream_decoder.Plo + -rm -f ./$(DEPDIR)/stream_encoder.Plo + -rm -f ./$(DEPDIR)/stream_encoder_framing.Plo + -rm -f ./$(DEPDIR)/stream_encoder_intrin_avx2.Plo + -rm -f ./$(DEPDIR)/stream_encoder_intrin_sse2.Plo + -rm -f ./$(DEPDIR)/stream_encoder_intrin_ssse3.Plo + -rm -f ./$(DEPDIR)/window.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-recursive dvi-am: +html: html-recursive + +html-am: + info: info-recursive info-am: install-data-am: install-m4dataDATA install-pkgconfigDATA +install-dvi: install-dvi-recursive + +install-dvi-am: + install-exec-am: install-libLTLIBRARIES +install-html: install-html-recursive + +install-html-am: + install-info: install-info-recursive +install-info-am: + install-man: +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) + -rm -f ../share/win_utf8_io/$(DEPDIR)/win_utf8_io.Plo + -rm -f ./$(DEPDIR)/bitmath.Plo + -rm -f ./$(DEPDIR)/bitreader.Plo + -rm -f ./$(DEPDIR)/bitwriter.Plo + -rm -f ./$(DEPDIR)/cpu.Plo + -rm -f ./$(DEPDIR)/crc.Plo + -rm -f ./$(DEPDIR)/fixed.Plo + -rm -f ./$(DEPDIR)/fixed_intrin_avx2.Plo + -rm -f ./$(DEPDIR)/fixed_intrin_sse2.Plo + -rm -f ./$(DEPDIR)/fixed_intrin_sse42.Plo + -rm -f ./$(DEPDIR)/fixed_intrin_ssse3.Plo + -rm -f ./$(DEPDIR)/float.Plo + -rm -f ./$(DEPDIR)/format.Plo + -rm -f ./$(DEPDIR)/lpc.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_avx2.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_fma.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_neon.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_sse2.Plo + -rm -f ./$(DEPDIR)/lpc_intrin_sse41.Plo + -rm -f ./$(DEPDIR)/md5.Plo + -rm -f ./$(DEPDIR)/memory.Plo + -rm -f ./$(DEPDIR)/metadata_iterators.Plo + -rm -f ./$(DEPDIR)/metadata_object.Plo + -rm -f ./$(DEPDIR)/ogg_decoder_aspect.Plo + -rm -f ./$(DEPDIR)/ogg_encoder_aspect.Plo + -rm -f ./$(DEPDIR)/ogg_helper.Plo + -rm -f ./$(DEPDIR)/ogg_mapping.Plo + -rm -f ./$(DEPDIR)/stream_decoder.Plo + -rm -f ./$(DEPDIR)/stream_encoder.Plo + -rm -f ./$(DEPDIR)/stream_encoder_framing.Plo + -rm -f ./$(DEPDIR)/stream_encoder_intrin_avx2.Plo + -rm -f ./$(DEPDIR)/stream_encoder_intrin_sse2.Plo + -rm -f ./$(DEPDIR)/stream_encoder_intrin_ssse3.Plo + -rm -f ./$(DEPDIR)/window.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -841,31 +1123,34 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES \ - uninstall-m4dataDATA uninstall-pkgconfigDATA - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libLTLIBRARIES clean-libtool \ - clean-recursive ctags ctags-recursive distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive \ - install-libLTLIBRARIES install-m4dataDATA install-man \ - install-pkgconfigDATA install-recursive install-strip \ +uninstall-am: uninstall-libLTLIBRARIES uninstall-m4dataDATA \ + uninstall-pkgconfigDATA + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-m4dataDATA install-man install-pdf install-pdf-am \ + install-pkgconfigDATA install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs installdirs-am \ - installdirs-recursive maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ - pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ - tags-recursive uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-libLTLIBRARIES \ - uninstall-m4dataDATA uninstall-pkgconfigDATA \ - uninstall-recursive + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-libLTLIBRARIES uninstall-m4dataDATA \ + uninstall-pkgconfigDATA + +.PRECIOUS: Makefile + + +.rc.o: + $(RC) $(AM_CPPFLAGS) $< $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/libFLAC/Makefile.lite b/3rdparty/libflac/src/libFLAC/Makefile.lite deleted file mode 100644 index 8ea37f87e7c..00000000000 --- a/3rdparty/libflac/src/libFLAC/Makefile.lite +++ /dev/null @@ -1,90 +0,0 @@ -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 = ../.. - -LIB_NAME = libFLAC -ifeq ($(DARWIN_BUILD),yes) -DEFINES = -DFLAC__CPU_PPC -DFLAC__USE_ALTIVEC -DFLAC__ALIGN_MALLOC_DATA -else -ifeq ($(SOLARIS_BUILD),yes) -DEFINES = -DFLAC__NO_ASM -DFLAC__ALIGN_MALLOC_DATA -else -DEFINES = -DFLAC__CPU_IA32 -DFLAC__USE_3DNOW -DFLAC__HAS_NASM -DFLAC__ALIGN_MALLOC_DATA -endif -endif -INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR) -DEBUG_CFLAGS = -DFLAC__OVERFLOW_DETECT - -ifeq ($(DARWIN_BUILD),yes) -SRCS_S = \ - ppc/as/lpc_asm.s -else -ifeq ($(SOLARIS_BUILD),yes) -else -SRCS_NASM = \ - ia32/bitreader_asm.nasm \ - ia32/cpu_asm.nasm \ - ia32/fixed_asm.nasm \ - ia32/lpc_asm.nasm \ - ia32/stream_encoder_asm.nasm -endif -endif - -SRCS_C = \ - bitmath.c \ - bitreader.c \ - bitwriter.c \ - cpu.c \ - crc.c \ - fixed.c \ - float.c \ - format.c \ - lpc.c \ - md5.c \ - memory.c \ - metadata_iterators.c \ - metadata_object.c \ - ogg_decoder_aspect.c \ - ogg_encoder_aspect.c \ - ogg_helper.c \ - ogg_mapping.c \ - stream_decoder.c \ - stream_encoder.c \ - stream_encoder_framing.c \ - window.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/libFLAC/bitmath.c b/3rdparty/libflac/src/libFLAC/bitmath.c index af19c35445a..077486b69a1 100644 --- a/3rdparty/libflac/src/libFLAC/bitmath.c +++ b/3rdparty/libflac/src/libFLAC/bitmath.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,47 +35,6 @@ #endif #include "private/bitmath.h" -#include "FLAC/assert.h" - -/* An example of what FLAC__bitmath_ilog2() computes: - * - * ilog2( 0) = assertion failure - * ilog2( 1) = 0 - * ilog2( 2) = 1 - * ilog2( 3) = 1 - * ilog2( 4) = 2 - * ilog2( 5) = 2 - * ilog2( 6) = 2 - * ilog2( 7) = 2 - * ilog2( 8) = 3 - * ilog2( 9) = 3 - * ilog2(10) = 3 - * ilog2(11) = 3 - * ilog2(12) = 3 - * ilog2(13) = 3 - * ilog2(14) = 3 - * ilog2(15) = 3 - * ilog2(16) = 4 - * ilog2(17) = 4 - * ilog2(18) = 4 - */ -unsigned FLAC__bitmath_ilog2(FLAC__uint32 v) -{ - unsigned l = 0; - FLAC__ASSERT(v > 0); - while(v >>= 1) - l++; - return l; -} - -unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v) -{ - unsigned l = 0; - FLAC__ASSERT(v > 0); - while(v >>= 1) - l++; - return l; -} /* An example of what FLAC__bitmath_silog2() computes: * @@ -100,50 +60,14 @@ unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v) * silog2( 9) = 5 * silog2( 10) = 5 */ -unsigned FLAC__bitmath_silog2(int v) +uint32_t FLAC__bitmath_silog2(FLAC__int64 v) { - while(1) { - if(v == 0) { - return 0; - } - else if(v > 0) { - unsigned l = 0; - while(v) { - l++; - v >>= 1; - } - return l+1; - } - else if(v == -1) { - return 2; - } - else { - v++; - v = -v; - } - } -} + if(v == 0) + return 0; -unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v) -{ - while(1) { - if(v == 0) { - return 0; - } - else if(v > 0) { - unsigned l = 0; - while(v) { - l++; - v >>= 1; - } - return l+1; - } - else if(v == -1) { - return 2; - } - else { - v++; - v = -v; - } - } + if(v == -1) + return 2; + + v = (v < 0) ? (-(v+1)) : v; + return FLAC__bitmath_ilog2_wide(v)+2; } diff --git a/3rdparty/libflac/src/libFLAC/bitreader.c b/3rdparty/libflac/src/libFLAC/bitreader.c index b48847d5e28..829b308e00c 100644 --- a/3rdparty/libflac/src/libFLAC/bitreader.c +++ b/3rdparty/libflac/src/libFLAC/bitreader.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,20 +34,26 @@ # include <config.h> #endif -#include <stdlib.h> /* for malloc() */ -#include <string.h> /* for memcpy(), memset() */ +#include <stdlib.h> +#include <string.h> #include "private/bitmath.h" #include "private/bitreader.h" #include "private/crc.h" +#include "private/cpu.h" +#include "private/macros.h" #include "FLAC/assert.h" +#include "share/compat.h" #include "share/endswap.h" /* Things should be fastest when this matches the machine word size */ -/* WATCHOUT: if you change this you must also change the following #defines down to COUNT_ZERO_MSBS below to match */ +/* WATCHOUT: if you change this you must also change the following #defines down to COUNT_ZERO_MSBS2 below to match */ /* WATCHOUT: there are a few places where the code will not work unless brword is >= 32 bits wide */ /* also, some sections currently only have fast versions for 4 or 8 bytes per word */ + +#if (ENABLE_64_BIT_WORDS == 0) + typedef FLAC__uint32 brword; -#define FLAC__BYTES_PER_WORD 4 +#define FLAC__BYTES_PER_WORD 4 /* sizeof brword */ #define FLAC__BITS_PER_WORD 32 #define FLAC__WORD_ALL_ONES ((FLAC__uint32)0xffffffff) /* SWAP_BE_WORD_TO_HOST swaps bytes in a brword (which is always big-endian) if necessary to match host byte order */ @@ -56,14 +63,26 @@ typedef FLAC__uint32 brword; #define SWAP_BE_WORD_TO_HOST(x) ENDSWAP_32(x) #endif /* counts the # of zero MSBs in a word */ -#define COUNT_ZERO_MSBS(word) ( \ - (word) <= 0xffff ? \ - ( (word) <= 0xff? byte_to_unary_table[word] + 24 : byte_to_unary_table[(word) >> 8] + 16 ) : \ - ( (word) <= 0xffffff? byte_to_unary_table[word >> 16] + 8 : byte_to_unary_table[(word) >> 24] ) \ -) -/* this alternate might be slightly faster on some systems/compilers: */ -#define COUNT_ZERO_MSBS2(word) ( (word) <= 0xff ? byte_to_unary_table[word] + 24 : ((word) <= 0xffff ? byte_to_unary_table[(word) >> 8] + 16 : ((word) <= 0xffffff ? byte_to_unary_table[(word) >> 16] + 8 : byte_to_unary_table[(word) >> 24])) ) +#define COUNT_ZERO_MSBS(word) FLAC__clz_uint32(word) +#define COUNT_ZERO_MSBS2(word) FLAC__clz2_uint32(word) + +#else + +typedef FLAC__uint64 brword; +#define FLAC__BYTES_PER_WORD 8 /* sizeof brword */ +#define FLAC__BITS_PER_WORD 64 +#define FLAC__WORD_ALL_ONES ((FLAC__uint64)FLAC__U64L(0xffffffffffffffff)) +/* SWAP_BE_WORD_TO_HOST swaps bytes in a brword (which is always big-endian) if necessary to match host byte order */ +#if WORDS_BIGENDIAN +#define SWAP_BE_WORD_TO_HOST(x) (x) +#else +#define SWAP_BE_WORD_TO_HOST(x) ENDSWAP_64(x) +#endif +/* counts the # of zero MSBs in a word */ +#define COUNT_ZERO_MSBS(word) FLAC__clz_uint64(word) +#define COUNT_ZERO_MSBS2(word) FLAC__clz2_uint64(word) +#endif /* * This should be at least twice as large as the largest number of words @@ -79,102 +98,79 @@ typedef FLAC__uint32 brword; * also depends on the CPU cache size and other factors; some twiddling * may be necessary to squeeze out the best performance. */ -static const unsigned FLAC__BITREADER_DEFAULT_CAPACITY = 65536u / FLAC__BITS_PER_WORD; /* in words */ - -static const unsigned char byte_to_unary_table[] = { - 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -#ifdef min -#undef min -#endif -#define min(x,y) ((x)<(y)?(x):(y)) -#ifdef max -#undef max -#endif -#define max(x,y) ((x)>(y)?(x):(y)) +static const uint32_t FLAC__BITREADER_DEFAULT_CAPACITY = 65536u / FLAC__BITS_PER_WORD; /* in words */ -/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ -#ifdef _MSC_VER -#define FLAC__U64L(x) x -#else -#define FLAC__U64L(x) x##LLU -#endif - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif - -/* WATCHOUT: assembly routines rely on the order in which these fields are declared */ 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; - unsigned capacity; /* in words */ - unsigned words; /* # of completed words in buffer */ - unsigned bytes; /* # of bytes in incomplete word at buffer[words] */ - unsigned consumed_words; /* #words ... */ - unsigned consumed_bits; /* ... + (#bits of head word) already consumed from the front of buffer */ - unsigned read_crc16; /* the running frame CRC */ - unsigned crc16_align; /* the number of bits in the current consumed word that should not be CRC'd */ + 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__bool read_limit_set; /* whether reads are limited */ + uint32_t read_limit; /* the remaining size of what can be read */ + uint32_t last_seen_framesync; /* the location of the last seen framesync, if it is in the buffer, in bits from front of buffer */ FLAC__BitReaderReadCallback read_callback; void *client_data; - FLAC__CPUInfo cpu_info; }; -static FLaC__INLINE void crc16_update_word_(FLAC__BitReader *br, brword word) +static inline void crc16_update_word_(FLAC__BitReader *br, brword word) { - register unsigned crc = br->read_crc16; -#if FLAC__BYTES_PER_WORD == 4 - switch(br->crc16_align) { - case 0: crc = FLAC__CRC16_UPDATE((unsigned)(word >> 24), crc); - case 8: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc); - case 16: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc); - case 24: br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc); + register uint32_t crc = br->read_crc16; + + for ( ; br->crc16_align < FLAC__BITS_PER_WORD ; br->crc16_align += 8) { + uint32_t shift = FLAC__BITS_PER_WORD - 8 - br->crc16_align ; + crc = FLAC__CRC16_UPDATE ((uint32_t) (shift < FLAC__BITS_PER_WORD ? (word >> shift) & 0xff : 0), crc); } + + br->read_crc16 = crc; + br->crc16_align = 0; +} + +static inline void crc16_update_block_(FLAC__BitReader *br) +{ + if(br->consumed_words > br->crc16_offset && br->crc16_align) + crc16_update_word_(br, br->buffer[br->crc16_offset++]); + + /* Prevent OOB read due to wrap-around. */ + if (br->consumed_words > br->crc16_offset) { +#if FLAC__BYTES_PER_WORD == 4 + br->read_crc16 = FLAC__crc16_update_words32(br->buffer + br->crc16_offset, br->consumed_words - br->crc16_offset, br->read_crc16); #elif FLAC__BYTES_PER_WORD == 8 - switch(br->crc16_align) { - case 0: crc = FLAC__CRC16_UPDATE((unsigned)(word >> 56), crc); - case 8: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 48) & 0xff), crc); - case 16: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 40) & 0xff), crc); - case 24: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 32) & 0xff), crc); - case 32: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 24) & 0xff), crc); - case 40: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 16) & 0xff), crc); - case 48: crc = FLAC__CRC16_UPDATE((unsigned)((word >> 8) & 0xff), crc); - case 56: br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)(word & 0xff), crc); - } + br->read_crc16 = FLAC__crc16_update_words64(br->buffer + br->crc16_offset, br->consumed_words - br->crc16_offset, br->read_crc16); #else - for( ; br->crc16_align < FLAC__BITS_PER_WORD; br->crc16_align += 8) - crc = FLAC__CRC16_UPDATE((unsigned)((word >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), crc); - br->read_crc16 = crc; + unsigned i; + + for (i = br->crc16_offset; i < br->consumed_words; i++) + crc16_update_word_(br, br->buffer[i]); #endif - br->crc16_align = 0; + } + + br->crc16_offset = 0; } -/* would be static except it needs to be called by asm routines */ -FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) +static FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) { - unsigned start, end; + uint32_t start, end; size_t bytes; FLAC__byte *target; +#if WORDS_BIGENDIAN +#else + brword preswap_backup; +#endif /* first shift the unconsumed buffer data toward the front as much as possible */ if(br->consumed_words > 0) { + /* invalidate last seen framesync */ + br->last_seen_framesync = -1; + + crc16_update_block_(br); /* CRC consumed words */ + start = br->consumed_words; end = br->words + (br->bytes? 1:0); memmove(br->buffer, br->buffer+start, FLAC__BYTES_PER_WORD * (end - start)); @@ -193,7 +189,7 @@ FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) /* before reading, if the existing reader looks like this (say brword is 32 bits wide) * bitstream : 11 22 33 44 55 br->words=1 br->bytes=1 (partial tail word is left-justified) - * buffer[BE]: 11 22 33 44 55 ?? ?? ?? (shown layed out as bytes sequentially in memory) + * buffer[BE]: 11 22 33 44 55 ?? ?? ?? (shown laid out as bytes sequentially in memory) * buffer[LE]: 44 33 22 11 ?? ?? ?? 55 (?? being don't-care) * ^^-------target, bytes=3 * on LE machines, have to byteswap the odd tail word so nothing is @@ -201,6 +197,7 @@ FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) */ #if WORDS_BIGENDIAN #else + preswap_backup = br->buffer[br->words]; if(br->bytes) br->buffer[br->words] = SWAP_BE_WORD_TO_HOST(br->buffer[br->words]); #endif @@ -213,8 +210,16 @@ FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) */ /* read in the data; note that the callback may return a smaller number of bytes */ - if(!br->read_callback(target, &bytes, br->client_data)) + if(!br->read_callback(target, &bytes, br->client_data)){ + /* Despite the read callback failing, the data in the target + * might be used later, when the buffer is rewound. Therefore + * we revert the swap that was just done */ +#if WORDS_BIGENDIAN +#else + br->buffer[br->words] = preswap_backup; +#endif return false; + } /* after reading bytes 66 77 88 99 AA BB CC DD EE FF from the client: * bitstream : 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF @@ -224,7 +229,7 @@ FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) */ #if WORDS_BIGENDIAN #else - end = (br->words*FLAC__BYTES_PER_WORD + br->bytes + bytes + (FLAC__BYTES_PER_WORD-1)) / FLAC__BYTES_PER_WORD; + end = (br->words*FLAC__BYTES_PER_WORD + br->bytes + (uint32_t)bytes + (FLAC__BYTES_PER_WORD-1)) / FLAC__BYTES_PER_WORD; for(start = br->words; start < end; start++) br->buffer[start] = SWAP_BE_WORD_TO_HOST(br->buffer[start]); #endif @@ -235,7 +240,7 @@ FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) * buffer[LE]: 44 33 22 11 88 77 66 55 CC BB AA 99 ?? FF EE DD * finally we'll update the reader values: */ - end = br->words*FLAC__BYTES_PER_WORD + br->bytes + bytes; + end = br->words*FLAC__BYTES_PER_WORD + br->bytes + (uint32_t)bytes; br->words = end / FLAC__BYTES_PER_WORD; br->bytes = end % FLAC__BYTES_PER_WORD; @@ -250,7 +255,7 @@ FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br) FLAC__BitReader *FLAC__bitreader_new(void) { - FLAC__BitReader *br = (FLAC__BitReader*)calloc(1, sizeof(FLAC__BitReader)); + FLAC__BitReader *br = calloc(1, sizeof(FLAC__BitReader)); /* calloc() implies: memset(br, 0, sizeof(FLAC__BitReader)); @@ -278,19 +283,21 @@ void FLAC__bitreader_delete(FLAC__BitReader *br) * ***********************************************************************/ -FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__CPUInfo cpu, FLAC__BitReaderReadCallback rcb, void *cd) +FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__BitReaderReadCallback rcb, void *cd) { FLAC__ASSERT(0 != br); br->words = br->bytes = 0; br->consumed_words = br->consumed_bits = 0; br->capacity = FLAC__BITREADER_DEFAULT_CAPACITY; - br->buffer = (brword*)malloc(sizeof(brword) * br->capacity); + br->buffer = malloc(sizeof(brword) * br->capacity); if(br->buffer == 0) return false; br->read_callback = rcb; br->client_data = cd; - br->cpu_info = cpu; + br->read_limit_set = false; + br->read_limit = -1; + br->last_seen_framesync = -1; return true; } @@ -307,42 +314,36 @@ void FLAC__bitreader_free(FLAC__BitReader *br) br->consumed_words = br->consumed_bits = 0; br->read_callback = 0; br->client_data = 0; + br->read_limit_set = false; + br->read_limit = -1; + br->last_seen_framesync = -1; } FLAC__bool FLAC__bitreader_clear(FLAC__BitReader *br) { br->words = br->bytes = 0; br->consumed_words = br->consumed_bits = 0; + br->read_limit_set = false; + br->read_limit = -1; + br->last_seen_framesync = -1; return true; } -void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out) +void FLAC__bitreader_set_framesync_location(FLAC__BitReader *br) +{ + br->last_seen_framesync = br->consumed_words * FLAC__BYTES_PER_WORD + br->consumed_bits / 8; +} + +FLAC__bool FLAC__bitreader_rewind_to_after_last_seen_framesync(FLAC__BitReader *br) { - unsigned i, j; - if(br == 0) { - fprintf(out, "bitreader is NULL\n"); + if(br->last_seen_framesync == (uint32_t)-1) { + br->consumed_words = br->consumed_bits = 0; + return false; } else { - fprintf(out, "bitreader: capacity=%u words=%u bytes=%u consumed: words=%u, bits=%u\n", br->capacity, br->words, br->bytes, br->consumed_words, br->consumed_bits); - - for(i = 0; i < br->words; i++) { - fprintf(out, "%08X: ", i); - for(j = 0; j < FLAC__BITS_PER_WORD; j++) - if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits)) - fprintf(out, "."); - else - fprintf(out, "%01u", br->buffer[i] & (1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); - fprintf(out, "\n"); - } - if(br->bytes > 0) { - fprintf(out, "%08X: ", i); - for(j = 0; j < br->bytes*8; j++) - if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits)) - fprintf(out, "."); - else - fprintf(out, "%01u", br->buffer[i] & (1 << (br->bytes*8-j-1)) ? 1:0); - fprintf(out, "\n"); - } + br->consumed_words = (br->last_seen_framesync + 1) / FLAC__BYTES_PER_WORD; + br->consumed_bits = ((br->last_seen_framesync + 1) % FLAC__BYTES_PER_WORD) * 8; + return true; } } @@ -352,7 +353,8 @@ void FLAC__bitreader_reset_read_crc16(FLAC__BitReader *br, FLAC__uint16 seed) FLAC__ASSERT(0 != br->buffer); FLAC__ASSERT((br->consumed_bits & 7) == 0); - br->read_crc16 = (unsigned)seed; + br->read_crc16 = (uint32_t)seed; + br->crc16_offset = br->consumed_words; br->crc16_align = br->consumed_bits; } @@ -360,6 +362,10 @@ FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br) { FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); + + /* CRC consumed words up to here */ + crc16_update_block_(br); + FLAC__ASSERT((br->consumed_bits & 7) == 0); FLAC__ASSERT(br->crc16_align <= br->consumed_bits); @@ -367,27 +373,49 @@ FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br) if(br->consumed_bits) { const brword tail = br->buffer[br->consumed_words]; for( ; br->crc16_align < br->consumed_bits; br->crc16_align += 8) - br->read_crc16 = FLAC__CRC16_UPDATE((unsigned)((tail >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), br->read_crc16); + br->read_crc16 = FLAC__CRC16_UPDATE((uint32_t)((tail >> (FLAC__BITS_PER_WORD-8-br->crc16_align)) & 0xff), br->read_crc16); } return br->read_crc16; } -FLaC__INLINE FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br) +inline FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br) { return ((br->consumed_bits & 7) == 0); } -FLaC__INLINE unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br) +inline uint32_t FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br) { return 8 - (br->consumed_bits & 7); } -FLaC__INLINE unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br) +inline uint32_t FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br) { return (br->words-br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes*8 - br->consumed_bits; } -FLaC__INLINE FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits) +void FLAC__bitreader_set_limit(FLAC__BitReader *br, uint32_t limit) +{ + br->read_limit = limit; + br->read_limit_set = true; +} + +void FLAC__bitreader_remove_limit(FLAC__BitReader *br) +{ + br->read_limit_set = false; + br->read_limit = -1; +} + +uint32_t FLAC__bitreader_limit_remaining(FLAC__BitReader *br) +{ + FLAC__ASSERT(br->read_limit_set); + return br->read_limit; +} +void FLAC__bitreader_limit_invalidate(FLAC__BitReader *br) +{ + br->read_limit = -1; +} + +FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, uint32_t bits) { FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); @@ -404,6 +432,15 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLA return true; } + if(br->read_limit_set && br->read_limit < (uint32_t)-1){ + if(br->read_limit < bits) { + br->read_limit = -1; + return false; + } + else + br->read_limit -= bits; + } + while((br->words-br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes*8 - br->consumed_bits < bits) { if(!bitreader_read_from_client_(br)) return false; @@ -412,35 +449,37 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLA /* OPT: taking out the consumed_bits==0 "else" case below might make things faster if less code allows the compiler to inline this function */ if(br->consumed_bits) { /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - const unsigned n = FLAC__BITS_PER_WORD - br->consumed_bits; + const uint32_t n = FLAC__BITS_PER_WORD - br->consumed_bits; const brword word = br->buffer[br->consumed_words]; + const brword mask = br->consumed_bits < FLAC__BITS_PER_WORD ? FLAC__WORD_ALL_ONES >> br->consumed_bits : 0; if(bits < n) { - *val = (word & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (n-bits); + uint32_t shift = n - bits; + *val = shift < FLAC__BITS_PER_WORD ? (FLAC__uint32)((word & mask) >> shift) : 0; /* The result has <= 32 non-zero bits */ br->consumed_bits += bits; return true; } - *val = word & (FLAC__WORD_ALL_ONES >> br->consumed_bits); + /* (FLAC__BITS_PER_WORD - br->consumed_bits <= bits) ==> (FLAC__WORD_ALL_ONES >> br->consumed_bits) has no more than 'bits' non-zero bits */ + *val = (FLAC__uint32)(word & mask); bits -= n; - crc16_update_word_(br, word); br->consumed_words++; br->consumed_bits = 0; if(bits) { /* if there are still bits left to read, there have to be less than 32 so they will all be in the next word */ - *val <<= bits; - *val |= (br->buffer[br->consumed_words] >> (FLAC__BITS_PER_WORD-bits)); + uint32_t shift = FLAC__BITS_PER_WORD - bits; + *val = bits < 32 ? *val << bits : 0; + *val |= shift < FLAC__BITS_PER_WORD ? (FLAC__uint32)(br->buffer[br->consumed_words] >> shift) : 0; br->consumed_bits = bits; } return true; } - else { + else { /* br->consumed_bits == 0 */ const brword word = br->buffer[br->consumed_words]; if(bits < FLAC__BITS_PER_WORD) { - *val = word >> (FLAC__BITS_PER_WORD-bits); + *val = (FLAC__uint32)(word >> (FLAC__BITS_PER_WORD-bits)); br->consumed_bits = bits; return true; } - /* at this point 'bits' must be == FLAC__BITS_PER_WORD; because of previous assertions, it can't be larger */ - *val = word; - crc16_update_word_(br, word); + /* at this point bits == FLAC__BITS_PER_WORD == 32; because of previous assertions, it can't be larger */ + *val = (FLAC__uint32)word; br->consumed_words++; return true; } @@ -454,30 +493,32 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLA if(br->consumed_bits) { /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ FLAC__ASSERT(br->consumed_bits + bits <= br->bytes*8); - *val = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (FLAC__BITS_PER_WORD-br->consumed_bits-bits); + *val = (FLAC__uint32)((br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES >> br->consumed_bits)) >> (FLAC__BITS_PER_WORD-br->consumed_bits-bits)); br->consumed_bits += bits; return true; } else { - *val = br->buffer[br->consumed_words] >> (FLAC__BITS_PER_WORD-bits); + *val = (FLAC__uint32)(br->buffer[br->consumed_words] >> (FLAC__BITS_PER_WORD-bits)); br->consumed_bits += bits; return true; } } } -FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits) +FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, uint32_t bits) { + FLAC__uint32 uval, mask; /* OPT: inline raw uint32 code here, or make into a macro if possible in the .h file */ - if(!FLAC__bitreader_read_raw_uint32(br, (FLAC__uint32*)val, bits)) + if (bits < 1 || ! FLAC__bitreader_read_raw_uint32(br, &uval, bits)) return false; - /* sign-extend: */ - *val <<= (32-bits); - *val >>= (32-bits); + /* sign-extend *val assuming it is currently bits wide. */ + /* From: https://graphics.stanford.edu/~seander/bithacks.html#FixedSignExtend */ + mask = bits >= 33 ? 0 : 1lu << (bits - 1); + *val = (uval ^ mask) - mask; return true; } -FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits) +FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, uint32_t bits) { FLAC__uint32 hi, lo; @@ -498,7 +539,20 @@ FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *va return true; } -FLaC__INLINE FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val) +FLAC__bool FLAC__bitreader_read_raw_int64(FLAC__BitReader *br, FLAC__int64 *val, uint32_t bits) +{ + FLAC__uint64 uval, mask; + /* OPT: inline raw uint64 code here, or make into a macro if possible in the .h file */ + if (bits < 1 || ! FLAC__bitreader_read_raw_uint64(br, &uval, bits)) + return false; + /* sign-extend *val assuming it is currently bits wide. */ + /* From: https://graphics.stanford.edu/~seander/bithacks.html#FixedSignExtend */ + mask = bits >= 65 ? 0 : 1llu << (bits - 1); + *val = (uval ^ mask) - mask; + return true; +} + +inline FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val) { FLAC__uint32 x8, x32 = 0; @@ -523,7 +577,7 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReade return true; } -FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits) +FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, uint32_t bits) { /* * OPT: a faster implementation is possible but probably not that useful @@ -533,12 +587,12 @@ FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits) FLAC__ASSERT(0 != br->buffer); if(bits > 0) { - const unsigned n = br->consumed_bits & 7; - unsigned m; + const uint32_t n = br->consumed_bits & 7; + uint32_t m; FLAC__uint32 x; if(n != 0) { - m = min(8-n, bits); + m = flac_min(8-n, bits); if(!FLAC__bitreader_read_raw_uint32(br, &x, m)) return false; bits -= m; @@ -558,7 +612,7 @@ FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits) return true; } -FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals) +FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, uint32_t nvals) { FLAC__uint32 x; @@ -566,6 +620,13 @@ FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, u FLAC__ASSERT(0 != br->buffer); FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(br)); + if(br->read_limit_set && br->read_limit < (uint32_t)-1){ + if(br->read_limit < nvals*8){ + br->read_limit = -1; + return false; + } + } + /* step 1: skip over partial head word to get word aligned */ while(nvals && br->consumed_bits) { /* i.e. run until we read 'nvals' bytes or we hit the end of the head word */ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) @@ -574,11 +635,14 @@ FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, u } if(0 == nvals) return true; + /* step 2: skip whole words in chunks */ while(nvals >= FLAC__BYTES_PER_WORD) { if(br->consumed_words < br->words) { br->consumed_words++; nvals -= FLAC__BYTES_PER_WORD; + if(br->read_limit_set) + br->read_limit -= FLAC__BITS_PER_WORD; } else if(!bitreader_read_from_client_(br)) return false; @@ -593,7 +657,7 @@ FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, u return true; } -FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals) +FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, uint32_t nvals) { FLAC__uint32 x; @@ -601,6 +665,13 @@ FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, F FLAC__ASSERT(0 != br->buffer); FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(br)); + if(br->read_limit_set && br->read_limit < (uint32_t)-1){ + if(br->read_limit < nvals*8){ + br->read_limit = -1; + return false; + } + } + /* step 1: read from partial head word to get word aligned */ while(nvals && br->consumed_bits) { /* i.e. run until we read 'nvals' bytes or we hit the end of the head word */ if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) @@ -634,6 +705,8 @@ FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, F #endif val += FLAC__BYTES_PER_WORD; nvals -= FLAC__BYTES_PER_WORD; + if(br->read_limit_set) + br->read_limit -= FLAC__BITS_PER_WORD; } else if(!bitreader_read_from_client_(br)) return false; @@ -649,10 +722,10 @@ FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, F return true; } -FLaC__INLINE FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val) +FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, uint32_t *val) #if 0 /* slow but readable version */ { - unsigned bit; + uint32_t bit; FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); @@ -670,7 +743,7 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, } #else { - unsigned i; + uint32_t i; FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); @@ -678,14 +751,13 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, *val = 0; while(1) { while(br->consumed_words < br->words) { /* if we've not consumed up to a partial tail word... */ - brword b = br->buffer[br->consumed_words] << br->consumed_bits; + brword b = br->consumed_bits < FLAC__BITS_PER_WORD ? br->buffer[br->consumed_words] << br->consumed_bits : 0; if(b) { i = COUNT_ZERO_MSBS(b); *val += i; i++; br->consumed_bits += i; if(br->consumed_bits >= FLAC__BITS_PER_WORD) { /* faster way of testing if(br->consumed_bits == FLAC__BITS_PER_WORD) */ - crc16_update_word_(br, br->buffer[br->consumed_words]); br->consumed_words++; br->consumed_bits = 0; } @@ -693,7 +765,6 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, } else { *val += FLAC__BITS_PER_WORD - br->consumed_bits; - crc16_update_word_(br, br->buffer[br->consumed_words]); br->consumed_words++; br->consumed_bits = 0; /* didn't find stop bit yet, have to keep going... */ @@ -706,8 +777,8 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, * us data a byte at a time (unlikely), br->consumed_bits may not * be zero. */ - if(br->bytes) { - const unsigned end = br->bytes * 8; + if(br->bytes*8 > br->consumed_bits) { + const uint32_t end = br->bytes * 8; brword b = (br->buffer[br->consumed_words] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD-end))) << br->consumed_bits; if(b) { i = COUNT_ZERO_MSBS(b); @@ -719,7 +790,7 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, } else { *val += end - br->consumed_bits; - br->consumed_bits += end; + br->consumed_bits = end; FLAC__ASSERT(br->consumed_bits < FLAC__BITS_PER_WORD); /* didn't find stop bit yet, have to keep going... */ } @@ -730,10 +801,11 @@ FLaC__INLINE FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, } #endif -FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter) +#if 0 /* unused */ +FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, uint32_t parameter) { FLAC__uint32 lsbs = 0, msbs = 0; - unsigned uval; + uint32_t uval; FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); @@ -756,387 +828,23 @@ FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsig return true; } - -/* this is by far the most heavily used reader call. it ain't pretty but it's fast */ -/* a lot of the logic is copied, then adapted, from FLAC__bitreader_read_unary_unsigned() and FLAC__bitreader_read_raw_uint32() */ -FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter) -/* OPT: possibly faster version for use with MSVC */ -#ifdef _MSC_VER -{ - unsigned i; - unsigned uval = 0; - unsigned bits; /* the # of binary LSBs left to read to finish a rice codeword */ - - /* try and get br->consumed_words and br->consumed_bits into register; - * must remember to flush them back to *br before calling other - * bitwriter functions that use them, and before returning */ - register unsigned cwords; - register unsigned cbits; - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ - FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); - FLAC__ASSERT(parameter < 32); - /* the above two asserts also guarantee that the binary part never straddles more that 2 words, so we don't have to loop to read it */ - - if(nvals == 0) - return true; - - cbits = br->consumed_bits; - cwords = br->consumed_words; - - while(1) { - - /* read unary part */ - while(1) { - while(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ - brword b = br->buffer[cwords] << cbits; - if(b) { -#if 0 /* slower, probably due to bad register allocation... */ && defined FLAC__CPU_IA32 && !defined FLAC__NO_ASM && FLAC__BITS_PER_WORD == 32 - __asm { - bsr eax, b - not eax - and eax, 31 - mov i, eax - } -#else - i = COUNT_ZERO_MSBS(b); -#endif - uval += i; - bits = parameter; - i++; - cbits += i; - if(cbits == FLAC__BITS_PER_WORD) { - crc16_update_word_(br, br->buffer[cwords]); - cwords++; - cbits = 0; - } - goto break1; - } - else { - uval += FLAC__BITS_PER_WORD - cbits; - crc16_update_word_(br, br->buffer[cwords]); - cwords++; - cbits = 0; - /* didn't find stop bit yet, have to keep going... */ - } - } - /* at this point we've eaten up all the whole words; have to try - * reading through any tail bytes before calling the read callback. - * this is a repeat of the above logic adjusted for the fact we - * don't have a whole word. note though if the client is feeding - * us data a byte at a time (unlikely), br->consumed_bits may not - * be zero. - */ - if(br->bytes) { - const unsigned end = br->bytes * 8; - brword b = (br->buffer[cwords] & (FLAC__WORD_ALL_ONES << (FLAC__BITS_PER_WORD-end))) << cbits; - if(b) { - i = COUNT_ZERO_MSBS(b); - uval += i; - bits = parameter; - i++; - cbits += i; - FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD); - goto break1; - } - else { - uval += end - cbits; - cbits += end; - FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD); - /* didn't find stop bit yet, have to keep going... */ - } - } - /* flush registers and read; bitreader_read_from_client_() does - * not touch br->consumed_bits at all but we still need to set - * it in case it fails and we have to return false. - */ - br->consumed_bits = cbits; - br->consumed_words = cwords; - if(!bitreader_read_from_client_(br)) - return false; - cwords = br->consumed_words; - } -break1: - /* read binary part */ - FLAC__ASSERT(cwords <= br->words); - - if(bits) { - while((br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits < bits) { - /* flush registers and read; bitreader_read_from_client_() does - * not touch br->consumed_bits at all but we still need to set - * it in case it fails and we have to return false. - */ - br->consumed_bits = cbits; - br->consumed_words = cwords; - if(!bitreader_read_from_client_(br)) - return false; - cwords = br->consumed_words; - } - if(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ - if(cbits) { - /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - const unsigned n = FLAC__BITS_PER_WORD - cbits; - const brword word = br->buffer[cwords]; - if(bits < n) { - uval <<= bits; - uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n-bits); - cbits += bits; - goto break2; - } - uval <<= n; - uval |= word & (FLAC__WORD_ALL_ONES >> cbits); - bits -= n; - crc16_update_word_(br, word); - cwords++; - cbits = 0; - if(bits) { /* if there are still bits left to read, there have to be less than 32 so they will all be in the next word */ - uval <<= bits; - uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-bits)); - cbits = bits; - } - goto break2; - } - else { - FLAC__ASSERT(bits < FLAC__BITS_PER_WORD); - uval <<= bits; - uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-bits); - cbits = bits; - goto break2; - } - } - else { - /* in this case we're starting our read at a partial tail word; - * the reader has guaranteed that we have at least 'bits' bits - * available to read, which makes this case simpler. - */ - uval <<= bits; - if(cbits) { - /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - FLAC__ASSERT(cbits + bits <= br->bytes*8); - uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD-cbits-bits); - cbits += bits; - goto break2; - } - else { - uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-bits); - cbits += bits; - goto break2; - } - } - } -break2: - /* compose the value */ - *vals = (int)(uval >> 1 ^ -(int)(uval & 1)); - - /* are we done? */ - --nvals; - if(nvals == 0) { - br->consumed_bits = cbits; - br->consumed_words = cwords; - return true; - } - - uval = 0; - ++vals; - - } -} -#else -{ - unsigned i; - unsigned uval = 0; - - /* try and get br->consumed_words and br->consumed_bits into register; - * must remember to flush them back to *br before calling other - * bitwriter functions that use them, and before returning */ - register unsigned cwords; - register unsigned cbits; - unsigned ucbits; /* keep track of the number of unconsumed bits in the buffer */ - - FLAC__ASSERT(0 != br); - FLAC__ASSERT(0 != br->buffer); - /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ - FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); - FLAC__ASSERT(parameter < 32); - /* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */ - - if(nvals == 0) - return true; - - cbits = br->consumed_bits; - cwords = br->consumed_words; - ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits; - - while(1) { - - /* read unary part */ - while(1) { - while(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ - brword b = br->buffer[cwords] << cbits; - if(b) { -#if 0 /* is not discernably faster... */ && defined FLAC__CPU_IA32 && !defined FLAC__NO_ASM && FLAC__BITS_PER_WORD == 32 && defined __GNUC__ - asm volatile ( - "bsrl %1, %0;" - "notl %0;" - "andl $31, %0;" - : "=r"(i) - : "r"(b) - ); -#else - i = COUNT_ZERO_MSBS(b); #endif - uval += i; - cbits += i; - cbits++; /* skip over stop bit */ - if(cbits >= FLAC__BITS_PER_WORD) { /* faster way of testing if(cbits == FLAC__BITS_PER_WORD) */ - crc16_update_word_(br, br->buffer[cwords]); - cwords++; - cbits = 0; - } - goto break1; - } - else { - uval += FLAC__BITS_PER_WORD - cbits; - crc16_update_word_(br, br->buffer[cwords]); - cwords++; - cbits = 0; - /* didn't find stop bit yet, have to keep going... */ - } - } - /* at this point we've eaten up all the whole words; have to try - * reading through any tail bytes before calling the read callback. - * this is a repeat of the above logic adjusted for the fact we - * don't have a whole word. note though if the client is feeding - * us data a byte at a time (unlikely), br->consumed_bits may not - * be zero. - */ - if(br->bytes) { - const unsigned end = br->bytes * 8; - brword b = (br->buffer[cwords] & ~(FLAC__WORD_ALL_ONES >> end)) << cbits; - if(b) { - i = COUNT_ZERO_MSBS(b); - uval += i; - cbits += i; - cbits++; /* skip over stop bit */ - FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD); - goto break1; - } - else { - uval += end - cbits; - cbits += end; - FLAC__ASSERT(cbits < FLAC__BITS_PER_WORD); - /* didn't find stop bit yet, have to keep going... */ - } - } - /* flush registers and read; bitreader_read_from_client_() does - * not touch br->consumed_bits at all but we still need to set - * it in case it fails and we have to return false. - */ - br->consumed_bits = cbits; - br->consumed_words = cwords; - if(!bitreader_read_from_client_(br)) - return false; - cwords = br->consumed_words; - ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits + uval; - /* + uval to offset our count by the # of unary bits already - * consumed before the read, because we will add these back - * in all at once at break1 - */ - } -break1: - ucbits -= uval; - ucbits--; /* account for stop bit */ - - /* read binary part */ - FLAC__ASSERT(cwords <= br->words); - - if(parameter) { - while(ucbits < parameter) { - /* flush registers and read; bitreader_read_from_client_() does - * not touch br->consumed_bits at all but we still need to set - * it in case it fails and we have to return false. - */ - br->consumed_bits = cbits; - br->consumed_words = cwords; - if(!bitreader_read_from_client_(br)) - return false; - cwords = br->consumed_words; - ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits; - } - if(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ - if(cbits) { - /* this also works when consumed_bits==0, it's just slower than necessary for that case */ - const unsigned n = FLAC__BITS_PER_WORD - cbits; - const brword word = br->buffer[cwords]; - if(parameter < n) { - uval <<= parameter; - uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n-parameter); - cbits += parameter; - } - else { - uval <<= n; - uval |= word & (FLAC__WORD_ALL_ONES >> cbits); - crc16_update_word_(br, word); - cwords++; - cbits = parameter - n; - if(cbits) { /* parameter > n, i.e. if there are still bits left to read, there have to be less than 32 so they will all be in the next word */ - uval <<= cbits; - uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits)); - } - } - } - else { - cbits = parameter; - uval <<= parameter; - uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits); - } - } - else { - /* in this case we're starting our read at a partial tail word; - * the reader has guaranteed that we have at least 'parameter' - * bits available to read, which makes this case simpler. - */ - uval <<= parameter; - if(cbits) { - /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - FLAC__ASSERT(cbits + parameter <= br->bytes*8); - uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD-cbits-parameter); - cbits += parameter; - } - else { - cbits = parameter; - uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits); - } - } - } - - ucbits -= parameter; - /* compose the value */ - *vals = (int)(uval >> 1 ^ -(int)(uval & 1)); - - /* are we done? */ - --nvals; - if(nvals == 0) { - br->consumed_bits = cbits; - br->consumed_words = cwords; - return true; - } - - uval = 0; - ++vals; +/* this is by far the most heavily used reader call. it ain't pretty but it's fast */ +FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], uint32_t nvals, uint32_t parameter) +#include "deduplication/bitreader_read_rice_signed_block.c" - } -} +#ifdef FLAC__BMI2_SUPPORTED +FLAC__SSE_TARGET("bmi2") +FLAC__bool FLAC__bitreader_read_rice_signed_block_bmi2(FLAC__BitReader *br, int vals[], uint32_t nvals, uint32_t parameter) +#include "deduplication/bitreader_read_rice_signed_block.c" #endif #if 0 /* UNUSED */ -FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter) +FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uint32_t parameter) { FLAC__uint32 lsbs = 0, msbs = 0; - unsigned bit, uval, k; + uint32_t bit, uval, k; FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); @@ -1156,7 +864,7 @@ FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uns uval = (msbs << k) | lsbs; } else { - unsigned d = (1 << (k+1)) - parameter; + uint32_t d = (1 << (k+1)) - parameter; if(lsbs >= d) { if(!FLAC__bitreader_read_bit(br, &bit)) return false; @@ -1168,7 +876,7 @@ FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uns uval = msbs * parameter + lsbs; } - /* unfold unsigned to signed */ + /* unfold uint32_t to signed */ if(uval & 1) *val = -((int)(uval >> 1)) - 1; else @@ -1177,10 +885,10 @@ FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uns return true; } -FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter) +FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, uint32_t *val, uint32_t parameter) { FLAC__uint32 lsbs, msbs = 0; - unsigned bit, k; + uint32_t bit, k; FLAC__ASSERT(0 != br); FLAC__ASSERT(0 != br->buffer); @@ -1200,7 +908,7 @@ FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *v *val = (msbs << k) | lsbs; } else { - unsigned d = (1 << (k+1)) - parameter; + uint32_t d = (1 << (k+1)) - parameter; if(lsbs >= d) { if(!FLAC__bitreader_read_bit(br, &bit)) return false; @@ -1217,11 +925,11 @@ FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *v #endif /* UNUSED */ /* on return, if *val == 0xffffffff then the utf-8 sequence was invalid, but the return value will be true */ -FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen) +FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, uint32_t *rawlen) { FLAC__uint32 v = 0; FLAC__uint32 x; - unsigned i; + uint32_t i; if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) return false; @@ -1272,11 +980,11 @@ FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *v } /* on return, if *val == 0xffffffffffffffff then the utf-8 sequence was invalid, but the return value will be true */ -FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen) +FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, uint32_t *rawlen) { FLAC__uint64 v = 0; FLAC__uint32 x; - unsigned i; + uint32_t i; if(!FLAC__bitreader_read_raw_uint32(br, &x, 8)) return false; @@ -1329,3 +1037,16 @@ FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *v *val = v; return true; } + +/* These functions are declared inline in this file but are also callable as + * externs from elsewhere. + * According to the C99 spec, section 6.7.4, simply providing a function + * prototype in a header file without 'inline' and making the function inline + * in this file should be sufficient. + * Unfortunately, the Microsoft VS compiler doesn't pick them up externally. To + * fix that we add extern declarations here. + */ +extern FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br); +extern uint32_t FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br); +extern uint32_t FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br); +extern FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val); diff --git a/3rdparty/libflac/src/libFLAC/bitwriter.c b/3rdparty/libflac/src/libFLAC/bitwriter.c index 441122ee883..1d7be8083f4 100644 --- a/3rdparty/libflac/src/libFLAC/bitwriter.c +++ b/3rdparty/libflac/src/libFLAC/bitwriter.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,21 +34,30 @@ # include <config.h> #endif -#include <stdlib.h> /* for malloc() */ -#include <string.h> /* for memcpy(), memset() */ +#include <stdlib.h> +#include <string.h> #include "private/bitwriter.h" #include "private/crc.h" +#include "private/format.h" +#include "private/macros.h" +#include "private/stream_encoder.h" #include "FLAC/assert.h" #include "share/alloc.h" +#include "share/compat.h" #include "share/endswap.h" /* Things should be fastest when this matches the machine word size */ /* WATCHOUT: if you change this you must also change the following #defines down to SWAP_BE_WORD_TO_HOST below to match */ /* WATCHOUT: there are a few places where the code will not work unless bwword is >= 32 bits wide */ + +#if (ENABLE_64_BIT_WORDS == 0) + typedef FLAC__uint32 bwword; -#define FLAC__BYTES_PER_WORD 4 +typedef FLAC__uint64 FLAC__bwtemp; +#define FLAC__BYTES_PER_WORD 4 /* sizeof bwword */ #define FLAC__BITS_PER_WORD 32 -#define FLAC__WORD_ALL_ONES ((FLAC__uint32)0xffffffff) +#define FLAC__TEMP_BITS 64 +#define FLAC__HALF_TEMP_BITS 32 /* SWAP_BE_WORD_TO_HOST swaps bytes in a bwword (which is always big-endian) if necessary to match host byte order */ #if WORDS_BIGENDIAN #define SWAP_BE_WORD_TO_HOST(x) (x) @@ -55,47 +65,51 @@ typedef FLAC__uint32 bwword; #define SWAP_BE_WORD_TO_HOST(x) ENDSWAP_32(x) #endif +#else + +typedef FLAC__uint64 bwword; +typedef FLAC__uint64 FLAC__bwtemp; +#define FLAC__BYTES_PER_WORD 8 /* sizeof bwword */ +#define FLAC__BITS_PER_WORD 64 +#define FLAC__TEMP_BITS 64 +#define FLAC__HALF_TEMP_BITS 32 +/* SWAP_BE_WORD_TO_HOST swaps bytes in a bwword (which is always big-endian) if necessary to match host byte order */ +#if WORDS_BIGENDIAN +#define SWAP_BE_WORD_TO_HOST(x) (x) +#else +#define SWAP_BE_WORD_TO_HOST(x) ENDSWAP_64(x) +#endif + +#endif + /* * The default capacity here doesn't matter too much. The buffer always grows * to hold whatever is written to it. Usually the encoder will stop adding at * a frame or metadata block, then write that out and clear the buffer for the * next one. */ -static const unsigned FLAC__BITWRITER_DEFAULT_CAPACITY = 32768u / sizeof(bwword); /* size in words */ +static const uint32_t FLAC__BITWRITER_DEFAULT_CAPACITY = 32768u / sizeof(bwword); /* size in words */ /* When growing, increment 4K at a time */ -static const unsigned FLAC__BITWRITER_DEFAULT_INCREMENT = 4096u / sizeof(bwword); /* size in words */ +static const uint32_t FLAC__BITWRITER_DEFAULT_INCREMENT = 4096u / sizeof(bwword); /* size in words */ #define FLAC__WORDS_TO_BITS(words) ((words) * FLAC__BITS_PER_WORD) #define FLAC__TOTAL_BITS(bw) (FLAC__WORDS_TO_BITS((bw)->words) + (bw)->bits) -#ifdef min -#undef min -#endif -#define min(x,y) ((x)<(y)?(x):(y)) - -/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ -#ifdef _MSC_VER -#define FLAC__U64L(x) x -#else -#define FLAC__U64L(x) x##LLU -#endif - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif - struct FLAC__BitWriter { bwword *buffer; bwword accum; /* accumulator; bits are right-justified; when full, accum is appended to buffer */ - unsigned capacity; /* capacity of buffer in words */ - unsigned words; /* # of complete words in buffer */ - unsigned bits; /* # of used bits in accum */ + uint32_t capacity; /* capacity of buffer in words */ + uint32_t words; /* # of complete words in buffer */ + uint32_t bits; /* # of used bits in accum */ }; /* * WATCHOUT: The current implementation only grows the buffer. */ -static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add) +#ifndef __SUNPRO_C +static +#endif +FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, uint32_t bits_to_add) { - unsigned new_capacity; + uint32_t new_capacity; bwword *new_buffer; FLAC__ASSERT(0 != bw); @@ -110,6 +124,13 @@ static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add) if(bw->capacity >= new_capacity) return true; + if(new_capacity * sizeof(bwword) > (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) + /* Requested new capacity is larger than the largest possible metadata block, + * which is also larger than the largest sane framesize. That means something + * went very wrong somewhere and previous checks failed. + * To prevent chrashing, give up */ + return false; + /* round up capacity increase to the nearest FLAC__BITWRITER_DEFAULT_INCREMENT */ if((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT) new_capacity += FLAC__BITWRITER_DEFAULT_INCREMENT - ((new_capacity - bw->capacity) % FLAC__BITWRITER_DEFAULT_INCREMENT); @@ -118,7 +139,7 @@ static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add) FLAC__ASSERT(new_capacity > bw->capacity); FLAC__ASSERT(new_capacity >= bw->words + ((bw->bits + bits_to_add + FLAC__BITS_PER_WORD - 1) / FLAC__BITS_PER_WORD)); - new_buffer = (bwword*)safe_realloc_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity); + new_buffer = safe_realloc_nofree_mul_2op_(bw->buffer, sizeof(bwword), /*times*/new_capacity); if(new_buffer == 0) return false; bw->buffer = new_buffer; @@ -135,7 +156,7 @@ static FLAC__bool bitwriter_grow_(FLAC__BitWriter *bw, unsigned bits_to_add) FLAC__BitWriter *FLAC__bitwriter_new(void) { - FLAC__BitWriter *bw = (FLAC__BitWriter*)calloc(1, sizeof(FLAC__BitWriter)); + FLAC__BitWriter *bw = calloc(1, sizeof(FLAC__BitWriter)); /* note that calloc() sets all members to 0 for us */ return bw; } @@ -160,7 +181,7 @@ FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw) bw->words = bw->bits = 0; bw->capacity = FLAC__BITWRITER_DEFAULT_CAPACITY; - bw->buffer = (bwword*)malloc(sizeof(bwword) * bw->capacity); + bw->buffer = malloc(sizeof(bwword) * bw->capacity); if(bw->buffer == 0) return false; @@ -183,30 +204,6 @@ void FLAC__bitwriter_clear(FLAC__BitWriter *bw) bw->words = bw->bits = 0; } -void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out) -{ - unsigned i, j; - if(bw == 0) { - fprintf(out, "bitwriter is NULL\n"); - } - else { - fprintf(out, "bitwriter: capacity=%u words=%u bits=%u total_bits=%u\n", bw->capacity, bw->words, bw->bits, FLAC__TOTAL_BITS(bw)); - - for(i = 0; i < bw->words; i++) { - fprintf(out, "%08X: ", i); - for(j = 0; j < FLAC__BITS_PER_WORD; j++) - fprintf(out, "%01u", bw->buffer[i] & (1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); - fprintf(out, "\n"); - } - if(bw->bits > 0) { - fprintf(out, "%08X: ", i); - for(j = 0; j < bw->bits; j++) - fprintf(out, "%01u", bw->accum & (1 << (bw->bits-j-1)) ? 1:0); - fprintf(out, "\n"); - } - } -} - FLAC__bool FLAC__bitwriter_get_write_crc16(FLAC__BitWriter *bw, FLAC__uint16 *crc) { const FLAC__byte *buffer; @@ -242,7 +239,7 @@ FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw) return ((bw->bits & 7) == 0); } -unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw) +uint32_t FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw) { return FLAC__TOTAL_BITS(bw); } @@ -275,9 +272,9 @@ void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw) (void)bw; } -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits) +inline FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, uint32_t bits) { - unsigned n; + uint32_t n; FLAC__ASSERT(0 != bw); FLAC__ASSERT(0 != bw->buffer); @@ -289,7 +286,7 @@ FLaC__INLINE FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsign return false; /* first part gets to word alignment */ if(bw->bits) { - n = min(FLAC__BITS_PER_WORD - bw->bits, bits); + n = flac_min(FLAC__BITS_PER_WORD - bw->bits, bits); bw->accum <<= n; bits -= n; bw->bits += n; @@ -313,20 +310,24 @@ FLaC__INLINE FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsign return true; } -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits) +static inline FLAC__bool FLAC__bitwriter_write_raw_uint32_nocheck(FLAC__BitWriter *bw, FLAC__uint32 val, uint32_t bits) { - register unsigned left; + register uint32_t left; /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); - FLAC__ASSERT(0 != bw); - FLAC__ASSERT(0 != bw->buffer); + if(bw == 0 || bw->buffer == 0) + return false; + + if (bits > 32) + return false; - FLAC__ASSERT(bits <= 32); if(bits == 0) return true; + FLAC__ASSERT((bits == 32) || (val>>bits == 0)); + /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+bits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */ if(bw->capacity <= bw->words + bits && !bitwriter_grow_(bw, bits)) return false; @@ -341,102 +342,124 @@ FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FL bw->accum <<= left; bw->accum |= val >> (bw->bits = bits - left); bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); - bw->accum = val; + bw->accum = val; /* unused top bits can contain garbage */ } - else { - bw->accum = val; - bw->bits = 0; - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(val); + else { /* at this point bits == FLAC__BITS_PER_WORD == 32 and bw->bits == 0 */ + bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST((bwword)val); } return true; } -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits) +inline FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, uint32_t bits) +{ + /* check that unused bits are unset */ + if((bits < 32) && (val>>bits != 0)) + return false; + + return FLAC__bitwriter_write_raw_uint32_nocheck(bw, val, bits); +} + +inline FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t bits) { /* zero-out unused bits */ if(bits < 32) val &= (~(0xffffffff << bits)); - return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits); + return FLAC__bitwriter_write_raw_uint32_nocheck(bw, (FLAC__uint32)val, bits); } -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits) +inline FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, uint32_t bits) { /* this could be a little faster but it's not used for much */ if(bits > 32) { return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(val>>32), bits-32) && - FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 32); + FLAC__bitwriter_write_raw_uint32_nocheck(bw, (FLAC__uint32)val, 32); } else return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, bits); } -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val) +inline FLAC__bool FLAC__bitwriter_write_raw_int64(FLAC__BitWriter *bw, FLAC__int64 val, uint32_t bits) +{ + FLAC__uint64 uval = val; + /* zero-out unused bits */ + if(bits < 64) + uval &= (~(UINT64_MAX << bits)); + return FLAC__bitwriter_write_raw_uint64(bw, uval, bits); +} + +inline FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val) { /* this doesn't need to be that fast as currently it is only used for vorbis comments */ - if(!FLAC__bitwriter_write_raw_uint32(bw, val & 0xff, 8)) + if(!FLAC__bitwriter_write_raw_uint32_nocheck(bw, val & 0xff, 8)) return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, (val>>8) & 0xff, 8)) + if(!FLAC__bitwriter_write_raw_uint32_nocheck(bw, (val>>8) & 0xff, 8)) return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, (val>>16) & 0xff, 8)) + if(!FLAC__bitwriter_write_raw_uint32_nocheck(bw, (val>>16) & 0xff, 8)) return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, val>>24, 8)) + if(!FLAC__bitwriter_write_raw_uint32_nocheck(bw, val>>24, 8)) return false; return true; } -FLaC__INLINE FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals) +inline FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], uint32_t nvals) { - unsigned i; + uint32_t i; + + /* grow capacity upfront to prevent constant reallocation during writes */ + if(bw->capacity <= bw->words + nvals / (FLAC__BITS_PER_WORD / 8) + 1 && !bitwriter_grow_(bw, nvals * 8)) + return false; /* this could be faster but currently we don't need it to be since it's only used for writing metadata */ for(i = 0; i < nvals; i++) { - if(!FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)(vals[i]), 8)) + if(!FLAC__bitwriter_write_raw_uint32_nocheck(bw, (FLAC__uint32)(vals[i]), 8)) return false; } return true; } -FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val) +FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, uint32_t val) { if(val < 32) - return FLAC__bitwriter_write_raw_uint32(bw, 1, ++val); + return FLAC__bitwriter_write_raw_uint32_nocheck(bw, 1, ++val); else return FLAC__bitwriter_write_zeroes(bw, val) && - FLAC__bitwriter_write_raw_uint32(bw, 1, 1); + FLAC__bitwriter_write_raw_uint32_nocheck(bw, 1, 1); } -unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter) +#if 0 /* UNUSED */ +uint32_t FLAC__bitwriter_rice_bits(FLAC__int32 val, uint32_t parameter) { FLAC__uint32 uval; - FLAC__ASSERT(parameter < sizeof(unsigned)*8); + FLAC__ASSERT(parameter < 32); - /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */ - uval = (val<<1) ^ (val>>31); + /* fold signed to uint32_t; actual formula is: negative(v)? -2v-1 : 2v */ + uval = val; + uval <<= 1; + uval ^= (val>>31); return 1 + parameter + (uval >> parameter); } -#if 0 /* UNUSED */ -unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter) +uint32_t FLAC__bitwriter_golomb_bits_signed(int val, uint32_t parameter) { - unsigned bits, msbs, uval; - unsigned k; + uint32_t bits, msbs, uval; + uint32_t k; FLAC__ASSERT(parameter > 0); - /* fold signed to unsigned */ + /* fold signed to uint32_t */ if(val < 0) - uval = (unsigned)(((-(++val)) << 1) + 1); + uval = (uint32_t)(((-(++val)) << 1) + 1); else - uval = (unsigned)(val << 1); + uval = (uint32_t)(val << 1); k = FLAC__bitmath_ilog2(parameter); if(parameter == 1u<<k) { @@ -446,7 +469,7 @@ unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter) bits = 1 + k + msbs; } else { - unsigned q, r, d; + uint32_t q, r, d; d = (1 << (k+1)) - parameter; q = uval / parameter; @@ -459,10 +482,10 @@ unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter) return bits; } -unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned uval, unsigned parameter) +uint32_t FLAC__bitwriter_golomb_bits_unsigned(uint32_t uval, uint32_t parameter) { - unsigned bits, msbs; - unsigned k; + uint32_t bits, msbs; + uint32_t k; FLAC__ASSERT(parameter > 0); @@ -474,7 +497,7 @@ unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned uval, unsigned parameter) bits = 1 + k + msbs; } else { - unsigned q, r, d; + uint32_t q, r, d; d = (1 << (k+1)) - parameter; q = uval / parameter; @@ -486,19 +509,20 @@ unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned uval, unsigned parameter) } return bits; } -#endif /* UNUSED */ -FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter) +FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t parameter) { - unsigned total_bits, interesting_bits, msbs; + uint32_t total_bits, interesting_bits, msbs; FLAC__uint32 uval, pattern; FLAC__ASSERT(0 != bw); FLAC__ASSERT(0 != bw->buffer); - FLAC__ASSERT(parameter < 8*sizeof(uval)); + FLAC__ASSERT(parameter < 32); - /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */ - uval = (val<<1) ^ (val>>31); + /* fold signed to uint32_t; actual formula is: negative(v)? -2v-1 : 2v */ + uval = val; + uval <<= 1; + uval ^= (val>>31); msbs = uval >> parameter; interesting_bits = 1 + parameter; @@ -513,142 +537,190 @@ FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 va FLAC__bitwriter_write_zeroes(bw, msbs) && /* write the unary MSBs */ FLAC__bitwriter_write_raw_uint32(bw, pattern, interesting_bits); /* write the unary end bit and binary LSBs */ } +#endif /* UNUSED */ + +#if (ENABLE_64_BIT_WORDS == 0) -FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter) +#define WIDE_ACCUM_TO_BW { \ + bw->accum = wide_accum >> FLAC__HALF_TEMP_BITS; \ + bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); \ + wide_accum <<= FLAC__HALF_TEMP_BITS; \ + bitpointer += FLAC__HALF_TEMP_BITS; \ +} + +#else + +#define WIDE_ACCUM_TO_BW { \ + FLAC__ASSERT(bw->bits % FLAC__HALF_TEMP_BITS == 0); \ + if(bw->bits == 0) { \ + bw->accum = wide_accum >> FLAC__HALF_TEMP_BITS; \ + wide_accum <<= FLAC__HALF_TEMP_BITS; \ + bw->bits = FLAC__HALF_TEMP_BITS; \ + } \ + else { \ + bw->accum <<= FLAC__HALF_TEMP_BITS; \ + bw->accum += wide_accum >> FLAC__HALF_TEMP_BITS; \ + bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); \ + wide_accum <<= FLAC__HALF_TEMP_BITS; \ + bw->bits = 0; \ + } \ + bitpointer += FLAC__HALF_TEMP_BITS; \ +} + +#endif + +FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, uint32_t nvals, uint32_t parameter) { - const FLAC__uint32 mask1 = FLAC__WORD_ALL_ONES << parameter; /* we val|=mask1 to set the stop bit above it... */ - const FLAC__uint32 mask2 = FLAC__WORD_ALL_ONES >> (31-parameter); /* ...then mask off the bits above the stop bit with val&=mask2*/ + const FLAC__uint32 mask1 = (FLAC__uint32)0xffffffff << parameter; /* we val|=mask1 to set the stop bit above it... */ + const FLAC__uint32 mask2 = (FLAC__uint32)0xffffffff >> (31-parameter); /* ...then mask off the bits above the stop bit with val&=mask2 */ FLAC__uint32 uval; - unsigned left; - const unsigned lsbits = 1 + parameter; - unsigned msbits; + const uint32_t lsbits = 1 + parameter; + uint32_t msbits, total_bits; + FLAC__bwtemp wide_accum = 0; + FLAC__uint32 bitpointer = FLAC__TEMP_BITS; FLAC__ASSERT(0 != bw); FLAC__ASSERT(0 != bw->buffer); - FLAC__ASSERT(parameter < 8*sizeof(bwword)-1); + FLAC__ASSERT(parameter < 31); /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); +#if (ENABLE_64_BIT_WORDS == 0) + if(bw->bits > 0) { + bitpointer -= bw->bits; + wide_accum = (FLAC__bwtemp)(bw->accum) << bitpointer; + bw->bits = 0; + } +#else + if(bw->bits > 0 && bw->bits < FLAC__HALF_TEMP_BITS) { + bitpointer -= bw->bits; + wide_accum = bw->accum << bitpointer; + bw->bits = 0; + } + else if(bw->bits > FLAC__HALF_TEMP_BITS) { + bitpointer -= (bw->bits - FLAC__HALF_TEMP_BITS); + wide_accum = bw->accum << bitpointer; + bw->accum >>= (bw->bits - FLAC__HALF_TEMP_BITS); + bw->bits = FLAC__HALF_TEMP_BITS; + } +#endif + + /* Reserve one FLAC__TEMP_BITS per symbol, so checks for space are only necessary when very large symbols are encountered + * this might be considered wasteful, but is only at most 8kB more than necessary for a blocksize of 4096 */ + if(bw->capacity * FLAC__BITS_PER_WORD <= bw->words * FLAC__BITS_PER_WORD + nvals * FLAC__TEMP_BITS + bw->bits && !bitwriter_grow_(bw, nvals * FLAC__TEMP_BITS)) + return false; while(nvals) { - /* fold signed to unsigned; actual formula is: negative(v)? -2v-1 : 2v */ - uval = (*vals<<1) ^ (*vals>>31); + /* fold signed to uint32_t; actual formula is: negative(v)? -2v-1 : 2v */ + uval = *vals; + uval <<= 1; + uval ^= (*vals>>31); msbits = uval >> parameter; + total_bits = lsbits + msbits; -#if 0 /* OPT: can remove this special case if it doesn't make up for the extra compare (doesn't make a statistically significant difference with msvc or gcc/x86) */ - if(bw->bits && bw->bits + msbits + lsbits <= FLAC__BITS_PER_WORD) { /* i.e. if the whole thing fits in the current bwword */ - /* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */ - bw->bits = bw->bits + msbits + lsbits; - uval |= mask1; /* set stop bit */ - uval &= mask2; /* mask off unused top bits */ - /* NOT: bw->accum <<= msbits + lsbits because msbits+lsbits could be 32, then the shift would be a NOP */ - bw->accum <<= msbits; - bw->accum <<= lsbits; - bw->accum |= uval; - if(bw->bits == FLAC__BITS_PER_WORD) { - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); - bw->bits = 0; - /* burying the capacity check down here means we have to grow the buffer a little if there are more vals to do */ - if(bw->capacity <= bw->words && nvals > 1 && !bitwriter_grow_(bw, 1)) { - FLAC__ASSERT(bw->capacity == bw->words); - return false; - } + uval |= mask1; /* set stop bit */ + uval &= mask2; /* mask off unused top bits */ + + + if(total_bits <= bitpointer) { + /* There is room enough to store the symbol whole at once */ + wide_accum |= (FLAC__bwtemp)(uval) << (bitpointer - total_bits); + bitpointer -= total_bits; + if(bitpointer <= FLAC__HALF_TEMP_BITS) { + /* A word is finished, copy the upper 32 bits of the wide_accum */ + WIDE_ACCUM_TO_BW } } else { -#elif 1 /*@@@@@@ OPT: try this version with MSVC6 to see if better, not much difference for gcc-4 */ - if(bw->bits && bw->bits + msbits + lsbits < FLAC__BITS_PER_WORD) { /* i.e. if the whole thing fits in the current bwword */ - /* ^^^ if bw->bits is 0 then we may have filled the buffer and have no free bwword to work in */ - bw->bits = bw->bits + msbits + lsbits; - uval |= mask1; /* set stop bit */ - uval &= mask2; /* mask off unused top bits */ - bw->accum <<= msbits + lsbits; - bw->accum |= uval; - } - else { -#endif - /* slightly pessimistic size check but faster than "<= bw->words + (bw->bits+msbits+lsbits+FLAC__BITS_PER_WORD-1)/FLAC__BITS_PER_WORD" */ - /* OPT: pessimism may cause flurry of false calls to grow_ which eat up all savings before it */ - if(bw->capacity <= bw->words + bw->bits + msbits + 1/*lsbits always fit in 1 bwword*/ && !bitwriter_grow_(bw, msbits+lsbits)) - return false; - - if(msbits) { - /* first part gets to word alignment */ - if(bw->bits) { - left = FLAC__BITS_PER_WORD - bw->bits; - if(msbits < left) { - bw->accum <<= msbits; - bw->bits += msbits; - goto break1; - } - else { - bw->accum <<= left; - msbits -= left; - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); - bw->bits = 0; - } - } - /* do whole words */ - while(msbits >= FLAC__BITS_PER_WORD) { - bw->buffer[bw->words++] = 0; - msbits -= FLAC__BITS_PER_WORD; - } - /* do any leftovers */ - if(msbits > 0) { - bw->accum = 0; - bw->bits = msbits; - } + /* The symbol needs to be split. This code isn't used often */ + /* First check for space in the bitwriter */ + if(total_bits > FLAC__TEMP_BITS) { + FLAC__uint32 oversize_in_bits = total_bits - FLAC__TEMP_BITS; + FLAC__uint32 capacity_needed = bw->words * FLAC__BITS_PER_WORD + bw->bits + nvals * FLAC__TEMP_BITS + oversize_in_bits; + if(bw->capacity * FLAC__BITS_PER_WORD <= capacity_needed && !bitwriter_grow_(bw, nvals * FLAC__TEMP_BITS + oversize_in_bits)) + return false; } -break1: - uval |= mask1; /* set stop bit */ - uval &= mask2; /* mask off unused top bits */ - - left = FLAC__BITS_PER_WORD - bw->bits; - if(lsbits < left) { - bw->accum <<= lsbits; - bw->accum |= uval; - bw->bits += lsbits; + if(msbits > bitpointer) { + /* We have a lot of 0 bits to write, first align with bitwriter word */ + msbits -= bitpointer - FLAC__HALF_TEMP_BITS; + bitpointer = FLAC__HALF_TEMP_BITS; + WIDE_ACCUM_TO_BW + while(msbits > bitpointer) { + /* As the accumulator is already zero, we only need to + * assign zeroes to the bitbuffer */ + WIDE_ACCUM_TO_BW + bitpointer -= FLAC__HALF_TEMP_BITS; + msbits -= FLAC__HALF_TEMP_BITS; + } + /* The remaining bits are zero, and the accumulator already is zero, + * so just subtract the number of bits from bitpointer. When storing, + * we can also just store 0 */ + bitpointer -= msbits; + if(bitpointer <= FLAC__HALF_TEMP_BITS) + WIDE_ACCUM_TO_BW } else { - /* if bw->bits == 0, left==FLAC__BITS_PER_WORD which will always - * be > lsbits (because of previous assertions) so it would have - * triggered the (lsbits<left) case above. - */ - FLAC__ASSERT(bw->bits); - FLAC__ASSERT(left < FLAC__BITS_PER_WORD); - bw->accum <<= left; - bw->accum |= uval >> (bw->bits = lsbits - left); - bw->buffer[bw->words++] = SWAP_BE_WORD_TO_HOST(bw->accum); - bw->accum = uval; + bitpointer -= msbits; + if(bitpointer <= FLAC__HALF_TEMP_BITS) + WIDE_ACCUM_TO_BW } -#if 1 + /* The lsbs + stop bit always fit 32 bit, so this code mirrors the code above */ + wide_accum |= (FLAC__bwtemp)(uval) << (bitpointer - lsbits); + bitpointer -= lsbits; + if(bitpointer <= FLAC__HALF_TEMP_BITS) { + /* A word is finished, copy the upper 32 bits of the wide_accum */ + WIDE_ACCUM_TO_BW + } } -#endif vals++; nvals--; } + /* Now fixup remainder of wide_accum */ +#if (ENABLE_64_BIT_WORDS == 0) + if(bitpointer < FLAC__TEMP_BITS) { + bw->accum = wide_accum >> bitpointer; + bw->bits = FLAC__TEMP_BITS - bitpointer; + } +#else + if(bitpointer < FLAC__TEMP_BITS) { + if(bw->bits == 0) { + bw->accum = wide_accum >> bitpointer; + bw->bits = FLAC__TEMP_BITS - bitpointer; + } + else if (bw->bits == FLAC__HALF_TEMP_BITS) { + bw->accum <<= FLAC__TEMP_BITS - bitpointer; + bw->accum |= (wide_accum >> bitpointer); + bw->bits = FLAC__HALF_TEMP_BITS + FLAC__TEMP_BITS - bitpointer; + } + else { + FLAC__ASSERT(0); + } + } +#endif + + return true; } #if 0 /* UNUSED */ -FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter) +FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, uint32_t parameter) { - unsigned total_bits, msbs, uval; - unsigned k; + uint32_t total_bits, msbs, uval; + uint32_t k; FLAC__ASSERT(0 != bw); FLAC__ASSERT(0 != bw->buffer); FLAC__ASSERT(parameter > 0); - /* fold signed to unsigned */ + /* fold signed to uint32_t */ if(val < 0) - uval = (unsigned)(((-(++val)) << 1) + 1); + uval = (uint32_t)(((-(++val)) << 1) + 1); else - uval = (unsigned)(val << 1); + uval = (uint32_t)(val << 1); k = FLAC__bitmath_ilog2(parameter); if(parameter == 1u<<k) { - unsigned pattern; + uint32_t pattern; FLAC__ASSERT(k <= 30); @@ -671,7 +743,7 @@ FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, uns } } else { - unsigned q, r, d; + uint32_t q, r, d; d = (1 << (k+1)) - parameter; q = uval / parameter; @@ -695,10 +767,10 @@ FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, uns return true; } -FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned uval, unsigned parameter) +FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, uint32_t uval, uint32_t parameter) { - unsigned total_bits, msbs; - unsigned k; + uint32_t total_bits, msbs; + uint32_t k; FLAC__ASSERT(0 != bw); FLAC__ASSERT(0 != bw->buffer); @@ -706,7 +778,7 @@ FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned u k = FLAC__bitmath_ilog2(parameter); if(parameter == 1u<<k) { - unsigned pattern; + uint32_t pattern; FLAC__ASSERT(k <= 30); @@ -729,7 +801,7 @@ FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned u } } else { - unsigned q, r, d; + uint32_t q, r, d; d = (1 << (k+1)) - parameter; q = uval / parameter; @@ -761,40 +833,41 @@ FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 v FLAC__ASSERT(0 != bw); FLAC__ASSERT(0 != bw->buffer); - FLAC__ASSERT(!(val & 0x80000000)); /* this version only handles 31 bits */ + if((val & 0x80000000) != 0) /* this version only handles 31 bits */ + return false; if(val < 0x80) { - return FLAC__bitwriter_write_raw_uint32(bw, val, 8); + return FLAC__bitwriter_write_raw_uint32_nocheck(bw, val, 8); } else if(val < 0x800) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (val>>6), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xC0 | (val>>6), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (val&0x3F), 8); } else if(val < 0x10000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (val>>12), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xE0 | (val>>12), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>6)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (val&0x3F), 8); } else if(val < 0x200000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (val>>18), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xF0 | (val>>18), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>12)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>6)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (val&0x3F), 8); } else if(val < 0x4000000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (val>>24), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xF8 | (val>>24), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>18)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>12)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>6)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (val&0x3F), 8); } else { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (val>>30), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>24)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | ((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xFC | (val>>30), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>24)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>18)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>12)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | ((val>>6)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (val&0x3F), 8); } return ok; @@ -807,49 +880,50 @@ FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 v FLAC__ASSERT(0 != bw); FLAC__ASSERT(0 != bw->buffer); - FLAC__ASSERT(!(val & FLAC__U64L(0xFFFFFFF000000000))); /* this version only handles 36 bits */ + if((val & FLAC__U64L(0xFFFFFFF000000000)) != 0) /* this version only handles 36 bits */ + return false; if(val < 0x80) { - return FLAC__bitwriter_write_raw_uint32(bw, (FLAC__uint32)val, 8); + return FLAC__bitwriter_write_raw_uint32_nocheck(bw, (FLAC__uint32)val, 8); } else if(val < 0x800) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xC0 | (FLAC__uint32)(val>>6), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xC0 | (FLAC__uint32)(val>>6), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); } else if(val < 0x10000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xE0 | (FLAC__uint32)(val>>12), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xE0 | (FLAC__uint32)(val>>12), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); } else if(val < 0x200000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF0 | (FLAC__uint32)(val>>18), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xF0 | (FLAC__uint32)(val>>18), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); } else if(val < 0x4000000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xF8 | (FLAC__uint32)(val>>24), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xF8 | (FLAC__uint32)(val>>24), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); } else if(val < 0x80000000) { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFC | (FLAC__uint32)(val>>30), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xFC | (FLAC__uint32)(val>>30), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); } else { - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0xFE, 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>30)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); - ok &= FLAC__bitwriter_write_raw_uint32(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0xFE, 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>30)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>24)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>18)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>12)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)((val>>6)&0x3F), 8); + ok &= FLAC__bitwriter_write_raw_uint32_nocheck(bw, 0x80 | (FLAC__uint32)(val&0x3F), 8); } return ok; @@ -863,3 +937,19 @@ FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw) else return true; } + +/* These functions are declared inline in this file but are also callable as + * externs from elsewhere. + * According to the C99 spec, section 6.7.4, simply providing a function + * prototype in a header file without 'inline' and making the function inline + * in this file should be sufficient. + * Unfortunately, the Microsoft VS compiler doesn't pick them up externally. To + * fix that we add extern declarations here. + */ +extern FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, uint32_t bits); +extern FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, uint32_t bits); +extern FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t bits); +extern FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, uint32_t bits); +extern FLAC__bool FLAC__bitwriter_write_raw_int64(FLAC__BitWriter *bw, FLAC__int64 val, uint32_t bits); +extern FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val); +extern FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], uint32_t nvals); diff --git a/3rdparty/libflac/src/libFLAC/cpu.c b/3rdparty/libflac/src/libFLAC/cpu.c index e5ea78ea37c..d088e3c0b70 100644 --- a/3rdparty/libflac/src/libFLAC/cpu.c +++ b/3rdparty/libflac/src/libFLAC/cpu.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,389 +35,221 @@ #endif #include "private/cpu.h" +#include "share/compat.h" #include <stdlib.h> -#include <stdio.h> - -#if defined FLAC__CPU_IA32 -# include <signal.h> -#elif defined FLAC__CPU_PPC -# if !defined FLAC__NO_ASM -# if defined FLAC__SYS_DARWIN -# include <sys/sysctl.h> -# include <mach/mach.h> -# include <mach/mach_host.h> -# include <mach/host_info.h> -# include <mach/machine.h> -# ifndef CPU_SUBTYPE_POWERPC_970 -# define CPU_SUBTYPE_POWERPC_970 ((cpu_subtype_t) 100) -# endif -# else /* FLAC__SYS_DARWIN */ - -# include <signal.h> -# include <setjmp.h> - -static sigjmp_buf jmpbuf; -static volatile sig_atomic_t canjump = 0; - -static void sigill_handler (int sig) -{ - if (!canjump) { - signal (sig, SIG_DFL); - raise (sig); - } - canjump = 0; - siglongjmp (jmpbuf, 1); -} -# endif /* FLAC__SYS_DARWIN */ -# endif /* FLAC__NO_ASM */ -#endif /* FLAC__CPU_PPC */ +#include <string.h> -#if defined (__NetBSD__) || defined(__OpenBSD__) -#include <sys/param.h> -#include <sys/sysctl.h> -#include <machine/cpu.h> +#if defined _MSC_VER +#include <intrin.h> /* for __cpuid() and _xgetbv() */ +#elif defined __GNUC__ && defined HAVE_CPUID_H +#include <cpuid.h> /* for __get_cpuid() and __get_cpuid_max() */ #endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -#include <sys/types.h> -#include <sys/sysctl.h> +#ifndef NDEBUG +#include <stdio.h> +#define dfprintf fprintf +#else +/* This is bad practice, it should be a static void empty function */ +#define dfprintf(file, format, ...) #endif -#if defined(__APPLE__) -/* how to get sysctlbyname()? */ +#if defined(HAVE_SYS_AUXV_H) +#include <sys/auxv.h> #endif -#if defined(FLAC__CPU_IA32) && !defined(FLAC__NO_ASM) && defined (FLAC__HAS_NASM) +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN && !defined FLAC__NO_ASM + /* these are flags in EDX of CPUID AX=00000001 */ -static const unsigned FLAC__CPUINFO_IA32_CPUID_CMOV = 0x00008000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_MMX = 0x00800000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_FXSR = 0x01000000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE = 0x02000000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE2 = 0x04000000; +static const uint32_t FLAC__CPUINFO_X86_CPUID_CMOV = 0x00008000; +static const uint32_t FLAC__CPUINFO_X86_CPUID_MMX = 0x00800000; +static const uint32_t FLAC__CPUINFO_X86_CPUID_SSE = 0x02000000; +static const uint32_t FLAC__CPUINFO_X86_CPUID_SSE2 = 0x04000000; + /* these are flags in ECX of CPUID AX=00000001 */ -static const unsigned FLAC__CPUINFO_IA32_CPUID_SSE3 = 0x00000001; -static const unsigned FLAC__CPUINFO_IA32_CPUID_SSSE3 = 0x00000200; -#ifdef FLAC__USE_3DNOW -/* these are flags in EDX of CPUID AX=80000001 */ -static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW = 0x80000000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW = 0x40000000; -static const unsigned FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX = 0x00400000; -#endif +static const uint32_t FLAC__CPUINFO_X86_CPUID_SSE3 = 0x00000001; +static const uint32_t FLAC__CPUINFO_X86_CPUID_SSSE3 = 0x00000200; +static const uint32_t FLAC__CPUINFO_X86_CPUID_SSE41 = 0x00080000; +static const uint32_t FLAC__CPUINFO_X86_CPUID_SSE42 = 0x00100000; +static const uint32_t FLAC__CPUINFO_X86_CPUID_OSXSAVE = 0x08000000; +static const uint32_t FLAC__CPUINFO_X86_CPUID_AVX = 0x10000000; +static const uint32_t FLAC__CPUINFO_X86_CPUID_FMA = 0x00001000; + +/* these are flags in EBX of CPUID AX=00000007 */ +static const uint32_t FLAC__CPUINFO_X86_CPUID_AVX2 = 0x00000020; +static const uint32_t FLAC__CPUINFO_X86_CPUID_BMI2 = 0x00000100; + +static uint32_t +cpu_xgetbv_x86(void) +{ +#if (defined _MSC_VER || defined __INTEL_COMPILER) && FLAC__AVX_SUPPORTED + return (uint32_t)_xgetbv(0); +#elif defined __GNUC__ + uint32_t lo, hi; + __asm__ volatile (".byte 0x0f, 0x01, 0xd0" : "=a"(lo), "=d"(hi) : "c" (0)); + return lo; +#else + return 0; #endif +} - -/* - * Extra stuff needed for detection of OS support for SSE on IA-32 - */ -#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM && !defined FLAC__NO_SSE_OS && !defined FLAC__SSE_OS -# if defined(__linux__) -/* - * If the OS doesn't support SSE, we will get here with a SIGILL. We - * modify the return address to jump over the offending SSE instruction - * and also the operation following it that indicates the instruction - * executed successfully. In this way we use no global variables and - * stay thread-safe. - * - * 3 + 3 + 6: - * 3 bytes for "xorps xmm0,xmm0" - * 3 bytes for estimate of how long the follwing "inc var" instruction is - * 6 bytes extra in case our estimate is wrong - * 12 bytes puts us in the NOP "landing zone" - */ -# undef USE_OBSOLETE_SIGCONTEXT_FLAVOR /* #define this to use the older signal handler method */ -# ifdef USE_OBSOLETE_SIGCONTEXT_FLAVOR - static void sigill_handler_sse_os(int signal, struct sigcontext sc) - { - (void)signal; - sc.eip += 3 + 3 + 6; - } -# else -# include <sys/ucontext.h> - static void sigill_handler_sse_os(int signal, siginfo_t *si, void *uc) - { - (void)signal, (void)si; - ((ucontext_t*)uc)->uc_mcontext.gregs[14/*REG_EIP*/] += 3 + 3 + 6; - } -# endif -# elif defined(_MSC_VER) -# include <windows.h> -# undef USE_TRY_CATCH_FLAVOR /* #define this to use the try/catch method for catching illegal opcode exception */ -# ifdef USE_TRY_CATCH_FLAVOR -# else - LONG CALLBACK sigill_handler_sse_os(EXCEPTION_POINTERS *ep) - { - if(ep->ExceptionRecord->ExceptionCode == EXCEPTION_ILLEGAL_INSTRUCTION) { - ep->ContextRecord->Eip += 3 + 3 + 6; - return EXCEPTION_CONTINUE_EXECUTION; - } - return EXCEPTION_CONTINUE_SEARCH; +static uint32_t +cpu_have_cpuid(void) +{ +#if defined FLAC__CPU_X86_64 || defined __i686__ || defined __SSE__ || (defined _M_IX86_FP && _M_IX86_FP > 0) + /* target CPU does have CPUID instruction */ + return 1; +#elif defined __GNUC__ && defined HAVE_CPUID_H + if (__get_cpuid_max(0, 0) != 0) + return 1; + else + return 0; +#elif defined _MSC_VER + FLAC__uint32 flags1, flags2; + __asm { + pushfd + pushfd + pop eax + mov flags1, eax + xor eax, 0x200000 + push eax + popfd + pushfd + pop eax + mov flags2, eax + popfd } -# endif -# endif + if (((flags1^flags2) & 0x200000) != 0) + return 1; + else + return 0; +#else + return 0; #endif +} - -void FLAC__cpu_info(FLAC__CPUInfo *info) +static void +cpuinfo_x86(FLAC__uint32 level, FLAC__uint32 *eax, FLAC__uint32 *ebx, FLAC__uint32 *ecx, FLAC__uint32 *edx) { -/* - * IA32-specific - */ -#ifdef FLAC__CPU_IA32 - info->type = FLAC__CPUINFO_TYPE_IA32; -#if !defined FLAC__NO_ASM && defined FLAC__HAS_NASM - info->use_asm = true; /* we assume a minimum of 80386 with FLAC__CPU_IA32 */ - info->data.ia32.cpuid = FLAC__cpu_have_cpuid_asm_ia32()? true : false; - info->data.ia32.bswap = info->data.ia32.cpuid; /* CPUID => BSWAP since it came after */ - info->data.ia32.cmov = false; - info->data.ia32.mmx = false; - info->data.ia32.fxsr = false; - info->data.ia32.sse = false; - info->data.ia32.sse2 = false; - info->data.ia32.sse3 = false; - info->data.ia32.ssse3 = false; - info->data.ia32._3dnow = false; - info->data.ia32.ext3dnow = false; - info->data.ia32.extmmx = false; - if(info->data.ia32.cpuid) { - /* http://www.sandpile.org/ia32/cpuid.htm */ - FLAC__uint32 flags_edx, flags_ecx; - FLAC__cpu_info_asm_ia32(&flags_edx, &flags_ecx); - info->data.ia32.cmov = (flags_edx & FLAC__CPUINFO_IA32_CPUID_CMOV )? true : false; - info->data.ia32.mmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_MMX )? true : false; - info->data.ia32.fxsr = (flags_edx & FLAC__CPUINFO_IA32_CPUID_FXSR )? true : false; - info->data.ia32.sse = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE )? true : false; - info->data.ia32.sse2 = (flags_edx & FLAC__CPUINFO_IA32_CPUID_SSE2 )? true : false; - info->data.ia32.sse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSE3 )? true : false; - info->data.ia32.ssse3 = (flags_ecx & FLAC__CPUINFO_IA32_CPUID_SSSE3)? true : false; - -#ifdef FLAC__USE_3DNOW - flags_edx = FLAC__cpu_info_extended_amd_asm_ia32(); - info->data.ia32._3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_3DNOW )? true : false; - info->data.ia32.ext3dnow = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXT3DNOW)? true : false; - info->data.ia32.extmmx = (flags_edx & FLAC__CPUINFO_IA32_CPUID_EXTENDED_AMD_EXTMMX )? true : false; +#if defined _MSC_VER + int cpuinfo[4]; + int ext = level & 0x80000000; + __cpuid(cpuinfo, ext); + if ((uint32_t)cpuinfo[0] >= level) { +#if FLAC__AVX_SUPPORTED + __cpuidex(cpuinfo, level, 0); /* for AVX2 detection */ #else - info->data.ia32._3dnow = info->data.ia32.ext3dnow = info->data.ia32.extmmx = false; + __cpuid(cpuinfo, level); /* some old compilers don't support __cpuidex */ #endif - -#ifdef DEBUG - fprintf(stderr, "CPU info (IA-32):\n"); - fprintf(stderr, " CPUID ...... %c\n", info->data.ia32.cpuid ? 'Y' : 'n'); - fprintf(stderr, " BSWAP ...... %c\n", info->data.ia32.bswap ? 'Y' : 'n'); - fprintf(stderr, " CMOV ....... %c\n", info->data.ia32.cmov ? 'Y' : 'n'); - fprintf(stderr, " MMX ........ %c\n", info->data.ia32.mmx ? 'Y' : 'n'); - fprintf(stderr, " FXSR ....... %c\n", info->data.ia32.fxsr ? 'Y' : 'n'); - fprintf(stderr, " SSE ........ %c\n", info->data.ia32.sse ? 'Y' : 'n'); - fprintf(stderr, " SSE2 ....... %c\n", info->data.ia32.sse2 ? 'Y' : 'n'); - fprintf(stderr, " SSE3 ....... %c\n", info->data.ia32.sse3 ? 'Y' : 'n'); - fprintf(stderr, " SSSE3 ...... %c\n", info->data.ia32.ssse3 ? 'Y' : 'n'); - fprintf(stderr, " 3DNow! ..... %c\n", info->data.ia32._3dnow ? 'Y' : 'n'); - fprintf(stderr, " 3DNow!-ext . %c\n", info->data.ia32.ext3dnow? 'Y' : 'n'); - fprintf(stderr, " 3DNow!-MMX . %c\n", info->data.ia32.extmmx ? 'Y' : 'n'); + *eax = cpuinfo[0]; *ebx = cpuinfo[1]; *ecx = cpuinfo[2]; *edx = cpuinfo[3]; + return; + } +#elif defined __GNUC__ && defined HAVE_CPUID_H + FLAC__uint32 ext = level & 0x80000000; + __cpuid(ext, *eax, *ebx, *ecx, *edx); + if (*eax >= level) { + __cpuid_count(level, 0, *eax, *ebx, *ecx, *edx); + return; + } #endif + *eax = *ebx = *ecx = *edx = 0; +} - /* - * now have to check for OS support of SSE/SSE2 - */ - if(info->data.ia32.fxsr || info->data.ia32.sse || info->data.ia32.sse2) { -#if defined FLAC__NO_SSE_OS - /* assume user knows better than us; turn it off */ - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -#elif defined FLAC__SSE_OS - /* assume user knows better than us; leave as detected above */ -#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__APPLE__) - int sse = 0; - size_t len; - /* at least one of these must work: */ - len = sizeof(sse); sse = sse || (sysctlbyname("hw.instruction_sse", &sse, &len, NULL, 0) == 0 && sse); - len = sizeof(sse); sse = sse || (sysctlbyname("hw.optional.sse" , &sse, &len, NULL, 0) == 0 && sse); /* __APPLE__ ? */ - if(!sse) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -#elif defined(__NetBSD__) || defined (__OpenBSD__) -# if __NetBSD_Version__ >= 105250000 || (defined __OpenBSD__) - int val = 0, mib[2] = { CTL_MACHDEP, CPU_SSE }; - size_t len = sizeof(val); - if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; - else { /* double-check SSE2 */ - mib[1] = CPU_SSE2; - len = sizeof(val); - if(sysctl(mib, 2, &val, &len, NULL, 0) < 0 || !val) - info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; - } -# else - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -# endif -#elif defined(__linux__) - int sse = 0; - struct sigaction sigill_save; -#ifdef USE_OBSOLETE_SIGCONTEXT_FLAVOR - if(0 == sigaction(SIGILL, NULL, &sigill_save) && signal(SIGILL, (void (*)(int))sigill_handler_sse_os) != SIG_ERR) -#else - struct sigaction sigill_sse; - sigill_sse.sa_sigaction = sigill_handler_sse_os; - __sigemptyset(&sigill_sse.sa_mask); - sigill_sse.sa_flags = SA_SIGINFO | SA_RESETHAND; /* SA_RESETHAND just in case our SIGILL return jump breaks, so we don't get stuck in a loop */ - if(0 == sigaction(SIGILL, &sigill_sse, &sigill_save)) #endif - { - /* http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html */ - /* see sigill_handler_sse_os() for an explanation of the following: */ - asm volatile ( - "xorl %0,%0\n\t" /* for some reason, still need to do this to clear 'sse' var */ - "xorps %%xmm0,%%xmm0\n\t" /* will cause SIGILL if unsupported by OS */ - "incl %0\n\t" /* SIGILL handler will jump over this */ - /* landing zone */ - "nop\n\t" /* SIGILL jump lands here if "inc" is 9 bytes */ - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" - "nop\n\t" /* SIGILL jump lands here if "inc" is 3 bytes (expected) */ - "nop\n\t" - "nop" /* SIGILL jump lands here if "inc" is 1 byte */ - : "=r"(sse) - : "r"(sse) - ); - sigaction(SIGILL, &sigill_save, NULL); - } +static void +x86_cpu_info (FLAC__CPUInfo *info) +{ +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN && !defined FLAC__NO_ASM + FLAC__bool x86_osxsave = false; + FLAC__bool os_avx = false; + FLAC__uint32 flags_eax, flags_ebx, flags_ecx, flags_edx; + + info->use_asm = true; /* we assume a minimum of 80386 */ + if (!cpu_have_cpuid()) + return; + + cpuinfo_x86(0, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); + info->x86.intel = (flags_ebx == 0x756E6547 && flags_edx == 0x49656E69 && flags_ecx == 0x6C65746E) ? true : false; /* GenuineIntel */ + cpuinfo_x86(1, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); + + info->x86.cmov = (flags_edx & FLAC__CPUINFO_X86_CPUID_CMOV ) ? true : false; + info->x86.mmx = (flags_edx & FLAC__CPUINFO_X86_CPUID_MMX ) ? true : false; + info->x86.sse = (flags_edx & FLAC__CPUINFO_X86_CPUID_SSE ) ? true : false; + info->x86.sse2 = (flags_edx & FLAC__CPUINFO_X86_CPUID_SSE2 ) ? true : false; + info->x86.sse3 = (flags_ecx & FLAC__CPUINFO_X86_CPUID_SSE3 ) ? true : false; + info->x86.ssse3 = (flags_ecx & FLAC__CPUINFO_X86_CPUID_SSSE3) ? true : false; + info->x86.sse41 = (flags_ecx & FLAC__CPUINFO_X86_CPUID_SSE41) ? true : false; + info->x86.sse42 = (flags_ecx & FLAC__CPUINFO_X86_CPUID_SSE42) ? true : false; + + if (FLAC__AVX_SUPPORTED) { + x86_osxsave = (flags_ecx & FLAC__CPUINFO_X86_CPUID_OSXSAVE) ? true : false; + info->x86.avx = (flags_ecx & FLAC__CPUINFO_X86_CPUID_AVX ) ? true : false; + info->x86.fma = (flags_ecx & FLAC__CPUINFO_X86_CPUID_FMA ) ? true : false; + cpuinfo_x86(7, &flags_eax, &flags_ebx, &flags_ecx, &flags_edx); + info->x86.avx2 = (flags_ebx & FLAC__CPUINFO_X86_CPUID_AVX2 ) ? true : false; + info->x86.bmi2 = (flags_ebx & FLAC__CPUINFO_X86_CPUID_BMI2 ) ? true : false; + } - if(!sse) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -#elif defined(_MSC_VER) -# ifdef USE_TRY_CATCH_FLAVOR - _try { - __asm { -# if _MSC_VER <= 1200 - /* VC6 assembler doesn't know SSE, have to emit bytecode instead */ - _emit 0x0F - _emit 0x57 - _emit 0xC0 -# else - xorps xmm0,xmm0 -# endif - } - } - _except(EXCEPTION_EXECUTE_HANDLER) { - if (_exception_code() == STATUS_ILLEGAL_INSTRUCTION) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; - } -# else - int sse = 0; - LPTOP_LEVEL_EXCEPTION_FILTER save = SetUnhandledExceptionFilter(sigill_handler_sse_os); - /* see GCC version above for explanation */ - /* http://msdn2.microsoft.com/en-us/library/4ks26t93.aspx */ - /* http://www.codeproject.com/cpp/gccasm.asp */ - /* http://www.hick.org/~mmiller/msvc_inline_asm.html */ - __asm { -# if _MSC_VER <= 1200 - /* VC6 assembler doesn't know SSE, have to emit bytecode instead */ - _emit 0x0F - _emit 0x57 - _emit 0xC0 -# else - xorps xmm0,xmm0 -# endif - inc sse - nop - nop - nop - nop - nop - nop - nop - nop - nop - } - SetUnhandledExceptionFilter(save); - if(!sse) - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -# endif +#if defined FLAC__CPU_IA32 + dfprintf(stderr, "CPU info (IA-32):\n"); #else - /* no way to test, disable to be safe */ - info->data.ia32.fxsr = info->data.ia32.sse = info->data.ia32.sse2 = info->data.ia32.sse3 = info->data.ia32.ssse3 = false; -#endif -#ifdef DEBUG - fprintf(stderr, " SSE OS sup . %c\n", info->data.ia32.sse ? 'Y' : 'n'); + dfprintf(stderr, "CPU info (x86-64):\n"); #endif - - } + dfprintf(stderr, " CMOV ....... %c\n", info->x86.cmov ? 'Y' : 'n'); + dfprintf(stderr, " MMX ........ %c\n", info->x86.mmx ? 'Y' : 'n'); + dfprintf(stderr, " SSE ........ %c\n", info->x86.sse ? 'Y' : 'n'); + dfprintf(stderr, " SSE2 ....... %c\n", info->x86.sse2 ? 'Y' : 'n'); + dfprintf(stderr, " SSE3 ....... %c\n", info->x86.sse3 ? 'Y' : 'n'); + dfprintf(stderr, " SSSE3 ...... %c\n", info->x86.ssse3 ? 'Y' : 'n'); + dfprintf(stderr, " SSE41 ...... %c\n", info->x86.sse41 ? 'Y' : 'n'); + dfprintf(stderr, " SSE42 ...... %c\n", info->x86.sse42 ? 'Y' : 'n'); + + if (FLAC__AVX_SUPPORTED) { + dfprintf(stderr, " AVX ........ %c\n", info->x86.avx ? 'Y' : 'n'); + dfprintf(stderr, " FMA ........ %c\n", info->x86.fma ? 'Y' : 'n'); + dfprintf(stderr, " AVX2 ....... %c\n", info->x86.avx2 ? 'Y' : 'n'); + dfprintf(stderr, " BMI2 ....... %c\n", info->x86.bmi2 ? 'Y' : 'n'); } -#else - info->use_asm = false; -#endif -/* - * PPC-specific - */ -#elif defined FLAC__CPU_PPC - info->type = FLAC__CPUINFO_TYPE_PPC; -# if !defined FLAC__NO_ASM - info->use_asm = true; -# ifdef FLAC__USE_ALTIVEC -# if defined FLAC__SYS_DARWIN - { - int val = 0, mib[2] = { CTL_HW, HW_VECTORUNIT }; - size_t len = sizeof(val); - info->data.ppc.altivec = !(sysctl(mib, 2, &val, &len, NULL, 0) || !val); + /* + * now have to check for OS support of AVX instructions + */ + if (FLAC__AVX_SUPPORTED && info->x86.avx && x86_osxsave && (cpu_xgetbv_x86() & 0x6) == 0x6) { + os_avx = true; } - { - host_basic_info_data_t hostInfo; - mach_msg_type_number_t infoCount; - - infoCount = HOST_BASIC_INFO_COUNT; - host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)&hostInfo, &infoCount); - - info->data.ppc.ppc64 = (hostInfo.cpu_type == CPU_TYPE_POWERPC) && (hostInfo.cpu_subtype == CPU_SUBTYPE_POWERPC_970); + if (os_avx) { + dfprintf(stderr, " AVX OS sup . %c\n", info->x86.avx ? 'Y' : 'n'); } -# else /* FLAC__USE_ALTIVEC && !FLAC__SYS_DARWIN */ - { - /* no Darwin, do it the brute-force way */ - /* @@@@@@ this is not thread-safe; replace with SSE OS method above or remove */ - info->data.ppc.altivec = 0; - info->data.ppc.ppc64 = 0; - - signal (SIGILL, sigill_handler); - canjump = 0; - if (!sigsetjmp (jmpbuf, 1)) { - canjump = 1; - - asm volatile ( - "mtspr 256, %0\n\t" - "vand %%v0, %%v0, %%v0" - : - : "r" (-1) - ); - - info->data.ppc.altivec = 1; - } - canjump = 0; - if (!sigsetjmp (jmpbuf, 1)) { - int x = 0; - canjump = 1; - - /* PPC64 hardware implements the cntlzd instruction */ - asm volatile ("cntlzd %0, %1" : "=r" (x) : "r" (x) ); - - info->data.ppc.ppc64 = 1; - } - signal (SIGILL, SIG_DFL); /*@@@@@@ should save and restore old signal */ + if (!os_avx) { + /* no OS AVX support */ + info->x86.avx = false; + info->x86.avx2 = false; + info->x86.fma = false; } -# endif -# else /* !FLAC__USE_ALTIVEC */ - info->data.ppc.altivec = 0; - info->data.ppc.ppc64 = 0; -# endif -# else +#else info->use_asm = false; -# endif +#endif +} -/* - * unknown CPI - */ +void FLAC__cpu_info (FLAC__CPUInfo *info) +{ + memset(info, 0, sizeof(*info)); + +#ifdef FLAC__CPU_IA32 + info->type = FLAC__CPUINFO_TYPE_IA32; +#elif defined FLAC__CPU_X86_64 + info->type = FLAC__CPUINFO_TYPE_X86_64; #else info->type = FLAC__CPUINFO_TYPE_UNKNOWN; - info->use_asm = false; #endif + + switch (info->type) { + case FLAC__CPUINFO_TYPE_IA32: /* fallthrough */ + case FLAC__CPUINFO_TYPE_X86_64: + x86_cpu_info (info); + break; + default: + info->use_asm = false; + break; + } } diff --git a/3rdparty/libflac/src/libFLAC/crc.c b/3rdparty/libflac/src/libFLAC/crc.c index 52574f87c80..9e488e9bcd5 100644 --- a/3rdparty/libflac/src/libFLAC/crc.c +++ b/3rdparty/libflac/src/libFLAC/crc.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,7 +38,7 @@ /* CRC-8, poly = x^8 + x^2 + x^1 + x^0, init = 0 */ -FLAC__byte const FLAC__crc8_table[256] = { +FLAC__uint8 const FLAC__crc8_table[256] = { 0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, 0x38, 0x3F, 0x36, 0x31, 0x24, 0x23, 0x2A, 0x2D, 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, @@ -74,8 +75,8 @@ FLAC__byte const FLAC__crc8_table[256] = { /* CRC-16, poly = x^16 + x^15 + x^2 + x^0, init = 0 */ -unsigned FLAC__crc16_table[256] = { - 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, +FLAC__uint16 const FLAC__crc16_table[8][256] = { + { 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, @@ -106,22 +107,263 @@ unsigned FLAC__crc16_table[256] = { 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, - 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 -}; + 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202 }, + { 0x0000, 0x8603, 0x8c03, 0x0a00, 0x9803, 0x1e00, 0x1400, 0x9203, + 0xb003, 0x3600, 0x3c00, 0xba03, 0x2800, 0xae03, 0xa403, 0x2200, + 0xe003, 0x6600, 0x6c00, 0xea03, 0x7800, 0xfe03, 0xf403, 0x7200, + 0x5000, 0xd603, 0xdc03, 0x5a00, 0xc803, 0x4e00, 0x4400, 0xc203, + 0x4003, 0xc600, 0xcc00, 0x4a03, 0xd800, 0x5e03, 0x5403, 0xd200, + 0xf000, 0x7603, 0x7c03, 0xfa00, 0x6803, 0xee00, 0xe400, 0x6203, + 0xa000, 0x2603, 0x2c03, 0xaa00, 0x3803, 0xbe00, 0xb400, 0x3203, + 0x1003, 0x9600, 0x9c00, 0x1a03, 0x8800, 0x0e03, 0x0403, 0x8200, + 0x8006, 0x0605, 0x0c05, 0x8a06, 0x1805, 0x9e06, 0x9406, 0x1205, + 0x3005, 0xb606, 0xbc06, 0x3a05, 0xa806, 0x2e05, 0x2405, 0xa206, + 0x6005, 0xe606, 0xec06, 0x6a05, 0xf806, 0x7e05, 0x7405, 0xf206, + 0xd006, 0x5605, 0x5c05, 0xda06, 0x4805, 0xce06, 0xc406, 0x4205, + 0xc005, 0x4606, 0x4c06, 0xca05, 0x5806, 0xde05, 0xd405, 0x5206, + 0x7006, 0xf605, 0xfc05, 0x7a06, 0xe805, 0x6e06, 0x6406, 0xe205, + 0x2006, 0xa605, 0xac05, 0x2a06, 0xb805, 0x3e06, 0x3406, 0xb205, + 0x9005, 0x1606, 0x1c06, 0x9a05, 0x0806, 0x8e05, 0x8405, 0x0206, + 0x8009, 0x060a, 0x0c0a, 0x8a09, 0x180a, 0x9e09, 0x9409, 0x120a, + 0x300a, 0xb609, 0xbc09, 0x3a0a, 0xa809, 0x2e0a, 0x240a, 0xa209, + 0x600a, 0xe609, 0xec09, 0x6a0a, 0xf809, 0x7e0a, 0x740a, 0xf209, + 0xd009, 0x560a, 0x5c0a, 0xda09, 0x480a, 0xce09, 0xc409, 0x420a, + 0xc00a, 0x4609, 0x4c09, 0xca0a, 0x5809, 0xde0a, 0xd40a, 0x5209, + 0x7009, 0xf60a, 0xfc0a, 0x7a09, 0xe80a, 0x6e09, 0x6409, 0xe20a, + 0x2009, 0xa60a, 0xac0a, 0x2a09, 0xb80a, 0x3e09, 0x3409, 0xb20a, + 0x900a, 0x1609, 0x1c09, 0x9a0a, 0x0809, 0x8e0a, 0x840a, 0x0209, + 0x000f, 0x860c, 0x8c0c, 0x0a0f, 0x980c, 0x1e0f, 0x140f, 0x920c, + 0xb00c, 0x360f, 0x3c0f, 0xba0c, 0x280f, 0xae0c, 0xa40c, 0x220f, + 0xe00c, 0x660f, 0x6c0f, 0xea0c, 0x780f, 0xfe0c, 0xf40c, 0x720f, + 0x500f, 0xd60c, 0xdc0c, 0x5a0f, 0xc80c, 0x4e0f, 0x440f, 0xc20c, + 0x400c, 0xc60f, 0xcc0f, 0x4a0c, 0xd80f, 0x5e0c, 0x540c, 0xd20f, + 0xf00f, 0x760c, 0x7c0c, 0xfa0f, 0x680c, 0xee0f, 0xe40f, 0x620c, + 0xa00f, 0x260c, 0x2c0c, 0xaa0f, 0x380c, 0xbe0f, 0xb40f, 0x320c, + 0x100c, 0x960f, 0x9c0f, 0x1a0c, 0x880f, 0x0e0c, 0x040c, 0x820f }, -void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc) -{ - *crc = FLAC__crc8_table[*crc ^ data]; -} + { 0x0000, 0x8017, 0x802b, 0x003c, 0x8053, 0x0044, 0x0078, 0x806f, + 0x80a3, 0x00b4, 0x0088, 0x809f, 0x00f0, 0x80e7, 0x80db, 0x00cc, + 0x8143, 0x0154, 0x0168, 0x817f, 0x0110, 0x8107, 0x813b, 0x012c, + 0x01e0, 0x81f7, 0x81cb, 0x01dc, 0x81b3, 0x01a4, 0x0198, 0x818f, + 0x8283, 0x0294, 0x02a8, 0x82bf, 0x02d0, 0x82c7, 0x82fb, 0x02ec, + 0x0220, 0x8237, 0x820b, 0x021c, 0x8273, 0x0264, 0x0258, 0x824f, + 0x03c0, 0x83d7, 0x83eb, 0x03fc, 0x8393, 0x0384, 0x03b8, 0x83af, + 0x8363, 0x0374, 0x0348, 0x835f, 0x0330, 0x8327, 0x831b, 0x030c, + 0x8503, 0x0514, 0x0528, 0x853f, 0x0550, 0x8547, 0x857b, 0x056c, + 0x05a0, 0x85b7, 0x858b, 0x059c, 0x85f3, 0x05e4, 0x05d8, 0x85cf, + 0x0440, 0x8457, 0x846b, 0x047c, 0x8413, 0x0404, 0x0438, 0x842f, + 0x84e3, 0x04f4, 0x04c8, 0x84df, 0x04b0, 0x84a7, 0x849b, 0x048c, + 0x0780, 0x8797, 0x87ab, 0x07bc, 0x87d3, 0x07c4, 0x07f8, 0x87ef, + 0x8723, 0x0734, 0x0708, 0x871f, 0x0770, 0x8767, 0x875b, 0x074c, + 0x86c3, 0x06d4, 0x06e8, 0x86ff, 0x0690, 0x8687, 0x86bb, 0x06ac, + 0x0660, 0x8677, 0x864b, 0x065c, 0x8633, 0x0624, 0x0618, 0x860f, + 0x8a03, 0x0a14, 0x0a28, 0x8a3f, 0x0a50, 0x8a47, 0x8a7b, 0x0a6c, + 0x0aa0, 0x8ab7, 0x8a8b, 0x0a9c, 0x8af3, 0x0ae4, 0x0ad8, 0x8acf, + 0x0b40, 0x8b57, 0x8b6b, 0x0b7c, 0x8b13, 0x0b04, 0x0b38, 0x8b2f, + 0x8be3, 0x0bf4, 0x0bc8, 0x8bdf, 0x0bb0, 0x8ba7, 0x8b9b, 0x0b8c, + 0x0880, 0x8897, 0x88ab, 0x08bc, 0x88d3, 0x08c4, 0x08f8, 0x88ef, + 0x8823, 0x0834, 0x0808, 0x881f, 0x0870, 0x8867, 0x885b, 0x084c, + 0x89c3, 0x09d4, 0x09e8, 0x89ff, 0x0990, 0x8987, 0x89bb, 0x09ac, + 0x0960, 0x8977, 0x894b, 0x095c, 0x8933, 0x0924, 0x0918, 0x890f, + 0x0f00, 0x8f17, 0x8f2b, 0x0f3c, 0x8f53, 0x0f44, 0x0f78, 0x8f6f, + 0x8fa3, 0x0fb4, 0x0f88, 0x8f9f, 0x0ff0, 0x8fe7, 0x8fdb, 0x0fcc, + 0x8e43, 0x0e54, 0x0e68, 0x8e7f, 0x0e10, 0x8e07, 0x8e3b, 0x0e2c, + 0x0ee0, 0x8ef7, 0x8ecb, 0x0edc, 0x8eb3, 0x0ea4, 0x0e98, 0x8e8f, + 0x8d83, 0x0d94, 0x0da8, 0x8dbf, 0x0dd0, 0x8dc7, 0x8dfb, 0x0dec, + 0x0d20, 0x8d37, 0x8d0b, 0x0d1c, 0x8d73, 0x0d64, 0x0d58, 0x8d4f, + 0x0cc0, 0x8cd7, 0x8ceb, 0x0cfc, 0x8c93, 0x0c84, 0x0cb8, 0x8caf, + 0x8c63, 0x0c74, 0x0c48, 0x8c5f, 0x0c30, 0x8c27, 0x8c1b, 0x0c0c }, + + { 0x0000, 0x9403, 0xa803, 0x3c00, 0xd003, 0x4400, 0x7800, 0xec03, + 0x2003, 0xb400, 0x8800, 0x1c03, 0xf000, 0x6403, 0x5803, 0xcc00, + 0x4006, 0xd405, 0xe805, 0x7c06, 0x9005, 0x0406, 0x3806, 0xac05, + 0x6005, 0xf406, 0xc806, 0x5c05, 0xb006, 0x2405, 0x1805, 0x8c06, + 0x800c, 0x140f, 0x280f, 0xbc0c, 0x500f, 0xc40c, 0xf80c, 0x6c0f, + 0xa00f, 0x340c, 0x080c, 0x9c0f, 0x700c, 0xe40f, 0xd80f, 0x4c0c, + 0xc00a, 0x5409, 0x6809, 0xfc0a, 0x1009, 0x840a, 0xb80a, 0x2c09, + 0xe009, 0x740a, 0x480a, 0xdc09, 0x300a, 0xa409, 0x9809, 0x0c0a, + 0x801d, 0x141e, 0x281e, 0xbc1d, 0x501e, 0xc41d, 0xf81d, 0x6c1e, + 0xa01e, 0x341d, 0x081d, 0x9c1e, 0x701d, 0xe41e, 0xd81e, 0x4c1d, + 0xc01b, 0x5418, 0x6818, 0xfc1b, 0x1018, 0x841b, 0xb81b, 0x2c18, + 0xe018, 0x741b, 0x481b, 0xdc18, 0x301b, 0xa418, 0x9818, 0x0c1b, + 0x0011, 0x9412, 0xa812, 0x3c11, 0xd012, 0x4411, 0x7811, 0xec12, + 0x2012, 0xb411, 0x8811, 0x1c12, 0xf011, 0x6412, 0x5812, 0xcc11, + 0x4017, 0xd414, 0xe814, 0x7c17, 0x9014, 0x0417, 0x3817, 0xac14, + 0x6014, 0xf417, 0xc817, 0x5c14, 0xb017, 0x2414, 0x1814, 0x8c17, + 0x803f, 0x143c, 0x283c, 0xbc3f, 0x503c, 0xc43f, 0xf83f, 0x6c3c, + 0xa03c, 0x343f, 0x083f, 0x9c3c, 0x703f, 0xe43c, 0xd83c, 0x4c3f, + 0xc039, 0x543a, 0x683a, 0xfc39, 0x103a, 0x8439, 0xb839, 0x2c3a, + 0xe03a, 0x7439, 0x4839, 0xdc3a, 0x3039, 0xa43a, 0x983a, 0x0c39, + 0x0033, 0x9430, 0xa830, 0x3c33, 0xd030, 0x4433, 0x7833, 0xec30, + 0x2030, 0xb433, 0x8833, 0x1c30, 0xf033, 0x6430, 0x5830, 0xcc33, + 0x4035, 0xd436, 0xe836, 0x7c35, 0x9036, 0x0435, 0x3835, 0xac36, + 0x6036, 0xf435, 0xc835, 0x5c36, 0xb035, 0x2436, 0x1836, 0x8c35, + 0x0022, 0x9421, 0xa821, 0x3c22, 0xd021, 0x4422, 0x7822, 0xec21, + 0x2021, 0xb422, 0x8822, 0x1c21, 0xf022, 0x6421, 0x5821, 0xcc22, + 0x4024, 0xd427, 0xe827, 0x7c24, 0x9027, 0x0424, 0x3824, 0xac27, + 0x6027, 0xf424, 0xc824, 0x5c27, 0xb024, 0x2427, 0x1827, 0x8c24, + 0x802e, 0x142d, 0x282d, 0xbc2e, 0x502d, 0xc42e, 0xf82e, 0x6c2d, + 0xa02d, 0x342e, 0x082e, 0x9c2d, 0x702e, 0xe42d, 0xd82d, 0x4c2e, + 0xc028, 0x542b, 0x682b, 0xfc28, 0x102b, 0x8428, 0xb828, 0x2c2b, + 0xe02b, 0x7428, 0x4828, 0xdc2b, 0x3028, 0xa42b, 0x982b, 0x0c28 }, + + { 0x0000, 0x807b, 0x80f3, 0x0088, 0x81e3, 0x0198, 0x0110, 0x816b, + 0x83c3, 0x03b8, 0x0330, 0x834b, 0x0220, 0x825b, 0x82d3, 0x02a8, + 0x8783, 0x07f8, 0x0770, 0x870b, 0x0660, 0x861b, 0x8693, 0x06e8, + 0x0440, 0x843b, 0x84b3, 0x04c8, 0x85a3, 0x05d8, 0x0550, 0x852b, + 0x8f03, 0x0f78, 0x0ff0, 0x8f8b, 0x0ee0, 0x8e9b, 0x8e13, 0x0e68, + 0x0cc0, 0x8cbb, 0x8c33, 0x0c48, 0x8d23, 0x0d58, 0x0dd0, 0x8dab, + 0x0880, 0x88fb, 0x8873, 0x0808, 0x8963, 0x0918, 0x0990, 0x89eb, + 0x8b43, 0x0b38, 0x0bb0, 0x8bcb, 0x0aa0, 0x8adb, 0x8a53, 0x0a28, + 0x9e03, 0x1e78, 0x1ef0, 0x9e8b, 0x1fe0, 0x9f9b, 0x9f13, 0x1f68, + 0x1dc0, 0x9dbb, 0x9d33, 0x1d48, 0x9c23, 0x1c58, 0x1cd0, 0x9cab, + 0x1980, 0x99fb, 0x9973, 0x1908, 0x9863, 0x1818, 0x1890, 0x98eb, + 0x9a43, 0x1a38, 0x1ab0, 0x9acb, 0x1ba0, 0x9bdb, 0x9b53, 0x1b28, + 0x1100, 0x917b, 0x91f3, 0x1188, 0x90e3, 0x1098, 0x1010, 0x906b, + 0x92c3, 0x12b8, 0x1230, 0x924b, 0x1320, 0x935b, 0x93d3, 0x13a8, + 0x9683, 0x16f8, 0x1670, 0x960b, 0x1760, 0x971b, 0x9793, 0x17e8, + 0x1540, 0x953b, 0x95b3, 0x15c8, 0x94a3, 0x14d8, 0x1450, 0x942b, + 0xbc03, 0x3c78, 0x3cf0, 0xbc8b, 0x3de0, 0xbd9b, 0xbd13, 0x3d68, + 0x3fc0, 0xbfbb, 0xbf33, 0x3f48, 0xbe23, 0x3e58, 0x3ed0, 0xbeab, + 0x3b80, 0xbbfb, 0xbb73, 0x3b08, 0xba63, 0x3a18, 0x3a90, 0xbaeb, + 0xb843, 0x3838, 0x38b0, 0xb8cb, 0x39a0, 0xb9db, 0xb953, 0x3928, + 0x3300, 0xb37b, 0xb3f3, 0x3388, 0xb2e3, 0x3298, 0x3210, 0xb26b, + 0xb0c3, 0x30b8, 0x3030, 0xb04b, 0x3120, 0xb15b, 0xb1d3, 0x31a8, + 0xb483, 0x34f8, 0x3470, 0xb40b, 0x3560, 0xb51b, 0xb593, 0x35e8, + 0x3740, 0xb73b, 0xb7b3, 0x37c8, 0xb6a3, 0x36d8, 0x3650, 0xb62b, + 0x2200, 0xa27b, 0xa2f3, 0x2288, 0xa3e3, 0x2398, 0x2310, 0xa36b, + 0xa1c3, 0x21b8, 0x2130, 0xa14b, 0x2020, 0xa05b, 0xa0d3, 0x20a8, + 0xa583, 0x25f8, 0x2570, 0xa50b, 0x2460, 0xa41b, 0xa493, 0x24e8, + 0x2640, 0xa63b, 0xa6b3, 0x26c8, 0xa7a3, 0x27d8, 0x2750, 0xa72b, + 0xad03, 0x2d78, 0x2df0, 0xad8b, 0x2ce0, 0xac9b, 0xac13, 0x2c68, + 0x2ec0, 0xaebb, 0xae33, 0x2e48, 0xaf23, 0x2f58, 0x2fd0, 0xafab, + 0x2a80, 0xaafb, 0xaa73, 0x2a08, 0xab63, 0x2b18, 0x2b90, 0xabeb, + 0xa943, 0x2938, 0x29b0, 0xa9cb, 0x28a0, 0xa8db, 0xa853, 0x2828 }, + + { 0x0000, 0xf803, 0x7003, 0x8800, 0xe006, 0x1805, 0x9005, 0x6806, + 0x4009, 0xb80a, 0x300a, 0xc809, 0xa00f, 0x580c, 0xd00c, 0x280f, + 0x8012, 0x7811, 0xf011, 0x0812, 0x6014, 0x9817, 0x1017, 0xe814, + 0xc01b, 0x3818, 0xb018, 0x481b, 0x201d, 0xd81e, 0x501e, 0xa81d, + 0x8021, 0x7822, 0xf022, 0x0821, 0x6027, 0x9824, 0x1024, 0xe827, + 0xc028, 0x382b, 0xb02b, 0x4828, 0x202e, 0xd82d, 0x502d, 0xa82e, + 0x0033, 0xf830, 0x7030, 0x8833, 0xe035, 0x1836, 0x9036, 0x6835, + 0x403a, 0xb839, 0x3039, 0xc83a, 0xa03c, 0x583f, 0xd03f, 0x283c, + 0x8047, 0x7844, 0xf044, 0x0847, 0x6041, 0x9842, 0x1042, 0xe841, + 0xc04e, 0x384d, 0xb04d, 0x484e, 0x2048, 0xd84b, 0x504b, 0xa848, + 0x0055, 0xf856, 0x7056, 0x8855, 0xe053, 0x1850, 0x9050, 0x6853, + 0x405c, 0xb85f, 0x305f, 0xc85c, 0xa05a, 0x5859, 0xd059, 0x285a, + 0x0066, 0xf865, 0x7065, 0x8866, 0xe060, 0x1863, 0x9063, 0x6860, + 0x406f, 0xb86c, 0x306c, 0xc86f, 0xa069, 0x586a, 0xd06a, 0x2869, + 0x8074, 0x7877, 0xf077, 0x0874, 0x6072, 0x9871, 0x1071, 0xe872, + 0xc07d, 0x387e, 0xb07e, 0x487d, 0x207b, 0xd878, 0x5078, 0xa87b, + 0x808b, 0x7888, 0xf088, 0x088b, 0x608d, 0x988e, 0x108e, 0xe88d, + 0xc082, 0x3881, 0xb081, 0x4882, 0x2084, 0xd887, 0x5087, 0xa884, + 0x0099, 0xf89a, 0x709a, 0x8899, 0xe09f, 0x189c, 0x909c, 0x689f, + 0x4090, 0xb893, 0x3093, 0xc890, 0xa096, 0x5895, 0xd095, 0x2896, + 0x00aa, 0xf8a9, 0x70a9, 0x88aa, 0xe0ac, 0x18af, 0x90af, 0x68ac, + 0x40a3, 0xb8a0, 0x30a0, 0xc8a3, 0xa0a5, 0x58a6, 0xd0a6, 0x28a5, + 0x80b8, 0x78bb, 0xf0bb, 0x08b8, 0x60be, 0x98bd, 0x10bd, 0xe8be, + 0xc0b1, 0x38b2, 0xb0b2, 0x48b1, 0x20b7, 0xd8b4, 0x50b4, 0xa8b7, + 0x00cc, 0xf8cf, 0x70cf, 0x88cc, 0xe0ca, 0x18c9, 0x90c9, 0x68ca, + 0x40c5, 0xb8c6, 0x30c6, 0xc8c5, 0xa0c3, 0x58c0, 0xd0c0, 0x28c3, + 0x80de, 0x78dd, 0xf0dd, 0x08de, 0x60d8, 0x98db, 0x10db, 0xe8d8, + 0xc0d7, 0x38d4, 0xb0d4, 0x48d7, 0x20d1, 0xd8d2, 0x50d2, 0xa8d1, + 0x80ed, 0x78ee, 0xf0ee, 0x08ed, 0x60eb, 0x98e8, 0x10e8, 0xe8eb, + 0xc0e4, 0x38e7, 0xb0e7, 0x48e4, 0x20e2, 0xd8e1, 0x50e1, 0xa8e2, + 0x00ff, 0xf8fc, 0x70fc, 0x88ff, 0xe0f9, 0x18fa, 0x90fa, 0x68f9, + 0x40f6, 0xb8f5, 0x30f5, 0xc8f6, 0xa0f0, 0x58f3, 0xd0f3, 0x28f0 }, + + { 0x0000, 0x8113, 0x8223, 0x0330, 0x8443, 0x0550, 0x0660, 0x8773, + 0x8883, 0x0990, 0x0aa0, 0x8bb3, 0x0cc0, 0x8dd3, 0x8ee3, 0x0ff0, + 0x9103, 0x1010, 0x1320, 0x9233, 0x1540, 0x9453, 0x9763, 0x1670, + 0x1980, 0x9893, 0x9ba3, 0x1ab0, 0x9dc3, 0x1cd0, 0x1fe0, 0x9ef3, + 0xa203, 0x2310, 0x2020, 0xa133, 0x2640, 0xa753, 0xa463, 0x2570, + 0x2a80, 0xab93, 0xa8a3, 0x29b0, 0xaec3, 0x2fd0, 0x2ce0, 0xadf3, + 0x3300, 0xb213, 0xb123, 0x3030, 0xb743, 0x3650, 0x3560, 0xb473, + 0xbb83, 0x3a90, 0x39a0, 0xb8b3, 0x3fc0, 0xbed3, 0xbde3, 0x3cf0, + 0xc403, 0x4510, 0x4620, 0xc733, 0x4040, 0xc153, 0xc263, 0x4370, + 0x4c80, 0xcd93, 0xcea3, 0x4fb0, 0xc8c3, 0x49d0, 0x4ae0, 0xcbf3, + 0x5500, 0xd413, 0xd723, 0x5630, 0xd143, 0x5050, 0x5360, 0xd273, + 0xdd83, 0x5c90, 0x5fa0, 0xdeb3, 0x59c0, 0xd8d3, 0xdbe3, 0x5af0, + 0x6600, 0xe713, 0xe423, 0x6530, 0xe243, 0x6350, 0x6060, 0xe173, + 0xee83, 0x6f90, 0x6ca0, 0xedb3, 0x6ac0, 0xebd3, 0xe8e3, 0x69f0, + 0xf703, 0x7610, 0x7520, 0xf433, 0x7340, 0xf253, 0xf163, 0x7070, + 0x7f80, 0xfe93, 0xfda3, 0x7cb0, 0xfbc3, 0x7ad0, 0x79e0, 0xf8f3, + 0x0803, 0x8910, 0x8a20, 0x0b33, 0x8c40, 0x0d53, 0x0e63, 0x8f70, + 0x8080, 0x0193, 0x02a3, 0x83b0, 0x04c3, 0x85d0, 0x86e0, 0x07f3, + 0x9900, 0x1813, 0x1b23, 0x9a30, 0x1d43, 0x9c50, 0x9f60, 0x1e73, + 0x1183, 0x9090, 0x93a0, 0x12b3, 0x95c0, 0x14d3, 0x17e3, 0x96f0, + 0xaa00, 0x2b13, 0x2823, 0xa930, 0x2e43, 0xaf50, 0xac60, 0x2d73, + 0x2283, 0xa390, 0xa0a0, 0x21b3, 0xa6c0, 0x27d3, 0x24e3, 0xa5f0, + 0x3b03, 0xba10, 0xb920, 0x3833, 0xbf40, 0x3e53, 0x3d63, 0xbc70, + 0xb380, 0x3293, 0x31a3, 0xb0b0, 0x37c3, 0xb6d0, 0xb5e0, 0x34f3, + 0xcc00, 0x4d13, 0x4e23, 0xcf30, 0x4843, 0xc950, 0xca60, 0x4b73, + 0x4483, 0xc590, 0xc6a0, 0x47b3, 0xc0c0, 0x41d3, 0x42e3, 0xc3f0, + 0x5d03, 0xdc10, 0xdf20, 0x5e33, 0xd940, 0x5853, 0x5b63, 0xda70, + 0xd580, 0x5493, 0x57a3, 0xd6b0, 0x51c3, 0xd0d0, 0xd3e0, 0x52f3, + 0x6e03, 0xef10, 0xec20, 0x6d33, 0xea40, 0x6b53, 0x6863, 0xe970, + 0xe680, 0x6793, 0x64a3, 0xe5b0, 0x62c3, 0xe3d0, 0xe0e0, 0x61f3, + 0xff00, 0x7e13, 0x7d23, 0xfc30, 0x7b43, 0xfa50, 0xf960, 0x7873, + 0x7783, 0xf690, 0xf5a0, 0x74b3, 0xf3c0, 0x72d3, 0x71e3, 0xf0f0 }, + + { 0x0000, 0x1006, 0x200c, 0x300a, 0x4018, 0x501e, 0x6014, 0x7012, + 0x8030, 0x9036, 0xa03c, 0xb03a, 0xc028, 0xd02e, 0xe024, 0xf022, + 0x8065, 0x9063, 0xa069, 0xb06f, 0xc07d, 0xd07b, 0xe071, 0xf077, + 0x0055, 0x1053, 0x2059, 0x305f, 0x404d, 0x504b, 0x6041, 0x7047, + 0x80cf, 0x90c9, 0xa0c3, 0xb0c5, 0xc0d7, 0xd0d1, 0xe0db, 0xf0dd, + 0x00ff, 0x10f9, 0x20f3, 0x30f5, 0x40e7, 0x50e1, 0x60eb, 0x70ed, + 0x00aa, 0x10ac, 0x20a6, 0x30a0, 0x40b2, 0x50b4, 0x60be, 0x70b8, + 0x809a, 0x909c, 0xa096, 0xb090, 0xc082, 0xd084, 0xe08e, 0xf088, + 0x819b, 0x919d, 0xa197, 0xb191, 0xc183, 0xd185, 0xe18f, 0xf189, + 0x01ab, 0x11ad, 0x21a7, 0x31a1, 0x41b3, 0x51b5, 0x61bf, 0x71b9, + 0x01fe, 0x11f8, 0x21f2, 0x31f4, 0x41e6, 0x51e0, 0x61ea, 0x71ec, + 0x81ce, 0x91c8, 0xa1c2, 0xb1c4, 0xc1d6, 0xd1d0, 0xe1da, 0xf1dc, + 0x0154, 0x1152, 0x2158, 0x315e, 0x414c, 0x514a, 0x6140, 0x7146, + 0x8164, 0x9162, 0xa168, 0xb16e, 0xc17c, 0xd17a, 0xe170, 0xf176, + 0x8131, 0x9137, 0xa13d, 0xb13b, 0xc129, 0xd12f, 0xe125, 0xf123, + 0x0101, 0x1107, 0x210d, 0x310b, 0x4119, 0x511f, 0x6115, 0x7113, + 0x8333, 0x9335, 0xa33f, 0xb339, 0xc32b, 0xd32d, 0xe327, 0xf321, + 0x0303, 0x1305, 0x230f, 0x3309, 0x431b, 0x531d, 0x6317, 0x7311, + 0x0356, 0x1350, 0x235a, 0x335c, 0x434e, 0x5348, 0x6342, 0x7344, + 0x8366, 0x9360, 0xa36a, 0xb36c, 0xc37e, 0xd378, 0xe372, 0xf374, + 0x03fc, 0x13fa, 0x23f0, 0x33f6, 0x43e4, 0x53e2, 0x63e8, 0x73ee, + 0x83cc, 0x93ca, 0xa3c0, 0xb3c6, 0xc3d4, 0xd3d2, 0xe3d8, 0xf3de, + 0x8399, 0x939f, 0xa395, 0xb393, 0xc381, 0xd387, 0xe38d, 0xf38b, + 0x03a9, 0x13af, 0x23a5, 0x33a3, 0x43b1, 0x53b7, 0x63bd, 0x73bb, + 0x02a8, 0x12ae, 0x22a4, 0x32a2, 0x42b0, 0x52b6, 0x62bc, 0x72ba, + 0x8298, 0x929e, 0xa294, 0xb292, 0xc280, 0xd286, 0xe28c, 0xf28a, + 0x82cd, 0x92cb, 0xa2c1, 0xb2c7, 0xc2d5, 0xd2d3, 0xe2d9, 0xf2df, + 0x02fd, 0x12fb, 0x22f1, 0x32f7, 0x42e5, 0x52e3, 0x62e9, 0x72ef, + 0x8267, 0x9261, 0xa26b, 0xb26d, 0xc27f, 0xd279, 0xe273, 0xf275, + 0x0257, 0x1251, 0x225b, 0x325d, 0x424f, 0x5249, 0x6243, 0x7245, + 0x0202, 0x1204, 0x220e, 0x3208, 0x421a, 0x521c, 0x6216, 0x7210, + 0x8232, 0x9234, 0xa23e, 0xb238, 0xc22a, 0xd22c, 0xe226, 0xf220 } +}; -void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc) +#if 0 +void FLAC__crc16_init_table(void) { - while(len--) - *crc = FLAC__crc8_table[*crc ^ *data++]; + int i, j; + FLAC__uint16 polynomial, crc; + polynomial = 0x8005; + + for(i = 0; i <= 0xFF; i++){ + crc = i << 8; + + for(j = 0; j < 8; j++) + crc = (crc << 1) ^ (crc & (1 << 15) ? polynomial : 0); + + FLAC__crc16_table[0][i] = crc; + } + + for(i = 0; i <= 0xFF; i++) + for(j = 1; j < 8; j++) + FLAC__crc16_table[j][i] = FLAC__crc16_table[0][FLAC__crc16_table[j - 1][i] >> 8] ^ (FLAC__crc16_table[j - 1][i] << 8); } +#endif -FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len) +FLAC__uint8 FLAC__crc8(const FLAC__byte *data, uint32_t len) { FLAC__uint8 crc = 0; @@ -131,12 +373,64 @@ FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len) return crc; } -unsigned FLAC__crc16(const FLAC__byte *data, unsigned len) +FLAC__uint16 FLAC__crc16(const FLAC__byte *data, uint32_t len) { - unsigned crc = 0; + FLAC__uint16 crc = 0; + + while(len >= 8){ + crc ^= data[0] << 8 | data[1]; + + crc = FLAC__crc16_table[7][crc >> 8] ^ FLAC__crc16_table[6][crc & 0xFF] ^ + FLAC__crc16_table[5][data[2] ] ^ FLAC__crc16_table[4][data[3] ] ^ + FLAC__crc16_table[3][data[4] ] ^ FLAC__crc16_table[2][data[5] ] ^ + FLAC__crc16_table[1][data[6] ] ^ FLAC__crc16_table[0][data[7] ]; + + data += 8; + len -= 8; + } while(len--) - crc = ((crc<<8) ^ FLAC__crc16_table[(crc>>8) ^ *data++]) & 0xffff; + crc = (crc<<8) ^ FLAC__crc16_table[0][(crc>>8) ^ *data++]; + + return crc; +} + +FLAC__uint16 FLAC__crc16_update_words32(const FLAC__uint32 *words, uint32_t len, FLAC__uint16 crc) +{ + while (len >= 2) { + crc ^= words[0] >> 16; + + crc = FLAC__crc16_table[7][crc >> 8 ] ^ FLAC__crc16_table[6][crc & 0xFF ] ^ + FLAC__crc16_table[5][(words[0] >> 8) & 0xFF] ^ FLAC__crc16_table[4][ words[0] & 0xFF] ^ + FLAC__crc16_table[3][ words[1] >> 24 ] ^ FLAC__crc16_table[2][(words[1] >> 16) & 0xFF] ^ + FLAC__crc16_table[1][(words[1] >> 8) & 0xFF] ^ FLAC__crc16_table[0][ words[1] & 0xFF]; + + words += 2; + len -= 2; + } + + if (len) { + crc ^= words[0] >> 16; + + crc = FLAC__crc16_table[3][crc >> 8 ] ^ FLAC__crc16_table[2][crc & 0xFF ] ^ + FLAC__crc16_table[1][(words[0] >> 8) & 0xFF] ^ FLAC__crc16_table[0][words[0] & 0xFF]; + } + + return crc; +} + +FLAC__uint16 FLAC__crc16_update_words64(const FLAC__uint64 *words, uint32_t len, FLAC__uint16 crc) +{ + while (len--) { + crc ^= words[0] >> 48; + + crc = FLAC__crc16_table[7][crc >> 8 ] ^ FLAC__crc16_table[6][crc & 0xFF ] ^ + FLAC__crc16_table[5][(words[0] >> 40) & 0xFF] ^ FLAC__crc16_table[4][(words[0] >> 32) & 0xFF] ^ + FLAC__crc16_table[3][(words[0] >> 24) & 0xFF] ^ FLAC__crc16_table[2][(words[0] >> 16) & 0xFF] ^ + FLAC__crc16_table[1][(words[0] >> 8) & 0xFF] ^ FLAC__crc16_table[0][ words[0] & 0xFF]; + + words++; + } return crc; } diff --git a/3rdparty/libflac/src/libFLAC/deduplication/bitreader_read_rice_signed_block.c b/3rdparty/libflac/src/libFLAC/deduplication/bitreader_read_rice_signed_block.c new file mode 100644 index 00000000000..75ed47f7275 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/deduplication/bitreader_read_rice_signed_block.c @@ -0,0 +1,143 @@ +{ + /* try and get br->consumed_words and br->consumed_bits into register; + * must remember to flush them back to *br before calling other + * bitreader functions that use them, and before returning */ + uint32_t cwords, words, lsbs, msbs, x, y, limit; + uint32_t ucbits; /* keep track of the number of unconsumed bits in word */ + brword b; + int *val, *end; + + FLAC__ASSERT(0 != br); + FLAC__ASSERT(0 != br->buffer); + /* WATCHOUT: code does not work with <32bit words; we can make things much faster with this assertion */ + FLAC__ASSERT(FLAC__BITS_PER_WORD >= 32); + FLAC__ASSERT(parameter < 32); + /* the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it */ + + limit = UINT32_MAX >> parameter; /* Maximal msbs that can occur with residual bounded to int32_t */ + + val = vals; + end = vals + nvals; + + if(parameter == 0) { + while(val < end) { + /* read the unary MSBs and end bit */ + if(!FLAC__bitreader_read_unary_unsigned(br, &msbs)) + return false; + /* Checking limit here would be overzealous: coding UINT32_MAX + * with parameter == 0 would take 4GiB */ + *val++ = (int)(msbs >> 1) ^ -(int)(msbs & 1); + } + + return true; + } + + FLAC__ASSERT(parameter > 0); + + cwords = br->consumed_words; + words = br->words; + + /* if we've not consumed up to a partial tail word... */ + if(cwords >= words) { + x = 0; + goto process_tail; + } + + ucbits = FLAC__BITS_PER_WORD - br->consumed_bits; + b = br->buffer[cwords] << br->consumed_bits; /* keep unconsumed bits aligned to left */ + + while(val < end) { + /* read the unary MSBs and end bit */ + x = y = COUNT_ZERO_MSBS2(b); + if(x == FLAC__BITS_PER_WORD) { + x = ucbits; + do { + /* didn't find stop bit yet, have to keep going... */ + cwords++; + if (cwords >= words) + goto incomplete_msbs; + b = br->buffer[cwords]; + y = COUNT_ZERO_MSBS2(b); + x += y; + } while(y == FLAC__BITS_PER_WORD); + } + b <<= y; + b <<= 1; /* account for stop bit */ + ucbits = (ucbits - x - 1) % FLAC__BITS_PER_WORD; + msbs = x; + + if(x > limit) + return false; + + /* read the binary LSBs */ + x = (FLAC__uint32)(b >> (FLAC__BITS_PER_WORD - parameter)); /* parameter < 32, so we can cast to 32-bit uint32_t */ + if(parameter <= ucbits) { + ucbits -= parameter; + b <<= parameter; + } else { + /* there are still bits left to read, they will all be in the next word */ + cwords++; + if (cwords >= words) + goto incomplete_lsbs; + b = br->buffer[cwords]; + ucbits += FLAC__BITS_PER_WORD - parameter; + x |= (FLAC__uint32)(b >> ucbits); + b <<= FLAC__BITS_PER_WORD - ucbits; + } + lsbs = x; + + /* compose the value */ + x = (msbs << parameter) | lsbs; + *val++ = (int)(x >> 1) ^ -(int)(x & 1); + + continue; + + /* at this point we've eaten up all the whole words */ +process_tail: + do { + if(0) { +incomplete_msbs: + br->consumed_bits = 0; + br->consumed_words = cwords; + } + + /* read the unary MSBs and end bit */ + if(!FLAC__bitreader_read_unary_unsigned(br, &msbs)) + return false; + msbs += x; + x = ucbits = 0; + + if(0) { +incomplete_lsbs: + br->consumed_bits = 0; + br->consumed_words = cwords; + } + + /* read the binary LSBs */ + if(!FLAC__bitreader_read_raw_uint32(br, &lsbs, parameter - ucbits)) + return false; + lsbs = x | lsbs; + + /* compose the value */ + x = (msbs << parameter) | lsbs; + *val++ = (int)(x >> 1) ^ -(int)(x & 1); + x = 0; + + cwords = br->consumed_words; + words = br->words; + ucbits = FLAC__BITS_PER_WORD - br->consumed_bits; + b = cwords < br->capacity ? br->buffer[cwords] << br->consumed_bits : 0; + } while(cwords >= words && val < end); + } + + if(ucbits == 0 && cwords < words) { + /* don't leave the head word with no unconsumed bits */ + cwords++; + ucbits = FLAC__BITS_PER_WORD; + } + + br->consumed_bits = FLAC__BITS_PER_WORD - ucbits; + br->consumed_words = cwords; + + return true; +} diff --git a/3rdparty/libflac/src/libFLAC/deduplication/lpc_compute_autocorrelation_intrin.c b/3rdparty/libflac/src/libFLAC/deduplication/lpc_compute_autocorrelation_intrin.c new file mode 100644 index 00000000000..76419db03cd --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/deduplication/lpc_compute_autocorrelation_intrin.c @@ -0,0 +1,14 @@ + int i, j; + (void) lag; + FLAC__ASSERT(lag <= MAX_LAG); + + for(i = 0; i < MAX_LAG; i++) + autoc[i] = 0.0; + + for(i = 0; i < MAX_LAG; i++) + for(j = 0; j <= i; j++) + autoc[j] += (double)data[i] * (double)data[i-j]; + + for(i = MAX_LAG; i < (int)data_len; i++) + for(j = 0; j < MAX_LAG; j++) + autoc[j] += (double)data[i] * (double)data[i-j]; diff --git a/3rdparty/libflac/src/libFLAC/deduplication/lpc_compute_autocorrelation_intrin_neon.c b/3rdparty/libflac/src/libFLAC/deduplication/lpc_compute_autocorrelation_intrin_neon.c new file mode 100644 index 00000000000..4df3aee9546 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/deduplication/lpc_compute_autocorrelation_intrin_neon.c @@ -0,0 +1,70 @@ + int i; + float64x2_t sum0 = vdupq_n_f64(0.0f); + float64x2_t sum1 = vdupq_n_f64(0.0f); + float64x2_t sum2 = vdupq_n_f64(0.0f); + float64x2_t sum3 = vdupq_n_f64(0.0f); + float64x2_t d0 = vdupq_n_f64(0.0f); + float64x2_t d1 = vdupq_n_f64(0.0f); + float64x2_t d2 = vdupq_n_f64(0.0f); + float64x2_t d3 = vdupq_n_f64(0.0f); +#if MAX_LAG > 8 + float64x2_t sum4 = vdupq_n_f64(0.0f); + float64x2_t d4 = vdupq_n_f64(0.0f); +#endif +#if MAX_LAG > 10 + float64x2_t sum5 = vdupq_n_f64(0.0f); + float64x2_t sum6 = vdupq_n_f64(0.0f); + float64x2_t d5 = vdupq_n_f64(0.0f); + float64x2_t d6 = vdupq_n_f64(0.0f); +#endif + float64x2_t d; + + (void)lag; + FLAC__ASSERT(lag <= MAX_LAG); + + // Loop backwards through samples from data_len to 0 + for (i = data_len - 1; i >= 0; i--) + { + d = vdupq_n_f64(data[i]); // Create vector with 2 entries data[i] + + // The next 6 lines of code right-shift the elements through the 7 vectors d0..d6. + // The 7th line adds the newly loaded element to d0. This works like a stack, where + // data[i] is pushed onto the stack every time and the 9th element falls off +#if MAX_LAG > 10 + d6 = vextq_f64(d5,d6,1); + d5 = vextq_f64(d4,d5,1); +#endif +#if MAX_LAG > 8 + d4 = vextq_f64(d3,d4,1); +#endif + d3 = vextq_f64(d2,d3,1); + d2 = vextq_f64(d1,d2,1); + d1 = vextq_f64(d0,d1,1); + d0 = vextq_f64(d,d0,1); + + // Fused multiply-add sum += d * d0..d6 + sum0 = vfmaq_f64(sum0, d, d0); + sum1 = vfmaq_f64(sum1, d, d1); + sum2 = vfmaq_f64(sum2, d, d2); + sum3 = vfmaq_f64(sum3, d, d3); +#if MAX_LAG > 8 + sum4 = vfmaq_f64(sum4, d, d4); +#endif +#if MAX_LAG > 10 + sum5 = vfmaq_f64(sum5, d, d5); + sum6 = vfmaq_f64(sum6, d, d6); +#endif + } + + // Store sum0..sum6 in autoc[0..14] + vst1q_f64(autoc, sum0); + vst1q_f64(autoc + 2, sum1); + vst1q_f64(autoc + 4, sum2); + vst1q_f64(autoc + 6, sum3); +#if MAX_LAG > 8 + vst1q_f64(autoc + 8, sum4); +#endif +#if MAX_LAG > 10 + vst1q_f64(autoc + 10, sum5); + vst1q_f64(autoc + 12, sum6); +#endif diff --git a/3rdparty/libflac/src/libFLAC/deduplication/lpc_compute_autocorrelation_intrin_sse2.c b/3rdparty/libflac/src/libFLAC/deduplication/lpc_compute_autocorrelation_intrin_sse2.c new file mode 100644 index 00000000000..607b42f41ef --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/deduplication/lpc_compute_autocorrelation_intrin_sse2.c @@ -0,0 +1,81 @@ +/* This code is imported several times in lpc_intrin_sse2.c with different + * values for MAX_LAG. Comments are for MAX_LAG == 14 */ + int i; + __m128d sum0, sum1, sum2, sum3; + __m128d d0, d1, d2, d3; +#if MAX_LAG > 8 + __m128d d4; + __m128d sum4; +#endif +#if MAX_LAG > 10 + __m128d d5, d6; + __m128d sum5, sum6; +#endif + + (void) lag; + FLAC__ASSERT(lag <= MAX_LAG); + + /* Initialize all sum vectors with zero */ + sum0 = _mm_setzero_pd(); + sum1 = _mm_setzero_pd(); + sum2 = _mm_setzero_pd(); + sum3 = _mm_setzero_pd(); + d0 = _mm_setzero_pd(); + d1 = _mm_setzero_pd(); + d2 = _mm_setzero_pd(); + d3 = _mm_setzero_pd(); +#if MAX_LAG > 8 + sum4 = _mm_setzero_pd(); + d4 = _mm_setzero_pd(); +#endif +#if MAX_LAG > 10 + sum5 = _mm_setzero_pd(); + sum6 = _mm_setzero_pd(); + d5 = _mm_setzero_pd(); + d6 = _mm_setzero_pd(); +#endif + + /* Loop backwards through samples from data_len to limit */ + for(i = data_len-1; i >= 0; i--) { + __m128d d = _mm_set1_pd(data[i]); + + /* The next lines of code work like a queue. For more + * information see the lag8 version of this function */ +#if MAX_LAG > 10 + d6 = _mm_shuffle_pd(d5, d6, _MM_SHUFFLE(0,0,0,1)); + d5 = _mm_shuffle_pd(d4, d5, _MM_SHUFFLE(0,0,0,1)); +#endif +#if MAX_LAG > 8 + d4 = _mm_shuffle_pd(d3, d4, _MM_SHUFFLE(0,0,0,1)); +#endif + d3 = _mm_shuffle_pd(d2, d3, _MM_SHUFFLE(0,0,0,1)); + d2 = _mm_shuffle_pd(d1, d2, _MM_SHUFFLE(0,0,0,1)); + d1 = _mm_shuffle_pd(d0, d1, _MM_SHUFFLE(0,0,0,1)); + d0 = _mm_shuffle_pd(d, d0, _MM_SHUFFLE(0,0,0,1)); + + /* sumn += d*dn */ + sum0 = _mm_add_pd(sum0, _mm_mul_pd(d, d0)); + sum1 = _mm_add_pd(sum1, _mm_mul_pd(d, d1)); + sum2 = _mm_add_pd(sum2, _mm_mul_pd(d, d2)); + sum3 = _mm_add_pd(sum3, _mm_mul_pd(d, d3)); +#if MAX_LAG > 8 + sum4 = _mm_add_pd(sum4, _mm_mul_pd(d, d4)); +#endif +#if MAX_LAG > 10 + sum5 = _mm_add_pd(sum5, _mm_mul_pd(d, d5)); + sum6 = _mm_add_pd(sum6, _mm_mul_pd(d, d6)); +#endif + } + + /* Store sum0..sum6 in autoc[0..14] */ + _mm_storeu_pd(autoc, sum0); + _mm_storeu_pd(autoc+2, sum1); + _mm_storeu_pd(autoc+4, sum2); + _mm_storeu_pd(autoc+6 ,sum3); +#if MAX_LAG > 8 + _mm_storeu_pd(autoc+8, sum4); +#endif +#if MAX_LAG > 10 + _mm_storeu_pd(autoc+10,sum5); + _mm_storeu_pd(autoc+12,sum6); +#endif diff --git a/3rdparty/libflac/src/libFLAC/fixed.c b/3rdparty/libflac/src/libFLAC/fixed.c index e92faf3d8ff..5c42570e7d4 100644 --- a/3rdparty/libflac/src/libFLAC/fixed.c +++ b/3rdparty/libflac/src/libFLAC/fixed.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,24 +36,21 @@ #include <math.h> #include <string.h> +#include "share/compat.h" #include "private/bitmath.h" #include "private/fixed.h" +#include "private/macros.h" #include "FLAC/assert.h" -#ifndef M_LN2 -/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */ -#define M_LN2 0.69314718055994530942 -#endif - -#ifdef min -#undef min -#endif -#define min(x,y) ((x) < (y)? (x) : (y)) - #ifdef local_abs #undef local_abs #endif -#define local_abs(x) ((unsigned)((x)<0? -(x) : (x))) +#define local_abs(x) ((uint32_t)((x)<0? -(x) : (x))) + +#ifdef local_abs64 +#undef local_abs64 +#endif +#define local_abs64(x) ((uint64_t)((x)<0? -(x) : (x))) #ifdef FLAC__INTEGER_ONLY_LIBRARY /* rbps stands for residual bits per sample @@ -64,7 +62,7 @@ static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__uint32 n) { FLAC__uint32 rbps; - unsigned bits; /* the number of bits required to represent a number */ + uint32_t bits; /* the number of bits required to represent a number */ int fracbits; /* the number of bits of rbps that comprise the fractional part */ FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint)); @@ -112,7 +110,7 @@ static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__ } } - rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1)); + rbps = FLAC__fixedpoint_log2(rbps, fracbits, (uint32_t)(-1)); if(rbps == 0) return 0; @@ -143,7 +141,7 @@ static FLAC__fixedpoint local__compute_rbps_integerized(FLAC__uint32 err, FLAC__ static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, FLAC__uint32 n) { FLAC__uint32 rbps; - unsigned bits; /* the number of bits required to represent a number */ + uint32_t bits; /* the number of bits required to represent a number */ int fracbits; /* the number of bits of rbps that comprise the fractional part */ FLAC__ASSERT(sizeof(rbps) == sizeof(FLAC__fixedpoint)); @@ -191,7 +189,7 @@ static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, F } } - rbps = FLAC__fixedpoint_log2(rbps, fracbits, (unsigned)(-1)); + rbps = FLAC__fixedpoint_log2(rbps, fracbits, (uint32_t)(-1)); if(rbps == 0) return 0; @@ -221,19 +219,28 @@ static FLAC__fixedpoint local__compute_rbps_wide_integerized(FLAC__uint64 err, F #endif #ifndef FLAC__INTEGER_ONLY_LIBRARY -unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +uint32_t FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) #else -unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +uint32_t FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) #endif { + FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0; + uint32_t order; +#if 0 + /* This code has been around a long time, and was written when compilers weren't able + * to vectorize code. These days, compilers are better in optimizing the next block + * which is also much more readable + */ FLAC__int32 last_error_0 = data[-1]; FLAC__int32 last_error_1 = data[-1] - data[-2]; FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]); FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]); FLAC__int32 error, save; - FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0; - unsigned i, order; - + uint32_t i; + /* total_error_* are 64-bits to avoid overflow when encoding + * erratic signals when the bits-per-sample and blocksize are + * large. + */ for(i = 0; i < data_len; i++) { error = data[i] ; total_error_0 += local_abs(error); save = error; error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error; @@ -241,14 +248,26 @@ unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned d error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error; error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save; } +#else + int i; + for(i = 0; i < (int)data_len; i++) { + total_error_0 += local_abs(data[i]); + total_error_1 += local_abs(data[i] - data[i-1]); + total_error_2 += local_abs(data[i] - 2 * data[i-1] + data[i-2]); + total_error_3 += local_abs(data[i] - 3 * data[i-1] + 3 * data[i-2] - data[i-3]); + total_error_4 += local_abs(data[i] - 4 * data[i-1] + 6 * data[i-2] - 4 * data[i-3] + data[i-4]); + } +#endif - if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4)) + + /* prefer lower order */ + if(total_error_0 <= flac_min(flac_min(flac_min(total_error_1, total_error_2), total_error_3), total_error_4)) order = 0; - else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4)) + else if(total_error_1 <= flac_min(flac_min(total_error_2, total_error_3), total_error_4)) order = 1; - else if(total_error_2 < min(total_error_3, total_error_4)) + else if(total_error_2 <= flac_min(total_error_3, total_error_4)) order = 2; - else if(total_error_3 < total_error_4) + else if(total_error_3 <= total_error_4) order = 3; else order = 4; @@ -262,11 +281,11 @@ unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned d FLAC__ASSERT(data_len > 0 || total_error_3 == 0); FLAC__ASSERT(data_len > 0 || total_error_4 == 0); #ifndef FLAC__INTEGER_ONLY_LIBRARY - residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[0] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[1] = (float)((total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[2] = (float)((total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[3] = (float)((total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[4] = (float)((total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double)data_len) / M_LN2 : 0.0); #else residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_integerized(total_error_0, data_len) : 0; residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_integerized(total_error_1, data_len) : 0; @@ -279,38 +298,31 @@ unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned d } #ifndef FLAC__INTEGER_ONLY_LIBRARY -unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +uint32_t FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) #else -unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +uint32_t FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) #endif { - FLAC__int32 last_error_0 = data[-1]; - FLAC__int32 last_error_1 = data[-1] - data[-2]; - FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]); - FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]); - FLAC__int32 error, save; - /* total_error_* are 64-bits to avoid overflow when encoding - * erratic signals when the bits-per-sample and blocksize are - * large. - */ FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0; - unsigned i, order; + uint32_t order; + int i; - for(i = 0; i < data_len; i++) { - error = data[i] ; total_error_0 += local_abs(error); save = error; - error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error; - error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error; - error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error; - error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save; + for(i = 0; i < (int)data_len; i++) { + total_error_0 += local_abs(data[i]); + total_error_1 += local_abs(data[i] - data[i-1]); + total_error_2 += local_abs(data[i] - 2 * data[i-1] + data[i-2]); + total_error_3 += local_abs(data[i] - 3 * data[i-1] + 3 * data[i-2] - data[i-3]); + total_error_4 += local_abs(data[i] - 4 * data[i-1] + 6 * data[i-2] - 4 * data[i-3] + data[i-4]); } - if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4)) + /* prefer lower order */ + if(total_error_0 <= flac_min(flac_min(flac_min(total_error_1, total_error_2), total_error_3), total_error_4)) order = 0; - else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4)) + else if(total_error_1 <= flac_min(flac_min(total_error_2, total_error_3), total_error_4)) order = 1; - else if(total_error_2 < min(total_error_3, total_error_4)) + else if(total_error_2 <= flac_min(total_error_3, total_error_4)) order = 2; - else if(total_error_3 < total_error_4) + else if(total_error_3 <= total_error_4) order = 3; else order = 4; @@ -324,20 +336,11 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig FLAC__ASSERT(data_len > 0 || total_error_3 == 0); FLAC__ASSERT(data_len > 0 || total_error_4 == 0); #ifndef FLAC__INTEGER_ONLY_LIBRARY -#if defined _MSC_VER || defined __MINGW32__ - /* with MSVC you have to spoon feed it the casting */ - residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)(FLAC__int64)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); -#else - residual_bits_per_sample[0] = (FLAC__float)((total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[1] = (FLAC__float)((total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[2] = (FLAC__float)((total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[3] = (FLAC__float)((total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); - residual_bits_per_sample[4] = (FLAC__float)((total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); -#endif + residual_bits_per_sample[0] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[1] = (float)((total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[2] = (float)((total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[3] = (float)((total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[4] = (float)((total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double)data_len) / M_LN2 : 0.0); #else residual_bits_per_sample[0] = (total_error_0 > 0) ? local__compute_rbps_wide_integerized(total_error_0, data_len) : 0; residual_bits_per_sample[1] = (total_error_1 > 0) ? local__compute_rbps_wide_integerized(total_error_1, data_len) : 0; @@ -349,7 +352,122 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig return order; } -void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]) +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#define CHECK_ORDER_IS_VALID(macro_order) \ +if(order_##macro_order##_is_valid && total_error_##macro_order < smallest_error) { \ + order = macro_order; \ + smallest_error = total_error_##macro_order ; \ + residual_bits_per_sample[ macro_order ] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); \ +} \ +else \ + residual_bits_per_sample[ macro_order ] = 34.0f; +#else +#define CHECK_ORDER_IS_VALID(macro_order) \ +if(order_##macro_order##_is_valid && total_error_##macro_order < smallest_error) { \ + order = macro_order; \ + smallest_error = total_error_##macro_order ; \ + residual_bits_per_sample[ macro_order ] = (total_error_##macro_order > 0) ? local__compute_rbps_wide_integerized(total_error_##macro_order, data_len) : 0; \ +} \ +else \ + residual_bits_per_sample[ macro_order ] = 34 * FLAC__FP_ONE; +#endif + + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +uint32_t FLAC__fixed_compute_best_predictor_limit_residual(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +#else +uint32_t FLAC__fixed_compute_best_predictor_limit_residual(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +#endif +{ + FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0, smallest_error = UINT64_MAX; + FLAC__uint64 error_0, error_1, error_2, error_3, error_4; + FLAC__bool order_0_is_valid = true, order_1_is_valid = true, order_2_is_valid = true, order_3_is_valid = true, order_4_is_valid = true; + uint32_t order = 0; + int i; + + for(i = -4; i < (int)data_len; i++) { + error_0 = local_abs64((FLAC__int64)data[i]); + error_1 = (i > -4) ? local_abs64((FLAC__int64)data[i] - data[i-1]) : 0 ; + error_2 = (i > -3) ? local_abs64((FLAC__int64)data[i] - 2 * (FLAC__int64)data[i-1] + data[i-2]) : 0; + error_3 = (i > -2) ? local_abs64((FLAC__int64)data[i] - 3 * (FLAC__int64)data[i-1] + 3 * (FLAC__int64)data[i-2] - data[i-3]) : 0; + error_4 = (i > -1) ? local_abs64((FLAC__int64)data[i] - 4 * (FLAC__int64)data[i-1] + 6 * (FLAC__int64)data[i-2] - 4 * (FLAC__int64)data[i-3] + data[i-4]) : 0; + + total_error_0 += error_0; + total_error_1 += error_1; + total_error_2 += error_2; + total_error_3 += error_3; + total_error_4 += error_4; + + /* residual must not be INT32_MIN because abs(INT32_MIN) is undefined */ + if(error_0 > INT32_MAX) + order_0_is_valid = false; + if(error_1 > INT32_MAX) + order_1_is_valid = false; + if(error_2 > INT32_MAX) + order_2_is_valid = false; + if(error_3 > INT32_MAX) + order_3_is_valid = false; + if(error_4 > INT32_MAX) + order_4_is_valid = false; + } + + CHECK_ORDER_IS_VALID(0); + CHECK_ORDER_IS_VALID(1); + CHECK_ORDER_IS_VALID(2); + CHECK_ORDER_IS_VALID(3); + CHECK_ORDER_IS_VALID(4); + + return order; +} + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +uint32_t FLAC__fixed_compute_best_predictor_limit_residual_33bit(const FLAC__int64 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +#else +uint32_t FLAC__fixed_compute_best_predictor_limit_residual_33bit(const FLAC__int64 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) +#endif +{ + FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0, smallest_error = UINT64_MAX; + FLAC__uint64 error_0, error_1, error_2, error_3, error_4; + FLAC__bool order_0_is_valid = true, order_1_is_valid = true, order_2_is_valid = true, order_3_is_valid = true, order_4_is_valid = true; + uint32_t order = 0; + int i; + + for(i = -4; i < (int)data_len; i++) { + error_0 = local_abs64(data[i]); + error_1 = (i > -4) ? local_abs64(data[i] - data[i-1]) : 0 ; + error_2 = (i > -3) ? local_abs64(data[i] - 2 * data[i-1] + data[i-2]) : 0; + error_3 = (i > -2) ? local_abs64(data[i] - 3 * data[i-1] + 3 * data[i-2] - data[i-3]) : 0; + error_4 = (i > -1) ? local_abs64(data[i] - 4 * data[i-1] + 6 * data[i-2] - 4 * data[i-3] + data[i-4]) : 0; + + total_error_0 += error_0; + total_error_1 += error_1; + total_error_2 += error_2; + total_error_3 += error_3; + total_error_4 += error_4; + + /* residual must not be INT32_MIN because abs(INT32_MIN) is undefined */ + if(error_0 > INT32_MAX) + order_0_is_valid = false; + if(error_1 > INT32_MAX) + order_1_is_valid = false; + if(error_2 > INT32_MAX) + order_2_is_valid = false; + if(error_3 > INT32_MAX) + order_3_is_valid = false; + if(error_4 > INT32_MAX) + order_4_is_valid = false; + } + + CHECK_ORDER_IS_VALID(0); + CHECK_ORDER_IS_VALID(1); + CHECK_ORDER_IS_VALID(2); + CHECK_ORDER_IS_VALID(3); + CHECK_ORDER_IS_VALID(4); + + return order; +} + +void FLAC__fixed_compute_residual(const FLAC__int32 data[], uint32_t data_len, uint32_t order, FLAC__int32 residual[]) { const int idata_len = (int)data_len; int i; @@ -365,34 +483,92 @@ void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, u break; case 2: for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - residual[i] = data[i] - (data[i-1] << 1) + data[i-2]; -#else residual[i] = data[i] - 2*data[i-1] + data[i-2]; -#endif break; case 3: for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - residual[i] = data[i] - (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) - data[i-3]; -#else residual[i] = data[i] - 3*data[i-1] + 3*data[i-2] - data[i-3]; -#endif break; case 4: for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - residual[i] = data[i] - ((data[i-1]+data[i-3])<<2) + ((data[i-2]<<2) + (data[i-2]<<1)) + data[i-4]; -#else residual[i] = data[i] - 4*data[i-1] + 6*data[i-2] - 4*data[i-3] + data[i-4]; -#endif break; default: FLAC__ASSERT(0); } } -void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[]) +void FLAC__fixed_compute_residual_wide(const FLAC__int32 data[], uint32_t data_len, uint32_t 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] = (FLAC__int64)data[i] - data[i-1]; + break; + case 2: + for(i = 0; i < idata_len; i++) + residual[i] = (FLAC__int64)data[i] - 2*(FLAC__int64)data[i-1] + data[i-2]; + break; + case 3: + for(i = 0; i < idata_len; i++) + residual[i] = (FLAC__int64)data[i] - 3*(FLAC__int64)data[i-1] + 3*(FLAC__int64)data[i-2] - data[i-3]; + break; + case 4: + for(i = 0; i < idata_len; i++) + residual[i] = (FLAC__int64)data[i] - 4*(FLAC__int64)data[i-1] + 6*(FLAC__int64)data[i-2] - 4*(FLAC__int64)data[i-3] + data[i-4]; + break; + default: + FLAC__ASSERT(0); + } +} + +void FLAC__fixed_compute_residual_wide_33bit(const FLAC__int64 data[], uint32_t data_len, uint32_t order, FLAC__int32 residual[]) +{ + const int idata_len = (int)data_len; + int i; + + switch(order) { + case 0: + for(i = 0; i < idata_len; i++) + residual[i] = data[i]; + 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); + } +} + +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && !defined(FUZZING_BUILD_MODE_FLAC_SANITIZE_SIGNED_INTEGER_OVERFLOW) +/* The attribute below is to silence the undefined sanitizer of oss-fuzz. + * Because fuzzing feeds bogus predictors and residual samples to the + * decoder, having overflows in this section is unavoidable. Also, + * because the calculated values are audio path only, there is no + * potential for security problems */ +__attribute__((no_sanitize("signed-integer-overflow"))) +#endif +void FLAC__fixed_restore_signal(const FLAC__int32 residual[], uint32_t data_len, uint32_t order, FLAC__int32 data[]) { int i, idata_len = (int)data_len; @@ -407,27 +583,83 @@ void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, break; case 2: for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - data[i] = residual[i] + (data[i-1]<<1) - data[i-2]; -#else data[i] = residual[i] + 2*data[i-1] - data[i-2]; -#endif break; case 3: for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - data[i] = residual[i] + (((data[i-1]-data[i-2])<<1) + (data[i-1]-data[i-2])) + data[i-3]; -#else data[i] = residual[i] + 3*data[i-1] - 3*data[i-2] + data[i-3]; -#endif break; case 4: for(i = 0; i < idata_len; i++) -#if 1 /* OPT: may be faster with some compilers on some systems */ - data[i] = residual[i] + ((data[i-1]+data[i-3])<<2) - ((data[i-2]<<2) + (data[i-2]<<1)) - data[i-4]; -#else data[i] = residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4]; + break; + default: + FLAC__ASSERT(0); + } +} + +void FLAC__fixed_restore_signal_wide(const FLAC__int32 residual[], uint32_t data_len, uint32_t order, FLAC__int32 data[]) +{ + int i, idata_len = (int)data_len; + + switch(order) { + case 0: + FLAC__ASSERT(sizeof(residual[0]) == sizeof(data[0])); + memcpy(data, residual, sizeof(residual[0])*data_len); + break; + case 1: + for(i = 0; i < idata_len; i++) + data[i] = (FLAC__int64)residual[i] + (FLAC__int64)data[i-1]; + break; + case 2: + for(i = 0; i < idata_len; i++) + data[i] = (FLAC__int64)residual[i] + 2*(FLAC__int64)data[i-1] - (FLAC__int64)data[i-2]; + break; + case 3: + for(i = 0; i < idata_len; i++) + data[i] = (FLAC__int64)residual[i] + 3*(FLAC__int64)data[i-1] - 3*(FLAC__int64)data[i-2] + (FLAC__int64)data[i-3]; + break; + case 4: + for(i = 0; i < idata_len; i++) + data[i] = (FLAC__int64)residual[i] + 4*(FLAC__int64)data[i-1] - 6*(FLAC__int64)data[i-2] + 4*(FLAC__int64)data[i-3] - (FLAC__int64)data[i-4]; + break; + default: + FLAC__ASSERT(0); + } +} + +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && !defined(FUZZING_BUILD_MODE_FLAC_SANITIZE_SIGNED_INTEGER_OVERFLOW) +/* The attribute below is to silence the undefined sanitizer of oss-fuzz. + * Because fuzzing feeds bogus predictors and residual samples to the + * decoder, having overflows in this section is unavoidable. Also, + * because the calculated values are audio path only, there is no + * potential for security problems */ +__attribute__((no_sanitize("signed-integer-overflow"))) #endif +void FLAC__fixed_restore_signal_wide_33bit(const FLAC__int32 residual[], uint32_t data_len, uint32_t order, FLAC__int64 data[]) +{ + int i, idata_len = (int)data_len; + + switch(order) { + case 0: + for(i = 0; i < idata_len; i++) + data[i] = residual[i]; + break; + case 1: + for(i = 0; i < idata_len; i++) + data[i] = (FLAC__int64)residual[i] + data[i-1]; + break; + case 2: + for(i = 0; i < idata_len; i++) + data[i] = (FLAC__int64)residual[i] + 2*data[i-1] - data[i-2]; + break; + case 3: + for(i = 0; i < idata_len; i++) + data[i] = (FLAC__int64)residual[i] + 3*data[i-1] - 3*data[i-2] + data[i-3]; + break; + case 4: + for(i = 0; i < idata_len; i++) + data[i] = (FLAC__int64)residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4]; break; default: FLAC__ASSERT(0); diff --git a/3rdparty/libflac/src/libFLAC/fixed_intrin_avx2.c b/3rdparty/libflac/src/libFLAC/fixed_intrin_avx2.c new file mode 100644 index 00000000000..85fc4a6d044 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/fixed_intrin_avx2.c @@ -0,0 +1,343 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +#include "private/fixed.h" +#ifdef FLAC__AVX2_SUPPORTED + +#include <immintrin.h> +#include <math.h> +#include "private/macros.h" +#include "share/compat.h" +#include "FLAC/assert.h" + +#ifdef local_abs +#undef local_abs +#endif +#define local_abs(x) ((uint32_t)((x)<0? -(x) : (x))) + +FLAC__SSE_TARGET("avx2") +uint32_t FLAC__fixed_compute_best_predictor_wide_intrin_avx2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]) +{ + FLAC__uint64 total_error_0, total_error_1, total_error_2, total_error_3, total_error_4; + FLAC__int32 i, data_len_int; + uint32_t order; + __m256i total_err0, total_err1, total_err2, total_err3, total_err4; + __m256i prev_err0, prev_err1, prev_err2, prev_err3; + __m256i tempA, tempB, bitmask; + FLAC__int64 data_scalar[4]; + FLAC__int64 prev_err0_scalar[4]; + FLAC__int64 prev_err1_scalar[4]; + FLAC__int64 prev_err2_scalar[4]; + FLAC__int64 prev_err3_scalar[4]; + total_err0 = _mm256_setzero_si256(); + total_err1 = _mm256_setzero_si256(); + total_err2 = _mm256_setzero_si256(); + total_err3 = _mm256_setzero_si256(); + total_err4 = _mm256_setzero_si256(); + data_len_int = data_len; + + for(i = 0; i < 4; i++){ + prev_err0_scalar[i] = data[-1+i*(data_len_int/4)]; + prev_err1_scalar[i] = data[-1+i*(data_len_int/4)] - data[-2+i*(data_len_int/4)]; + prev_err2_scalar[i] = prev_err1_scalar[i] - (data[-2+i*(data_len_int/4)] - data[-3+i*(data_len_int/4)]); + prev_err3_scalar[i] = prev_err2_scalar[i] - (data[-2+i*(data_len_int/4)] - 2*data[-3+i*(data_len_int/4)] + data[-4+i*(data_len_int/4)]); + } + prev_err0 = _mm256_loadu_si256((const __m256i*)(void*)prev_err0_scalar); + prev_err1 = _mm256_loadu_si256((const __m256i*)(void*)prev_err1_scalar); + prev_err2 = _mm256_loadu_si256((const __m256i*)(void*)prev_err2_scalar); + prev_err3 = _mm256_loadu_si256((const __m256i*)(void*)prev_err3_scalar); + for(i = 0; i < data_len_int / 4; i++){ + data_scalar[0] = data[i]; + data_scalar[1] = data[i+data_len/4]; + data_scalar[2] = data[i+2*data_len/4]; + data_scalar[3] = data[i+3*data_len/4]; + tempA = _mm256_loadu_si256((const __m256i*)(void*)data_scalar); + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempA); + tempB = _mm256_xor_si256(tempA, bitmask); + tempB = _mm256_sub_epi64(tempB, bitmask); + total_err0 = _mm256_add_epi64(total_err0,tempB); + tempB = _mm256_sub_epi64(tempA,prev_err0); + prev_err0 = tempA; + /* Next three intrinsics calculate tempA as abs of tempB */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempB); + tempA = _mm256_xor_si256(tempB, bitmask); + tempA = _mm256_sub_epi64(tempA, bitmask); + total_err1 = _mm256_add_epi64(total_err1,tempA); + tempA = _mm256_sub_epi64(tempB,prev_err1); + prev_err1 = tempB; + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempA); + tempB = _mm256_xor_si256(tempA, bitmask); + tempB = _mm256_sub_epi64(tempB, bitmask); + total_err2 = _mm256_add_epi64(total_err2,tempB); + tempB = _mm256_sub_epi64(tempA,prev_err2); + prev_err2 = tempA; + /* Next three intrinsics calculate tempA as abs of tempB */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempB); + tempA = _mm256_xor_si256(tempB, bitmask); + tempA = _mm256_sub_epi64(tempA, bitmask); + total_err3 = _mm256_add_epi64(total_err3,tempA); + tempA = _mm256_sub_epi64(tempB,prev_err3); + prev_err3 = tempB; + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempA); + tempB = _mm256_xor_si256(tempA, bitmask); + tempB = _mm256_sub_epi64(tempB, bitmask); + total_err4 = _mm256_add_epi64(total_err4,tempB); + } + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err0); + total_error_0 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err1); + total_error_1 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err2); + total_error_2 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err3); + total_error_3 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err4); + total_error_4 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + + /* Ignore the remainder, we're ignore the first few samples too */ + + /* prefer lower order */ + if(total_error_0 <= flac_min(flac_min(flac_min(total_error_1, total_error_2), total_error_3), total_error_4)) + order = 0; + else if(total_error_1 <= flac_min(flac_min(total_error_2, total_error_3), total_error_4)) + order = 1; + else if(total_error_2 <= flac_min(total_error_3, total_error_4)) + order = 2; + else if(total_error_3 <= total_error_4) + order = 3; + else + order = 4; + + /* Estimate the expected number of bits per residual signal sample. */ + /* 'total_error*' is linearly related to the variance of the residual */ + /* signal, so we use it directly to compute E(|x|) */ + FLAC__ASSERT(data_len > 0 || total_error_0 == 0); + FLAC__ASSERT(data_len > 0 || total_error_1 == 0); + FLAC__ASSERT(data_len > 0 || total_error_2 == 0); + FLAC__ASSERT(data_len > 0 || total_error_3 == 0); + FLAC__ASSERT(data_len > 0 || total_error_4 == 0); + + residual_bits_per_sample[0] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[1] = (float)((total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[2] = (float)((total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[3] = (float)((total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[4] = (float)((total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double)data_len) / M_LN2 : 0.0); + + return order; +} + +#ifdef local_abs64 +#undef local_abs64 +#endif +#define local_abs64(x) ((uint64_t)((x)<0? -(x) : (x))) + +#define CHECK_ORDER_IS_VALID(macro_order) \ +if(shadow_error_##macro_order <= INT32_MAX) { \ + if(total_error_##macro_order < smallest_error) { \ + order = macro_order; \ + smallest_error = total_error_##macro_order ; \ + } \ + residual_bits_per_sample[ macro_order ] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); \ +} \ +else \ + residual_bits_per_sample[ macro_order ] = 34.0f; + +FLAC__SSE_TARGET("avx2") +uint32_t FLAC__fixed_compute_best_predictor_limit_residual_intrin_avx2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]) +{ + FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0, smallest_error = UINT64_MAX; + FLAC__uint64 shadow_error_0 = 0, shadow_error_1 = 0, shadow_error_2 = 0, shadow_error_3 = 0, shadow_error_4 = 0; + FLAC__uint64 error_0, error_1, error_2, error_3, error_4; + FLAC__int32 i, data_len_int; + uint32_t order = 0; + __m256i total_err0, total_err1, total_err2, total_err3, total_err4; + __m256i shadow_err0, shadow_err1, shadow_err2, shadow_err3, shadow_err4; + __m256i prev_err0, prev_err1, prev_err2, prev_err3; + __m256i tempA, tempB, bitmask; + FLAC__int64 data_scalar[4]; + FLAC__int64 prev_err0_scalar[4]; + FLAC__int64 prev_err1_scalar[4]; + FLAC__int64 prev_err2_scalar[4]; + FLAC__int64 prev_err3_scalar[4]; + total_err0 = _mm256_setzero_si256(); + total_err1 = _mm256_setzero_si256(); + total_err2 = _mm256_setzero_si256(); + total_err3 = _mm256_setzero_si256(); + total_err4 = _mm256_setzero_si256(); + shadow_err0 = _mm256_setzero_si256(); + shadow_err1 = _mm256_setzero_si256(); + shadow_err2 = _mm256_setzero_si256(); + shadow_err3 = _mm256_setzero_si256(); + shadow_err4 = _mm256_setzero_si256(); + data_len_int = data_len; + + /* First take care of preceding samples */ + for(i = -4; i < 0; i++) { + error_0 = local_abs64((FLAC__int64)data[i]); + error_1 = (i > -4) ? local_abs64((FLAC__int64)data[i] - data[i-1]) : 0 ; + error_2 = (i > -3) ? local_abs64((FLAC__int64)data[i] - 2 * (FLAC__int64)data[i-1] + data[i-2]) : 0; + error_3 = (i > -2) ? local_abs64((FLAC__int64)data[i] - 3 * (FLAC__int64)data[i-1] + 3 * (FLAC__int64)data[i-2] - data[i-3]) : 0; + + total_error_0 += error_0; + total_error_1 += error_1; + total_error_2 += error_2; + total_error_3 += error_3; + + shadow_error_0 |= error_0; + shadow_error_1 |= error_1; + shadow_error_2 |= error_2; + shadow_error_3 |= error_3; + } + + for(i = 0; i < 4; i++){ + prev_err0_scalar[i] = data[-1+i*(data_len_int/4)]; + prev_err1_scalar[i] = (FLAC__int64)(data[-1+i*(data_len_int/4)]) - data[-2+i*(data_len_int/4)]; + prev_err2_scalar[i] = prev_err1_scalar[i] - ((FLAC__int64)(data[-2+i*(data_len_int/4)]) - data[-3+i*(data_len_int/4)]); + prev_err3_scalar[i] = prev_err2_scalar[i] - ((FLAC__int64)(data[-2+i*(data_len_int/4)]) - 2*(FLAC__int64)(data[-3+i*(data_len_int/4)]) + data[-4+i*(data_len_int/4)]); + } + prev_err0 = _mm256_loadu_si256((const __m256i*)(void*)prev_err0_scalar); + prev_err1 = _mm256_loadu_si256((const __m256i*)(void*)prev_err1_scalar); + prev_err2 = _mm256_loadu_si256((const __m256i*)(void*)prev_err2_scalar); + prev_err3 = _mm256_loadu_si256((const __m256i*)(void*)prev_err3_scalar); + for(i = 0; i < data_len_int / 4; i++){ + data_scalar[0] = data[i]; + data_scalar[1] = data[i+data_len/4]; + data_scalar[2] = data[i+2*data_len/4]; + data_scalar[3] = data[i+3*data_len/4]; + tempA = _mm256_loadu_si256((const __m256i*)(void*)data_scalar); + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempA); + tempB = _mm256_xor_si256(tempA, bitmask); + tempB = _mm256_sub_epi64(tempB, bitmask); + total_err0 = _mm256_add_epi64(total_err0,tempB); + shadow_err0 = _mm256_or_si256(shadow_err0,tempB); + tempB = _mm256_sub_epi64(tempA,prev_err0); + prev_err0 = tempA; + /* Next three intrinsics calculate tempA as abs of tempB */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempB); + tempA = _mm256_xor_si256(tempB, bitmask); + tempA = _mm256_sub_epi64(tempA, bitmask); + total_err1 = _mm256_add_epi64(total_err1,tempA); + shadow_err1 = _mm256_or_si256(shadow_err1,tempA); + tempA = _mm256_sub_epi64(tempB,prev_err1); + prev_err1 = tempB; + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempA); + tempB = _mm256_xor_si256(tempA, bitmask); + tempB = _mm256_sub_epi64(tempB, bitmask); + total_err2 = _mm256_add_epi64(total_err2,tempB); + shadow_err2 = _mm256_or_si256(shadow_err2,tempB); + tempB = _mm256_sub_epi64(tempA,prev_err2); + prev_err2 = tempA; + /* Next three intrinsics calculate tempA as abs of tempB */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempB); + tempA = _mm256_xor_si256(tempB, bitmask); + tempA = _mm256_sub_epi64(tempA, bitmask); + total_err3 = _mm256_add_epi64(total_err3,tempA); + shadow_err3 = _mm256_or_si256(shadow_err3,tempA); + tempA = _mm256_sub_epi64(tempB,prev_err3); + prev_err3 = tempB; + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm256_cmpgt_epi64(_mm256_set1_epi64x(0), tempA); + tempB = _mm256_xor_si256(tempA, bitmask); + tempB = _mm256_sub_epi64(tempB, bitmask); + total_err4 = _mm256_add_epi64(total_err4,tempB); + shadow_err4 = _mm256_or_si256(shadow_err4,tempB); + } + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err0); + total_error_0 += data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err1); + total_error_1 += data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err2); + total_error_2 += data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err3); + total_error_3 += data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,total_err4); + total_error_4 += data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,shadow_err0); + shadow_error_0 |= data_scalar[0] | data_scalar[1] | data_scalar[2] | data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,shadow_err1); + shadow_error_1 |= data_scalar[0] | data_scalar[1] | data_scalar[2] | data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,shadow_err2); + shadow_error_2 |= data_scalar[0] | data_scalar[1] | data_scalar[2] | data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,shadow_err3); + shadow_error_3 |= data_scalar[0] | data_scalar[1] | data_scalar[2] | data_scalar[3]; + _mm256_storeu_si256((__m256i*)(void*)data_scalar,shadow_err4); + shadow_error_4 |= data_scalar[0] | data_scalar[1] | data_scalar[2] | data_scalar[3]; + + /* Take care of remaining sample */ + for(i = (data_len/4)*4; i < data_len_int; i++) { + error_0 = local_abs64((FLAC__int64)data[i]); + error_1 = local_abs64((FLAC__int64)data[i] - data[i-1]); + error_2 = local_abs64((FLAC__int64)data[i] - 2 * (FLAC__int64)data[i-1] + data[i-2]); + error_3 = local_abs64((FLAC__int64)data[i] - 3 * (FLAC__int64)data[i-1] + 3 * (FLAC__int64)data[i-2] - data[i-3]); + error_4 = local_abs64((FLAC__int64)data[i] - 4 * (FLAC__int64)data[i-1] + 6 * (FLAC__int64)data[i-2] - 4 * (FLAC__int64)data[i-3] + data[i-4]); + + total_error_0 += error_0; + total_error_1 += error_1; + total_error_2 += error_2; + total_error_3 += error_3; + total_error_4 += error_4; + + shadow_error_0 |= error_0; + shadow_error_1 |= error_1; + shadow_error_2 |= error_2; + shadow_error_3 |= error_3; + shadow_error_4 |= error_4; + } + + + CHECK_ORDER_IS_VALID(0); + CHECK_ORDER_IS_VALID(1); + CHECK_ORDER_IS_VALID(2); + CHECK_ORDER_IS_VALID(3); + CHECK_ORDER_IS_VALID(4); + + return order; +} + +#endif /* FLAC__AVX2_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/fixed_intrin_sse2.c b/3rdparty/libflac/src/libFLAC/fixed_intrin_sse2.c new file mode 100644 index 00000000000..b92c13c1085 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/fixed_intrin_sse2.c @@ -0,0 +1,194 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_X86INTRIN +#include "private/fixed.h" +#ifdef FLAC__SSE2_SUPPORTED + +#include <emmintrin.h> /* SSE2 */ +#include <math.h> +#include "private/macros.h" +#include "share/compat.h" +#include "FLAC/assert.h" + +#ifdef FLAC__CPU_IA32 +#define m128i_to_i64(dest, src) _mm_storel_epi64((__m128i*)&dest, src) +#else +#define m128i_to_i64(dest, src) dest = _mm_cvtsi128_si64(src) +#endif + +#ifdef local_abs +#undef local_abs +#endif +#define local_abs(x) ((uint32_t)((x)<0? -(x) : (x))) + +FLAC__SSE_TARGET("sse2") +uint32_t FLAC__fixed_compute_best_predictor_intrin_sse2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]) +{ + FLAC__uint32 total_error_0, total_error_1, total_error_2, total_error_3, total_error_4; + FLAC__int32 i, data_len_int; + uint32_t order; + __m128i total_err0, total_err1, total_err2, total_err3, total_err4; + __m128i prev_err0, prev_err1, prev_err2, prev_err3; + __m128i tempA, tempB, bitmask; + FLAC__int32 data_scalar[4]; + FLAC__int32 prev_err0_scalar[4]; + FLAC__int32 prev_err1_scalar[4]; + FLAC__int32 prev_err2_scalar[4]; + FLAC__int32 prev_err3_scalar[4]; + total_err0 = _mm_setzero_si128(); + total_err1 = _mm_setzero_si128(); + total_err2 = _mm_setzero_si128(); + total_err3 = _mm_setzero_si128(); + total_err4 = _mm_setzero_si128(); + data_len_int = data_len; + + for(i = 0; i < 4; i++){ + prev_err0_scalar[i] = data[-1+i*(data_len_int/4)]; + prev_err1_scalar[i] = data[-1+i*(data_len_int/4)] - data[-2+i*(data_len_int/4)]; + prev_err2_scalar[i] = prev_err1_scalar[i] - (data[-2+i*(data_len_int/4)] - data[-3+i*(data_len_int/4)]); + prev_err3_scalar[i] = prev_err2_scalar[i] - (data[-2+i*(data_len_int/4)] - 2*data[-3+i*(data_len_int/4)] + data[-4+i*(data_len_int/4)]); + } + prev_err0 = _mm_loadu_si128((const __m128i*)prev_err0_scalar); + prev_err1 = _mm_loadu_si128((const __m128i*)prev_err1_scalar); + prev_err2 = _mm_loadu_si128((const __m128i*)prev_err2_scalar); + prev_err3 = _mm_loadu_si128((const __m128i*)prev_err3_scalar); + for(i = 0; i < data_len_int / 4; i++){ + data_scalar[0] = data[i]; + data_scalar[1] = data[i+data_len/4]; + data_scalar[2] = data[i+2*(data_len/4)]; + data_scalar[3] = data[i+3*(data_len/4)]; + tempA = _mm_loadu_si128((const __m128i*)data_scalar); + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm_srai_epi32(tempA, 31); + tempB = _mm_xor_si128(tempA, bitmask); + tempB = _mm_sub_epi32(tempB, bitmask); + total_err0 = _mm_add_epi32(total_err0,tempB); + tempB = _mm_sub_epi32(tempA,prev_err0); + prev_err0 = tempA; + /* Next three intrinsics calculate tempA as abs of tempB */ + bitmask = _mm_srai_epi32(tempB, 31); + tempA = _mm_xor_si128(tempB, bitmask); + tempA = _mm_sub_epi32(tempA, bitmask); + total_err1 = _mm_add_epi32(total_err1,tempA); + tempA = _mm_sub_epi32(tempB,prev_err1); + prev_err1 = tempB; + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm_srai_epi32(tempA, 31); + tempB = _mm_xor_si128(tempA, bitmask); + tempB = _mm_sub_epi32(tempB, bitmask); + total_err2 = _mm_add_epi32(total_err2,tempB); + tempB = _mm_sub_epi32(tempA,prev_err2); + prev_err2 = tempA; + /* Next three intrinsics calculate tempA as abs of tempB */ + bitmask = _mm_srai_epi32(tempB, 31); + tempA = _mm_xor_si128(tempB, bitmask); + tempA = _mm_sub_epi32(tempA, bitmask); + total_err3 = _mm_add_epi32(total_err3,tempA); + tempA = _mm_sub_epi32(tempB,prev_err3); + prev_err3 = tempB; + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm_srai_epi32(tempA, 31); + tempB = _mm_xor_si128(tempA, bitmask); + tempB = _mm_sub_epi32(tempB, bitmask); + total_err4 = _mm_add_epi32(total_err4,tempB); + } + _mm_storeu_si128((__m128i*)data_scalar,total_err0); + total_error_0 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm_storeu_si128((__m128i*)data_scalar,total_err1); + total_error_1 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm_storeu_si128((__m128i*)data_scalar,total_err2); + total_error_2 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm_storeu_si128((__m128i*)data_scalar,total_err3); + total_error_3 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm_storeu_si128((__m128i*)data_scalar,total_err4); + total_error_4 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + + /* Now the remainder of samples needs to be processed */ + i *= 4; + if(data_len % 4 > 0){ + FLAC__int32 last_error_0 = data[i-1]; + FLAC__int32 last_error_1 = data[i-1] - data[i-2]; + FLAC__int32 last_error_2 = last_error_1 - (data[i-2] - data[i-3]); + FLAC__int32 last_error_3 = last_error_2 - (data[i-2] - 2*data[i-3] + data[i-4]); + FLAC__int32 error, save; + for(; i < data_len_int; i++) { + error = data[i] ; total_error_0 += local_abs(error); save = error; + error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error; + error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error; + error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error; + error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save; + } + } + + /* prefer lower order */ + if(total_error_0 <= flac_min(flac_min(flac_min(total_error_1, total_error_2), total_error_3), total_error_4)) + order = 0; + else if(total_error_1 <= flac_min(flac_min(total_error_2, total_error_3), total_error_4)) + order = 1; + else if(total_error_2 <= flac_min(total_error_3, total_error_4)) + order = 2; + else if(total_error_3 <= total_error_4) + order = 3; + else + order = 4; + + /* Estimate the expected number of bits per residual signal sample. */ + /* 'total_error*' is linearly related to the variance of the residual */ + /* signal, so we use it directly to compute E(|x|) */ + FLAC__ASSERT(data_len > 0 || total_error_0 == 0); + FLAC__ASSERT(data_len > 0 || total_error_1 == 0); + FLAC__ASSERT(data_len > 0 || total_error_2 == 0); + FLAC__ASSERT(data_len > 0 || total_error_3 == 0); + FLAC__ASSERT(data_len > 0 || total_error_4 == 0); + + residual_bits_per_sample[0] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[1] = (float)((total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[2] = (float)((total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[3] = (float)((total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[4] = (float)((total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double)data_len) / M_LN2 : 0.0); + + return order; +} + +#endif /* FLAC__SSE2_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/fixed_intrin_sse42.c b/3rdparty/libflac/src/libFLAC/fixed_intrin_sse42.c new file mode 100644 index 00000000000..0556eaaddbc --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/fixed_intrin_sse42.c @@ -0,0 +1,223 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +#include "private/fixed.h" +#ifdef FLAC__SSE4_2_SUPPORTED + +#include <nmmintrin.h> /* SSE4.2 */ +#include <math.h> +#include "private/macros.h" +#include "share/compat.h" +#include "FLAC/assert.h" + +#ifdef local_abs64 +#undef local_abs64 +#endif +#define local_abs64(x) ((uint64_t)((x)<0? -(x) : (x))) + +#define CHECK_ORDER_IS_VALID(macro_order) \ +if(shadow_error_##macro_order <= INT32_MAX) { \ + if(total_error_##macro_order < smallest_error) { \ + order = macro_order; \ + smallest_error = total_error_##macro_order ; \ + } \ + residual_bits_per_sample[ macro_order ] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); \ +} \ +else \ + residual_bits_per_sample[ macro_order ] = 34.0f; + +FLAC__SSE_TARGET("sse4.2") +uint32_t FLAC__fixed_compute_best_predictor_limit_residual_intrin_sse42(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]) +{ + FLAC__uint64 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0, smallest_error = UINT64_MAX; + FLAC__uint64 shadow_error_0 = 0, shadow_error_1 = 0, shadow_error_2 = 0, shadow_error_3 = 0, shadow_error_4 = 0; + FLAC__uint64 error_0, error_1, error_2, error_3, error_4; + FLAC__int32 i, data_len_int; + uint32_t order = 0; + __m128i total_err0, total_err1, total_err2, total_err3, total_err4; + __m128i shadow_err0, shadow_err1, shadow_err2, shadow_err3, shadow_err4; + __m128i prev_err0, prev_err1, prev_err2, prev_err3; + __m128i tempA, tempB, bitmask; + FLAC__int64 data_scalar[2]; + FLAC__int64 prev_err0_scalar[2]; + FLAC__int64 prev_err1_scalar[2]; + FLAC__int64 prev_err2_scalar[2]; + FLAC__int64 prev_err3_scalar[2]; + total_err0 = _mm_setzero_si128(); + total_err1 = _mm_setzero_si128(); + total_err2 = _mm_setzero_si128(); + total_err3 = _mm_setzero_si128(); + total_err4 = _mm_setzero_si128(); + shadow_err0 = _mm_setzero_si128(); + shadow_err1 = _mm_setzero_si128(); + shadow_err2 = _mm_setzero_si128(); + shadow_err3 = _mm_setzero_si128(); + shadow_err4 = _mm_setzero_si128(); + data_len_int = data_len; + + /* First take care of preceding samples */ + for(i = -4; i < 0; i++) { + error_0 = local_abs64((FLAC__int64)data[i]); + error_1 = (i > -4) ? local_abs64((FLAC__int64)data[i] - data[i-1]) : 0 ; + error_2 = (i > -3) ? local_abs64((FLAC__int64)data[i] - 2 * (FLAC__int64)data[i-1] + data[i-2]) : 0; + error_3 = (i > -2) ? local_abs64((FLAC__int64)data[i] - 3 * (FLAC__int64)data[i-1] + 3 * (FLAC__int64)data[i-2] - data[i-3]) : 0; + + total_error_0 += error_0; + total_error_1 += error_1; + total_error_2 += error_2; + total_error_3 += error_3; + + shadow_error_0 |= error_0; + shadow_error_1 |= error_1; + shadow_error_2 |= error_2; + shadow_error_3 |= error_3; + } + + for(i = 0; i < 2; i++){ + prev_err0_scalar[i] = data[-1+i*(data_len_int/2)]; + prev_err1_scalar[i] = (FLAC__int64)(data[-1+i*(data_len_int/2)]) - data[-2+i*(data_len_int/2)]; + prev_err2_scalar[i] = prev_err1_scalar[i] - ((FLAC__int64)(data[-2+i*(data_len_int/2)]) - data[-3+i*(data_len_int/2)]); + prev_err3_scalar[i] = prev_err2_scalar[i] - ((FLAC__int64)(data[-2+i*(data_len_int/2)]) - 2*(FLAC__int64)(data[-3+i*(data_len_int/2)]) + data[-4+i*(data_len_int/2)]); + } + prev_err0 = _mm_loadu_si128((const __m128i*)prev_err0_scalar); + prev_err1 = _mm_loadu_si128((const __m128i*)prev_err1_scalar); + prev_err2 = _mm_loadu_si128((const __m128i*)prev_err2_scalar); + prev_err3 = _mm_loadu_si128((const __m128i*)prev_err3_scalar); + for(i = 0; i < data_len_int / 2; i++){ + data_scalar[0] = data[i]; + data_scalar[1] = data[i+data_len/2]; + tempA = _mm_loadu_si128((const __m128i*)data_scalar); + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), tempA); + tempB = _mm_xor_si128(tempA, bitmask); + tempB = _mm_sub_epi64(tempB, bitmask); + total_err0 = _mm_add_epi64(total_err0,tempB); + shadow_err0 = _mm_or_si128(shadow_err0,tempB); + tempB = _mm_sub_epi64(tempA,prev_err0); + prev_err0 = tempA; + /* Next three intrinsics calculate tempA as abs of tempB */ + bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), tempB); + tempA = _mm_xor_si128(tempB, bitmask); + tempA = _mm_sub_epi64(tempA, bitmask); + total_err1 = _mm_add_epi64(total_err1,tempA); + shadow_err1 = _mm_or_si128(shadow_err1,tempA); + tempA = _mm_sub_epi64(tempB,prev_err1); + prev_err1 = tempB; + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), tempA); + tempB = _mm_xor_si128(tempA, bitmask); + tempB = _mm_sub_epi64(tempB, bitmask); + total_err2 = _mm_add_epi64(total_err2,tempB); + shadow_err2 = _mm_or_si128(shadow_err2,tempB); + tempB = _mm_sub_epi64(tempA,prev_err2); + prev_err2 = tempA; + /* Next three intrinsics calculate tempA as abs of tempB */ + bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), tempB); + tempA = _mm_xor_si128(tempB, bitmask); + tempA = _mm_sub_epi64(tempA, bitmask); + total_err3 = _mm_add_epi64(total_err3,tempA); + shadow_err3 = _mm_or_si128(shadow_err3,tempA); + tempA = _mm_sub_epi64(tempB,prev_err3); + prev_err3 = tempB; + /* Next three intrinsics calculate tempB as abs of tempA */ + bitmask = _mm_cmpgt_epi64(_mm_set1_epi64x(0), tempA); + tempB = _mm_xor_si128(tempA, bitmask); + tempB = _mm_sub_epi64(tempB, bitmask); + total_err4 = _mm_add_epi64(total_err4,tempB); + shadow_err4 = _mm_or_si128(shadow_err4,tempB); + } + _mm_storeu_si128((__m128i*)data_scalar,total_err0); + total_error_0 += data_scalar[0] + data_scalar[1]; + _mm_storeu_si128((__m128i*)data_scalar,total_err1); + total_error_1 += data_scalar[0] + data_scalar[1]; + _mm_storeu_si128((__m128i*)data_scalar,total_err2); + total_error_2 += data_scalar[0] + data_scalar[1]; + _mm_storeu_si128((__m128i*)data_scalar,total_err3); + total_error_3 += data_scalar[0] + data_scalar[1]; + _mm_storeu_si128((__m128i*)data_scalar,total_err4); + total_error_4 += data_scalar[0] + data_scalar[1]; + _mm_storeu_si128((__m128i*)data_scalar,shadow_err0); + shadow_error_0 |= data_scalar[0] | data_scalar[1]; + _mm_storeu_si128((__m128i*)data_scalar,shadow_err1); + shadow_error_1 |= data_scalar[0] | data_scalar[1]; + _mm_storeu_si128((__m128i*)data_scalar,shadow_err2); + shadow_error_2 |= data_scalar[0] | data_scalar[1]; + _mm_storeu_si128((__m128i*)data_scalar,shadow_err3); + shadow_error_3 |= data_scalar[0] | data_scalar[1]; + _mm_storeu_si128((__m128i*)data_scalar,shadow_err4); + shadow_error_4 |= data_scalar[0] | data_scalar[1]; + + /* Take care of remaining sample */ + if(data_len_int % 2 > 0) { + i += data_len/2; + error_0 = local_abs64((FLAC__int64)data[i]); + error_1 = local_abs64((FLAC__int64)data[i] - data[i-1]); + error_2 = local_abs64((FLAC__int64)data[i] - 2 * (FLAC__int64)data[i-1] + data[i-2]); + error_3 = local_abs64((FLAC__int64)data[i] - 3 * (FLAC__int64)data[i-1] + 3 * (FLAC__int64)data[i-2] - data[i-3]); + error_4 = local_abs64((FLAC__int64)data[i] - 4 * (FLAC__int64)data[i-1] + 6 * (FLAC__int64)data[i-2] - 4 * (FLAC__int64)data[i-3] + data[i-4]); + + total_error_0 += error_0; + total_error_1 += error_1; + total_error_2 += error_2; + total_error_3 += error_3; + total_error_4 += error_4; + + shadow_error_0 |= error_0; + shadow_error_1 |= error_1; + shadow_error_2 |= error_2; + shadow_error_3 |= error_3; + shadow_error_4 |= error_4; + } + + + CHECK_ORDER_IS_VALID(0); + CHECK_ORDER_IS_VALID(1); + CHECK_ORDER_IS_VALID(2); + CHECK_ORDER_IS_VALID(3); + CHECK_ORDER_IS_VALID(4); + + return order; +} + +#endif /* FLAC__SSE4_2_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/fixed_intrin_ssse3.c b/3rdparty/libflac/src/libFLAC/fixed_intrin_ssse3.c new file mode 100644 index 00000000000..551693bf826 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/fixed_intrin_ssse3.c @@ -0,0 +1,179 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +#include "private/fixed.h" +#ifdef FLAC__SSSE3_SUPPORTED + +#include <tmmintrin.h> /* SSSE3 */ +#include <math.h> +#include "private/macros.h" +#include "share/compat.h" +#include "FLAC/assert.h" + +#ifdef FLAC__CPU_IA32 +#define m128i_to_i64(dest, src) _mm_storel_epi64((__m128i*)&dest, src) +#else +#define m128i_to_i64(dest, src) dest = _mm_cvtsi128_si64(src) +#endif + +#ifdef local_abs +#undef local_abs +#endif +#define local_abs(x) ((uint32_t)((x)<0? -(x) : (x))) + +FLAC__SSE_TARGET("ssse3") +uint32_t FLAC__fixed_compute_best_predictor_intrin_ssse3(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]) +{ + FLAC__uint32 total_error_0, total_error_1, total_error_2, total_error_3, total_error_4; + FLAC__int32 i, data_len_int; + uint32_t order; + __m128i total_err0, total_err1, total_err2, total_err3, total_err4; + __m128i prev_err0, prev_err1, prev_err2, prev_err3; + __m128i tempA, tempB; + FLAC__int32 data_scalar[4]; + FLAC__int32 prev_err0_scalar[4]; + FLAC__int32 prev_err1_scalar[4]; + FLAC__int32 prev_err2_scalar[4]; + FLAC__int32 prev_err3_scalar[4]; + total_err0 = _mm_setzero_si128(); + total_err1 = _mm_setzero_si128(); + total_err2 = _mm_setzero_si128(); + total_err3 = _mm_setzero_si128(); + total_err4 = _mm_setzero_si128(); + data_len_int = data_len; + + for(i = 0; i < 4; i++){ + prev_err0_scalar[i] = data[-1+i*(data_len_int/4)]; + prev_err1_scalar[i] = data[-1+i*(data_len_int/4)] - data[-2+i*(data_len_int/4)]; + prev_err2_scalar[i] = prev_err1_scalar[i] - (data[-2+i*(data_len_int/4)] - data[-3+i*(data_len_int/4)]); + prev_err3_scalar[i] = prev_err2_scalar[i] - (data[-2+i*(data_len_int/4)] - 2*data[-3+i*(data_len_int/4)] + data[-4+i*(data_len_int/4)]); + } + prev_err0 = _mm_loadu_si128((const __m128i*)prev_err0_scalar); + prev_err1 = _mm_loadu_si128((const __m128i*)prev_err1_scalar); + prev_err2 = _mm_loadu_si128((const __m128i*)prev_err2_scalar); + prev_err3 = _mm_loadu_si128((const __m128i*)prev_err3_scalar); + for(i = 0; i < data_len_int / 4; i++){ + data_scalar[0] = data[i]; + data_scalar[1] = data[i+data_len/4]; + data_scalar[2] = data[i+2*(data_len/4)]; + data_scalar[3] = data[i+3*(data_len/4)]; + tempA = _mm_loadu_si128((const __m128i*)data_scalar); + tempB = _mm_abs_epi32(tempA); + total_err0 = _mm_add_epi32(total_err0,tempB); + tempB = _mm_sub_epi32(tempA,prev_err0); + prev_err0 = tempA; + tempA = _mm_abs_epi32(tempB); + total_err1 = _mm_add_epi32(total_err1,tempA); + tempA = _mm_sub_epi32(tempB,prev_err1); + prev_err1 = tempB; + tempB = _mm_abs_epi32(tempA); + total_err2 = _mm_add_epi32(total_err2,tempB); + tempB = _mm_sub_epi32(tempA,prev_err2); + prev_err2 = tempA; + tempA = _mm_abs_epi32(tempB); + total_err3 = _mm_add_epi32(total_err3,tempA); + tempA = _mm_sub_epi32(tempB,prev_err3); + prev_err3 = tempB; + tempB = _mm_abs_epi32(tempA); + total_err4 = _mm_add_epi32(total_err4,tempB); + } + _mm_storeu_si128((__m128i*)data_scalar,total_err0); + total_error_0 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm_storeu_si128((__m128i*)data_scalar,total_err1); + total_error_1 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm_storeu_si128((__m128i*)data_scalar,total_err2); + total_error_2 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm_storeu_si128((__m128i*)data_scalar,total_err3); + total_error_3 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + _mm_storeu_si128((__m128i*)data_scalar,total_err4); + total_error_4 = data_scalar[0] + data_scalar[1] + data_scalar[2] + data_scalar[3]; + + /* Now the remainder of samples needs to be processed */ + i *= 4; + if(data_len % 4 > 0){ + FLAC__int32 last_error_0 = data[i-1]; + FLAC__int32 last_error_1 = data[i-1] - data[i-2]; + FLAC__int32 last_error_2 = last_error_1 - (data[i-2] - data[i-3]); + FLAC__int32 last_error_3 = last_error_2 - (data[i-2] - 2*data[i-3] + data[i-4]); + FLAC__int32 error, save; + for(; i < data_len_int; i++) { + error = data[i] ; total_error_0 += local_abs(error); save = error; + error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error; + error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error; + error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error; + error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save; + } + } + + /* prefer lower order */ + if(total_error_0 <= flac_min(flac_min(flac_min(total_error_1, total_error_2), total_error_3), total_error_4)) + order = 0; + else if(total_error_1 <= flac_min(flac_min(total_error_2, total_error_3), total_error_4)) + order = 1; + else if(total_error_2 <= flac_min(total_error_3, total_error_4)) + order = 2; + else if(total_error_3 <= total_error_4) + order = 3; + else + order = 4; + + /* Estimate the expected number of bits per residual signal sample. */ + /* 'total_error*' is linearly related to the variance of the residual */ + /* signal, so we use it directly to compute E(|x|) */ + FLAC__ASSERT(data_len > 0 || total_error_0 == 0); + FLAC__ASSERT(data_len > 0 || total_error_1 == 0); + FLAC__ASSERT(data_len > 0 || total_error_2 == 0); + FLAC__ASSERT(data_len > 0 || total_error_3 == 0); + FLAC__ASSERT(data_len > 0 || total_error_4 == 0); + + residual_bits_per_sample[0] = (float)((total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[1] = (float)((total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[2] = (float)((total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[3] = (float)((total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double)data_len) / M_LN2 : 0.0); + residual_bits_per_sample[4] = (float)((total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double)data_len) / M_LN2 : 0.0); + + return order; +} + +#endif /* FLAC__SSSE3_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/flac.pc.in b/3rdparty/libflac/src/libFLAC/flac.pc.in index 8fc39f83026..56e8594e86d 100644 --- a/3rdparty/libflac/src/libFLAC/flac.pc.in +++ b/3rdparty/libflac/src/libFLAC/flac.pc.in @@ -6,5 +6,7 @@ includedir=@includedir@ Name: FLAC Description: Free Lossless Audio Codec Library Version: @VERSION@ -Libs: -L${libdir} -lFLAC -lm -Cflags: -I${includedir}/FLAC +Requires.private: @OGG_PACKAGE@ +Libs: -L${libdir} -lFLAC +Libs.private: -lm +Cflags: -I${includedir} diff --git a/3rdparty/libflac/src/libFLAC/float.c b/3rdparty/libflac/src/libFLAC/float.c index 60fa7e8371a..a06ad285e98 100644 --- a/3rdparty/libflac/src/libFLAC/float.c +++ b/3rdparty/libflac/src/libFLAC/float.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2004-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,18 +35,11 @@ #endif #include "FLAC/assert.h" - +#include "share/compat.h" #include "private/float.h" #ifdef FLAC__INTEGER_ONLY_LIBRARY -/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ -#ifdef _MSC_VER -#define FLAC__U64L(x) x -#else -#define FLAC__U64L(x) x##LLU -#endif - const FLAC__fixedpoint FLAC__FP_ZERO = 0; const FLAC__fixedpoint FLAC__FP_ONE_HALF = 0x00008000; const FLAC__fixedpoint FLAC__FP_ONE = 0x00010000; @@ -272,7 +266,7 @@ static const FLAC__uint64 log2_lookup_wide[] = { }; #endif -FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision) +FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, uint32_t fracbits, uint32_t precision) { const FLAC__uint32 ONE = (1u << fracbits); const FLAC__uint32 *table = log2_lookup[fracbits >> 2]; @@ -282,7 +276,7 @@ FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned p if(x < ONE) return 0; - + if(precision > LOG2_LOOKUP_PRECISION) precision = LOG2_LOOKUP_PRECISION; diff --git a/3rdparty/libflac/src/libFLAC/format.c b/3rdparty/libflac/src/libFLAC/format.c index 3480905108a..8bbffbef8cf 100644 --- a/3rdparty/libflac/src/libFLAC/format.c +++ b/3rdparty/libflac/src/libFLAC/format.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,128 +39,119 @@ #include <string.h> /* for memset() */ #include "FLAC/assert.h" #include "FLAC/format.h" +#include "share/alloc.h" +#include "share/compat.h" #include "private/format.h" - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif - -#ifdef min -#undef min -#endif -#define min(a,b) ((a)<(b)?(a):(b)) - -/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ -#ifdef _MSC_VER -#define FLAC__U64L(x) x +#include "private/macros.h" + +#if (defined GIT_COMMIT_HASH && defined GIT_COMMIT_DATE) +# ifdef GIT_COMMIT_TAG +FLAC_API const char *FLAC__VERSION_STRING = GIT_COMMIT_TAG; +FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " GIT_COMMIT_TAG " " GIT_COMMIT_DATE; +# else +FLAC_API const char *FLAC__VERSION_STRING = "git-" GIT_COMMIT_HASH " " GIT_COMMIT_DATE; +FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC git-" GIT_COMMIT_HASH " " GIT_COMMIT_DATE; +# endif #else -#define FLAC__U64L(x) x##LLU -#endif - -/* VERSION should come from configure */ -FLAC_API const char *FLAC__VERSION_STRING = VERSION; - -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINW32__ -/* yet one more hack because of MSVC6: */ -FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC 1.2.1 20070917"; -#else -FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " VERSION " 20070917"; +/* PACKAGE_VERSION should come from configure */ +FLAC_API const char *FLAC__VERSION_STRING = PACKAGE_VERSION; +FLAC_API const char *FLAC__VENDOR_STRING = "reference libFLAC " PACKAGE_VERSION " 20230623"; #endif FLAC_API const FLAC__byte FLAC__STREAM_SYNC_STRING[4] = { 'f','L','a','C' }; -FLAC_API const unsigned FLAC__STREAM_SYNC = 0x664C6143; -FLAC_API const unsigned FLAC__STREAM_SYNC_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_SYNC = 0x664C6143; +FLAC_API const uint32_t FLAC__STREAM_SYNC_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN = 16; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN = 16; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN = 24; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN = 24; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN = 20; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN = 3; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN = 5; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN = 36; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN = 128; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN = 16; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN = 16; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN = 24; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN = 24; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_SAMPLE_RATE_LEN = 20; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_CHANNELS_LEN = 3; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN = 5; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN = 36; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_STREAMINFO_MD5SUM_LEN = 128; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_APPLICATION_ID_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_APPLICATION_ID_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN = 64; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN = 64; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN = 16; /* bits */ FLAC_API const FLAC__uint64 FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER = FLAC__U64L(0xffffffffffffffff); -FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN = 32; /* bits */ - -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN = 64; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN = 8; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN = 3*8; /* bits */ - -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN = 64; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN = 8; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN = 12*8; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN = 1; /* bit */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN = 1; /* bit */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN = 6+13*8; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN = 8; /* bits */ - -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN = 128*8; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN = 64; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN = 1; /* bit */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN = 7+258*8; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN = 8; /* bits */ - -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_TYPE_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_COLORS_LEN = 32; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN = 32; /* bits */ - -FLAC_API const unsigned FLAC__STREAM_METADATA_IS_LAST_LEN = 1; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_TYPE_LEN = 7; /* bits */ -FLAC_API const unsigned FLAC__STREAM_METADATA_LENGTH_LEN = 24; /* bits */ - -FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC = 0x3ffe; -FLAC_API const unsigned FLAC__FRAME_HEADER_SYNC_LEN = 14; /* bits */ -FLAC_API const unsigned FLAC__FRAME_HEADER_RESERVED_LEN = 1; /* bits */ -FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN = 1; /* bits */ -FLAC_API const unsigned FLAC__FRAME_HEADER_BLOCK_SIZE_LEN = 4; /* bits */ -FLAC_API const unsigned FLAC__FRAME_HEADER_SAMPLE_RATE_LEN = 4; /* bits */ -FLAC_API const unsigned FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN = 4; /* bits */ -FLAC_API const unsigned FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN = 3; /* bits */ -FLAC_API const unsigned FLAC__FRAME_HEADER_ZERO_PAD_LEN = 1; /* bits */ -FLAC_API const unsigned FLAC__FRAME_HEADER_CRC_LEN = 8; /* bits */ - -FLAC_API const unsigned FLAC__FRAME_FOOTER_CRC_LEN = 16; /* bits */ - -FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_TYPE_LEN = 2; /* bits */ -FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN = 4; /* bits */ -FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN = 4; /* bits */ -FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN = 5; /* bits */ -FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN = 5; /* bits */ - -FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER = 15; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */ -FLAC_API const unsigned FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER = 31; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN = 32; /* bits */ + +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN = 64; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN = 8; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN = 3*8; /* bits */ + +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_OFFSET_LEN = 64; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_NUMBER_LEN = 8; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_ISRC_LEN = 12*8; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_TYPE_LEN = 1; /* bit */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_PRE_EMPHASIS_LEN = 1; /* bit */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_RESERVED_LEN = 6+13*8; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN = 8; /* bits */ + +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN = 128*8; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_LEAD_IN_LEN = 64; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_IS_CD_LEN = 1; /* bit */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_RESERVED_LEN = 7+258*8; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_CUESHEET_NUM_TRACKS_LEN = 8; /* bits */ + +FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_TYPE_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_COLORS_LEN = 32; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN = 32; /* bits */ + +FLAC_API const uint32_t FLAC__STREAM_METADATA_IS_LAST_LEN = 1; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_TYPE_LEN = 7; /* bits */ +FLAC_API const uint32_t FLAC__STREAM_METADATA_LENGTH_LEN = 24; /* bits */ + +FLAC_API const uint32_t FLAC__FRAME_HEADER_SYNC = 0x3ffe; +FLAC_API const uint32_t FLAC__FRAME_HEADER_SYNC_LEN = 14; /* bits */ +FLAC_API const uint32_t FLAC__FRAME_HEADER_RESERVED_LEN = 1; /* bits */ +FLAC_API const uint32_t FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN = 1; /* bits */ +FLAC_API const uint32_t FLAC__FRAME_HEADER_BLOCK_SIZE_LEN = 4; /* bits */ +FLAC_API const uint32_t FLAC__FRAME_HEADER_SAMPLE_RATE_LEN = 4; /* bits */ +FLAC_API const uint32_t FLAC__FRAME_HEADER_CHANNEL_ASSIGNMENT_LEN = 4; /* bits */ +FLAC_API const uint32_t FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN = 3; /* bits */ +FLAC_API const uint32_t FLAC__FRAME_HEADER_ZERO_PAD_LEN = 1; /* bits */ +FLAC_API const uint32_t FLAC__FRAME_HEADER_CRC_LEN = 8; /* bits */ + +FLAC_API const uint32_t FLAC__FRAME_FOOTER_CRC_LEN = 16; /* bits */ + +FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_TYPE_LEN = 2; /* bits */ +FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN = 4; /* bits */ +FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN = 4; /* bits */ +FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN = 5; /* bits */ +FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN = 5; /* bits */ + +FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER = 15; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN)-1 */ +FLAC_API const uint32_t FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER = 31; /* == (1<<FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN)-1 */ FLAC_API const char * const FLAC__EntropyCodingMethodTypeString[] = { "PARTITIONED_RICE", "PARTITIONED_RICE2" }; -FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN = 4; /* bits */ -FLAC_API const unsigned FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN = 5; /* bits */ +FLAC_API const uint32_t FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN = 4; /* bits */ +FLAC_API const uint32_t FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN = 5; /* bits */ -FLAC_API const unsigned FLAC__SUBFRAME_ZERO_PAD_LEN = 1; /* bits */ -FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LEN = 6; /* bits */ -FLAC_API const unsigned FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN = 1; /* bits */ +FLAC_API const uint32_t FLAC__SUBFRAME_ZERO_PAD_LEN = 1; /* bits */ +FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_LEN = 6; /* bits */ +FLAC_API const uint32_t FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN = 1; /* bits */ -FLAC_API const unsigned FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK = 0x00; -FLAC_API const unsigned FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK = 0x02; -FLAC_API const unsigned FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK = 0x10; -FLAC_API const unsigned FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK = 0x40; +FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK = 0x00; +FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK = 0x02; +FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK = 0x10; +FLAC_API const uint32_t FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK = 0x40; FLAC_API const char * const FLAC__SubframeTypeString[] = { "CONSTANT", @@ -214,23 +206,31 @@ FLAC_API const char * const FLAC__StreamMetadata_Picture_TypeString[] = { "Publisher/Studio logotype" }; -FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(unsigned sample_rate) +FLAC_API FLAC__bool FLAC__format_sample_rate_is_valid(uint32_t sample_rate) { - if(sample_rate == 0 || sample_rate > FLAC__MAX_SAMPLE_RATE) { + if(sample_rate > FLAC__MAX_SAMPLE_RATE) { return false; } else return true; } -FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate) +FLAC_API FLAC__bool FLAC__format_blocksize_is_subset(uint32_t blocksize, uint32_t sample_rate) +{ + if(blocksize > 16384) + return false; + else if(sample_rate <= 48000 && blocksize > 4608) + return false; + else + return true; +} + +FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(uint32_t sample_rate) { - if( - !FLAC__format_sample_rate_is_valid(sample_rate) || - ( - sample_rate >= (1u << 16) && - !(sample_rate % 1000 == 0 || sample_rate % 10 == 0) - ) + if( // sample rate is not subset if + !FLAC__format_sample_rate_is_valid(sample_rate) || // sample rate is invalid or + sample_rate >= ((1u << 16) * 10) || // sample rate is larger then or equal to 655360 or + (sample_rate >= (1u << 16) && sample_rate % 10 != 0) //sample rate is >= 65536 and not divisible by 10 ) { return false; } @@ -241,12 +241,15 @@ FLAC_API FLAC__bool FLAC__format_sample_rate_is_subset(unsigned sample_rate) /* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ FLAC_API FLAC__bool FLAC__format_seektable_is_legal(const FLAC__StreamMetadata_SeekTable *seek_table) { - unsigned i; + uint32_t i; FLAC__uint64 prev_sample_number = 0; FLAC__bool got_prev = false; FLAC__ASSERT(0 != seek_table); + if((FLAC__uint64)(seek_table->num_points) * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) + return false; + for(i = 0; i < seek_table->num_points; i++) { if(got_prev) { if( @@ -275,13 +278,16 @@ static int seekpoint_compare_(const FLAC__StreamMetadata_SeekPoint *l, const FLA } /* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ -FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table) +FLAC_API uint32_t FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *seek_table) { - unsigned i, j; + uint32_t i, j; FLAC__bool first; FLAC__ASSERT(0 != seek_table); + if (seek_table->num_points == 0) + return 0; + /* sort the seekpoints */ qsort(seek_table->points, seek_table->num_points, sizeof(FLAC__StreamMetadata_SeekPoint), (int (*)(const void *, const void *))seekpoint_compare_); @@ -313,7 +319,7 @@ FLAC_API unsigned FLAC__format_seektable_sort(FLAC__StreamMetadata_SeekTable *se * and a more clear explanation at the end of this section: * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 */ -static FLaC__INLINE unsigned utf8len_(const FLAC__byte *utf8) +static uint32_t utf8len_(const FLAC__byte *utf8) { FLAC__ASSERT(0 != utf8); if ((utf8[0] & 0x80) == 0) { @@ -363,11 +369,11 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_name_is_legal(const char *n return true; } -FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, unsigned length) +FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__byte *value, uint32_t length) { - if(length == (unsigned)(-1)) { + if(length == (uint32_t)(-1)) { while(*value) { - unsigned n = utf8len_(value); + uint32_t n = utf8len_(value); if(n == 0) return false; value += n; @@ -376,7 +382,7 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__ else { const FLAC__byte *end = value + length; while(value < end) { - unsigned n = utf8len_(value); + uint32_t n = utf8len_(value); if(n == 0) return false; value += n; @@ -387,7 +393,7 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_value_is_legal(const FLAC__ return true; } -FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, unsigned length) +FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte *entry, uint32_t length) { const FLAC__byte *s, *end; @@ -401,7 +407,7 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte * s++; /* skip '=' */ while(s < end) { - unsigned n = utf8len_(s); + uint32_t n = utf8len_(s); if(n == 0) return false; s += n; @@ -415,7 +421,7 @@ FLAC_API FLAC__bool FLAC__format_vorbiscomment_entry_is_legal(const FLAC__byte * /* @@@@ add to unit tests; it is already indirectly tested by the metadata_object tests */ FLAC_API FLAC__bool FLAC__format_cuesheet_is_legal(const FLAC__StreamMetadata_CueSheet *cue_sheet, FLAC__bool check_cd_da_subset, const char **violation) { - unsigned i, j; + uint32_t i, j; if(check_cd_da_subset) { if(cue_sheet->lead_in < 2 * 44100) { @@ -505,7 +511,7 @@ FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Pic } for(b = picture->description; *b; ) { - unsigned n = utf8len_(b); + uint32_t n = utf8len_(b); if(n == 0) { if(violation) *violation = "description string must be valid UTF-8"; return false; @@ -519,7 +525,8 @@ FLAC_API FLAC__bool FLAC__format_picture_is_legal(const FLAC__StreamMetadata_Pic /* * These routines are private to libFLAC */ -unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order) +#if 0 /* UNUSED */ +uint32_t FLAC__format_get_max_rice_partition_order(uint32_t blocksize, uint32_t predictor_order) { return FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order( @@ -528,20 +535,21 @@ unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order ); } +#endif -unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize) +uint32_t FLAC__format_get_max_rice_partition_order_from_blocksize(uint32_t blocksize) { - unsigned max_rice_partition_order = 0; + uint32_t max_rice_partition_order = 0; while(!(blocksize & 1)) { max_rice_partition_order++; blocksize >>= 1; } - return min(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order); + return flac_min(FLAC__MAX_RICE_PARTITION_ORDER, max_rice_partition_order); } -unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order) +uint32_t FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(uint32_t limit, uint32_t blocksize, uint32_t predictor_order) { - unsigned max_rice_partition_order = limit; + uint32_t max_rice_partition_order = limit; while(max_rice_partition_order > 0 && (blocksize >> max_rice_partition_order) <= predictor_order) max_rice_partition_order--; @@ -574,20 +582,27 @@ void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__En FLAC__format_entropy_coding_method_partitioned_rice_contents_init(object); } -FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order) +#if defined(_MSC_VER) +// silence three MSVC warnings 'result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)' +#pragma warning ( disable : 4334 ) +#endif + +FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, uint32_t max_partition_order) { FLAC__ASSERT(0 != object); - FLAC__ASSERT(object->capacity_by_order > 0 || (0 == object->parameters && 0 == object->raw_bits)); - - if(object->capacity_by_order < max_partition_order) { - if(0 == (object->parameters = (unsigned*)realloc(object->parameters, sizeof(unsigned)*((unsigned long long)1 << max_partition_order)))) + if(object->capacity_by_order < max_partition_order || object->parameters == NULL || object->raw_bits == NULL) { + if(0 == (object->parameters = safe_realloc_(object->parameters, sizeof(uint32_t)*(1 << max_partition_order)))) return false; - if(0 == (object->raw_bits = (unsigned*)realloc(object->raw_bits, sizeof(unsigned)*((unsigned long long)1 << max_partition_order)))) + if(0 == (object->raw_bits = safe_realloc_(object->raw_bits, sizeof(uint32_t)*(1 << max_partition_order)))) return false; - memset(object->raw_bits, 0, sizeof(unsigned)*((unsigned long long)1 << max_partition_order)); + memset(object->raw_bits, 0, sizeof(uint32_t)*(1 << max_partition_order)); object->capacity_by_order = max_partition_order; } return true; } + +#if defined(_MSC_VER) +#pragma warning ( default : 4334 ) +#endif diff --git a/3rdparty/libflac/src/libFLAC/ia32/Makefile.am b/3rdparty/libflac/src/libFLAC/ia32/Makefile.am deleted file mode 100644 index 04a5b9841dd..00000000000 --- a/3rdparty/libflac/src/libFLAC/ia32/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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. - -SUFFIXES = .nasm .lo - -STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh - -.nasm.lo: - $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) $(NASM) -f $(OBJ_FORMAT) -d OBJ_FORMAT_$(OBJ_FORMAT) -i$(srcdir)/ $< -o $@ - -noinst_LTLIBRARIES = libFLAC-asm.la -libFLAC_asm_la_SOURCES = \ - bitreader_asm.nasm \ - cpu_asm.nasm \ - fixed_asm.nasm \ - lpc_asm.nasm \ - nasm.h \ - stream_encoder_asm.nasm diff --git a/3rdparty/libflac/src/libFLAC/ia32/Makefile.in b/3rdparty/libflac/src/libFLAC/ia32/Makefile.in deleted file mode 100644 index 3a14b13bcc5..00000000000 --- a/3rdparty/libflac/src/libFLAC/ia32/Makefile.in +++ /dev/null @@ -1,487 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -SUFFIXES = .nasm .lo - -STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh - -noinst_LTLIBRARIES = libFLAC-asm.la -libFLAC_asm_la_SOURCES = \ - bitreader_asm.nasm \ - cpu_asm.nasm \ - fixed_asm.nasm \ - lpc_asm.nasm \ - nasm.h \ - stream_encoder_asm.nasm - -subdir = src/libFLAC/ia32 -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libFLAC_asm_la_LDFLAGS = -libFLAC_asm_la_LIBADD = -am_libFLAC_asm_la_OBJECTS = bitreader_asm.lo cpu_asm.lo fixed_asm.lo \ - lpc_asm.lo stream_encoder_asm.lo -libFLAC_asm_la_OBJECTS = $(am_libFLAC_asm_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libFLAC_asm_la_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(libFLAC_asm_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .nasm .lo -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libFLAC/ia32/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libFLAC-asm.la: $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_DEPENDENCIES) - $(LINK) $(libFLAC_asm_la_LDFLAGS) $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am - - -.nasm.lo: - $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) $(NASM) -f $(OBJ_FORMAT) -d OBJ_FORMAT_$(OBJ_FORMAT) -i$(srcdir)/ $< -o $@ -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/libFLAC/ia32/bitreader_asm.nasm b/3rdparty/libflac/src/libFLAC/ia32/bitreader_asm.nasm deleted file mode 100644 index 5d1bbfa4464..00000000000 --- a/3rdparty/libflac/src/libFLAC/ia32/bitreader_asm.nasm +++ /dev/null @@ -1,568 +0,0 @@ -; vim:filetype=nasm ts=8 - -; libFLAC - Free Lossless Audio Codec library -; Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; -; - Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; -; - Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; -; - Neither the name of the Xiph.org Foundation nor the names of its -; contributors may be used to endorse or promote products derived from -; this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR -; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -%include "nasm.h" - - data_section - -cextern FLAC__crc16_table ; unsigned FLAC__crc16_table[256]; -cextern bitreader_read_from_client_ ; FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br); - -cglobal FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap - - code_section - - -; ********************************************************************** -; -; void FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter) -; -; Some details like assertions and other checking is performed by the caller. - ALIGN 16 -cident FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap - - ;ASSERT(0 != br); - ;ASSERT(0 != br->buffer); - ; WATCHOUT: code only works if sizeof(brword)==32; we can make things much faster with this assertion - ;ASSERT(FLAC__BITS_PER_WORD == 32); - ;ASSERT(parameter < 32); - ; the above two asserts also guarantee that the binary part never straddles more than 2 words, so we don't have to loop to read it - - ;; peppered throughout the code at major checkpoints are keys like this as to where things are at that point in time - ;; [esp + 16] unsigned parameter - ;; [esp + 12] unsigned nvals - ;; [esp + 8] int vals[] - ;; [esp + 4] FLAC__BitReader *br - mov eax, [esp + 12] ; if(nvals == 0) - test eax, eax - ja .nvals_gt_0 - mov eax, 1 ; return true; - ret - -.nvals_gt_0: - push ebp - push ebx - push esi - push edi - sub esp, 4 - ;; [esp + 36] unsigned parameter - ;; [esp + 32] unsigned nvals - ;; [esp + 28] int vals[] - ;; [esp + 24] FLAC__BitReader *br - ;; [esp] ucbits - mov ebp, [esp + 24] ; ebp <- br == br->buffer - mov esi, [ebp + 16] ; esi <- br->consumed_words (aka 'cwords' in the C version) - mov ecx, [ebp + 20] ; ecx <- br->consumed_bits (aka 'cbits' in the C version) - xor edi, edi ; edi <- 0 'uval' - ;; ecx cbits - ;; esi cwords - ;; edi uval - ;; ebp br - ;; [ebp] br->buffer - ;; [ebp + 8] br->words - ;; [ebp + 12] br->bytes - ;; [ebp + 16] br->consumed_words - ;; [ebp + 20] br->consumed_bits - ;; [ebp + 24] br->read_crc - ;; [ebp + 28] br->crc16_align - - ; ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits; - mov eax, [ebp + 8] ; eax <- br->words - sub eax, esi ; eax <- br->words-cwords - shl eax, 2 ; eax <- (br->words-cwords)*FLAC__BYTES_PER_WORD - add eax, [ebp + 12] ; eax <- (br->words-cwords)*FLAC__BYTES_PER_WORD + br->bytes - shl eax, 3 ; eax <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - sub eax, ecx ; eax <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits - mov [esp], eax ; ucbits <- eax - - ALIGN 16 -.val_loop: ; while(1) { - - ; - ; read unary part - ; -.unary_loop: ; while(1) { - ;; ecx cbits - ;; esi cwords - ;; edi uval - ;; ebp br - cmp esi, [ebp + 8] ; while(cwords < br->words) /* if we've not consumed up to a partial tail word... */ - jae near .c1_next1 -.c1_loop: ; { - mov ebx, [ebp] - mov eax, [ebx + 4*esi] ; b = br->buffer[cwords] - mov edx, eax ; edx = br->buffer[cwords] (saved for later use) - shl eax, cl ; b = br->buffer[cwords] << cbits - test eax, eax ; (still have to test since cbits may be 0, thus ZF not updated for shl eax,0) - jz near .c1_next2 ; if(b) { - bsr ebx, eax - not ebx - and ebx, 31 ; ebx = 'i' = # of leading 0 bits in 'b' (eax) - add ecx, ebx ; cbits += i; - add edi, ebx ; uval += i; - add ecx, byte 1 ; cbits++; /* skip over stop bit */ - test ecx, ~31 - jz near .break1 ; if(cbits >= FLAC__BITS_PER_WORD) { /* faster way of testing if(cbits == FLAC__BITS_PER_WORD) */ - ; crc16_update_word_(br, br->buffer[cwords]); - push edi ; [need more registers] - bswap edx ; edx = br->buffer[cwords] swapped; now we can CRC the bytes from LSByte to MSByte which makes things much easier - mov ecx, [ebp + 28] ; ecx <- br->crc16_align - mov eax, [ebp + 24] ; ax <- br->read_crc (a.k.a. crc) -%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE - mov edi, _FLAC__crc16_table -%else - mov edi, FLAC__crc16_table -%endif - ;; eax (ax) crc a.k.a. br->read_crc - ;; ebx (bl) intermediate result index into FLAC__crc16_table[] - ;; ecx br->crc16_align - ;; edx byteswapped brword to CRC - ;; esi cwords - ;; edi unsigned FLAC__crc16_table[] - ;; ebp br - test ecx, ecx ; switch(br->crc16_align) ... - jnz .c0b4 ; [br->crc16_align is 0 the vast majority of the time so we optimize the common case] -.c0b0: xor dl, ah ; dl <- (crc>>8)^(word>>24) - movzx ebx, dl - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word>>24)] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word>>24)] -.c0b1: xor dh, ah ; dh <- (crc>>8)^((word>>16)&0xff)) - movzx ebx, dh - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))] - shr edx, 16 -.c0b2: xor dl, ah ; dl <- (crc>>8)^((word>>8)&0xff)) - movzx ebx, dl - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))] -.c0b3: xor dh, ah ; dh <- (crc>>8)^(word&0xff) - movzx ebx, dh - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word&0xff)] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word&0xff)] - movzx eax, ax - mov [ebp + 24], eax ; br->read_crc <- crc - pop edi - - add esi, byte 1 ; cwords++; - xor ecx, ecx ; cbits = 0; - ; } - jmp near .break1 ; goto break1; - ;; this section relocated out of the way for performance -.c0b4: - mov [ebp + 28], dword 0 ; br->crc16_align <- 0 - cmp ecx, 8 - je .c0b1 - shr edx, 16 - cmp ecx, 16 - je .c0b2 - jmp .c0b3 - - ;; this section relocated out of the way for performance -.c1b4: - mov [ebp + 28], dword 0 ; br->crc16_align <- 0 - cmp ecx, 8 - je .c1b1 - shr edx, 16 - cmp ecx, 16 - je .c1b2 - jmp .c1b3 - -.c1_next2: ; } else { - ;; ecx cbits - ;; edx current brword 'b' - ;; esi cwords - ;; edi uval - ;; ebp br - add edi, 32 - sub edi, ecx ; uval += FLAC__BITS_PER_WORD - cbits; - ; crc16_update_word_(br, br->buffer[cwords]); - push edi ; [need more registers] - bswap edx ; edx = br->buffer[cwords] swapped; now we can CRC the bytes from LSByte to MSByte which makes things much easier - mov ecx, [ebp + 28] ; ecx <- br->crc16_align - mov eax, [ebp + 24] ; ax <- br->read_crc (a.k.a. crc) -%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE - mov edi, _FLAC__crc16_table -%else - mov edi, FLAC__crc16_table -%endif - ;; eax (ax) crc a.k.a. br->read_crc - ;; ebx (bl) intermediate result index into FLAC__crc16_table[] - ;; ecx br->crc16_align - ;; edx byteswapped brword to CRC - ;; esi cwords - ;; edi unsigned FLAC__crc16_table[] - ;; ebp br - test ecx, ecx ; switch(br->crc16_align) ... - jnz .c1b4 ; [br->crc16_align is 0 the vast majority of the time so we optimize the common case] -.c1b0: xor dl, ah ; dl <- (crc>>8)^(word>>24) - movzx ebx, dl - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word>>24)] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word>>24)] -.c1b1: xor dh, ah ; dh <- (crc>>8)^((word>>16)&0xff)) - movzx ebx, dh - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))] - shr edx, 16 -.c1b2: xor dl, ah ; dl <- (crc>>8)^((word>>8)&0xff)) - movzx ebx, dl - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))] -.c1b3: xor dh, ah ; dh <- (crc>>8)^(word&0xff) - movzx ebx, dh - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word&0xff)] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word&0xff)] - movzx eax, ax - mov [ebp + 24], eax ; br->read_crc <- crc - pop edi - - add esi, byte 1 ; cwords++; - xor ecx, ecx ; cbits = 0; - ; /* didn't find stop bit yet, have to keep going... */ - ; } - - cmp esi, [ebp + 8] ; } while(cwords < br->words) /* if we've not consumed up to a partial tail word... */ - jb near .c1_loop - -.c1_next1: - ; at this point we've eaten up all the whole words; have to try - ; reading through any tail bytes before calling the read callback. - ; this is a repeat of the above logic adjusted for the fact we - ; don't have a whole word. note though if the client is feeding - ; us data a byte at a time (unlikely), br->consumed_bits may not - ; be zero. - ;; ecx cbits - ;; esi cwords - ;; edi uval - ;; ebp br - mov edx, [ebp + 12] ; edx <- br->bytes - test edx, edx - jz .read1 ; if(br->bytes) { [NOTE: this case is rare so it doesn't have to be all that fast ] - mov ebx, [ebp] - shl edx, 3 ; edx <- const unsigned end = br->bytes * 8; - mov eax, [ebx + 4*esi] ; b = br->buffer[cwords] - xchg edx, ecx ; [edx <- cbits , ecx <- end] - mov ebx, 0xffffffff ; ebx <- FLAC__WORD_ALL_ONES - shr ebx, cl ; ebx <- FLAC__WORD_ALL_ONES >> end - not ebx ; ebx <- ~(FLAC__WORD_ALL_ONES >> end) - xchg edx, ecx ; [edx <- end , ecx <- cbits] - and eax, ebx ; b = (br->buffer[cwords] & ~(FLAC__WORD_ALL_ONES >> end)); - shl eax, cl ; b = (br->buffer[cwords] & ~(FLAC__WORD_ALL_ONES >> end)) << cbits; - test eax, eax ; (still have to test since cbits may be 0, thus ZF not updated for shl eax,0) - jz .c1_next3 ; if(b) { - bsr ebx, eax - not ebx - and ebx, 31 ; ebx = 'i' = # of leading 0 bits in 'b' (eax) - add ecx, ebx ; cbits += i; - add edi, ebx ; uval += i; - add ecx, byte 1 ; cbits++; /* skip over stop bit */ - jmp short .break1 ; goto break1; -.c1_next3: ; } else { - sub edi, ecx - add edi, edx ; uval += end - cbits; - add ecx, edx ; cbits += end - ; /* didn't find stop bit yet, have to keep going... */ - ; } - ; } -.read1: - ; flush registers and read; bitreader_read_from_client_() does - ; not touch br->consumed_bits at all but we still need to set - ; it in case it fails and we have to return false. - ;; ecx cbits - ;; esi cwords - ;; edi uval - ;; ebp br - mov [ebp + 16], esi ; br->consumed_words = cwords; - mov [ebp + 20], ecx ; br->consumed_bits = cbits; - push ecx ; /* save */ - push ebp ; /* push br argument */ -%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE - call _bitreader_read_from_client_ -%else - call bitreader_read_from_client_ -%endif - pop edx ; /* discard, unused */ - pop ecx ; /* restore */ - mov esi, [ebp + 16] ; cwords = br->consumed_words; - ; ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits; - mov ebx, [ebp + 8] ; ebx <- br->words - sub ebx, esi ; ebx <- br->words-cwords - shl ebx, 2 ; ebx <- (br->words-cwords)*FLAC__BYTES_PER_WORD - add ebx, [ebp + 12] ; ebx <- (br->words-cwords)*FLAC__BYTES_PER_WORD + br->bytes - shl ebx, 3 ; ebx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - sub ebx, ecx ; ebx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits - add ebx, edi ; ebx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits + uval - ; + uval to offset our count by the # of unary bits already - ; consumed before the read, because we will add these back - ; in all at once at break1 - mov [esp], ebx ; ucbits <- ebx - test eax, eax ; if(!bitreader_read_from_client_(br)) - jnz near .unary_loop - jmp .end ; return false; /* eax (the return value) is already 0 */ - ; } /* end while(1) unary part */ - - ALIGN 16 -.break1: - ;; ecx cbits - ;; esi cwords - ;; edi uval - ;; ebp br - ;; [esp] ucbits - sub [esp], edi ; ucbits -= uval; - sub dword [esp], byte 1 ; ucbits--; /* account for stop bit */ - - ; - ; read binary part - ; - mov ebx, [esp + 36] ; ebx <- parameter - test ebx, ebx ; if(parameter) { - jz near .break2 -.read2: - cmp [esp], ebx ; while(ucbits < parameter) { - jae .c2_next1 - ; flush registers and read; bitreader_read_from_client_() does - ; not touch br->consumed_bits at all but we still need to set - ; it in case it fails and we have to return false. - mov [ebp + 16], esi ; br->consumed_words = cwords; - mov [ebp + 20], ecx ; br->consumed_bits = cbits; - push ecx ; /* save */ - push ebp ; /* push br argument */ -%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE - call _bitreader_read_from_client_ -%else - call bitreader_read_from_client_ -%endif - pop edx ; /* discard, unused */ - pop ecx ; /* restore */ - mov esi, [ebp + 16] ; cwords = br->consumed_words; - ; ucbits = (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits; - mov edx, [ebp + 8] ; edx <- br->words - sub edx, esi ; edx <- br->words-cwords - shl edx, 2 ; edx <- (br->words-cwords)*FLAC__BYTES_PER_WORD - add edx, [ebp + 12] ; edx <- (br->words-cwords)*FLAC__BYTES_PER_WORD + br->bytes - shl edx, 3 ; edx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - sub edx, ecx ; edx <- (br->words-cwords)*FLAC__BITS_PER_WORD + br->bytes*8 - cbits - mov [esp], edx ; ucbits <- edx - test eax, eax ; if(!bitreader_read_from_client_(br)) - jnz .read2 - jmp .end ; return false; /* eax (the return value) is already 0 */ - ; } -.c2_next1: - ;; ebx parameter - ;; ecx cbits - ;; esi cwords - ;; edi uval - ;; ebp br - ;; [esp] ucbits - cmp esi, [ebp + 8] ; if(cwords < br->words) { /* if we've not consumed up to a partial tail word... */ - jae near .c2_next2 - test ecx, ecx ; if(cbits) { - jz near .c2_next3 ; /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - mov eax, 32 - mov edx, [ebp] - sub eax, ecx ; const unsigned n = FLAC__BITS_PER_WORD - cbits; - mov edx, [edx + 4*esi] ; const brword word = br->buffer[cwords]; - cmp ebx, eax ; if(parameter < n) { - jae .c2_next4 - ; uval <<= parameter; - ; uval |= (word & (FLAC__WORD_ALL_ONES >> cbits)) >> (n-parameter); - shl edx, cl - xchg ebx, ecx - shld edi, edx, cl - add ebx, ecx ; cbits += parameter; - xchg ebx, ecx ; ebx <- parameter, ecx <- cbits - jmp .break2 ; goto break2; - ; } -.c2_next4: - ; uval <<= n; - ; uval |= word & (FLAC__WORD_ALL_ONES >> cbits); -%if 1 - rol edx, cl ; @@@@@@OPT: may be faster to use rol to save edx so we can restore it for CRC'ing - ; @@@@@@OPT: or put parameter in ch instead and free up ebx completely again -%else - shl edx, cl -%endif - xchg eax, ecx - shld edi, edx, cl - xchg eax, ecx -%if 1 - ror edx, cl ; restored. -%else - mov edx, [ebp] - mov edx, [edx + 4*esi] -%endif - ; crc16_update_word_(br, br->buffer[cwords]); - push edi ; [need more registers] - push ebx ; [need more registers] - push eax ; [need more registers] - bswap edx ; edx = br->buffer[cwords] swapped; now we can CRC the bytes from LSByte to MSByte which makes things much easier - mov ecx, [ebp + 28] ; ecx <- br->crc16_align - mov eax, [ebp + 24] ; ax <- br->read_crc (a.k.a. crc) -%ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE - mov edi, _FLAC__crc16_table -%else - mov edi, FLAC__crc16_table -%endif - ;; eax (ax) crc a.k.a. br->read_crc - ;; ebx (bl) intermediate result index into FLAC__crc16_table[] - ;; ecx br->crc16_align - ;; edx byteswapped brword to CRC - ;; esi cwords - ;; edi unsigned FLAC__crc16_table[] - ;; ebp br - test ecx, ecx ; switch(br->crc16_align) ... - jnz .c2b4 ; [br->crc16_align is 0 the vast majority of the time so we optimize the common case] -.c2b0: xor dl, ah ; dl <- (crc>>8)^(word>>24) - movzx ebx, dl - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word>>24)] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word>>24)] -.c2b1: xor dh, ah ; dh <- (crc>>8)^((word>>16)&0xff)) - movzx ebx, dh - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>16)&0xff))] - shr edx, 16 -.c2b2: xor dl, ah ; dl <- (crc>>8)^((word>>8)&0xff)) - movzx ebx, dl - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^((word>>8)&0xff))] -.c2b3: xor dh, ah ; dh <- (crc>>8)^(word&0xff) - movzx ebx, dh - mov ecx, [ebx*4 + edi] ; cx <- FLAC__crc16_table[(crc>>8)^(word&0xff)] - shl eax, 8 ; ax <- (crc<<8) - xor eax, ecx ; crc <- ax <- (crc<<8) ^ FLAC__crc16_table[(crc>>8)^(word&0xff)] - movzx eax, ax - mov [ebp + 24], eax ; br->read_crc <- crc - pop eax - pop ebx - pop edi - add esi, byte 1 ; cwords++; - mov ecx, ebx - sub ecx, eax ; cbits = parameter - n; - jz .break2 ; if(cbits) { /* parameter > n, i.e. if there are still bits left to read, there have to be less than 32 so they will all be in the next word */ - ; uval <<= cbits; - ; uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits)); - mov eax, [ebp] - mov eax, [eax + 4*esi] - shld edi, eax, cl - ; } - jmp .break2 ; goto break2; - - ;; this section relocated out of the way for performance -.c2b4: - mov [ebp + 28], dword 0 ; br->crc16_align <- 0 - cmp ecx, 8 - je .c2b1 - shr edx, 16 - cmp ecx, 16 - je .c2b2 - jmp .c2b3 - -.c2_next3: ; } else { - mov ecx, ebx ; cbits = parameter; - ; uval <<= cbits; - ; uval |= (br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits)); - mov eax, [ebp] - mov eax, [eax + 4*esi] - shld edi, eax, cl - jmp .break2 ; goto break2; - ; } -.c2_next2: ; } else { - ; in this case we're starting our read at a partial tail word; - ; the reader has guaranteed that we have at least 'parameter' - ; bits available to read, which makes this case simpler. - ; uval <<= parameter; - ; if(cbits) { - ; /* this also works when consumed_bits==0, it's just a little slower than necessary for that case */ - ; uval |= (br->buffer[cwords] & (FLAC__WORD_ALL_ONES >> cbits)) >> (FLAC__BITS_PER_WORD-cbits-parameter); - ; cbits += parameter; - ; goto break2; - ; } else { - ; cbits = parameter; - ; uval |= br->buffer[cwords] >> (FLAC__BITS_PER_WORD-cbits); - ; goto break2; - ; } - ; the above is much shorter in assembly: - mov eax, [ebp] - mov eax, [eax + 4*esi] ; eax <- br->buffer[cwords] - shl eax, cl ; eax <- br->buffer[cwords] << cbits - add ecx, ebx ; cbits += parameter - xchg ebx, ecx ; ebx <- cbits, ecx <- parameter - shld edi, eax, cl ; uval <<= parameter <<< 'parameter' bits of tail word - xchg ebx, ecx ; ebx <- parameter, ecx <- cbits - ; } - ; } -.break2: - sub [esp], ebx ; ucbits -= parameter; - - ; - ; compose the value - ; - mov ebx, [esp + 28] ; ebx <- vals - mov edx, edi ; edx <- uval - and edi, 1 ; edi <- uval & 1 - shr edx, 1 ; edx <- uval >> 1 - neg edi ; edi <- -(int)(uval & 1) - xor edx, edi ; edx <- (uval >> 1 ^ -(int)(uval & 1)) - mov [ebx], edx ; *vals <- edx - sub dword [esp + 32], byte 1 ; --nvals; - jz .finished ; if(nvals == 0) /* jump to finish */ - xor edi, edi ; uval = 0; - add dword [esp + 28], 4 ; ++vals - jmp .val_loop ; } - -.finished: - mov [ebp + 16], esi ; br->consumed_words = cwords; - mov [ebp + 20], ecx ; br->consumed_bits = cbits; - mov eax, 1 -.end: - add esp, 4 - pop edi - pop esi - pop ebx - pop ebp - ret - -end - -%ifdef OBJ_FORMAT_elf - section .note.GNU-stack noalloc -%endif diff --git a/3rdparty/libflac/src/libFLAC/ia32/cpu_asm.nasm b/3rdparty/libflac/src/libFLAC/ia32/cpu_asm.nasm deleted file mode 100644 index f5eb1102c2b..00000000000 --- a/3rdparty/libflac/src/libFLAC/ia32/cpu_asm.nasm +++ /dev/null @@ -1,121 +0,0 @@ -; vim:filetype=nasm ts=8 - -; libFLAC - Free Lossless Audio Codec library -; Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; -; - Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; -; - Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; -; - Neither the name of the Xiph.org Foundation nor the names of its -; contributors may be used to endorse or promote products derived from -; this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR -; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -%include "nasm.h" - - data_section - -cglobal FLAC__cpu_have_cpuid_asm_ia32 -cglobal FLAC__cpu_info_asm_ia32 -cglobal FLAC__cpu_info_extended_amd_asm_ia32 - - code_section - -; ********************************************************************** -; -; FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32() -; - -cident FLAC__cpu_have_cpuid_asm_ia32 - push ebx - pushfd - pop eax - mov edx, eax - xor eax, 0x00200000 - push eax - popfd - pushfd - pop eax - cmp eax, edx - jz .no_cpuid - mov eax, 1 - jmp .end -.no_cpuid: - xor eax, eax -.end: - pop ebx - ret - -; ********************************************************************** -; -; void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx) -; - -cident FLAC__cpu_info_asm_ia32 - ;[esp + 8] == flags_edx - ;[esp + 12] == flags_ecx - - push ebx - call FLAC__cpu_have_cpuid_asm_ia32 - test eax, eax - jz .no_cpuid - mov eax, 1 - cpuid - mov ebx, [esp + 8] - mov [ebx], edx - mov ebx, [esp + 12] - mov [ebx], ecx - jmp .end -.no_cpuid - xor eax, eax - mov ebx, [esp + 8] - mov [ebx], eax - mov ebx, [esp + 12] - mov [ebx], eax -.end - pop ebx - ret - -cident FLAC__cpu_info_extended_amd_asm_ia32 - push ebx - call FLAC__cpu_have_cpuid_asm_ia32 - test eax, eax - jz .no_cpuid - mov eax, 0x80000000 - cpuid - cmp eax, 0x80000001 - jb .no_cpuid - mov eax, 0x80000001 - cpuid - mov eax, edx - jmp .end -.no_cpuid - xor eax, eax -.end - pop ebx - ret - -end - -%ifdef OBJ_FORMAT_elf - section .note.GNU-stack noalloc -%endif diff --git a/3rdparty/libflac/src/libFLAC/ia32/fixed_asm.nasm b/3rdparty/libflac/src/libFLAC/ia32/fixed_asm.nasm deleted file mode 100644 index 0185f4d8763..00000000000 --- a/3rdparty/libflac/src/libFLAC/ia32/fixed_asm.nasm +++ /dev/null @@ -1,312 +0,0 @@ -; vim:filetype=nasm ts=8 - -; libFLAC - Free Lossless Audio Codec library -; Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; -; - Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; -; - Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; -; - Neither the name of the Xiph.org Foundation nor the names of its -; contributors may be used to endorse or promote products derived from -; this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR -; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -%include "nasm.h" - - data_section - -cglobal FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov - - code_section - -; ********************************************************************** -; -; unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 *data, unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]) -; { -; FLAC__int32 last_error_0 = data[-1]; -; FLAC__int32 last_error_1 = data[-1] - data[-2]; -; FLAC__int32 last_error_2 = last_error_1 - (data[-2] - data[-3]); -; FLAC__int32 last_error_3 = last_error_2 - (data[-2] - 2*data[-3] + data[-4]); -; FLAC__int32 error, save; -; FLAC__uint32 total_error_0 = 0, total_error_1 = 0, total_error_2 = 0, total_error_3 = 0, total_error_4 = 0; -; unsigned i, order; -; -; for(i = 0; i < data_len; i++) { -; error = data[i] ; total_error_0 += local_abs(error); save = error; -; error -= last_error_0; total_error_1 += local_abs(error); last_error_0 = save; save = error; -; error -= last_error_1; total_error_2 += local_abs(error); last_error_1 = save; save = error; -; error -= last_error_2; total_error_3 += local_abs(error); last_error_2 = save; save = error; -; error -= last_error_3; total_error_4 += local_abs(error); last_error_3 = save; -; } -; -; if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4)) -; order = 0; -; else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4)) -; order = 1; -; else if(total_error_2 < min(total_error_3, total_error_4)) -; order = 2; -; else if(total_error_3 < total_error_4) -; order = 3; -; else -; order = 4; -; -; residual_bits_per_sample[0] = (FLAC__float)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); -; residual_bits_per_sample[1] = (FLAC__float)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); -; residual_bits_per_sample[2] = (FLAC__float)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); -; residual_bits_per_sample[3] = (FLAC__float)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); -; residual_bits_per_sample[4] = (FLAC__float)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); -; -; return order; -; } - ALIGN 16 -cident FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov - - ; esp + 36 == data[] - ; esp + 40 == data_len - ; esp + 44 == residual_bits_per_sample[] - - push ebp - push ebx - push esi - push edi - sub esp, byte 16 - ; qword [esp] == temp space for loading FLAC__uint64s to FPU regs - - ; ebx == &data[i] - ; ecx == loop counter (i) - ; ebp == order - ; mm0 == total_error_1:total_error_0 - ; mm1 == total_error_2:total_error_3 - ; mm2 == :total_error_4 - ; mm3 == last_error_1:last_error_0 - ; mm4 == last_error_2:last_error_3 - - mov ecx, [esp + 40] ; ecx = data_len - test ecx, ecx - jz near .data_len_is_0 - - mov ebx, [esp + 36] ; ebx = data[] - movd mm3, [ebx - 4] ; mm3 = 0:last_error_0 - movd mm2, [ebx - 8] ; mm2 = 0:data[-2] - movd mm1, [ebx - 12] ; mm1 = 0:data[-3] - movd mm0, [ebx - 16] ; mm0 = 0:data[-4] - movq mm5, mm3 ; mm5 = 0:last_error_0 - psubd mm5, mm2 ; mm5 = 0:last_error_1 - punpckldq mm3, mm5 ; mm3 = last_error_1:last_error_0 - psubd mm2, mm1 ; mm2 = 0:data[-2] - data[-3] - psubd mm5, mm2 ; mm5 = 0:last_error_2 - movq mm4, mm5 ; mm4 = 0:last_error_2 - psubd mm4, mm2 ; mm4 = 0:last_error_2 - (data[-2] - data[-3]) - paddd mm4, mm1 ; mm4 = 0:last_error_2 - (data[-2] - 2 * data[-3]) - psubd mm4, mm0 ; mm4 = 0:last_error_3 - punpckldq mm4, mm5 ; mm4 = last_error_2:last_error_3 - pxor mm0, mm0 ; mm0 = total_error_1:total_error_0 - pxor mm1, mm1 ; mm1 = total_error_2:total_error_3 - pxor mm2, mm2 ; mm2 = 0:total_error_4 - - ALIGN 16 -.loop: - movd mm7, [ebx] ; mm7 = 0:error_0 - add ebx, byte 4 - movq mm6, mm7 ; mm6 = 0:error_0 - psubd mm7, mm3 ; mm7 = :error_1 - punpckldq mm6, mm7 ; mm6 = error_1:error_0 - movq mm5, mm6 ; mm5 = error_1:error_0 - movq mm7, mm6 ; mm7 = error_1:error_0 - psubd mm5, mm3 ; mm5 = error_2: - movq mm3, mm6 ; mm3 = error_1:error_0 - psrad mm6, 31 - pxor mm7, mm6 - psubd mm7, mm6 ; mm7 = abs(error_1):abs(error_0) - paddd mm0, mm7 ; mm0 = total_error_1:total_error_0 - movq mm6, mm5 ; mm6 = error_2: - psubd mm5, mm4 ; mm5 = error_3: - punpckhdq mm5, mm6 ; mm5 = error_2:error_3 - movq mm7, mm5 ; mm7 = error_2:error_3 - movq mm6, mm5 ; mm6 = error_2:error_3 - psubd mm5, mm4 ; mm5 = :error_4 - movq mm4, mm6 ; mm4 = error_2:error_3 - psrad mm6, 31 - pxor mm7, mm6 - psubd mm7, mm6 ; mm7 = abs(error_2):abs(error_3) - paddd mm1, mm7 ; mm1 = total_error_2:total_error_3 - movq mm6, mm5 ; mm6 = :error_4 - psrad mm5, 31 - pxor mm6, mm5 - psubd mm6, mm5 ; mm6 = :abs(error_4) - paddd mm2, mm6 ; mm2 = :total_error_4 - - dec ecx - jnz short .loop - -; if(total_error_0 < min(min(min(total_error_1, total_error_2), total_error_3), total_error_4)) -; order = 0; -; else if(total_error_1 < min(min(total_error_2, total_error_3), total_error_4)) -; order = 1; -; else if(total_error_2 < min(total_error_3, total_error_4)) -; order = 2; -; else if(total_error_3 < total_error_4) -; order = 3; -; else -; order = 4; - movq mm3, mm0 ; mm3 = total_error_1:total_error_0 - movd edi, mm2 ; edi = total_error_4 - movd esi, mm1 ; esi = total_error_3 - movd eax, mm0 ; eax = total_error_0 - punpckhdq mm1, mm1 ; mm1 = total_error_2:total_error_2 - punpckhdq mm3, mm3 ; mm3 = total_error_1:total_error_1 - movd edx, mm1 ; edx = total_error_2 - movd ecx, mm3 ; ecx = total_error_1 - - xor ebx, ebx - xor ebp, ebp - inc ebx - cmp ecx, eax - cmovb eax, ecx ; eax = min(total_error_0, total_error_1) - cmovbe ebp, ebx - inc ebx - cmp edx, eax - cmovb eax, edx ; eax = min(total_error_0, total_error_1, total_error_2) - cmovbe ebp, ebx - inc ebx - cmp esi, eax - cmovb eax, esi ; eax = min(total_error_0, total_error_1, total_error_2, total_error_3) - cmovbe ebp, ebx - inc ebx - cmp edi, eax - cmovb eax, edi ; eax = min(total_error_0, total_error_1, total_error_2, total_error_3, total_error_4) - cmovbe ebp, ebx - movd ebx, mm0 ; ebx = total_error_0 - emms - - ; residual_bits_per_sample[0] = (FLAC__float)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (FLAC__double)total_error_0 / (FLAC__double)data_len) / M_LN2 : 0.0); - ; residual_bits_per_sample[1] = (FLAC__float)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (FLAC__double)total_error_1 / (FLAC__double)data_len) / M_LN2 : 0.0); - ; residual_bits_per_sample[2] = (FLAC__float)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (FLAC__double)total_error_2 / (FLAC__double)data_len) / M_LN2 : 0.0); - ; residual_bits_per_sample[3] = (FLAC__float)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (FLAC__double)total_error_3 / (FLAC__double)data_len) / M_LN2 : 0.0); - ; residual_bits_per_sample[4] = (FLAC__float)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (FLAC__double)total_error_4 / (FLAC__double)data_len) / M_LN2 : 0.0); - xor eax, eax - fild dword [esp + 40] ; ST = data_len (NOTE: assumes data_len is <2gigs) -.rbps_0: - test ebx, ebx - jz .total_error_0_is_0 - fld1 ; ST = 1.0 data_len - mov [esp], ebx - mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_0 - mov ebx, [esp + 44] - fild qword [esp] ; ST = total_error_0 1.0 data_len - fdiv st2 ; ST = total_error_0/data_len 1.0 data_len - fldln2 ; ST = ln2 total_error_0/data_len 1.0 data_len - fmulp st1 ; ST = ln2*total_error_0/data_len 1.0 data_len - fyl2x ; ST = log2(ln2*total_error_0/data_len) data_len - fstp dword [ebx] ; residual_bits_per_sample[0] = log2(ln2*total_error_0/data_len) ST = data_len - jmp short .rbps_1 -.total_error_0_is_0: - mov ebx, [esp + 44] - mov [ebx], eax ; residual_bits_per_sample[0] = 0.0 -.rbps_1: - test ecx, ecx - jz .total_error_1_is_0 - fld1 ; ST = 1.0 data_len - mov [esp], ecx - mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_1 - fild qword [esp] ; ST = total_error_1 1.0 data_len - fdiv st2 ; ST = total_error_1/data_len 1.0 data_len - fldln2 ; ST = ln2 total_error_1/data_len 1.0 data_len - fmulp st1 ; ST = ln2*total_error_1/data_len 1.0 data_len - fyl2x ; ST = log2(ln2*total_error_1/data_len) data_len - fstp dword [ebx + 4] ; residual_bits_per_sample[1] = log2(ln2*total_error_1/data_len) ST = data_len - jmp short .rbps_2 -.total_error_1_is_0: - mov [ebx + 4], eax ; residual_bits_per_sample[1] = 0.0 -.rbps_2: - test edx, edx - jz .total_error_2_is_0 - fld1 ; ST = 1.0 data_len - mov [esp], edx - mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_2 - fild qword [esp] ; ST = total_error_2 1.0 data_len - fdiv st2 ; ST = total_error_2/data_len 1.0 data_len - fldln2 ; ST = ln2 total_error_2/data_len 1.0 data_len - fmulp st1 ; ST = ln2*total_error_2/data_len 1.0 data_len - fyl2x ; ST = log2(ln2*total_error_2/data_len) data_len - fstp dword [ebx + 8] ; residual_bits_per_sample[2] = log2(ln2*total_error_2/data_len) ST = data_len - jmp short .rbps_3 -.total_error_2_is_0: - mov [ebx + 8], eax ; residual_bits_per_sample[2] = 0.0 -.rbps_3: - test esi, esi - jz .total_error_3_is_0 - fld1 ; ST = 1.0 data_len - mov [esp], esi - mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_3 - fild qword [esp] ; ST = total_error_3 1.0 data_len - fdiv st2 ; ST = total_error_3/data_len 1.0 data_len - fldln2 ; ST = ln2 total_error_3/data_len 1.0 data_len - fmulp st1 ; ST = ln2*total_error_3/data_len 1.0 data_len - fyl2x ; ST = log2(ln2*total_error_3/data_len) data_len - fstp dword [ebx + 12] ; residual_bits_per_sample[3] = log2(ln2*total_error_3/data_len) ST = data_len - jmp short .rbps_4 -.total_error_3_is_0: - mov [ebx + 12], eax ; residual_bits_per_sample[3] = 0.0 -.rbps_4: - test edi, edi - jz .total_error_4_is_0 - fld1 ; ST = 1.0 data_len - mov [esp], edi - mov [esp + 4], eax ; [esp] = (FLAC__uint64)total_error_4 - fild qword [esp] ; ST = total_error_4 1.0 data_len - fdiv st2 ; ST = total_error_4/data_len 1.0 data_len - fldln2 ; ST = ln2 total_error_4/data_len 1.0 data_len - fmulp st1 ; ST = ln2*total_error_4/data_len 1.0 data_len - fyl2x ; ST = log2(ln2*total_error_4/data_len) data_len - fstp dword [ebx + 16] ; residual_bits_per_sample[4] = log2(ln2*total_error_4/data_len) ST = data_len - jmp short .rbps_end -.total_error_4_is_0: - mov [ebx + 16], eax ; residual_bits_per_sample[4] = 0.0 -.rbps_end: - fstp st0 ; ST = [empty] - jmp short .end -.data_len_is_0: - ; data_len == 0, so residual_bits_per_sample[*] = 0.0 - xor ebp, ebp - mov edi, [esp + 44] - mov [edi], ebp - mov [edi + 4], ebp - mov [edi + 8], ebp - mov [edi + 12], ebp - mov [edi + 16], ebp - add ebp, byte 4 ; order = 4 - -.end: - mov eax, ebp ; return order - add esp, byte 16 - pop edi - pop esi - pop ebx - pop ebp - ret - -end - -%ifdef OBJ_FORMAT_elf - section .note.GNU-stack noalloc -%endif diff --git a/3rdparty/libflac/src/libFLAC/ia32/lpc_asm.nasm b/3rdparty/libflac/src/libFLAC/ia32/lpc_asm.nasm deleted file mode 100644 index 4bc4c91326f..00000000000 --- a/3rdparty/libflac/src/libFLAC/ia32/lpc_asm.nasm +++ /dev/null @@ -1,1511 +0,0 @@ -; vim:filetype=nasm ts=8 - -; libFLAC - Free Lossless Audio Codec library -; Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; -; - Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; -; - Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; -; - Neither the name of the Xiph.org Foundation nor the names of its -; contributors may be used to endorse or promote products derived from -; this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR -; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -%include "nasm.h" - - data_section - -cglobal FLAC__lpc_compute_autocorrelation_asm_ia32 -cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4 -cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8 -cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12 -cglobal FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow -cglobal FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32 -cglobal FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx -cglobal FLAC__lpc_restore_signal_asm_ia32 -cglobal FLAC__lpc_restore_signal_asm_ia32_mmx - - code_section - -; ********************************************************************** -; -; void FLAC__lpc_compute_autocorrelation_asm(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]) -; { -; FLAC__real d; -; unsigned sample, coeff; -; const unsigned limit = data_len - lag; -; -; FLAC__ASSERT(lag > 0); -; FLAC__ASSERT(lag <= data_len); -; -; for(coeff = 0; coeff < lag; coeff++) -; autoc[coeff] = 0.0; -; for(sample = 0; sample <= limit; sample++) { -; d = data[sample]; -; for(coeff = 0; coeff < lag; coeff++) -; autoc[coeff] += d * data[sample+coeff]; -; } -; for(; sample < data_len; sample++) { -; d = data[sample]; -; for(coeff = 0; coeff < data_len - sample; coeff++) -; autoc[coeff] += d * data[sample+coeff]; -; } -; } -; - ALIGN 16 -cident FLAC__lpc_compute_autocorrelation_asm_ia32 - ;[esp + 28] == autoc[] - ;[esp + 24] == lag - ;[esp + 20] == data_len - ;[esp + 16] == data[] - - ;ASSERT(lag > 0) - ;ASSERT(lag <= 33) - ;ASSERT(lag <= data_len) - -.begin: - push esi - push edi - push ebx - - ; for(coeff = 0; coeff < lag; coeff++) - ; autoc[coeff] = 0.0; - mov edi, [esp + 28] ; edi == autoc - mov ecx, [esp + 24] ; ecx = # of dwords (=lag) of 0 to write - xor eax, eax - rep stosd - - ; const unsigned limit = data_len - lag; - mov eax, [esp + 24] ; eax == lag - mov ecx, [esp + 20] - sub ecx, eax ; ecx == limit - - mov edi, [esp + 28] ; edi == autoc - mov esi, [esp + 16] ; esi == data - inc ecx ; we are looping <= limit so we add one to the counter - - ; for(sample = 0; sample <= limit; sample++) { - ; d = data[sample]; - ; for(coeff = 0; coeff < lag; coeff++) - ; autoc[coeff] += d * data[sample+coeff]; - ; } - fld dword [esi] ; ST = d <- data[sample] - ; each iteration is 11 bytes so we need (-eax)*11, so we do (-12*eax + eax) - lea edx, [eax + eax*2] - neg edx - lea edx, [eax + edx*4 + .jumper1_0 - .get_eip1] - call .get_eip1 -.get_eip1: - pop ebx - add edx, ebx - inc edx ; compensate for the shorter opcode on the last iteration - inc edx ; compensate for the shorter opcode on the last iteration - inc edx ; compensate for the shorter opcode on the last iteration - cmp eax, 33 - jne .loop1_start - sub edx, byte 9 ; compensate for the longer opcodes on the first iteration -.loop1_start: - jmp edx - - fld st0 ; ST = d d - fmul dword [esi + (32*4)] ; ST = d*data[sample+32] d WATCHOUT: not a byte displacement here! - fadd dword [edi + (32*4)] ; ST = autoc[32]+d*data[sample+32] d WATCHOUT: not a byte displacement here! - fstp dword [edi + (32*4)] ; autoc[32]+=d*data[sample+32] ST = d WATCHOUT: not a byte displacement here! - fld st0 ; ST = d d - fmul dword [esi + (31*4)] ; ST = d*data[sample+31] d - fadd dword [edi + (31*4)] ; ST = autoc[31]+d*data[sample+31] d - fstp dword [edi + (31*4)] ; autoc[31]+=d*data[sample+31] ST = d - fld st0 ; ST = d d - fmul dword [esi + (30*4)] ; ST = d*data[sample+30] d - fadd dword [edi + (30*4)] ; ST = autoc[30]+d*data[sample+30] d - fstp dword [edi + (30*4)] ; autoc[30]+=d*data[sample+30] ST = d - fld st0 ; ST = d d - fmul dword [esi + (29*4)] ; ST = d*data[sample+29] d - fadd dword [edi + (29*4)] ; ST = autoc[29]+d*data[sample+29] d - fstp dword [edi + (29*4)] ; autoc[29]+=d*data[sample+29] ST = d - fld st0 ; ST = d d - fmul dword [esi + (28*4)] ; ST = d*data[sample+28] d - fadd dword [edi + (28*4)] ; ST = autoc[28]+d*data[sample+28] d - fstp dword [edi + (28*4)] ; autoc[28]+=d*data[sample+28] ST = d - fld st0 ; ST = d d - fmul dword [esi + (27*4)] ; ST = d*data[sample+27] d - fadd dword [edi + (27*4)] ; ST = autoc[27]+d*data[sample+27] d - fstp dword [edi + (27*4)] ; autoc[27]+=d*data[sample+27] ST = d - fld st0 ; ST = d d - fmul dword [esi + (26*4)] ; ST = d*data[sample+26] d - fadd dword [edi + (26*4)] ; ST = autoc[26]+d*data[sample+26] d - fstp dword [edi + (26*4)] ; autoc[26]+=d*data[sample+26] ST = d - fld st0 ; ST = d d - fmul dword [esi + (25*4)] ; ST = d*data[sample+25] d - fadd dword [edi + (25*4)] ; ST = autoc[25]+d*data[sample+25] d - fstp dword [edi + (25*4)] ; autoc[25]+=d*data[sample+25] ST = d - fld st0 ; ST = d d - fmul dword [esi + (24*4)] ; ST = d*data[sample+24] d - fadd dword [edi + (24*4)] ; ST = autoc[24]+d*data[sample+24] d - fstp dword [edi + (24*4)] ; autoc[24]+=d*data[sample+24] ST = d - fld st0 ; ST = d d - fmul dword [esi + (23*4)] ; ST = d*data[sample+23] d - fadd dword [edi + (23*4)] ; ST = autoc[23]+d*data[sample+23] d - fstp dword [edi + (23*4)] ; autoc[23]+=d*data[sample+23] ST = d - fld st0 ; ST = d d - fmul dword [esi + (22*4)] ; ST = d*data[sample+22] d - fadd dword [edi + (22*4)] ; ST = autoc[22]+d*data[sample+22] d - fstp dword [edi + (22*4)] ; autoc[22]+=d*data[sample+22] ST = d - fld st0 ; ST = d d - fmul dword [esi + (21*4)] ; ST = d*data[sample+21] d - fadd dword [edi + (21*4)] ; ST = autoc[21]+d*data[sample+21] d - fstp dword [edi + (21*4)] ; autoc[21]+=d*data[sample+21] ST = d - fld st0 ; ST = d d - fmul dword [esi + (20*4)] ; ST = d*data[sample+20] d - fadd dword [edi + (20*4)] ; ST = autoc[20]+d*data[sample+20] d - fstp dword [edi + (20*4)] ; autoc[20]+=d*data[sample+20] ST = d - fld st0 ; ST = d d - fmul dword [esi + (19*4)] ; ST = d*data[sample+19] d - fadd dword [edi + (19*4)] ; ST = autoc[19]+d*data[sample+19] d - fstp dword [edi + (19*4)] ; autoc[19]+=d*data[sample+19] ST = d - fld st0 ; ST = d d - fmul dword [esi + (18*4)] ; ST = d*data[sample+18] d - fadd dword [edi + (18*4)] ; ST = autoc[18]+d*data[sample+18] d - fstp dword [edi + (18*4)] ; autoc[18]+=d*data[sample+18] ST = d - fld st0 ; ST = d d - fmul dword [esi + (17*4)] ; ST = d*data[sample+17] d - fadd dword [edi + (17*4)] ; ST = autoc[17]+d*data[sample+17] d - fstp dword [edi + (17*4)] ; autoc[17]+=d*data[sample+17] ST = d - fld st0 ; ST = d d - fmul dword [esi + (16*4)] ; ST = d*data[sample+16] d - fadd dword [edi + (16*4)] ; ST = autoc[16]+d*data[sample+16] d - fstp dword [edi + (16*4)] ; autoc[16]+=d*data[sample+16] ST = d - fld st0 ; ST = d d - fmul dword [esi + (15*4)] ; ST = d*data[sample+15] d - fadd dword [edi + (15*4)] ; ST = autoc[15]+d*data[sample+15] d - fstp dword [edi + (15*4)] ; autoc[15]+=d*data[sample+15] ST = d - fld st0 ; ST = d d - fmul dword [esi + (14*4)] ; ST = d*data[sample+14] d - fadd dword [edi + (14*4)] ; ST = autoc[14]+d*data[sample+14] d - fstp dword [edi + (14*4)] ; autoc[14]+=d*data[sample+14] ST = d - fld st0 ; ST = d d - fmul dword [esi + (13*4)] ; ST = d*data[sample+13] d - fadd dword [edi + (13*4)] ; ST = autoc[13]+d*data[sample+13] d - fstp dword [edi + (13*4)] ; autoc[13]+=d*data[sample+13] ST = d - fld st0 ; ST = d d - fmul dword [esi + (12*4)] ; ST = d*data[sample+12] d - fadd dword [edi + (12*4)] ; ST = autoc[12]+d*data[sample+12] d - fstp dword [edi + (12*4)] ; autoc[12]+=d*data[sample+12] ST = d - fld st0 ; ST = d d - fmul dword [esi + (11*4)] ; ST = d*data[sample+11] d - fadd dword [edi + (11*4)] ; ST = autoc[11]+d*data[sample+11] d - fstp dword [edi + (11*4)] ; autoc[11]+=d*data[sample+11] ST = d - fld st0 ; ST = d d - fmul dword [esi + (10*4)] ; ST = d*data[sample+10] d - fadd dword [edi + (10*4)] ; ST = autoc[10]+d*data[sample+10] d - fstp dword [edi + (10*4)] ; autoc[10]+=d*data[sample+10] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 9*4)] ; ST = d*data[sample+9] d - fadd dword [edi + ( 9*4)] ; ST = autoc[9]+d*data[sample+9] d - fstp dword [edi + ( 9*4)] ; autoc[9]+=d*data[sample+9] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 8*4)] ; ST = d*data[sample+8] d - fadd dword [edi + ( 8*4)] ; ST = autoc[8]+d*data[sample+8] d - fstp dword [edi + ( 8*4)] ; autoc[8]+=d*data[sample+8] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 7*4)] ; ST = d*data[sample+7] d - fadd dword [edi + ( 7*4)] ; ST = autoc[7]+d*data[sample+7] d - fstp dword [edi + ( 7*4)] ; autoc[7]+=d*data[sample+7] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 6*4)] ; ST = d*data[sample+6] d - fadd dword [edi + ( 6*4)] ; ST = autoc[6]+d*data[sample+6] d - fstp dword [edi + ( 6*4)] ; autoc[6]+=d*data[sample+6] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 5*4)] ; ST = d*data[sample+4] d - fadd dword [edi + ( 5*4)] ; ST = autoc[4]+d*data[sample+4] d - fstp dword [edi + ( 5*4)] ; autoc[4]+=d*data[sample+4] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 4*4)] ; ST = d*data[sample+4] d - fadd dword [edi + ( 4*4)] ; ST = autoc[4]+d*data[sample+4] d - fstp dword [edi + ( 4*4)] ; autoc[4]+=d*data[sample+4] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 3*4)] ; ST = d*data[sample+3] d - fadd dword [edi + ( 3*4)] ; ST = autoc[3]+d*data[sample+3] d - fstp dword [edi + ( 3*4)] ; autoc[3]+=d*data[sample+3] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 2*4)] ; ST = d*data[sample+2] d - fadd dword [edi + ( 2*4)] ; ST = autoc[2]+d*data[sample+2] d - fstp dword [edi + ( 2*4)] ; autoc[2]+=d*data[sample+2] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 1*4)] ; ST = d*data[sample+1] d - fadd dword [edi + ( 1*4)] ; ST = autoc[1]+d*data[sample+1] d - fstp dword [edi + ( 1*4)] ; autoc[1]+=d*data[sample+1] ST = d - fld st0 ; ST = d d - fmul dword [esi] ; ST = d*data[sample] d WATCHOUT: no displacement byte here! - fadd dword [edi] ; ST = autoc[0]+d*data[sample] d WATCHOUT: no displacement byte here! - fstp dword [edi] ; autoc[0]+=d*data[sample] ST = d WATCHOUT: no displacement byte here! -.jumper1_0: - - fstp st0 ; pop d, ST = empty - add esi, byte 4 ; sample++ - dec ecx - jz .loop1_end - fld dword [esi] ; ST = d <- data[sample] - jmp edx -.loop1_end: - - ; for(; sample < data_len; sample++) { - ; d = data[sample]; - ; for(coeff = 0; coeff < data_len - sample; coeff++) - ; autoc[coeff] += d * data[sample+coeff]; - ; } - mov ecx, [esp + 24] ; ecx <- lag - dec ecx ; ecx <- lag - 1 - jz near .end ; skip loop if 0 (i.e. lag == 1) - - fld dword [esi] ; ST = d <- data[sample] - mov eax, ecx ; eax <- lag - 1 == data_len - sample the first time through - ; each iteration is 11 bytes so we need (-eax)*11, so we do (-12*eax + eax) - lea edx, [eax + eax*2] - neg edx - lea edx, [eax + edx*4 + .jumper2_0 - .get_eip2] - call .get_eip2 -.get_eip2: - pop ebx - add edx, ebx - inc edx ; compensate for the shorter opcode on the last iteration - inc edx ; compensate for the shorter opcode on the last iteration - inc edx ; compensate for the shorter opcode on the last iteration - jmp edx - - fld st0 ; ST = d d - fmul dword [esi + (31*4)] ; ST = d*data[sample+31] d - fadd dword [edi + (31*4)] ; ST = autoc[31]+d*data[sample+31] d - fstp dword [edi + (31*4)] ; autoc[31]+=d*data[sample+31] ST = d - fld st0 ; ST = d d - fmul dword [esi + (30*4)] ; ST = d*data[sample+30] d - fadd dword [edi + (30*4)] ; ST = autoc[30]+d*data[sample+30] d - fstp dword [edi + (30*4)] ; autoc[30]+=d*data[sample+30] ST = d - fld st0 ; ST = d d - fmul dword [esi + (29*4)] ; ST = d*data[sample+29] d - fadd dword [edi + (29*4)] ; ST = autoc[29]+d*data[sample+29] d - fstp dword [edi + (29*4)] ; autoc[29]+=d*data[sample+29] ST = d - fld st0 ; ST = d d - fmul dword [esi + (28*4)] ; ST = d*data[sample+28] d - fadd dword [edi + (28*4)] ; ST = autoc[28]+d*data[sample+28] d - fstp dword [edi + (28*4)] ; autoc[28]+=d*data[sample+28] ST = d - fld st0 ; ST = d d - fmul dword [esi + (27*4)] ; ST = d*data[sample+27] d - fadd dword [edi + (27*4)] ; ST = autoc[27]+d*data[sample+27] d - fstp dword [edi + (27*4)] ; autoc[27]+=d*data[sample+27] ST = d - fld st0 ; ST = d d - fmul dword [esi + (26*4)] ; ST = d*data[sample+26] d - fadd dword [edi + (26*4)] ; ST = autoc[26]+d*data[sample+26] d - fstp dword [edi + (26*4)] ; autoc[26]+=d*data[sample+26] ST = d - fld st0 ; ST = d d - fmul dword [esi + (25*4)] ; ST = d*data[sample+25] d - fadd dword [edi + (25*4)] ; ST = autoc[25]+d*data[sample+25] d - fstp dword [edi + (25*4)] ; autoc[25]+=d*data[sample+25] ST = d - fld st0 ; ST = d d - fmul dword [esi + (24*4)] ; ST = d*data[sample+24] d - fadd dword [edi + (24*4)] ; ST = autoc[24]+d*data[sample+24] d - fstp dword [edi + (24*4)] ; autoc[24]+=d*data[sample+24] ST = d - fld st0 ; ST = d d - fmul dword [esi + (23*4)] ; ST = d*data[sample+23] d - fadd dword [edi + (23*4)] ; ST = autoc[23]+d*data[sample+23] d - fstp dword [edi + (23*4)] ; autoc[23]+=d*data[sample+23] ST = d - fld st0 ; ST = d d - fmul dword [esi + (22*4)] ; ST = d*data[sample+22] d - fadd dword [edi + (22*4)] ; ST = autoc[22]+d*data[sample+22] d - fstp dword [edi + (22*4)] ; autoc[22]+=d*data[sample+22] ST = d - fld st0 ; ST = d d - fmul dword [esi + (21*4)] ; ST = d*data[sample+21] d - fadd dword [edi + (21*4)] ; ST = autoc[21]+d*data[sample+21] d - fstp dword [edi + (21*4)] ; autoc[21]+=d*data[sample+21] ST = d - fld st0 ; ST = d d - fmul dword [esi + (20*4)] ; ST = d*data[sample+20] d - fadd dword [edi + (20*4)] ; ST = autoc[20]+d*data[sample+20] d - fstp dword [edi + (20*4)] ; autoc[20]+=d*data[sample+20] ST = d - fld st0 ; ST = d d - fmul dword [esi + (19*4)] ; ST = d*data[sample+19] d - fadd dword [edi + (19*4)] ; ST = autoc[19]+d*data[sample+19] d - fstp dword [edi + (19*4)] ; autoc[19]+=d*data[sample+19] ST = d - fld st0 ; ST = d d - fmul dword [esi + (18*4)] ; ST = d*data[sample+18] d - fadd dword [edi + (18*4)] ; ST = autoc[18]+d*data[sample+18] d - fstp dword [edi + (18*4)] ; autoc[18]+=d*data[sample+18] ST = d - fld st0 ; ST = d d - fmul dword [esi + (17*4)] ; ST = d*data[sample+17] d - fadd dword [edi + (17*4)] ; ST = autoc[17]+d*data[sample+17] d - fstp dword [edi + (17*4)] ; autoc[17]+=d*data[sample+17] ST = d - fld st0 ; ST = d d - fmul dword [esi + (16*4)] ; ST = d*data[sample+16] d - fadd dword [edi + (16*4)] ; ST = autoc[16]+d*data[sample+16] d - fstp dword [edi + (16*4)] ; autoc[16]+=d*data[sample+16] ST = d - fld st0 ; ST = d d - fmul dword [esi + (15*4)] ; ST = d*data[sample+15] d - fadd dword [edi + (15*4)] ; ST = autoc[15]+d*data[sample+15] d - fstp dword [edi + (15*4)] ; autoc[15]+=d*data[sample+15] ST = d - fld st0 ; ST = d d - fmul dword [esi + (14*4)] ; ST = d*data[sample+14] d - fadd dword [edi + (14*4)] ; ST = autoc[14]+d*data[sample+14] d - fstp dword [edi + (14*4)] ; autoc[14]+=d*data[sample+14] ST = d - fld st0 ; ST = d d - fmul dword [esi + (13*4)] ; ST = d*data[sample+13] d - fadd dword [edi + (13*4)] ; ST = autoc[13]+d*data[sample+13] d - fstp dword [edi + (13*4)] ; autoc[13]+=d*data[sample+13] ST = d - fld st0 ; ST = d d - fmul dword [esi + (12*4)] ; ST = d*data[sample+12] d - fadd dword [edi + (12*4)] ; ST = autoc[12]+d*data[sample+12] d - fstp dword [edi + (12*4)] ; autoc[12]+=d*data[sample+12] ST = d - fld st0 ; ST = d d - fmul dword [esi + (11*4)] ; ST = d*data[sample+11] d - fadd dword [edi + (11*4)] ; ST = autoc[11]+d*data[sample+11] d - fstp dword [edi + (11*4)] ; autoc[11]+=d*data[sample+11] ST = d - fld st0 ; ST = d d - fmul dword [esi + (10*4)] ; ST = d*data[sample+10] d - fadd dword [edi + (10*4)] ; ST = autoc[10]+d*data[sample+10] d - fstp dword [edi + (10*4)] ; autoc[10]+=d*data[sample+10] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 9*4)] ; ST = d*data[sample+9] d - fadd dword [edi + ( 9*4)] ; ST = autoc[9]+d*data[sample+9] d - fstp dword [edi + ( 9*4)] ; autoc[9]+=d*data[sample+9] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 8*4)] ; ST = d*data[sample+8] d - fadd dword [edi + ( 8*4)] ; ST = autoc[8]+d*data[sample+8] d - fstp dword [edi + ( 8*4)] ; autoc[8]+=d*data[sample+8] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 7*4)] ; ST = d*data[sample+7] d - fadd dword [edi + ( 7*4)] ; ST = autoc[7]+d*data[sample+7] d - fstp dword [edi + ( 7*4)] ; autoc[7]+=d*data[sample+7] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 6*4)] ; ST = d*data[sample+6] d - fadd dword [edi + ( 6*4)] ; ST = autoc[6]+d*data[sample+6] d - fstp dword [edi + ( 6*4)] ; autoc[6]+=d*data[sample+6] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 5*4)] ; ST = d*data[sample+4] d - fadd dword [edi + ( 5*4)] ; ST = autoc[4]+d*data[sample+4] d - fstp dword [edi + ( 5*4)] ; autoc[4]+=d*data[sample+4] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 4*4)] ; ST = d*data[sample+4] d - fadd dword [edi + ( 4*4)] ; ST = autoc[4]+d*data[sample+4] d - fstp dword [edi + ( 4*4)] ; autoc[4]+=d*data[sample+4] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 3*4)] ; ST = d*data[sample+3] d - fadd dword [edi + ( 3*4)] ; ST = autoc[3]+d*data[sample+3] d - fstp dword [edi + ( 3*4)] ; autoc[3]+=d*data[sample+3] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 2*4)] ; ST = d*data[sample+2] d - fadd dword [edi + ( 2*4)] ; ST = autoc[2]+d*data[sample+2] d - fstp dword [edi + ( 2*4)] ; autoc[2]+=d*data[sample+2] ST = d - fld st0 ; ST = d d - fmul dword [esi + ( 1*4)] ; ST = d*data[sample+1] d - fadd dword [edi + ( 1*4)] ; ST = autoc[1]+d*data[sample+1] d - fstp dword [edi + ( 1*4)] ; autoc[1]+=d*data[sample+1] ST = d - fld st0 ; ST = d d - fmul dword [esi] ; ST = d*data[sample] d WATCHOUT: no displacement byte here! - fadd dword [edi] ; ST = autoc[0]+d*data[sample] d WATCHOUT: no displacement byte here! - fstp dword [edi] ; autoc[0]+=d*data[sample] ST = d WATCHOUT: no displacement byte here! -.jumper2_0: - - fstp st0 ; pop d, ST = empty - add esi, byte 4 ; sample++ - dec ecx - jz .loop2_end - add edx, byte 11 ; adjust our inner loop counter by adjusting the jump target - fld dword [esi] ; ST = d <- data[sample] - jmp edx -.loop2_end: - -.end: - pop ebx - pop edi - pop esi - ret - - ALIGN 16 -cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4 - ;[esp + 16] == autoc[] - ;[esp + 12] == lag - ;[esp + 8] == data_len - ;[esp + 4] == data[] - - ;ASSERT(lag > 0) - ;ASSERT(lag <= 4) - ;ASSERT(lag <= data_len) - - ; for(coeff = 0; coeff < lag; coeff++) - ; autoc[coeff] = 0.0; - xorps xmm5, xmm5 - - mov edx, [esp + 8] ; edx == data_len - mov eax, [esp + 4] ; eax == &data[sample] <- &data[0] - - movss xmm0, [eax] ; xmm0 = 0,0,0,data[0] - add eax, 4 - movaps xmm2, xmm0 ; xmm2 = 0,0,0,data[0] - shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0] -.warmup: ; xmm2 == data[sample-3],data[sample-2],data[sample-1],data[sample] - mulps xmm0, xmm2 ; xmm0 = xmm0 * xmm2 - addps xmm5, xmm0 ; xmm5 += xmm0 * xmm2 - dec edx - jz .loop_end - ALIGN 16 -.loop_start: - ; start by reading the next sample - movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample] - add eax, 4 - shufps xmm0, xmm0, 0 ; xmm0 = data[sample],data[sample],data[sample],data[sample] - shufps xmm2, xmm2, 93h ; 93h=2-1-0-3 => xmm2 gets rotated left by one float - movss xmm2, xmm0 - mulps xmm0, xmm2 ; xmm0 = xmm0 * xmm2 - addps xmm5, xmm0 ; xmm5 += xmm0 * xmm2 - dec edx - jnz .loop_start -.loop_end: - ; store autoc - mov edx, [esp + 16] ; edx == autoc - movups [edx], xmm5 - -.end: - ret - - ALIGN 16 -cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8 - ;[esp + 16] == autoc[] - ;[esp + 12] == lag - ;[esp + 8] == data_len - ;[esp + 4] == data[] - - ;ASSERT(lag > 0) - ;ASSERT(lag <= 8) - ;ASSERT(lag <= data_len) - - ; for(coeff = 0; coeff < lag; coeff++) - ; autoc[coeff] = 0.0; - xorps xmm5, xmm5 - xorps xmm6, xmm6 - - mov edx, [esp + 8] ; edx == data_len - mov eax, [esp + 4] ; eax == &data[sample] <- &data[0] - - movss xmm0, [eax] ; xmm0 = 0,0,0,data[0] - add eax, 4 - movaps xmm2, xmm0 ; xmm2 = 0,0,0,data[0] - shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0] - movaps xmm1, xmm0 ; xmm1 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0] - xorps xmm3, xmm3 ; xmm3 = 0,0,0,0 -.warmup: ; xmm3:xmm2 == data[sample-7],data[sample-6],...,data[sample] - mulps xmm0, xmm2 - mulps xmm1, xmm3 ; xmm1:xmm0 = xmm1:xmm0 * xmm3:xmm2 - addps xmm5, xmm0 - addps xmm6, xmm1 ; xmm6:xmm5 += xmm1:xmm0 * xmm3:xmm2 - dec edx - jz .loop_end - ALIGN 16 -.loop_start: - ; start by reading the next sample - movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample] - ; here we reorder the instructions; see the (#) indexes for a logical order - shufps xmm2, xmm2, 93h ; (3) 93h=2-1-0-3 => xmm2 gets rotated left by one float - add eax, 4 ; (0) - shufps xmm3, xmm3, 93h ; (4) 93h=2-1-0-3 => xmm3 gets rotated left by one float - shufps xmm0, xmm0, 0 ; (1) xmm0 = data[sample],data[sample],data[sample],data[sample] - movss xmm3, xmm2 ; (5) - movaps xmm1, xmm0 ; (2) xmm1 = data[sample],data[sample],data[sample],data[sample] - movss xmm2, xmm0 ; (6) - mulps xmm1, xmm3 ; (8) - mulps xmm0, xmm2 ; (7) xmm1:xmm0 = xmm1:xmm0 * xmm3:xmm2 - addps xmm6, xmm1 ; (10) - addps xmm5, xmm0 ; (9) xmm6:xmm5 += xmm1:xmm0 * xmm3:xmm2 - dec edx - jnz .loop_start -.loop_end: - ; store autoc - mov edx, [esp + 16] ; edx == autoc - movups [edx], xmm5 - movups [edx + 16], xmm6 - -.end: - ret - - ALIGN 16 -cident FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12 - ;[esp + 16] == autoc[] - ;[esp + 12] == lag - ;[esp + 8] == data_len - ;[esp + 4] == data[] - - ;ASSERT(lag > 0) - ;ASSERT(lag <= 12) - ;ASSERT(lag <= data_len) - - ; for(coeff = 0; coeff < lag; coeff++) - ; autoc[coeff] = 0.0; - xorps xmm5, xmm5 - xorps xmm6, xmm6 - xorps xmm7, xmm7 - - mov edx, [esp + 8] ; edx == data_len - mov eax, [esp + 4] ; eax == &data[sample] <- &data[0] - - movss xmm0, [eax] ; xmm0 = 0,0,0,data[0] - add eax, 4 - movaps xmm2, xmm0 ; xmm2 = 0,0,0,data[0] - shufps xmm0, xmm0, 0 ; xmm0 == data[sample],data[sample],data[sample],data[sample] = data[0],data[0],data[0],data[0] - xorps xmm3, xmm3 ; xmm3 = 0,0,0,0 - xorps xmm4, xmm4 ; xmm4 = 0,0,0,0 -.warmup: ; xmm3:xmm2 == data[sample-7],data[sample-6],...,data[sample] - movaps xmm1, xmm0 - mulps xmm1, xmm2 - addps xmm5, xmm1 - movaps xmm1, xmm0 - mulps xmm1, xmm3 - addps xmm6, xmm1 - mulps xmm0, xmm4 - addps xmm7, xmm0 ; xmm7:xmm6:xmm5 += xmm0:xmm0:xmm0 * xmm4:xmm3:xmm2 - dec edx - jz .loop_end - ALIGN 16 -.loop_start: - ; start by reading the next sample - movss xmm0, [eax] ; xmm0 = 0,0,0,data[sample] - add eax, 4 - shufps xmm0, xmm0, 0 ; xmm0 = data[sample],data[sample],data[sample],data[sample] - - ; shift xmm4:xmm3:xmm2 left by one float - shufps xmm2, xmm2, 93h ; 93h=2-1-0-3 => xmm2 gets rotated left by one float - shufps xmm3, xmm3, 93h ; 93h=2-1-0-3 => xmm3 gets rotated left by one float - shufps xmm4, xmm4, 93h ; 93h=2-1-0-3 => xmm4 gets rotated left by one float - movss xmm4, xmm3 - movss xmm3, xmm2 - movss xmm2, xmm0 - - ; xmm7:xmm6:xmm5 += xmm0:xmm0:xmm0 * xmm3:xmm3:xmm2 - movaps xmm1, xmm0 - mulps xmm1, xmm2 - addps xmm5, xmm1 - movaps xmm1, xmm0 - mulps xmm1, xmm3 - addps xmm6, xmm1 - mulps xmm0, xmm4 - addps xmm7, xmm0 - - dec edx - jnz .loop_start -.loop_end: - ; store autoc - mov edx, [esp + 16] ; edx == autoc - movups [edx], xmm5 - movups [edx + 16], xmm6 - movups [edx + 32], xmm7 - -.end: - ret - - ALIGN 16 -cident FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow - ;[ebp + 32] autoc - ;[ebp + 28] lag - ;[ebp + 24] data_len - ;[ebp + 20] data - - push ebp - push ebx - push esi - push edi - mov ebp, esp - - mov esi, [ebp + 20] - mov edi, [ebp + 24] - mov edx, [ebp + 28] - inc edx - and edx, byte -2 - mov eax, edx - neg eax - and esp, byte -8 - lea esp, [esp + 4 * eax] - mov ecx, edx - xor eax, eax -.loop0: - dec ecx - mov [esp + 4 * ecx], eax - jnz short .loop0 - - mov eax, edi - sub eax, edx - mov ebx, edx - and ebx, byte 1 - sub eax, ebx - lea ecx, [esi + 4 * eax - 12] - cmp esi, ecx - mov eax, esi - ja short .loop2_pre - ALIGN 16 ;4 nops -.loop1_i: - movd mm0, [eax] - movd mm2, [eax + 4] - movd mm4, [eax + 8] - movd mm6, [eax + 12] - mov ebx, edx - punpckldq mm0, mm0 - punpckldq mm2, mm2 - punpckldq mm4, mm4 - punpckldq mm6, mm6 - ALIGN 16 ;3 nops -.loop1_j: - sub ebx, byte 2 - movd mm1, [eax + 4 * ebx] - movd mm3, [eax + 4 * ebx + 4] - movd mm5, [eax + 4 * ebx + 8] - movd mm7, [eax + 4 * ebx + 12] - punpckldq mm1, mm3 - punpckldq mm3, mm5 - pfmul mm1, mm0 - punpckldq mm5, mm7 - pfmul mm3, mm2 - punpckldq mm7, [eax + 4 * ebx + 16] - pfmul mm5, mm4 - pfmul mm7, mm6 - pfadd mm1, mm3 - movq mm3, [esp + 4 * ebx] - pfadd mm5, mm7 - pfadd mm1, mm5 - pfadd mm3, mm1 - movq [esp + 4 * ebx], mm3 - jg short .loop1_j - - add eax, byte 16 - cmp eax, ecx - jb short .loop1_i - -.loop2_pre: - mov ebx, eax - sub eax, esi - shr eax, 2 - lea ecx, [esi + 4 * edi] - mov esi, ebx -.loop2_i: - movd mm0, [esi] - mov ebx, edi - sub ebx, eax - cmp ebx, edx - jbe short .loop2_j - mov ebx, edx -.loop2_j: - dec ebx - movd mm1, [esi + 4 * ebx] - pfmul mm1, mm0 - movd mm2, [esp + 4 * ebx] - pfadd mm1, mm2 - movd [esp + 4 * ebx], mm1 - - jnz short .loop2_j - - add esi, byte 4 - inc eax - cmp esi, ecx - jnz short .loop2_i - - mov edi, [ebp + 32] - mov edx, [ebp + 28] -.loop3: - dec edx - mov eax, [esp + 4 * edx] - mov [edi + 4 * edx], eax - jnz short .loop3 - - femms - - mov esp, ebp - pop edi - pop esi - pop ebx - pop ebp - ret - -;void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]) -; -; for(i = 0; i < data_len; i++) { -; sum = 0; -; for(j = 0; j < order; j++) -; sum += qlp_coeff[j] * data[i-j-1]; -; residual[i] = data[i] - (sum >> lp_quantization); -; } -; - ALIGN 16 -cident FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32 - ;[esp + 40] residual[] - ;[esp + 36] lp_quantization - ;[esp + 32] order - ;[esp + 28] qlp_coeff[] - ;[esp + 24] data_len - ;[esp + 20] data[] - - ;ASSERT(order > 0) - - push ebp - push ebx - push esi - push edi - - mov esi, [esp + 20] ; esi = data[] - mov edi, [esp + 40] ; edi = residual[] - mov eax, [esp + 32] ; eax = order - mov ebx, [esp + 24] ; ebx = data_len - - test ebx, ebx - jz near .end ; do nothing if data_len == 0 -.begin: - cmp eax, byte 1 - jg short .i_1more - - mov ecx, [esp + 28] - mov edx, [ecx] ; edx = qlp_coeff[0] - mov eax, [esi - 4] ; eax = data[-1] - mov cl, [esp + 36] ; cl = lp_quantization - ALIGN 16 -.i_1_loop_i: - imul eax, edx - sar eax, cl - neg eax - add eax, [esi] - mov [edi], eax - mov eax, [esi] - add edi, byte 4 - add esi, byte 4 - dec ebx - jnz .i_1_loop_i - - jmp .end - -.i_1more: - cmp eax, byte 32 ; for order <= 32 there is a faster routine - jbe short .i_32 - - ; This version is here just for completeness, since FLAC__MAX_LPC_ORDER == 32 - ALIGN 16 -.i_32more_loop_i: - xor ebp, ebp - mov ecx, [esp + 32] - mov edx, ecx - shl edx, 2 - add edx, [esp + 28] - neg ecx - ALIGN 16 -.i_32more_loop_j: - sub edx, byte 4 - mov eax, [edx] - imul eax, [esi + 4 * ecx] - add ebp, eax - inc ecx - jnz short .i_32more_loop_j - - mov cl, [esp + 36] - sar ebp, cl - neg ebp - add ebp, [esi] - mov [edi], ebp - add esi, byte 4 - add edi, byte 4 - - dec ebx - jnz .i_32more_loop_i - - jmp .end - -.i_32: - sub edi, esi - neg eax - lea edx, [eax + eax * 8 + .jumper_0 - .get_eip0] - call .get_eip0 -.get_eip0: - pop eax - add edx, eax - inc edx - mov eax, [esp + 28] ; eax = qlp_coeff[] - xor ebp, ebp - jmp edx - - mov ecx, [eax + 124] - imul ecx, [esi - 128] - add ebp, ecx - mov ecx, [eax + 120] - imul ecx, [esi - 124] - add ebp, ecx - mov ecx, [eax + 116] - imul ecx, [esi - 120] - add ebp, ecx - mov ecx, [eax + 112] - imul ecx, [esi - 116] - add ebp, ecx - mov ecx, [eax + 108] - imul ecx, [esi - 112] - add ebp, ecx - mov ecx, [eax + 104] - imul ecx, [esi - 108] - add ebp, ecx - mov ecx, [eax + 100] - imul ecx, [esi - 104] - add ebp, ecx - mov ecx, [eax + 96] - imul ecx, [esi - 100] - add ebp, ecx - mov ecx, [eax + 92] - imul ecx, [esi - 96] - add ebp, ecx - mov ecx, [eax + 88] - imul ecx, [esi - 92] - add ebp, ecx - mov ecx, [eax + 84] - imul ecx, [esi - 88] - add ebp, ecx - mov ecx, [eax + 80] - imul ecx, [esi - 84] - add ebp, ecx - mov ecx, [eax + 76] - imul ecx, [esi - 80] - add ebp, ecx - mov ecx, [eax + 72] - imul ecx, [esi - 76] - add ebp, ecx - mov ecx, [eax + 68] - imul ecx, [esi - 72] - add ebp, ecx - mov ecx, [eax + 64] - imul ecx, [esi - 68] - add ebp, ecx - mov ecx, [eax + 60] - imul ecx, [esi - 64] - add ebp, ecx - mov ecx, [eax + 56] - imul ecx, [esi - 60] - add ebp, ecx - mov ecx, [eax + 52] - imul ecx, [esi - 56] - add ebp, ecx - mov ecx, [eax + 48] - imul ecx, [esi - 52] - add ebp, ecx - mov ecx, [eax + 44] - imul ecx, [esi - 48] - add ebp, ecx - mov ecx, [eax + 40] - imul ecx, [esi - 44] - add ebp, ecx - mov ecx, [eax + 36] - imul ecx, [esi - 40] - add ebp, ecx - mov ecx, [eax + 32] - imul ecx, [esi - 36] - add ebp, ecx - mov ecx, [eax + 28] - imul ecx, [esi - 32] - add ebp, ecx - mov ecx, [eax + 24] - imul ecx, [esi - 28] - add ebp, ecx - mov ecx, [eax + 20] - imul ecx, [esi - 24] - add ebp, ecx - mov ecx, [eax + 16] - imul ecx, [esi - 20] - add ebp, ecx - mov ecx, [eax + 12] - imul ecx, [esi - 16] - add ebp, ecx - mov ecx, [eax + 8] - imul ecx, [esi - 12] - add ebp, ecx - mov ecx, [eax + 4] - imul ecx, [esi - 8] - add ebp, ecx - mov ecx, [eax] ; there is one byte missing - imul ecx, [esi - 4] - add ebp, ecx -.jumper_0: - - mov cl, [esp + 36] - sar ebp, cl - neg ebp - add ebp, [esi] - mov [edi + esi], ebp - add esi, byte 4 - - dec ebx - jz short .end - xor ebp, ebp - jmp edx - -.end: - pop edi - pop esi - pop ebx - pop ebp - ret - -; WATCHOUT: this routine works on 16 bit data which means bits-per-sample for -; the channel and qlp_coeffs must be <= 16. Especially note that this routine -; cannot be used for side-channel coded 16bps channels since the effective bps -; is 17. - ALIGN 16 -cident FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx - ;[esp + 40] residual[] - ;[esp + 36] lp_quantization - ;[esp + 32] order - ;[esp + 28] qlp_coeff[] - ;[esp + 24] data_len - ;[esp + 20] data[] - - ;ASSERT(order > 0) - - push ebp - push ebx - push esi - push edi - - mov esi, [esp + 20] ; esi = data[] - mov edi, [esp + 40] ; edi = residual[] - mov eax, [esp + 32] ; eax = order - mov ebx, [esp + 24] ; ebx = data_len - - test ebx, ebx - jz near .end ; do nothing if data_len == 0 - dec ebx - test ebx, ebx - jz near .last_one - - mov edx, [esp + 28] ; edx = qlp_coeff[] - movd mm6, [esp + 36] ; mm6 = 0:lp_quantization - mov ebp, esp - - and esp, 0xfffffff8 - - xor ecx, ecx -.copy_qlp_loop: - push word [edx + 4 * ecx] - inc ecx - cmp ecx, eax - jnz short .copy_qlp_loop - - and ecx, 0x3 - test ecx, ecx - je short .za_end - sub ecx, byte 4 -.za_loop: - push word 0 - inc eax - inc ecx - jnz short .za_loop -.za_end: - - movq mm5, [esp + 2 * eax - 8] - movd mm4, [esi - 16] - punpckldq mm4, [esi - 12] - movd mm0, [esi - 8] - punpckldq mm0, [esi - 4] - packssdw mm4, mm0 - - cmp eax, byte 4 - jnbe short .mmx_4more - - ALIGN 16 -.mmx_4_loop_i: - movd mm1, [esi] - movq mm3, mm4 - punpckldq mm1, [esi + 4] - psrlq mm4, 16 - movq mm0, mm1 - psllq mm0, 48 - por mm4, mm0 - movq mm2, mm4 - psrlq mm4, 16 - pxor mm0, mm0 - punpckhdq mm0, mm1 - pmaddwd mm3, mm5 - pmaddwd mm2, mm5 - psllq mm0, 16 - por mm4, mm0 - movq mm0, mm3 - punpckldq mm3, mm2 - punpckhdq mm0, mm2 - paddd mm3, mm0 - psrad mm3, mm6 - psubd mm1, mm3 - movd [edi], mm1 - punpckhdq mm1, mm1 - movd [edi + 4], mm1 - - add edi, byte 8 - add esi, byte 8 - - sub ebx, 2 - jg .mmx_4_loop_i - jmp .mmx_end - -.mmx_4more: - shl eax, 2 - neg eax - add eax, byte 16 - - ALIGN 16 -.mmx_4more_loop_i: - movd mm1, [esi] - punpckldq mm1, [esi + 4] - movq mm3, mm4 - psrlq mm4, 16 - movq mm0, mm1 - psllq mm0, 48 - por mm4, mm0 - movq mm2, mm4 - psrlq mm4, 16 - pxor mm0, mm0 - punpckhdq mm0, mm1 - pmaddwd mm3, mm5 - pmaddwd mm2, mm5 - psllq mm0, 16 - por mm4, mm0 - - mov ecx, esi - add ecx, eax - mov edx, esp - - ALIGN 16 -.mmx_4more_loop_j: - movd mm0, [ecx - 16] - movd mm7, [ecx - 8] - punpckldq mm0, [ecx - 12] - punpckldq mm7, [ecx - 4] - packssdw mm0, mm7 - pmaddwd mm0, [edx] - punpckhdq mm7, mm7 - paddd mm3, mm0 - movd mm0, [ecx - 12] - punpckldq mm0, [ecx - 8] - punpckldq mm7, [ecx] - packssdw mm0, mm7 - pmaddwd mm0, [edx] - paddd mm2, mm0 - - add edx, byte 8 - add ecx, byte 16 - cmp ecx, esi - jnz .mmx_4more_loop_j - - movq mm0, mm3 - punpckldq mm3, mm2 - punpckhdq mm0, mm2 - paddd mm3, mm0 - psrad mm3, mm6 - psubd mm1, mm3 - movd [edi], mm1 - punpckhdq mm1, mm1 - movd [edi + 4], mm1 - - add edi, byte 8 - add esi, byte 8 - - sub ebx, 2 - jg near .mmx_4more_loop_i - -.mmx_end: - emms - mov esp, ebp -.last_one: - mov eax, [esp + 32] - inc ebx - jnz near FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32.begin - -.end: - pop edi - pop esi - pop ebx - pop ebp - ret - -; ********************************************************************** -; -; void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]) -; { -; unsigned i, j; -; FLAC__int32 sum; -; -; FLAC__ASSERT(order > 0); -; -; for(i = 0; i < data_len; i++) { -; sum = 0; -; for(j = 0; j < order; j++) -; sum += qlp_coeff[j] * data[i-j-1]; -; data[i] = residual[i] + (sum >> lp_quantization); -; } -; } - ALIGN 16 -cident FLAC__lpc_restore_signal_asm_ia32 - ;[esp + 40] data[] - ;[esp + 36] lp_quantization - ;[esp + 32] order - ;[esp + 28] qlp_coeff[] - ;[esp + 24] data_len - ;[esp + 20] residual[] - - ;ASSERT(order > 0) - - push ebp - push ebx - push esi - push edi - - mov esi, [esp + 20] ; esi = residual[] - mov edi, [esp + 40] ; edi = data[] - mov eax, [esp + 32] ; eax = order - mov ebx, [esp + 24] ; ebx = data_len - - test ebx, ebx - jz near .end ; do nothing if data_len == 0 - -.begin: - cmp eax, byte 1 - jg short .x87_1more - - mov ecx, [esp + 28] - mov edx, [ecx] - mov eax, [edi - 4] - mov cl, [esp + 36] - ALIGN 16 -.x87_1_loop_i: - imul eax, edx - sar eax, cl - add eax, [esi] - mov [edi], eax - add esi, byte 4 - add edi, byte 4 - dec ebx - jnz .x87_1_loop_i - - jmp .end - -.x87_1more: - cmp eax, byte 32 ; for order <= 32 there is a faster routine - jbe short .x87_32 - - ; This version is here just for completeness, since FLAC__MAX_LPC_ORDER == 32 - ALIGN 16 -.x87_32more_loop_i: - xor ebp, ebp - mov ecx, [esp + 32] - mov edx, ecx - shl edx, 2 - add edx, [esp + 28] - neg ecx - ALIGN 16 -.x87_32more_loop_j: - sub edx, byte 4 - mov eax, [edx] - imul eax, [edi + 4 * ecx] - add ebp, eax - inc ecx - jnz short .x87_32more_loop_j - - mov cl, [esp + 36] - sar ebp, cl - add ebp, [esi] - mov [edi], ebp - add edi, byte 4 - add esi, byte 4 - - dec ebx - jnz .x87_32more_loop_i - - jmp .end - -.x87_32: - sub esi, edi - neg eax - lea edx, [eax + eax * 8 + .jumper_0 - .get_eip0] - call .get_eip0 -.get_eip0: - pop eax - add edx, eax - inc edx ; compensate for the shorter opcode on the last iteration - mov eax, [esp + 28] ; eax = qlp_coeff[] - xor ebp, ebp - jmp edx - - mov ecx, [eax + 124] ; ecx = qlp_coeff[31] - imul ecx, [edi - 128] ; ecx = qlp_coeff[31] * data[i-32] - add ebp, ecx ; sum += qlp_coeff[31] * data[i-32] - mov ecx, [eax + 120] ; ecx = qlp_coeff[30] - imul ecx, [edi - 124] ; ecx = qlp_coeff[30] * data[i-31] - add ebp, ecx ; sum += qlp_coeff[30] * data[i-31] - mov ecx, [eax + 116] ; ecx = qlp_coeff[29] - imul ecx, [edi - 120] ; ecx = qlp_coeff[29] * data[i-30] - add ebp, ecx ; sum += qlp_coeff[29] * data[i-30] - mov ecx, [eax + 112] ; ecx = qlp_coeff[28] - imul ecx, [edi - 116] ; ecx = qlp_coeff[28] * data[i-29] - add ebp, ecx ; sum += qlp_coeff[28] * data[i-29] - mov ecx, [eax + 108] ; ecx = qlp_coeff[27] - imul ecx, [edi - 112] ; ecx = qlp_coeff[27] * data[i-28] - add ebp, ecx ; sum += qlp_coeff[27] * data[i-28] - mov ecx, [eax + 104] ; ecx = qlp_coeff[26] - imul ecx, [edi - 108] ; ecx = qlp_coeff[26] * data[i-27] - add ebp, ecx ; sum += qlp_coeff[26] * data[i-27] - mov ecx, [eax + 100] ; ecx = qlp_coeff[25] - imul ecx, [edi - 104] ; ecx = qlp_coeff[25] * data[i-26] - add ebp, ecx ; sum += qlp_coeff[25] * data[i-26] - mov ecx, [eax + 96] ; ecx = qlp_coeff[24] - imul ecx, [edi - 100] ; ecx = qlp_coeff[24] * data[i-25] - add ebp, ecx ; sum += qlp_coeff[24] * data[i-25] - mov ecx, [eax + 92] ; ecx = qlp_coeff[23] - imul ecx, [edi - 96] ; ecx = qlp_coeff[23] * data[i-24] - add ebp, ecx ; sum += qlp_coeff[23] * data[i-24] - mov ecx, [eax + 88] ; ecx = qlp_coeff[22] - imul ecx, [edi - 92] ; ecx = qlp_coeff[22] * data[i-23] - add ebp, ecx ; sum += qlp_coeff[22] * data[i-23] - mov ecx, [eax + 84] ; ecx = qlp_coeff[21] - imul ecx, [edi - 88] ; ecx = qlp_coeff[21] * data[i-22] - add ebp, ecx ; sum += qlp_coeff[21] * data[i-22] - mov ecx, [eax + 80] ; ecx = qlp_coeff[20] - imul ecx, [edi - 84] ; ecx = qlp_coeff[20] * data[i-21] - add ebp, ecx ; sum += qlp_coeff[20] * data[i-21] - mov ecx, [eax + 76] ; ecx = qlp_coeff[19] - imul ecx, [edi - 80] ; ecx = qlp_coeff[19] * data[i-20] - add ebp, ecx ; sum += qlp_coeff[19] * data[i-20] - mov ecx, [eax + 72] ; ecx = qlp_coeff[18] - imul ecx, [edi - 76] ; ecx = qlp_coeff[18] * data[i-19] - add ebp, ecx ; sum += qlp_coeff[18] * data[i-19] - mov ecx, [eax + 68] ; ecx = qlp_coeff[17] - imul ecx, [edi - 72] ; ecx = qlp_coeff[17] * data[i-18] - add ebp, ecx ; sum += qlp_coeff[17] * data[i-18] - mov ecx, [eax + 64] ; ecx = qlp_coeff[16] - imul ecx, [edi - 68] ; ecx = qlp_coeff[16] * data[i-17] - add ebp, ecx ; sum += qlp_coeff[16] * data[i-17] - mov ecx, [eax + 60] ; ecx = qlp_coeff[15] - imul ecx, [edi - 64] ; ecx = qlp_coeff[15] * data[i-16] - add ebp, ecx ; sum += qlp_coeff[15] * data[i-16] - mov ecx, [eax + 56] ; ecx = qlp_coeff[14] - imul ecx, [edi - 60] ; ecx = qlp_coeff[14] * data[i-15] - add ebp, ecx ; sum += qlp_coeff[14] * data[i-15] - mov ecx, [eax + 52] ; ecx = qlp_coeff[13] - imul ecx, [edi - 56] ; ecx = qlp_coeff[13] * data[i-14] - add ebp, ecx ; sum += qlp_coeff[13] * data[i-14] - mov ecx, [eax + 48] ; ecx = qlp_coeff[12] - imul ecx, [edi - 52] ; ecx = qlp_coeff[12] * data[i-13] - add ebp, ecx ; sum += qlp_coeff[12] * data[i-13] - mov ecx, [eax + 44] ; ecx = qlp_coeff[11] - imul ecx, [edi - 48] ; ecx = qlp_coeff[11] * data[i-12] - add ebp, ecx ; sum += qlp_coeff[11] * data[i-12] - mov ecx, [eax + 40] ; ecx = qlp_coeff[10] - imul ecx, [edi - 44] ; ecx = qlp_coeff[10] * data[i-11] - add ebp, ecx ; sum += qlp_coeff[10] * data[i-11] - mov ecx, [eax + 36] ; ecx = qlp_coeff[ 9] - imul ecx, [edi - 40] ; ecx = qlp_coeff[ 9] * data[i-10] - add ebp, ecx ; sum += qlp_coeff[ 9] * data[i-10] - mov ecx, [eax + 32] ; ecx = qlp_coeff[ 8] - imul ecx, [edi - 36] ; ecx = qlp_coeff[ 8] * data[i- 9] - add ebp, ecx ; sum += qlp_coeff[ 8] * data[i- 9] - mov ecx, [eax + 28] ; ecx = qlp_coeff[ 7] - imul ecx, [edi - 32] ; ecx = qlp_coeff[ 7] * data[i- 8] - add ebp, ecx ; sum += qlp_coeff[ 7] * data[i- 8] - mov ecx, [eax + 24] ; ecx = qlp_coeff[ 6] - imul ecx, [edi - 28] ; ecx = qlp_coeff[ 6] * data[i- 7] - add ebp, ecx ; sum += qlp_coeff[ 6] * data[i- 7] - mov ecx, [eax + 20] ; ecx = qlp_coeff[ 5] - imul ecx, [edi - 24] ; ecx = qlp_coeff[ 5] * data[i- 6] - add ebp, ecx ; sum += qlp_coeff[ 5] * data[i- 6] - mov ecx, [eax + 16] ; ecx = qlp_coeff[ 4] - imul ecx, [edi - 20] ; ecx = qlp_coeff[ 4] * data[i- 5] - add ebp, ecx ; sum += qlp_coeff[ 4] * data[i- 5] - mov ecx, [eax + 12] ; ecx = qlp_coeff[ 3] - imul ecx, [edi - 16] ; ecx = qlp_coeff[ 3] * data[i- 4] - add ebp, ecx ; sum += qlp_coeff[ 3] * data[i- 4] - mov ecx, [eax + 8] ; ecx = qlp_coeff[ 2] - imul ecx, [edi - 12] ; ecx = qlp_coeff[ 2] * data[i- 3] - add ebp, ecx ; sum += qlp_coeff[ 2] * data[i- 3] - mov ecx, [eax + 4] ; ecx = qlp_coeff[ 1] - imul ecx, [edi - 8] ; ecx = qlp_coeff[ 1] * data[i- 2] - add ebp, ecx ; sum += qlp_coeff[ 1] * data[i- 2] - mov ecx, [eax] ; ecx = qlp_coeff[ 0] (NOTE: one byte missing from instruction) - imul ecx, [edi - 4] ; ecx = qlp_coeff[ 0] * data[i- 1] - add ebp, ecx ; sum += qlp_coeff[ 0] * data[i- 1] -.jumper_0: - - mov cl, [esp + 36] - sar ebp, cl ; ebp = (sum >> lp_quantization) - add ebp, [esi + edi] ; ebp = residual[i] + (sum >> lp_quantization) - mov [edi], ebp ; data[i] = residual[i] + (sum >> lp_quantization) - add edi, byte 4 - - dec ebx - jz short .end - xor ebp, ebp - jmp edx - -.end: - pop edi - pop esi - pop ebx - pop ebp - ret - -; WATCHOUT: this routine works on 16 bit data which means bits-per-sample for -; the channel and qlp_coeffs must be <= 16. Especially note that this routine -; cannot be used for side-channel coded 16bps channels since the effective bps -; is 17. -; WATCHOUT: this routine requires that each data array have a buffer of up to -; 3 zeroes in front (at negative indices) for alignment purposes, i.e. for each -; channel n, data[n][-1] through data[n][-3] should be accessible and zero. - ALIGN 16 -cident FLAC__lpc_restore_signal_asm_ia32_mmx - ;[esp + 40] data[] - ;[esp + 36] lp_quantization - ;[esp + 32] order - ;[esp + 28] qlp_coeff[] - ;[esp + 24] data_len - ;[esp + 20] residual[] - - ;ASSERT(order > 0) - - push ebp - push ebx - push esi - push edi - - mov esi, [esp + 20] - mov edi, [esp + 40] - mov eax, [esp + 32] - mov ebx, [esp + 24] - - test ebx, ebx - jz near .end ; do nothing if data_len == 0 - cmp eax, byte 4 - jb near FLAC__lpc_restore_signal_asm_ia32.begin - - mov edx, [esp + 28] - movd mm6, [esp + 36] - mov ebp, esp - - and esp, 0xfffffff8 - - xor ecx, ecx -.copy_qlp_loop: - push word [edx + 4 * ecx] - inc ecx - cmp ecx, eax - jnz short .copy_qlp_loop - - and ecx, 0x3 - test ecx, ecx - je short .za_end - sub ecx, byte 4 -.za_loop: - push word 0 - inc eax - inc ecx - jnz short .za_loop -.za_end: - - movq mm5, [esp + 2 * eax - 8] - movd mm4, [edi - 16] - punpckldq mm4, [edi - 12] - movd mm0, [edi - 8] - punpckldq mm0, [edi - 4] - packssdw mm4, mm0 - - cmp eax, byte 4 - jnbe short .mmx_4more - - ALIGN 16 -.mmx_4_loop_i: - movq mm7, mm4 - pmaddwd mm7, mm5 - movq mm0, mm7 - punpckhdq mm7, mm7 - paddd mm7, mm0 - psrad mm7, mm6 - movd mm1, [esi] - paddd mm7, mm1 - movd [edi], mm7 - psllq mm7, 48 - psrlq mm4, 16 - por mm4, mm7 - - add esi, byte 4 - add edi, byte 4 - - dec ebx - jnz .mmx_4_loop_i - jmp .mmx_end -.mmx_4more: - shl eax, 2 - neg eax - add eax, byte 16 - ALIGN 16 -.mmx_4more_loop_i: - mov ecx, edi - add ecx, eax - mov edx, esp - - movq mm7, mm4 - pmaddwd mm7, mm5 - - ALIGN 16 -.mmx_4more_loop_j: - movd mm0, [ecx - 16] - punpckldq mm0, [ecx - 12] - movd mm1, [ecx - 8] - punpckldq mm1, [ecx - 4] - packssdw mm0, mm1 - pmaddwd mm0, [edx] - paddd mm7, mm0 - - add edx, byte 8 - add ecx, byte 16 - cmp ecx, edi - jnz .mmx_4more_loop_j - - movq mm0, mm7 - punpckhdq mm7, mm7 - paddd mm7, mm0 - psrad mm7, mm6 - movd mm1, [esi] - paddd mm7, mm1 - movd [edi], mm7 - psllq mm7, 48 - psrlq mm4, 16 - por mm4, mm7 - - add esi, byte 4 - add edi, byte 4 - - dec ebx - jnz short .mmx_4more_loop_i -.mmx_end: - emms - mov esp, ebp - -.end: - pop edi - pop esi - pop ebx - pop ebp - ret - -end - -%ifdef OBJ_FORMAT_elf - section .note.GNU-stack noalloc -%endif diff --git a/3rdparty/libflac/src/libFLAC/ia32/nasm.h b/3rdparty/libflac/src/libFLAC/ia32/nasm.h deleted file mode 100644 index 215498d811e..00000000000 --- a/3rdparty/libflac/src/libFLAC/ia32/nasm.h +++ /dev/null @@ -1,75 +0,0 @@ -; libFLAC - Free Lossless Audio Codec library -; Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -; -; 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. - - bits 32 - -%ifdef OBJ_FORMAT_win32 - %define FLAC__PUBLIC_NEEDS_UNDERSCORE - %idefine code_section section .text align=16 class=CODE use32 - %idefine data_section section .data align=32 class=DATA use32 - %idefine bss_section section .bss align=32 class=DATA use32 -%elifdef OBJ_FORMAT_aout - %define FLAC__PUBLIC_NEEDS_UNDERSCORE - %idefine code_section section .text - %idefine data_section section .data - %idefine bss_section section .bss -%elifdef OBJ_FORMAT_aoutb - %define FLAC__PUBLIC_NEEDS_UNDERSCORE - %idefine code_section section .text - %idefine data_section section .data - %idefine bss_section section .bss -%elifdef OBJ_FORMAT_elf - %idefine code_section section .text align=16 - %idefine data_section section .data align=32 - %idefine bss_section section .bss align=32 -%else - %error unsupported object format! -%endif - -%imacro cglobal 1 - %ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE - global _%1 - %else - global %1 - %endif -%endmacro - -%imacro cextern 1 - %ifdef FLAC__PUBLIC_NEEDS_UNDERSCORE - extern _%1 - %else - extern %1 - %endif -%endmacro - -%imacro cident 1 -_%1: -%1: -%endmacro diff --git a/3rdparty/libflac/src/libFLAC/ia32/stream_encoder_asm.nasm b/3rdparty/libflac/src/libFLAC/ia32/stream_encoder_asm.nasm deleted file mode 100644 index b7ecef8cd94..00000000000 --- a/3rdparty/libflac/src/libFLAC/ia32/stream_encoder_asm.nasm +++ /dev/null @@ -1,159 +0,0 @@ -; vim:filetype=nasm ts=8 - -; libFLAC - Free Lossless Audio Codec library -; Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; -; - Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; -; - Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; -; - Neither the name of the Xiph.org Foundation nor the names of its -; contributors may be used to endorse or promote products derived from -; this software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -; ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR -; CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -%include "nasm.h" - - data_section - -cglobal precompute_partition_info_sums_32bit_asm_ia32_ - - code_section - - -; ********************************************************************** -; -; void FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter) -; void precompute_partition_info_sums_32bit_( -; const FLAC__int32 residual[], -; FLAC__uint64 abs_residual_partition_sums[], -; unsigned blocksize, -; unsigned predictor_order, -; unsigned min_partition_order, -; unsigned max_partition_order -; ) -; - ALIGN 16 -cident precompute_partition_info_sums_32bit_asm_ia32_ - - ;; peppered throughout the code at major checkpoints are keys like this as to where things are at that point in time - ;; [esp + 4] const FLAC__int32 residual[] - ;; [esp + 8] FLAC__uint64 abs_residual_partition_sums[] - ;; [esp + 12] unsigned blocksize - ;; [esp + 16] unsigned predictor_order - ;; [esp + 20] unsigned min_partition_order - ;; [esp + 24] unsigned max_partition_order - push ebp - push ebx - push esi - push edi - sub esp, 8 - ;; [esp + 28] const FLAC__int32 residual[] - ;; [esp + 32] FLAC__uint64 abs_residual_partition_sums[] - ;; [esp + 36] unsigned blocksize - ;; [esp + 40] unsigned predictor_order - ;; [esp + 44] unsigned min_partition_order - ;; [esp + 48] unsigned max_partition_order - ;; [esp] partitions - ;; [esp + 4] default_partition_samples - - mov ecx, [esp + 48] - mov eax, 1 - shl eax, cl - mov [esp], eax ; [esp] <- partitions = 1u << max_partition_order; - mov eax, [esp + 36] - shr eax, cl - mov [esp + 4], eax ; [esp + 4] <- default_partition_samples = blocksize >> max_partition_order; - - ; - ; first do max_partition_order - ; - mov edi, [esp + 4] - sub edi, [esp + 40] ; edi <- end = (unsigned)(-(int)predictor_order) + default_partition_samples - xor esi, esi ; esi <- residual_sample = 0 - xor ecx, ecx ; ecx <- partition = 0 - mov ebp, [esp + 28] ; ebp <- residual[] - xor ebx, ebx ; ebx <- abs_residual_partition_sum = 0; - ; note we put the updates to 'end' and 'abs_residual_partition_sum' at the end of loop0 and in the initialization above so we could align loop0 and loop1 - ALIGN 16 -.loop0: ; for(partition = residual_sample = 0; partition < partitions; partition++) { -.loop1: ; for( ; residual_sample < end; residual_sample++) - mov eax, [ebp + esi * 4] - cdq - xor eax, edx - sub eax, edx - add ebx, eax ; abs_residual_partition_sum += abs(residual[residual_sample]); - ;@@@@@@ check overflow flag and abort here? - add esi, byte 1 - cmp esi, edi ; /* since the loop will always run at least once, we can put the loop check down here */ - jb .loop1 -.next1: - add edi, [esp + 4] ; end += default_partition_samples; - mov eax, [esp + 32] - mov [eax + ecx * 8], ebx ; abs_residual_partition_sums[partition] = abs_residual_partition_sum; - mov [eax + ecx * 8 + 4], dword 0 - xor ebx, ebx ; abs_residual_partition_sum = 0; - add ecx, byte 1 - cmp ecx, [esp] ; /* since the loop will always run at least once, we can put the loop check down here */ - jb .loop0 -.next0: ; } - ; - ; now merge partitions for lower orders - ; - mov esi, [esp + 32] ; esi <- abs_residual_partition_sums[from_partition==0]; - mov eax, [esp] - lea edi, [esi + eax * 8] ; edi <- abs_residual_partition_sums[to_partition==partitions]; - mov ecx, [esp + 48] - sub ecx, byte 1 ; ecx <- partition_order = (int)max_partition_order - 1; - ALIGN 16 -.loop2: ; for(; partition_order >= (int)min_partition_order; partition_order--) { - cmp ecx, [esp + 44] - jl .next2 - mov edx, 1 - shl edx, cl ; const unsigned partitions = 1u << partition_order; - ALIGN 16 -.loop3: ; for(i = 0; i < partitions; i++) { - mov eax, [esi] - mov ebx, [esi + 4] - add eax, [esi + 8] - adc ebx, [esi + 12] - mov [edi], eax - mov [edi + 4], ebx ; a_r_p_s[to_partition] = a_r_p_s[from_partition] + a_r_p_s[from_partition+1]; - add esi, byte 16 - add edi, byte 8 - sub edx, byte 1 - jnz .loop3 ; } - sub ecx, byte 1 - jmp .loop2 ; } -.next2: - - add esp, 8 - pop edi - pop esi - pop ebx - pop ebp - ret - -end - -%ifdef OBJ_FORMAT_elf - section .note.GNU-stack noalloc -%endif diff --git a/3rdparty/libflac/src/libFLAC/include/Makefile.am b/3rdparty/libflac/src/libFLAC/include/Makefile.am index 866a8948e30..8484d1284ba 100644 --- a/3rdparty/libflac/src/libFLAC/include/Makefile.am +++ b/3rdparty/libflac/src/libFLAC/include/Makefile.am @@ -1,5 +1,6 @@ # libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/3rdparty/libflac/src/libFLAC/include/Makefile.in b/3rdparty/libflac/src/libFLAC/include/Makefile.in index ae91c1e7f83..b59a2cb5741 100644 --- a/3rdparty/libflac/src/libFLAC/include/Makefile.in +++ b/3rdparty/libflac/src/libFLAC/include/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -43,17 +44,67 @@ # 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. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -65,12 +116,114 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +subdir = src/libFLAC/include +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -79,182 +232,176 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ SUBDIRS = private protected -subdir = src/libFLAC/include -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = $(SUBDIRS) all: all-recursive .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libFLAC/include/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/include/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/include/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo @@ -262,21 +409,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -284,152 +436,131 @@ $(RECURSIVE_TARGETS): else \ local_target="$$target"; \ fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ + empty_fix=.; \ else \ include_option=--include; \ + empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done - list='$(SUBDIRS)'; for subdir in $$list; do \ + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ @@ -439,7 +570,6 @@ check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: - install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -450,16 +580,22 @@ install-am: all-am installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -470,25 +606,46 @@ clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags +distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: +html: html-recursive + +html-am: + info: info-recursive info-am: install-data-am: +install-dvi: install-dvi-recursive + +install-dvi-am: + install-exec-am: +install-html: install-html-recursive + +install-html-am: + install-info: install-info-recursive +install-info-am: + install-man: +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -507,26 +664,25 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/libFLAC/include/config.h b/3rdparty/libflac/src/libFLAC/include/config.h index d9f49ff504b..a0b24186c99 100644 --- a/3rdparty/libflac/src/libFLAC/include/config.h +++ b/3rdparty/libflac/src/libFLAC/include/config.h @@ -1 +1,25 @@ -#define VERSION "1.2.1"
\ No newline at end of file +#if defined(__i386__) || defined(_M_IX86) +#define FLAC__CPU_IA32 +#endif + +#if defined(__x86_64__) || defined(_M_X64) +#define FLAC__CPU_X86_64 +#endif + +#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_X64) +#define FLAC__ALIGN_MALLOC_DATA +#define FLAC__HAS_X86INTRIN 1 +#else +#define FLAC__HAS_X86INTRIN 0 +#endif + +#if defined(__aarch64__) || defined(_M_ARM64) +#define FLAC__CPU_ARM64 +#define FLAC__HAS_NEONINTRIN 1 +#define FLAC__HAS_A64NEONINTRIN 1 +#else +#define FLAC__HAS_NEONINTRIN 0 +#define FLAC__HAS_A64NEONINTRIN 0 +#endif + +#define PACKAGE_VERSION "1.4.3" diff --git a/3rdparty/libflac/src/libFLAC/include/private/Makefile.am b/3rdparty/libflac/src/libFLAC/include/private/Makefile.am index e8abc582fcf..3e63d310883 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/Makefile.am +++ b/3rdparty/libflac/src/libFLAC/include/private/Makefile.am @@ -1,5 +1,6 @@ # libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -39,6 +40,7 @@ noinst_HEADERS = \ float.h \ format.h \ lpc.h \ + macros.h \ md5.h \ memory.h \ metadata.h \ @@ -46,5 +48,6 @@ noinst_HEADERS = \ ogg_encoder_aspect.h \ ogg_helper.h \ ogg_mapping.h \ + stream_encoder.h \ stream_encoder_framing.h \ window.h diff --git a/3rdparty/libflac/src/libFLAC/include/private/Makefile.in b/3rdparty/libflac/src/libFLAC/include/private/Makefile.in index 456024205a7..475175fdc78 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/Makefile.in +++ b/3rdparty/libflac/src/libFLAC/include/private/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -44,16 +45,67 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -65,12 +117,74 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +subdir = src/libFLAC/include/private +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -79,159 +193,143 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ noinst_HEADERS = \ all.h \ bitmath.h \ @@ -243,6 +341,7 @@ noinst_HEADERS = \ float.h \ format.h \ lpc.h \ + macros.h \ md5.h \ memory.h \ metadata.h \ @@ -250,26 +349,42 @@ noinst_HEADERS = \ ogg_encoder_aspect.h \ ogg_helper.h \ ogg_mapping.h \ + stream_encoder.h \ stream_encoder_framing.h \ window.h -subdir = src/libFLAC/include/private -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libFLAC/include/private/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/include/private/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/include/private/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo @@ -277,99 +392,93 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) - installdirs: install: install-am install-exec: install-exec-am @@ -381,16 +490,22 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -401,25 +516,46 @@ clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags +distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -438,17 +574,25 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags uninstall uninstall-am uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/libFLAC/include/private/all.h b/3rdparty/libflac/src/libFLAC/include/private/all.h index 304c471a52a..10b6949528f 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/all.h +++ b/3rdparty/libflac/src/libFLAC/include/private/all.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/3rdparty/libflac/src/libFLAC/include/private/bitmath.h b/3rdparty/libflac/src/libFLAC/include/private/bitmath.h index 87fa0facd6b..12e062f88c5 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/bitmath.h +++ b/3rdparty/libflac/src/libFLAC/include/private/bitmath.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,10 +34,177 @@ #define FLAC__PRIVATE__BITMATH_H #include "FLAC/ordinals.h" +#include "FLAC/assert.h" -unsigned FLAC__bitmath_ilog2(FLAC__uint32 v); -unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v); -unsigned FLAC__bitmath_silog2(int v); -unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v); +#include "share/compat.h" + +#if defined(_MSC_VER) +#include <intrin.h> /* for _BitScanReverse* */ +#endif + +/* Will never be emitted for MSVC, GCC, Intel compilers */ +static inline uint32_t FLAC__clz_soft_uint32(FLAC__uint32 word) +{ + static const uint8_t byte_to_unary_table[] = { + 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + + return word > 0xffffff ? byte_to_unary_table[word >> 24] : + word > 0xffff ? byte_to_unary_table[word >> 16] + 8 : + word > 0xff ? byte_to_unary_table[word >> 8] + 16 : + byte_to_unary_table[word] + 24; +} + +static inline uint32_t FLAC__clz_uint32(FLAC__uint32 v) +{ +/* Never used with input 0 */ + FLAC__ASSERT(v > 0); +#if defined(__INTEL_COMPILER) + return _bit_scan_reverse(v) ^ 31U; +#elif defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +/* This will translate either to (bsr ^ 31U), clz , ctlz, cntlz, lzcnt depending on + * -march= setting or to a software routine in exotic machines. */ + return __builtin_clz(v); +#elif defined(_MSC_VER) + { + uint32_t idx; + _BitScanReverse(&idx, v); + return idx ^ 31U; + } +#else + return FLAC__clz_soft_uint32(v); +#endif +} + +/* Used when 64-bit bsr/clz is unavailable; can use 32-bit bsr/clz when possible */ +static inline uint32_t FLAC__clz_soft_uint64(FLAC__uint64 word) +{ + return (FLAC__uint32)(word>>32) ? FLAC__clz_uint32((FLAC__uint32)(word>>32)) : + FLAC__clz_uint32((FLAC__uint32)word) + 32; +} + +static inline uint32_t FLAC__clz_uint64(FLAC__uint64 v) +{ + /* Never used with input 0 */ + FLAC__ASSERT(v > 0); +#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) + return __builtin_clzll(v); +#elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64)) + { + uint32_t idx; + _BitScanReverse64(&idx, v); + return idx ^ 63U; + } +#else + return FLAC__clz_soft_uint64(v); +#endif +} + +/* These two functions work with input 0 */ +static inline uint32_t FLAC__clz2_uint32(FLAC__uint32 v) +{ + if (!v) + return 32; + return FLAC__clz_uint32(v); +} + +static inline uint32_t FLAC__clz2_uint64(FLAC__uint64 v) +{ + if (!v) + return 64; + return FLAC__clz_uint64(v); +} + +/* An example of what FLAC__bitmath_ilog2() computes: + * + * ilog2( 0) = assertion failure + * ilog2( 1) = 0 + * ilog2( 2) = 1 + * ilog2( 3) = 1 + * ilog2( 4) = 2 + * ilog2( 5) = 2 + * ilog2( 6) = 2 + * ilog2( 7) = 2 + * ilog2( 8) = 3 + * ilog2( 9) = 3 + * ilog2(10) = 3 + * ilog2(11) = 3 + * ilog2(12) = 3 + * ilog2(13) = 3 + * ilog2(14) = 3 + * ilog2(15) = 3 + * ilog2(16) = 4 + * ilog2(17) = 4 + * ilog2(18) = 4 + */ + +static inline uint32_t FLAC__bitmath_ilog2(FLAC__uint32 v) +{ + FLAC__ASSERT(v > 0); +#if defined(__INTEL_COMPILER) + return _bit_scan_reverse(v); +#elif defined(_MSC_VER) + { + uint32_t idx; + _BitScanReverse(&idx, v); + return idx; + } +#else + return FLAC__clz_uint32(v) ^ 31U; +#endif +} + +static inline uint32_t FLAC__bitmath_ilog2_wide(FLAC__uint64 v) +{ + FLAC__ASSERT(v > 0); +#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) + return __builtin_clzll(v) ^ 63U; +/* Sorry, only supported in x64/Itanium.. and both have fast FPU which makes integer-only encoder pointless */ +#elif (defined(__INTEL_COMPILER) || defined(_MSC_VER)) && (defined(_M_IA64) || defined(_M_X64)) + { + uint32_t idx; + _BitScanReverse64(&idx, v); + return idx; + } +#else +/* Brain-damaged compilers will use the fastest possible way that is, + de Bruijn sequences (http://supertech.csail.mit.edu/papers/debruijn.pdf) + (C) Timothy B. Terriberry (tterribe@xiph.org) 2001-2009 CC0 (Public domain). +*/ + { + static const uint8_t DEBRUIJN_IDX64[64]={ + 0, 1, 2, 7, 3,13, 8,19, 4,25,14,28, 9,34,20,40, + 5,17,26,38,15,46,29,48,10,31,35,54,21,50,41,57, + 63, 6,12,18,24,27,33,39,16,37,45,47,30,53,49,56, + 62,11,23,32,36,44,52,55,61,22,43,51,60,42,59,58 + }; + v|= v>>1; + v|= v>>2; + v|= v>>4; + v|= v>>8; + v|= v>>16; + v|= v>>32; + v= (v>>1)+1; + return DEBRUIJN_IDX64[v*FLAC__U64L(0x218A392CD3D5DBF)>>58&0x3F]; + } +#endif +} + +uint32_t FLAC__bitmath_silog2(FLAC__int64 v); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/bitreader.h b/3rdparty/libflac/src/libFLAC/include/private/bitreader.h index fd0f6aac6ce..c36c9266102 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/bitreader.h +++ b/3rdparty/libflac/src/libFLAC/include/private/bitreader.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,10 +50,11 @@ typedef FLAC__bool (*FLAC__BitReaderReadCallback)(FLAC__byte buffer[], size_t *b */ FLAC__BitReader *FLAC__bitreader_new(void); void FLAC__bitreader_delete(FLAC__BitReader *br); -FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__CPUInfo cpu, FLAC__BitReaderReadCallback rcb, void *cd); +FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__BitReaderReadCallback rcb, void *cd); void FLAC__bitreader_free(FLAC__BitReader *br); /* does not 'free(br)' */ FLAC__bool FLAC__bitreader_clear(FLAC__BitReader *br); -void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out); +void FLAC__bitreader_set_framesync_location(FLAC__BitReader *br); +FLAC__bool FLAC__bitreader_rewind_to_after_last_seen_framesync(FLAC__BitReader *br); /* * CRC functions @@ -64,36 +66,36 @@ FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br); * info functions */ FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br); -unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br); -unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br); +uint32_t FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br); +uint32_t FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br); +void FLAC__bitreader_set_limit(FLAC__BitReader *br, uint32_t limit); +void FLAC__bitreader_remove_limit(FLAC__BitReader *br); +uint32_t FLAC__bitreader_limit_remaining(FLAC__BitReader *br); +void FLAC__bitreader_limit_invalidate(FLAC__BitReader *br); /* * read functions */ -FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits); -FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits); -FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits); +FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, uint32_t bits); +FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, uint32_t bits); +FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, uint32_t bits); +FLAC__bool FLAC__bitreader_read_raw_int64(FLAC__BitReader *br, FLAC__int64 *val, uint32_t bits); FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val); /*only for bits=32*/ -FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits); /* WATCHOUT: does not CRC the skipped data! */ /*@@@@ add to unit tests */ -FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals); /* WATCHOUT: does not CRC the read data! */ -FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals); /* WATCHOUT: does not CRC the read data! */ -FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val); -FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter); -FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter); -#ifndef FLAC__NO_ASM -# ifdef FLAC__CPU_IA32 -# ifdef FLAC__HAS_NASM -FLAC__bool FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter); -# endif -# endif +FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, uint32_t bits); /* WATCHOUT: does not CRC the skipped data! */ /*@@@@ add to unit tests */ +FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, uint32_t nvals); /* WATCHOUT: does not CRC the read data! */ +FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, uint32_t nvals); /* WATCHOUT: does not CRC the read data! */ +FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, uint32_t *val); +FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, uint32_t parameter); +FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], uint32_t nvals, uint32_t parameter); +#ifdef FLAC__BMI2_SUPPORTED +FLAC__bool FLAC__bitreader_read_rice_signed_block_bmi2(FLAC__BitReader *br, int vals[], uint32_t nvals, uint32_t parameter); #endif + #if 0 /* UNUSED */ -FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter); -FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter); +FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, uint32_t parameter); +FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, uint32_t *val, uint32_t parameter); #endif -FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen); -FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen); - -FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br); +FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, uint32_t *rawlen); +FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, uint32_t *rawlen); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/bitwriter.h b/3rdparty/libflac/src/libFLAC/include/private/bitwriter.h index aa5c4f74fcb..39bcf254dcd 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/bitwriter.h +++ b/3rdparty/libflac/src/libFLAC/include/private/bitwriter.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,7 +50,6 @@ void FLAC__bitwriter_delete(FLAC__BitWriter *bw); FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw); void FLAC__bitwriter_free(FLAC__BitWriter *bw); /* does not 'free(buffer)' */ void FLAC__bitwriter_clear(FLAC__BitWriter *bw); -void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out); /* * CRC functions @@ -63,7 +63,7 @@ FLAC__bool FLAC__bitwriter_get_write_crc8(FLAC__BitWriter *bw, FLAC__byte *crc); * info functions */ FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw); -unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw); /* can be called anytime, returns total # of bits unconsumed */ +uint32_t FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw); /* can be called anytime, returns total # of bits unconsumed */ /* * direct buffer access @@ -78,23 +78,24 @@ void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw); /* * write functions */ -FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits); -FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits); -FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits); -FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits); +FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, uint32_t bits); +FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, uint32_t bits); +FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t bits); +FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, uint32_t bits); +FLAC__bool FLAC__bitwriter_write_raw_int64(FLAC__BitWriter *bw, FLAC__int64 val, uint32_t bits); FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val); /*only for bits=32*/ -FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals); -FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val); -unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter); +FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], uint32_t nvals); +FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, uint32_t val); #if 0 /* UNUSED */ -unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter); -unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned val, unsigned parameter); +uint32_t FLAC__bitwriter_rice_bits(FLAC__int32 val, uint32_t parameter); +uint32_t FLAC__bitwriter_golomb_bits_signed(int val, uint32_t parameter); +uint32_t FLAC__bitwriter_golomb_bits_unsigned(uint32_t val, uint32_t parameter); +FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, uint32_t parameter); #endif -FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter); -FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter); +FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, uint32_t nvals, uint32_t parameter); #if 0 /* UNUSED */ -FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter); -FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned val, unsigned parameter); +FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, uint32_t parameter); +FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, uint32_t val, uint32_t parameter); #endif FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 val); FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 val); diff --git a/3rdparty/libflac/src/libFLAC/include/private/cpu.h b/3rdparty/libflac/src/libFLAC/include/private/cpu.h index 651bb224f2a..8843c74bfee 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/cpu.h +++ b/3rdparty/libflac/src/libFLAC/include/private/cpu.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,51 +39,160 @@ #include <config.h> #endif +#ifndef FLAC__CPU_X86_64 + +#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64) +#define FLAC__CPU_X86_64 +#endif + +#endif + +#ifndef FLAC__CPU_IA32 + +#if defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) ||defined( __i386) || defined(_M_IX86) +#define FLAC__CPU_IA32 +#endif + +#endif + +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + +#if FLAC__HAS_X86INTRIN +/* SSE intrinsics support by ICC/MSVC/GCC */ +#if defined __INTEL_COMPILER + #define FLAC__SSE_TARGET(x) + #define FLAC__SSE_SUPPORTED 1 + #define FLAC__SSE2_SUPPORTED 1 + #if (__INTEL_COMPILER >= 1000) /* Intel C++ Compiler 10.0 */ + #define FLAC__SSSE3_SUPPORTED 1 + #define FLAC__SSE4_1_SUPPORTED 1 + #define FLAC__SSE4_2_SUPPORTED 1 + #endif + #ifdef FLAC__USE_AVX + #if (__INTEL_COMPILER >= 1110) /* Intel C++ Compiler 11.1 */ + #define FLAC__AVX_SUPPORTED 1 + #endif + #if (__INTEL_COMPILER >= 1300) /* Intel C++ Compiler 13.0 */ + #define FLAC__AVX2_SUPPORTED 1 + #define FLAC__FMA_SUPPORTED 1 + #endif + #endif +#elif defined __clang__ && __has_attribute(__target__) /* clang */ + #define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x))) + #define FLAC__SSE_SUPPORTED 1 + #define FLAC__SSE2_SUPPORTED 1 + #define FLAC__SSSE3_SUPPORTED 1 + #define FLAC__SSE4_1_SUPPORTED 1 + #define FLAC__SSE4_2_SUPPORTED 1 + #ifdef FLAC__USE_AVX + #define FLAC__AVX_SUPPORTED 1 + #define FLAC__AVX2_SUPPORTED 1 + #define FLAC__FMA_SUPPORTED 1 + #define FLAC__BMI2_SUPPORTED 1 + #endif +#elif defined __GNUC__ && !defined __clang__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) /* GCC 4.9+ */ + #define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x))) + #define FLAC__SSE_SUPPORTED 1 + #define FLAC__SSE2_SUPPORTED 1 + #define FLAC__SSSE3_SUPPORTED 1 + #define FLAC__SSE4_1_SUPPORTED 1 + #define FLAC__SSE4_2_SUPPORTED 1 + #ifdef FLAC__USE_AVX + #define FLAC__AVX_SUPPORTED 1 + #define FLAC__AVX2_SUPPORTED 1 + #define FLAC__FMA_SUPPORTED 1 + #define FLAC__BMI2_SUPPORTED 1 + #endif +#elif defined _MSC_VER + #define FLAC__SSE_TARGET(x) + #define FLAC__SSE_SUPPORTED 1 + #define FLAC__SSE2_SUPPORTED 1 + #if (_MSC_VER >= 1500) /* MS Visual Studio 2008 */ + #define FLAC__SSSE3_SUPPORTED 1 + #define FLAC__SSE4_1_SUPPORTED 1 + #define FLAC__SSE4_2_SUPPORTED 1 + #endif + #ifdef FLAC__USE_AVX + #if (_MSC_FULL_VER >= 160040219) /* MS Visual Studio 2010 SP1 */ + #define FLAC__AVX_SUPPORTED 1 + #endif + #if (_MSC_VER >= 1700) /* MS Visual Studio 2012 */ + #define FLAC__AVX2_SUPPORTED 1 + #define FLAC__FMA_SUPPORTED 1 + #endif + #endif +#else + #define FLAC__SSE_TARGET(x) + #ifdef __SSE__ + #define FLAC__SSE_SUPPORTED 1 + #endif + #ifdef __SSE2__ + #define FLAC__SSE2_SUPPORTED 1 + #endif + #ifdef __SSSE3__ + #define FLAC__SSSE3_SUPPORTED 1 + #endif + #ifdef __SSE4_1__ + #define FLAC__SSE4_1_SUPPORTED 1 + #endif + #ifdef __SSE4_2__ + #define FLAC__SSE4_2_SUPPORTED 1 + #endif + #ifdef FLAC__USE_AVX + #ifdef __AVX__ + #define FLAC__AVX_SUPPORTED 1 + #endif + #ifdef __AVX2__ + #define FLAC__AVX2_SUPPORTED 1 + #endif + #ifdef __FMA__ + #define FLAC__FMA_SUPPORTED 1 + #endif + #endif +#endif /* compiler version */ +#endif /* intrinsics support */ + + +#ifndef FLAC__AVX_SUPPORTED +#define FLAC__AVX_SUPPORTED 0 +#endif + typedef enum { FLAC__CPUINFO_TYPE_IA32, - FLAC__CPUINFO_TYPE_PPC, + FLAC__CPUINFO_TYPE_X86_64, FLAC__CPUINFO_TYPE_UNKNOWN } FLAC__CPUInfo_Type; typedef struct { - FLAC__bool cpuid; - FLAC__bool bswap; + FLAC__bool intel; + FLAC__bool cmov; FLAC__bool mmx; - FLAC__bool fxsr; FLAC__bool sse; FLAC__bool sse2; + FLAC__bool sse3; FLAC__bool ssse3; - FLAC__bool _3dnow; - FLAC__bool ext3dnow; - FLAC__bool extmmx; -} FLAC__CPUInfo_IA32; - -typedef struct { - FLAC__bool altivec; - FLAC__bool ppc64; -} FLAC__CPUInfo_PPC; + FLAC__bool sse41; + FLAC__bool sse42; + FLAC__bool avx; + FLAC__bool avx2; + FLAC__bool fma; + FLAC__bool bmi2; +} FLAC__CPUInfo_x86; typedef struct { FLAC__bool use_asm; FLAC__CPUInfo_Type type; - union { - FLAC__CPUInfo_IA32 ia32; - FLAC__CPUInfo_PPC ppc; - } data; + FLAC__CPUInfo_x86 x86; } FLAC__CPUInfo; void FLAC__cpu_info(FLAC__CPUInfo *info); -#ifndef FLAC__NO_ASM -#ifdef FLAC__CPU_IA32 -#ifdef FLAC__HAS_NASM FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32(void); -void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx); -FLAC__uint32 FLAC__cpu_info_extended_amd_asm_ia32(void); -#endif -#endif -#endif + +void FLAC__cpu_info_asm_ia32(FLAC__uint32 level, FLAC__uint32 *eax, FLAC__uint32 *ebx, FLAC__uint32 *ecx, FLAC__uint32 *edx); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/crc.h b/3rdparty/libflac/src/libFLAC/include/private/crc.h index 0b67fb4be5d..fe445020c31 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/crc.h +++ b/3rdparty/libflac/src/libFLAC/include/private/crc.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,24 +39,22 @@ ** polynomial = x^8 + x^2 + x^1 + x^0 ** init = 0 */ -extern FLAC__byte const FLAC__crc8_table[256]; -#define FLAC__CRC8_UPDATE(data, crc) (crc) = FLAC__crc8_table[(crc) ^ (data)]; -void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc); -void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc); -FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len); +FLAC__uint8 FLAC__crc8(const FLAC__byte *data, uint32_t len); /* 16 bit CRC generator, MSB shifted first ** polynomial = x^16 + x^15 + x^2 + x^0 ** init = 0 */ -extern unsigned FLAC__crc16_table[256]; +extern FLAC__uint16 const FLAC__crc16_table[8][256]; -#define FLAC__CRC16_UPDATE(data, crc) (((((crc)<<8) & 0xffff) ^ FLAC__crc16_table[((crc)>>8) ^ (data)])) +#define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) & 0xffff) ^ FLAC__crc16_table[0][((crc)>>8) ^ (data)]) /* this alternate may be faster on some systems/compilers */ #if 0 -#define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) & 0xffff) +#define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) ^ FLAC__crc16_table[0][((crc)>>8) ^ (data)]) & 0xffff) #endif -unsigned FLAC__crc16(const FLAC__byte *data, unsigned len); +FLAC__uint16 FLAC__crc16(const FLAC__byte *data, uint32_t len); +FLAC__uint16 FLAC__crc16_update_words32(const FLAC__uint32 *words, uint32_t len, FLAC__uint16 crc); +FLAC__uint16 FLAC__crc16_update_words64(const FLAC__uint64 *words, uint32_t len, FLAC__uint16 crc); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/fixed.h b/3rdparty/libflac/src/libFLAC/include/private/fixed.h index 6656b796bec..c4efecd5f61 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/fixed.h +++ b/3rdparty/libflac/src/libFLAC/include/private/fixed.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,6 +37,7 @@ #include <config.h> #endif +#include "private/cpu.h" #include "private/float.h" #include "FLAC/format.h" @@ -52,18 +54,32 @@ * OUT residual_bits_per_sample[0,FLAC__MAX_FIXED_ORDER] */ #ifndef FLAC__INTEGER_ONLY_LIBRARY -unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +uint32_t FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +uint32_t FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +uint32_t FLAC__fixed_compute_best_predictor_limit_residual(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +uint32_t FLAC__fixed_compute_best_predictor_limit_residual_33bit(const FLAC__int64 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); # ifndef FLAC__NO_ASM -# ifdef FLAC__CPU_IA32 -# ifdef FLAC__HAS_NASM -unsigned FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +# if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +# ifdef FLAC__SSE2_SUPPORTED +uint32_t FLAC__fixed_compute_best_predictor_intrin_sse2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER + 1]); +# endif +# ifdef FLAC__SSSE3_SUPPORTED +uint32_t FLAC__fixed_compute_best_predictor_intrin_ssse3(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +# endif +# ifdef FLAC__SSE4_2_SUPPORTED +uint32_t FLAC__fixed_compute_best_predictor_limit_residual_intrin_sse42(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +# endif +# ifdef FLAC__AVX2_SUPPORTED +uint32_t FLAC__fixed_compute_best_predictor_wide_intrin_avx2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +uint32_t FLAC__fixed_compute_best_predictor_limit_residual_intrin_avx2(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); # endif # endif # endif -unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); #else -unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); -unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +uint32_t FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +uint32_t FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +uint32_t FLAC__fixed_compute_best_predictor_limit_residual(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); +uint32_t FLAC__fixed_compute_best_predictor_limit_residual_33bit(const FLAC__int64 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); #endif /* @@ -77,7 +93,9 @@ unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsig * IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order * OUT residual[0,data_len-1] residual signal */ -void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]); +void FLAC__fixed_compute_residual(const FLAC__int32 data[], uint32_t data_len, uint32_t order, FLAC__int32 residual[]); +void FLAC__fixed_compute_residual_wide(const FLAC__int32 data[], uint32_t data_len, uint32_t order, FLAC__int32 residual[]); +void FLAC__fixed_compute_residual_wide_33bit(const FLAC__int64 data[], uint32_t data_len, uint32_t order, FLAC__int32 residual[]); /* * FLAC__fixed_restore_signal() @@ -92,6 +110,8 @@ void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, u * IN data[-order,-1] previously-reconstructed historical samples * OUT data[0,data_len-1] original signal */ -void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[]); +void FLAC__fixed_restore_signal(const FLAC__int32 residual[], uint32_t data_len, uint32_t order, FLAC__int32 data[]); +void FLAC__fixed_restore_signal_wide(const FLAC__int32 residual[], uint32_t data_len, uint32_t order, FLAC__int32 data[]); +void FLAC__fixed_restore_signal_wide_33bit(const FLAC__int32 residual[], uint32_t data_len, uint32_t order, FLAC__int64 data[]); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/float.h b/3rdparty/libflac/src/libFLAC/include/private/float.h index 73313f6dbf8..bec26345e00 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/float.h +++ b/3rdparty/libflac/src/libFLAC/include/private/float.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2004-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,18 +40,15 @@ #include "FLAC/ordinals.h" /* - * These typedefs make it easier to ensure that integer versions of - * the library really only contain integer operations. All the code - * in libFLAC should use FLAC__float and FLAC__double in place of - * float and double, and be protected by checks of the macro + * All the code in libFLAC that uses float and double + * should be protected by checks of the macro * FLAC__INTEGER_ONLY_LIBRARY. * - * FLAC__real is the basic floating point type used in LPC analysis. */ #ifndef FLAC__INTEGER_ONLY_LIBRARY -typedef double FLAC__double; -typedef float FLAC__float; /* + * FLAC__real is the basic floating point type used in LPC analysis. + * * WATCHOUT: changing FLAC__real will change the signatures of many * functions that have assembly language equivalents and break them. */ @@ -83,14 +81,14 @@ extern const FLAC__fixedpoint FLAC__FP_E; * be < 32 and evenly divisible by 4 (0 is OK but not very precise). * * 'precision' roughly limits the number of iterations that are done; - * use (unsigned)(-1) for maximum precision. + * use (uint32_t)(-1) for maximum precision. * * If 'x' is less than one -- that is, x < (1<<fracbits) -- then this * function will punt and return 0. * * The return value will also have 'fracbits' fractional bits. */ -FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision); +FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, uint32_t fracbits, uint32_t precision); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/format.h b/3rdparty/libflac/src/libFLAC/include/private/format.h index 7f5cc9360dc..7630f6fad5b 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/format.h +++ b/3rdparty/libflac/src/libFLAC/include/private/format.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,11 +35,13 @@ #include "FLAC/format.h" -unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order); -unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize); -unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order); +#if 0 /* UNUSED */ +uint32_t FLAC__format_get_max_rice_partition_order(uint32_t blocksize, uint32_t predictor_order); +#endif +uint32_t FLAC__format_get_max_rice_partition_order_from_blocksize(uint32_t blocksize); +uint32_t FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(uint32_t limit, uint32_t blocksize, uint32_t predictor_order); void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object); void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object); -FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order); +FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, uint32_t max_partition_order); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/lpc.h b/3rdparty/libflac/src/libFLAC/include/private/lpc.h index 2cb139b4bfd..766f0560ea7 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/lpc.h +++ b/3rdparty/libflac/src/libFLAC/include/private/lpc.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,6 +37,7 @@ #include <config.h> #endif +#include "private/cpu.h" #include "private/float.h" #include "FLAC/format.h" @@ -52,7 +54,10 @@ * OUT out[0,lag-1] * IN data_len */ -void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], unsigned data_len); +void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len); +void FLAC__lpc_window_data_wide(const FLAC__int64 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len); +void FLAC__lpc_window_data_partial(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len, uint32_t part_size, uint32_t data_shift); +void FLAC__lpc_window_data_partial_wide(const FLAC__int64 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len, uint32_t part_size, uint32_t data_shift); /* * FLAC__lpc_compute_autocorrelation() @@ -66,18 +71,28 @@ void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FL * IN 0 < lag <= data_len * OUT autoc[0,lag-1] */ -void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); +void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); #ifndef FLAC__NO_ASM -# ifdef FLAC__CPU_IA32 -# ifdef FLAC__HAS_NASM -void FLAC__lpc_compute_autocorrelation_asm_ia32(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); -void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); -void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); -void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); -void FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); +# if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +# ifdef FLAC__SSE2_SUPPORTED +void FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_8(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); +void FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_10(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); +void FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_14(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); # endif # endif +# if defined FLAC__CPU_X86_64 && FLAC__HAS_X86INTRIN +# ifdef FLAC__FMA_SUPPORTED +void FLAC__lpc_compute_autocorrelation_intrin_fma_lag_8(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); +void FLAC__lpc_compute_autocorrelation_intrin_fma_lag_12(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); +void FLAC__lpc_compute_autocorrelation_intrin_fma_lag_16(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); +# endif +# endif +#if defined FLAC__CPU_ARM64 && FLAC__HAS_NEONINTRIN && FLAC__HAS_A64NEONINTRIN +void FLAC__lpc_compute_autocorrelation_intrin_neon_lag_8(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); +void FLAC__lpc_compute_autocorrelation_intrin_neon_lag_10(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); +void FLAC__lpc_compute_autocorrelation_intrin_neon_lag_14(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); #endif +#endif /* FLAC__NO_ASM */ /* * FLAC__lpc_compute_lp_coefficients() @@ -100,7 +115,7 @@ void FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow(const FLAC__real data[], u * in lp_coeff[8][0,8], the LP coefficients for order 8 will be * in lp_coeff[7][0,7], etc. */ -void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__double error[]); +void FLAC__lpc_compute_lp_coefficients(const double autoc[], uint32_t *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], double error[]); /* * FLAC__lpc_quantize_coefficients() @@ -122,7 +137,7 @@ void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_o * 2 => coefficients are all zero, which is bad. 'shift' is * unset. */ -int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift); +int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], uint32_t order, uint32_t precision, FLAC__int32 qlp_coeff[], int *shift); /* * FLAC__lpc_compute_residual_from_qlp_coefficients() @@ -137,19 +152,38 @@ int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, * IN lp_quantization quantization of LP coefficients in bits * OUT residual[0,data_len-1] residual signal */ -void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); -void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); +void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +FLAC__bool FLAC__lpc_compute_residual_from_qlp_coefficients_limit_residual(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +FLAC__bool FLAC__lpc_compute_residual_from_qlp_coefficients_limit_residual_33bit(const FLAC__int64 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); #ifndef FLAC__NO_ASM -# ifdef FLAC__CPU_IA32 -# ifdef FLAC__HAS_NASM -void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); -void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); +# ifdef FLAC__CPU_ARM64 +void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_neon(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_neon(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +# endif + +# if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +# ifdef FLAC__SSE2_SUPPORTED +void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +# endif +# ifdef FLAC__SSE4_1_SUPPORTED +void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +# endif +# ifdef FLAC__AVX2_SUPPORTED +void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); # endif # endif #endif #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ +uint32_t FLAC__lpc_max_prediction_before_shift_bps(uint32_t subframe_bps, const FLAC__int32 qlp_coeff[], uint32_t order); +uint32_t FLAC__lpc_max_residual_bps(uint32_t subframe_bps, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization); + /* * FLAC__lpc_restore_signal() * -------------------------------------------------------------------- @@ -165,19 +199,9 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__i * IN data[-order,-1] previously-reconstructed historical samples * OUT data[0,data_len-1] original signal */ -void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); -void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); -#ifndef FLAC__NO_ASM -# ifdef FLAC__CPU_IA32 -# ifdef FLAC__HAS_NASM -void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); -void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); -# endif /* FLAC__HAS_NASM */ -# elif defined FLAC__CPU_PPC -void FLAC__lpc_restore_signal_asm_ppc_altivec_16(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); -void FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); -# endif/* FLAC__CPU_IA32 || FLAC__CPU_PPC */ -#endif /* FLAC__NO_ASM */ +void FLAC__lpc_restore_signal(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]); +void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 data[]); +void FLAC__lpc_restore_signal_wide_33bit(const FLAC__int32 residual[], uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int64 data[]); #ifndef FLAC__INTEGER_ONLY_LIBRARY @@ -191,8 +215,8 @@ void FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residu * IN total_samples > 0 # of samples in residual signal * RETURN expected bits per sample */ -FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__double lpc_error, unsigned total_samples); -FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(FLAC__double lpc_error, FLAC__double error_scale); +double FLAC__lpc_compute_expected_bits_per_residual_sample(double lpc_error, uint32_t total_samples); +double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(double lpc_error, double error_scale); /* * FLAC__lpc_compute_best_order() @@ -207,7 +231,7 @@ FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scal * (includes warmup sample size and quantized LP coefficient) * RETURN [1,max_order] best order */ -unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order); +uint32_t FLAC__lpc_compute_best_order(const double lpc_error[], uint32_t max_order, uint32_t total_samples, uint32_t overhead_bits_per_order); #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/include/private/macros.h b/3rdparty/libflac/src/libFLAC/include/private/macros.h new file mode 100644 index 00000000000..8204ed544a9 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/include/private/macros.h @@ -0,0 +1,74 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2012-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__MACROS_H +#define FLAC__PRIVATE__MACROS_H + +#if defined(__GNUC__) && (__GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + +#define flac_max(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _a : _b; }) + +#define MIN_PASTE(A,B) A##B +#define MIN_IMPL(A,B,L) ({ \ + __typeof__(A) MIN_PASTE(__a,L) = (A); \ + __typeof__(B) MIN_PASTE(__b,L) = (B); \ + MIN_PASTE(__a,L) < MIN_PASTE(__b,L) ? MIN_PASTE(__a,L) : MIN_PASTE(__b,L); \ + }) + +#define flac_min(A,B) MIN_IMPL(A,B,__COUNTER__) + +/* Whatever other unix that has sys/param.h */ +#elif defined(HAVE_SYS_PARAM_H) +#include <sys/param.h> +#if defined(MIN) && defined(MAX) +#define flac_max(a,b) MAX(a,b) +#define flac_min(a,b) MIN(a,b) +#endif + +/* Windows VS has them in stdlib.h.. XXX:Untested */ +#elif defined(_MSC_VER) +#include <stdlib.h> +#define flac_max(a,b) __max(a,b) +#define flac_min(a,b) __min(a,b) +#endif + +#ifndef flac_min +#define flac_min(x,y) ((x) <= (y) ? (x) : (y)) +#endif + +#ifndef flac_max +#define flac_max(x,y) ((x) >= (y) ? (x) : (y)) +#endif + +#endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/md5.h b/3rdparty/libflac/src/libFLAC/include/private/md5.h index e5f675a830a..f9d79c3e35c 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/md5.h +++ b/3rdparty/libflac/src/libFLAC/include/private/md5.h @@ -28,17 +28,23 @@ #include "FLAC/ordinals.h" +typedef union { + FLAC__byte *p8; + FLAC__int16 *p16; + FLAC__int32 *p32; +} FLAC__multibyte; + typedef struct { FLAC__uint32 in[16]; FLAC__uint32 buf[4]; FLAC__uint32 bytes[2]; - FLAC__byte *internal_buf; + FLAC__multibyte internal_buf; size_t capacity; } FLAC__MD5Context; void FLAC__MD5Init(FLAC__MD5Context *context); void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context); -FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample); +FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], uint32_t channels, uint32_t samples, uint32_t bytes_per_sample); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/memory.h b/3rdparty/libflac/src/libFLAC/include/private/memory.h index 38a9ffe0711..4221bcfde44 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/memory.h +++ b/3rdparty/libflac/src/libFLAC/include/private/memory.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,10 +48,11 @@ void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address); FLAC__bool FLAC__memory_alloc_aligned_int32_array(size_t elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer); FLAC__bool FLAC__memory_alloc_aligned_uint32_array(size_t elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer); +FLAC__bool FLAC__memory_alloc_aligned_int64_array(size_t elements, FLAC__int64 **unaligned_pointer, FLAC__int64 **aligned_pointer); FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer); -FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, unsigned **unaligned_pointer, unsigned **aligned_pointer); #ifndef FLAC__INTEGER_ONLY_LIBRARY FLAC__bool FLAC__memory_alloc_aligned_real_array(size_t elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer); #endif +void *safe_malloc_mul_2op_p(size_t size1, size_t size2); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/metadata.h b/3rdparty/libflac/src/libFLAC/include/private/metadata.h index b5268c9552e..d3ceb53fe3a 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/metadata.h +++ b/3rdparty/libflac/src/libFLAC/include/private/metadata.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/3rdparty/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h b/3rdparty/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h index df2b6b55bdf..c9236410ef8 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h +++ b/3rdparty/libflac/src/libFLAC/include/private/ogg_decoder_aspect.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,7 +46,7 @@ typedef struct FLAC__OggDecoderAspect { /* these are for internal state related to Ogg decoding */ ogg_stream_state stream_state; ogg_sync_state sync_state; - unsigned version_major, version_minor; + uint32_t version_major, version_minor; FLAC__bool need_serial_number; FLAC__bool end_of_stream; FLAC__bool have_working_page; /* only if true will the following vars be valid */ diff --git a/3rdparty/libflac/src/libFLAC/include/private/ogg_encoder_aspect.h b/3rdparty/libflac/src/libFLAC/include/private/ogg_encoder_aspect.h index 290da071c6b..0e9bb4bcaa0 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/ogg_encoder_aspect.h +++ b/3rdparty/libflac/src/libFLAC/include/private/ogg_encoder_aspect.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,7 +41,7 @@ typedef struct FLAC__OggEncoderAspect { /* these are storage for values that can be set through the API */ long serial_number; - unsigned num_metadata; + uint32_t num_metadata; /* these are for internal state related to Ogg encoding */ ogg_stream_state stream_state; @@ -51,12 +52,12 @@ typedef struct FLAC__OggEncoderAspect { } FLAC__OggEncoderAspect; void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect, long value); -FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, unsigned value); +FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, uint32_t value); void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect); FLAC__bool FLAC__ogg_encoder_aspect_init(FLAC__OggEncoderAspect *aspect); void FLAC__ogg_encoder_aspect_finish(FLAC__OggEncoderAspect *aspect); -typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); +typedef FLAC__StreamEncoderWriteStatus (*FLAC__OggEncoderAspectWriteCallbackProxy)(const void *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data); -FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data); +FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/ogg_helper.h b/3rdparty/libflac/src/libFLAC/include/private/ogg_helper.h index 389be18aba1..67685787ae1 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/ogg_helper.h +++ b/3rdparty/libflac/src/libFLAC/include/private/ogg_helper.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2004-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/3rdparty/libflac/src/libFLAC/include/private/ogg_mapping.h b/3rdparty/libflac/src/libFLAC/include/private/ogg_mapping.h index 07dd8b273fb..1a213a4f9db 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/ogg_mapping.h +++ b/3rdparty/libflac/src/libFLAC/include/private/ogg_mapping.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2004-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,10 +35,10 @@ #include "FLAC/ordinals.h" -/** The length of the 'FLAC' magic in bytes. */ +/** The length of the packet type field in bytes. */ #define FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH (1u) -extern const unsigned FLAC__OGG_MAPPING_PACKET_TYPE_LEN; /* = 8 bits */ +extern const uint32_t FLAC__OGG_MAPPING_PACKET_TYPE_LEN; /* = 8 bits */ extern const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE; /* = 0x7f */ @@ -46,8 +47,8 @@ extern const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE; /* = 0x7f */ extern const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC; /* = "FLAC" */ -extern const unsigned FLAC__OGG_MAPPING_VERSION_MAJOR_LEN; /* = 8 bits */ -extern const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN; /* = 8 bits */ +extern const uint32_t FLAC__OGG_MAPPING_VERSION_MAJOR_LEN; /* = 8 bits */ +extern const uint32_t FLAC__OGG_MAPPING_VERSION_MINOR_LEN; /* = 8 bits */ /** The length of the Ogg FLAC mapping major version number in bytes. */ #define FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH (1u) @@ -55,7 +56,7 @@ extern const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN; /* = 8 bits */ /** The length of the Ogg FLAC mapping minor version number in bytes. */ #define FLAC__OGG_MAPPING_VERSION_MINOR_LENGTH (1u) -extern const unsigned FLAC__OGG_MAPPING_NUM_HEADERS_LEN; /* = 16 bits */ +extern const uint32_t FLAC__OGG_MAPPING_NUM_HEADERS_LEN; /* = 16 bits */ /** The length of the #-of-header-packets number bytes. */ #define FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH (2u) diff --git a/3rdparty/libflac/src/libFLAC/include/private/stream_encoder.h b/3rdparty/libflac/src/libFLAC/include/private/stream_encoder.h new file mode 100644 index 00000000000..0a1b672adfa --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/include/private/stream_encoder.h @@ -0,0 +1,67 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FLAC__PRIVATE__STREAM_ENCODER_H +#define FLAC__PRIVATE__STREAM_ENCODER_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +/* + * This is used to avoid overflow with unusual signals in 32-bit + * accumulator in the *precompute_partition_info_sums_* functions. + */ +#define FLAC__MAX_EXTRA_RESIDUAL_BPS 4 + +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && defined FLAC__HAS_X86INTRIN +#include "private/cpu.h" +#include "FLAC/format.h" + +#ifdef FLAC__SSE2_SUPPORTED +extern void FLAC__precompute_partition_info_sums_intrin_sse2(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], + uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps); +#endif + +#ifdef FLAC__SSSE3_SUPPORTED +extern void FLAC__precompute_partition_info_sums_intrin_ssse3(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], + uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps); +#endif + +#ifdef FLAC__AVX2_SUPPORTED +extern void FLAC__precompute_partition_info_sums_intrin_avx2(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], + uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps); +#endif + +#endif + +#endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/stream_encoder_framing.h b/3rdparty/libflac/src/libFLAC/include/private/stream_encoder_framing.h index 4865c16c8a9..705965aebd4 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/stream_encoder_framing.h +++ b/3rdparty/libflac/src/libFLAC/include/private/stream_encoder_framing.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,11 +36,11 @@ #include "FLAC/format.h" #include "bitwriter.h" -FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw); +FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw, FLAC__bool update_vendor_string); FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWriter *bw); -FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); -FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); -FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); -FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); +FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw); +FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, uint32_t residual_samples, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw); +FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, uint32_t residual_samples, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw); +FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, uint32_t samples, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/private/window.h b/3rdparty/libflac/src/libFLAC/include/private/window.h index 01e0fc46c94..87a3fdf1c77 100644 --- a/3rdparty/libflac/src/libFLAC/include/private/window.h +++ b/3rdparty/libflac/src/libFLAC/include/private/window.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2006,2007 Josh Coalson + * Copyright (C) 2006-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,6 +65,8 @@ void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L); void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L); void FLAC__window_triangle(FLAC__real *window, const FLAC__int32 L); void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p); +void FLAC__window_partial_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p, const FLAC__real start, const FLAC__real end); +void FLAC__window_punchout_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p, const FLAC__real start, const FLAC__real end); void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L); #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/include/protected/Makefile.am b/3rdparty/libflac/src/libFLAC/include/protected/Makefile.am index 66c697c8277..97e85a84595 100644 --- a/3rdparty/libflac/src/libFLAC/include/protected/Makefile.am +++ b/3rdparty/libflac/src/libFLAC/include/protected/Makefile.am @@ -1,5 +1,6 @@ # libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/3rdparty/libflac/src/libFLAC/include/protected/Makefile.in b/3rdparty/libflac/src/libFLAC/include/protected/Makefile.in index 96133a6ad98..5b2e4af8f04 100644 --- a/3rdparty/libflac/src/libFLAC/include/protected/Makefile.in +++ b/3rdparty/libflac/src/libFLAC/include/protected/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -44,16 +45,67 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -65,12 +117,74 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +subdir = src/libFLAC/include/protected +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -79,181 +193,180 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ noinst_HEADERS = \ all.h \ stream_decoder.h \ stream_encoder.h -subdir = src/libFLAC/include/protected -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libFLAC/include/protected/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/libFLAC/include/protected/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/libFLAC/include/protected/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo @@ -261,99 +374,93 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) - installdirs: install: install-am install-exec: install-exec-am @@ -365,16 +472,22 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -385,25 +498,46 @@ clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags +distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am @@ -422,17 +556,25 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags uninstall uninstall-am uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ + clean-libtool cscopelist-am ctags ctags-am distclean \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ + uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/libFLAC/include/protected/all.h b/3rdparty/libflac/src/libFLAC/include/protected/all.h index 2921092b380..9f6de97a7ba 100644 --- a/3rdparty/libflac/src/libFLAC/include/protected/all.h +++ b/3rdparty/libflac/src/libFLAC/include/protected/all.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/3rdparty/libflac/src/libFLAC/include/protected/stream_decoder.h b/3rdparty/libflac/src/libFLAC/include/protected/stream_decoder.h index 9108ca78f22..4a9c76865f5 100644 --- a/3rdparty/libflac/src/libFLAC/include/protected/stream_decoder.h +++ b/3rdparty/libflac/src/libFLAC/include/protected/stream_decoder.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,11 +40,12 @@ typedef struct FLAC__StreamDecoderProtected { FLAC__StreamDecoderState state; - unsigned channels; + FLAC__StreamDecoderInitStatus initstate; + uint32_t channels; FLAC__ChannelAssignment channel_assignment; - unsigned bits_per_sample; - unsigned sample_rate; /* in Hz */ - unsigned blocksize; /* in samples (per channel) */ + uint32_t bits_per_sample; + uint32_t sample_rate; /* in Hz */ + uint32_t blocksize; /* in samples (per channel) */ FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */ #if FLAC__HAS_OGG FLAC__OggDecoderAspect ogg_decoder_aspect; @@ -51,8 +53,8 @@ typedef struct FLAC__StreamDecoderProtected { } FLAC__StreamDecoderProtected; /* - * return the number of input bytes consumed + * Return the number of input bytes consumed */ -unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder); +uint32_t FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder); #endif diff --git a/3rdparty/libflac/src/libFLAC/include/protected/stream_encoder.h b/3rdparty/libflac/src/libFLAC/include/protected/stream_encoder.h index 4101ee55288..863e43b3607 100644 --- a/3rdparty/libflac/src/libFLAC/include/protected/stream_encoder.h +++ b/3rdparty/libflac/src/libFLAC/include/protected/stream_encoder.h @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -58,6 +59,9 @@ typedef enum { FLAC__APODIZATION_RECTANGLE, FLAC__APODIZATION_TRIANGLE, FLAC__APODIZATION_TUKEY, + FLAC__APODIZATION_PARTIAL_TUKEY, + FLAC__APODIZATION_PUNCHOUT_TUKEY, + FLAC__APODIZATION_SUBDIVIDE_TUKEY, FLAC__APODIZATION_WELCH } FLAC__ApodizationFunction; @@ -70,6 +74,15 @@ typedef struct { struct { FLAC__real p; } tukey; + struct { + FLAC__real p; + FLAC__real start; + FLAC__real end; + } multiple_tukey; + struct { + FLAC__real p; + FLAC__int32 parts; + } subdivide_tukey; } parameters; } FLAC__ApodizationSpecification; @@ -82,25 +95,26 @@ typedef struct FLAC__StreamEncoderProtected { FLAC__bool do_md5; FLAC__bool do_mid_side_stereo; FLAC__bool loose_mid_side_stereo; - unsigned channels; - unsigned bits_per_sample; - unsigned sample_rate; - unsigned blocksize; + uint32_t channels; + uint32_t bits_per_sample; + uint32_t sample_rate; + uint32_t blocksize; #ifndef FLAC__INTEGER_ONLY_LIBRARY - unsigned num_apodizations; + uint32_t num_apodizations; FLAC__ApodizationSpecification apodizations[FLAC__MAX_APODIZATION_FUNCTIONS]; #endif - unsigned max_lpc_order; - unsigned qlp_coeff_precision; + uint32_t max_lpc_order; + uint32_t qlp_coeff_precision; FLAC__bool do_qlp_coeff_prec_search; FLAC__bool do_exhaustive_model_search; FLAC__bool do_escape_coding; - unsigned min_residual_partition_order; - unsigned max_residual_partition_order; - unsigned rice_parameter_search_dist; + uint32_t min_residual_partition_order; + uint32_t max_residual_partition_order; + uint32_t rice_parameter_search_dist; FLAC__uint64 total_samples_estimate; + FLAC__bool limit_min_bitrate; FLAC__StreamMetadata **metadata; - unsigned num_metadata_blocks; + uint32_t num_metadata_blocks; FLAC__uint64 streaminfo_offset, seektable_offset, audio_offset; #if FLAC__HAS_OGG FLAC__OggEncoderAspect ogg_encoder_aspect; diff --git a/3rdparty/libflac/src/libFLAC/libFLAC.m4 b/3rdparty/libflac/src/libFLAC/libFLAC.m4 index 24eb0c5432a..5dfc5ea5d06 100644 --- a/3rdparty/libflac/src/libFLAC/libFLAC.m4 +++ b/3rdparty/libflac/src/libFLAC/libFLAC.m4 @@ -14,14 +14,18 @@ AC_ARG_WITH(libFLAC-includes,[ --with-libFLAC-includes=DIR Directory where li AC_ARG_ENABLE(libFLACtest, [ --disable-libFLACtest Do not try to compile and run a test libFLAC program],, enable_libFLACtest=yes) if test "x$libFLAC_libraries" != "x" ; then - LIBFLAC_LIBDIR="$libFLAC_libraries" + LIBFLAC_LIBS="-L$libFLAC_libraries" + elif test "x$libFLAC_prefix" = "xno" || test "x$libFLAC_prefix" = "xyes" ; then + LIBFLAC_LIBS="" elif test "x$libFLAC_prefix" != "x" ; then - LIBFLAC_LIBDIR="$libFLAC_prefix/lib" - elif test "x$prefix" != "xNONE" ; then - LIBFLAC_LIBDIR="$libdir" + LIBFLAC_LIBS="-L$libFLAC_prefix/lib" + elif test "x$prefix" != "xNONE"; then + LIBFLAC_LIBS="-L$prefix/lib" fi - LIBFLAC_LIBS="-L$LIBFLAC_LIBDIR -lFLAC $OGG_LIBS -lm" + if test "x$libFLAC_prefix" != "xno" ; then + LIBFLAC_LIBS="$LIBFLAC_LIBS -lFLAC $OGG_LIBS -lm" + fi if test "x$libFLAC_includes" != "x" ; then LIBFLAC_CFLAGS="-I$libFLAC_includes" @@ -48,19 +52,15 @@ dnl dnl Now check if the installed libFLAC is sufficiently new. dnl rm -f conf.libFLACtest - AC_TRY_RUN([ + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <FLAC/format.h> - -int main () -{ +]],[[ system("touch conf.libFLACtest"); return 0; -} - -],, no_libFLAC=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) +]])],[],[no_libFLAC=yes],[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" @@ -94,7 +94,7 @@ int main () 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 occured. This usually means libFLAC was incorrectly installed" + 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: $LIBFLAC_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" diff --git a/3rdparty/libflac/src/libFLAC/libFLAC_dynamic.dsp b/3rdparty/libflac/src/libFLAC/libFLAC_dynamic.dsp deleted file mode 100644 index 73169ecfc22..00000000000 --- a/3rdparty/libflac/src/libFLAC/libFLAC_dynamic.dsp +++ /dev/null @@ -1,464 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libFLAC_dynamic" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=libFLAC_dynamic - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libFLAC_dynamic.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libFLAC_dynamic.mak" CFG="libFLAC_dynamic - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libFLAC_dynamic - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libFLAC_dynamic - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "libFLAC" -# PROP Scc_LocalPath "..\.." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_dynamic" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I ".\include" /I "..\..\include" /D "NDEBUG" /D "FLAC_API_EXPORTS" /D "FLAC__HAS_OGG" /D VERSION=\"1.2.1\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" /d "_USRDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:windows /dll /machine:I386 /out:"..\..\obj\release\bin/libFLAC.dll" - -!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_dynamic" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I ".\include" /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__OVERFLOW_DETECT" /D "FLAC_API_EXPORTS" /D "FLAC__HAS_OGG" /D VERSION=\"1.2.1\" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "_WINDOWS" /D "_WINDLL" /D "WIN32" /D "_USRDLL" /FR /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o "NUL" /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" /d "_USRDLL" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:windows /dll /debug /machine:I386 /out:"..\..\obj\debug\bin/libFLAC.dll" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "libFLAC_dynamic - Win32 Release" -# Name "libFLAC_dynamic - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Group "Assembly Files (ia32)" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ia32\bitreader_asm.nasm - -!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" - -USERDEP__CPU_A="ia32/bitreader_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\bitreader_asm.nasm - -"ia32/bitreader_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" - -USERDEP__CPU_A="ia32/bitreader_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\bitreader_asm.nasm - -"ia32/bitreader_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\cpu_asm.nasm - -!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" - -USERDEP__CPU_A="ia32/cpu_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\cpu_asm.nasm - -"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" - -USERDEP__CPU_A="ia32/cpu_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\cpu_asm.nasm - -"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\fixed_asm.nasm - -!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" - -USERDEP__FIXED="ia32/fixed_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\fixed_asm.nasm - -"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" - -USERDEP__FIXED="ia32/fixed_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\fixed_asm.nasm - -"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\lpc_asm.nasm - -!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" - -USERDEP__LPC_A="ia32/lpc_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\lpc_asm.nasm - -"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" - -USERDEP__LPC_A="ia32/lpc_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\lpc_asm.nasm - -"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\stream_encoder_asm.nasm - -!IF "$(CFG)" == "libFLAC_dynamic - Win32 Release" - -USERDEP__CPU_A="ia32/stream_encoder_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\stream_encoder_asm.nasm - -"ia32/stream_encoder_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_dynamic - Win32 Debug" - -USERDEP__CPU_A="ia32/stream_encoder_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\stream_encoder_asm.nasm - -"ia32/stream_encoder_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\nasm.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\bitmath.c -# End Source File -# Begin Source File - -SOURCE=.\bitreader.c -# End Source File -# Begin Source File - -SOURCE=.\bitwriter.c -# End Source File -# Begin Source File - -SOURCE=.\cpu.c -# End Source File -# Begin Source File - -SOURCE=.\crc.c -# End Source File -# Begin Source File - -SOURCE=.\fixed.c -# End Source File -# Begin Source File - -SOURCE=.\float.c -# End Source File -# Begin Source File - -SOURCE=.\format.c -# End Source File -# Begin Source File - -SOURCE=.\lpc.c -# End Source File -# Begin Source File - -SOURCE=.\md5.c -# End Source File -# Begin Source File - -SOURCE=.\memory.c -# End Source File -# Begin Source File - -SOURCE=.\metadata_iterators.c -# End Source File -# Begin Source File - -SOURCE=.\metadata_object.c -# End Source File -# Begin Source File - -SOURCE=.\ogg_decoder_aspect.c -# End Source File -# Begin Source File - -SOURCE=.\ogg_encoder_aspect.c -# End Source File -# Begin Source File - -SOURCE=.\ogg_helper.c -# End Source File -# Begin Source File - -SOURCE=.\ogg_mapping.c -# End Source File -# Begin Source File - -SOURCE=.\stream_decoder.c -# End Source File -# Begin Source File - -SOURCE=.\stream_encoder.c -# End Source File -# Begin Source File - -SOURCE=.\stream_encoder_framing.c -# End Source File -# Begin Source File - -SOURCE=.\window.c -# End Source File -# End Group -# Begin Group "Private Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\include\private\all.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\bitmath.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\bitreader.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\bitwriter.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\cpu.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\crc.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\fixed.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\float.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\format.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\lpc.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\md5.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\memory.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\metadata.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\ogg_decoder_aspect.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\ogg_encoder_aspect.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\ogg_helper.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\ogg_mapping.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\stream_encoder_framing.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\window.h -# End Source File -# End Group -# Begin Group "Protected Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\include\protected\all.h -# End Source File -# Begin Source File - -SOURCE=.\include\protected\stream_decoder.h -# End Source File -# Begin Source File - -SOURCE=.\include\protected\stream_encoder.h -# End Source File -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\include\FLAC\all.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\assert.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\export.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\format.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\metadata.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\ordinals.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\stream_decoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\stream_encoder.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/libFLAC/libFLAC_dynamic.vcproj b/3rdparty/libflac/src/libFLAC/libFLAC_dynamic.vcproj deleted file mode 100644 index f8163ab7b9d..00000000000 --- a/3rdparty/libflac/src/libFLAC/libFLAC_dynamic.vcproj +++ /dev/null @@ -1,540 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="libFLAC_dynamic" - ProjectGUID="{4cefbc83-c215-11db-8314-0800200c9a66}" - RootNamespace="libFLAC_dynamic" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\lib" - IntermediateDirectory="Debug_dynamic" - ConfigurationType="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";DEBUG;FLAC__OVERFLOW_DETECT" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\lib" - IntermediateDirectory="Release_dynamic" - ConfigurationType="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLAC_API_EXPORTS;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\"" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\private\all.h" - > - </File> - <File - RelativePath=".\include\protected\all.h" - > - </File> - <File - RelativePath=".\include\private\bitmath.h" - > - </File> - <File - RelativePath=".\include\private\bitreader.h" - > - </File> - <File - RelativePath=".\include\private\bitwriter.h" - > - </File> - <File - RelativePath=".\include\private\cpu.h" - > - </File> - <File - RelativePath=".\include\private\crc.h" - > - </File> - <File - RelativePath=".\include\private\fixed.h" - > - </File> - <File - RelativePath=".\include\private\float.h" - > - </File> - <File - RelativePath=".\include\private\format.h" - > - </File> - <File - RelativePath=".\include\private\lpc.h" - > - </File> - <File - RelativePath=".\include\private\md5.h" - > - </File> - <File - RelativePath=".\include\private\memory.h" - > - </File> - <File - RelativePath=".\include\private\metadata.h" - > - </File> - <File - RelativePath=".\ia32\nasm.h" - > - </File> - <File - RelativePath=".\include\private\ogg_decoder_aspect.h" - > - </File> - <File - RelativePath=".\include\private\ogg_encoder_aspect.h" - > - </File> - <File - RelativePath=".\include\private\ogg_helper.h" - > - </File> - <File - RelativePath=".\include\private\ogg_mapping.h" - > - </File> - <File - RelativePath=".\include\protected\stream_decoder.h" - > - </File> - <File - RelativePath=".\include\protected\stream_encoder.h" - > - </File> - <File - RelativePath=".\include\private\stream_encoder_framing.h" - > - </File> - <File - RelativePath=".\include\private\window.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\bitmath.c" - > - </File> - <File - RelativePath=".\bitreader.c" - > - </File> - <File - RelativePath=".\bitwriter.c" - > - </File> - <File - RelativePath=".\cpu.c" - > - </File> - <File - RelativePath=".\crc.c" - > - </File> - <File - RelativePath=".\fixed.c" - > - </File> - <File - RelativePath=".\float.c" - > - </File> - <File - RelativePath=".\format.c" - > - </File> - <File - RelativePath=".\lpc.c" - > - </File> - <File - RelativePath=".\md5.c" - > - </File> - <File - RelativePath=".\memory.c" - > - </File> - <File - RelativePath=".\metadata_iterators.c" - > - </File> - <File - RelativePath=".\metadata_object.c" - > - </File> - <File - RelativePath=".\ogg_decoder_aspect.c" - > - </File> - <File - RelativePath=".\ogg_encoder_aspect.c" - > - </File> - <File - RelativePath=".\ogg_helper.c" - > - </File> - <File - RelativePath=".\ogg_mapping.c" - > - </File> - <File - RelativePath=".\stream_decoder.c" - > - </File> - <File - RelativePath=".\stream_encoder.c" - > - </File> - <File - RelativePath=".\stream_encoder_framing.c" - > - </File> - <File - RelativePath=".\window.c" - > - </File> - </Filter> - <Filter - Name="Public Header Files" - > - <File - RelativePath="..\..\include\FLAC\all.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\assert.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\callback.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\export.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\format.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\metadata.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\ordinals.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\stream_decoder.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\stream_encoder.h" - > - </File> - </Filter> - <File - RelativePath=".\ia32\bitreader_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
" - AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h" - Outputs="ia32/bitreader_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
" - AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h" - Outputs="ia32/bitreader_asm.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\release_static\BuildLog.htm" - > - </File> - <File - RelativePath=".\ia32\cpu_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
" - AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h" - Outputs="ia32/cpu_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
" - AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h" - Outputs="ia32/cpu_asm.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\ia32\fixed_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
" - AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h" - Outputs="ia32/fixed_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
" - AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h" - Outputs="ia32/fixed_asm.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\ia32\lpc_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
" - AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h" - Outputs="ia32/lpc_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
" - AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h" - Outputs="ia32/lpc_asm.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\ia32\stream_encoder_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
" - AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h" - Outputs="ia32/stream_encoder_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
" - AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h" - Outputs="ia32/stream_encoder_asm.obj" - /> - </FileConfiguration> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/libFLAC/libFLAC_static.dsp b/3rdparty/libflac/src/libFLAC/libFLAC_static.dsp deleted file mode 100644 index 1a11d8b2120..00000000000 --- a/3rdparty/libflac/src/libFLAC/libFLAC_static.dsp +++ /dev/null @@ -1,457 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libFLAC_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=libFLAC_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libFLAC_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libFLAC_static.mak" CFG="libFLAC_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libFLAC_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "libFLAC_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "libFLAC" -# PROP Scc_LocalPath "..\.." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libFLAC_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\include" /D VERSION=\"1.2.1\" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\include" /D VERSION=\"1.2.1\" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "FLAC__CPU_IA32" /D "FLAC__HAS_NASM" /D "FLAC__USE_3DNOW" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "FLAC__OVERFLOW_DETECT" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "libFLAC_static - Win32 Release" -# Name "libFLAC_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Group "Assembly Files (ia32)" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ia32\bitreader_asm.nasm - -!IF "$(CFG)" == "libFLAC_static - Win32 Release" - -USERDEP__CPU_A="ia32/bitreader_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\bitreader_asm.nasm - -"ia32/bitreader_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" - -USERDEP__CPU_A="ia32/bitreader_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\bitreader_asm.nasm - -"ia32/bitreader_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\cpu_asm.nasm - -!IF "$(CFG)" == "libFLAC_static - Win32 Release" - -USERDEP__CPU_A="ia32/cpu_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\cpu_asm.nasm - -"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" - -USERDEP__CPU_A="ia32/cpu_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\cpu_asm.nasm - -"ia32/cpu_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\fixed_asm.nasm - -!IF "$(CFG)" == "libFLAC_static - Win32 Release" - -USERDEP__FIXED="ia32/fixed_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\fixed_asm.nasm - -"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" - -USERDEP__FIXED="ia32/fixed_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\fixed_asm.nasm - -"ia32/fixed_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\lpc_asm.nasm - -!IF "$(CFG)" == "libFLAC_static - Win32 Release" - -USERDEP__LPC_A="ia32/lpc_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\lpc_asm.nasm - -"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" - -USERDEP__LPC_A="ia32/lpc_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\lpc_asm.nasm - -"ia32/lpc_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\stream_encoder_asm.nasm - -!IF "$(CFG)" == "libFLAC_static - Win32 Release" - -USERDEP__CPU_A="ia32/stream_encoder_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\stream_encoder_asm.nasm - -"ia32/stream_encoder_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj - -# End Custom Build - -!ELSEIF "$(CFG)" == "libFLAC_static - Win32 Debug" - -USERDEP__CPU_A="ia32/stream_encoder_asm.nasm" -# Begin Custom Build -InputPath=.\ia32\stream_encoder_asm.nasm - -"ia32/stream_encoder_asm.obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\ia32\nasm.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\bitmath.c -# End Source File -# Begin Source File - -SOURCE=.\bitreader.c -# End Source File -# Begin Source File - -SOURCE=.\bitwriter.c -# End Source File -# Begin Source File - -SOURCE=.\cpu.c -# End Source File -# Begin Source File - -SOURCE=.\crc.c -# End Source File -# Begin Source File - -SOURCE=.\fixed.c -# End Source File -# Begin Source File - -SOURCE=.\float.c -# End Source File -# Begin Source File - -SOURCE=.\format.c -# End Source File -# Begin Source File - -SOURCE=.\lpc.c -# End Source File -# Begin Source File - -SOURCE=.\md5.c -# End Source File -# Begin Source File - -SOURCE=.\memory.c -# End Source File -# Begin Source File - -SOURCE=.\metadata_iterators.c -# End Source File -# Begin Source File - -SOURCE=.\metadata_object.c -# End Source File -# Begin Source File - -SOURCE=.\ogg_decoder_aspect.c -# End Source File -# Begin Source File - -SOURCE=.\ogg_encoder_aspect.c -# End Source File -# Begin Source File - -SOURCE=.\ogg_helper.c -# End Source File -# Begin Source File - -SOURCE=.\ogg_mapping.c -# End Source File -# Begin Source File - -SOURCE=.\stream_decoder.c -# End Source File -# Begin Source File - -SOURCE=.\stream_encoder.c -# End Source File -# Begin Source File - -SOURCE=.\stream_encoder_framing.c -# End Source File -# Begin Source File - -SOURCE=.\window.c -# End Source File -# End Group -# Begin Group "Private Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\include\private\all.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\bitmath.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\bitreader.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\bitwriter.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\cpu.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\crc.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\fixed.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\float.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\format.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\lpc.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\md5.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\memory.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\metadata.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\ogg_decoder_aspect.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\ogg_encoder_aspect.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\ogg_helper.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\ogg_mapping.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\stream_encoder_framing.h -# End Source File -# Begin Source File - -SOURCE=.\include\private\window.h -# End Source File -# End Group -# Begin Group "Protected Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\include\protected\all.h -# End Source File -# Begin Source File - -SOURCE=.\include\protected\stream_decoder.h -# End Source File -# Begin Source File - -SOURCE=.\include\protected\stream_encoder.h -# End Source File -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\include\FLAC\all.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\assert.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\export.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\format.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\metadata.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\ordinals.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\stream_decoder.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\FLAC\stream_encoder.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/libFLAC/libFLAC_static.vcproj b/3rdparty/libflac/src/libFLAC/libFLAC_static.vcproj deleted file mode 100644 index cdc1531c92c..00000000000 --- a/3rdparty/libflac/src/libFLAC/libFLAC_static.vcproj +++ /dev/null @@ -1,505 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="libFLAC_static" - ProjectGUID="{4cefbc84-c215-11db-8314-0800200c9a66}" - RootNamespace="libFLAC_static" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\lib" - IntermediateDirectory="Debug_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLAC__NO_DLL;DEBUG;FLAC__OVERFLOW_DETECT" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\obj\debug\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\lib" - IntermediateDirectory="Release_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__HAS_OGG;FLAC__CPU_IA32;FLAC__HAS_NASM;FLAC__USE_3DNOW;VERSION=\"1.2.0\";FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\obj\release\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\protected\all.h" - > - </File> - <File - RelativePath=".\include\private\all.h" - > - </File> - <File - RelativePath=".\include\private\bitmath.h" - > - </File> - <File - RelativePath=".\include\private\bitreader.h" - > - </File> - <File - RelativePath=".\include\private\bitwriter.h" - > - </File> - <File - RelativePath=".\include\private\cpu.h" - > - </File> - <File - RelativePath=".\include\private\crc.h" - > - </File> - <File - RelativePath=".\include\private\fixed.h" - > - </File> - <File - RelativePath=".\include\private\float.h" - > - </File> - <File - RelativePath=".\include\private\format.h" - > - </File> - <File - RelativePath=".\include\private\lpc.h" - > - </File> - <File - RelativePath=".\include\private\md5.h" - > - </File> - <File - RelativePath=".\include\private\memory.h" - > - </File> - <File - RelativePath=".\include\private\metadata.h" - > - </File> - <File - RelativePath=".\ia32\nasm.h" - > - </File> - <File - RelativePath=".\include\private\ogg_decoder_aspect.h" - > - </File> - <File - RelativePath=".\include\private\ogg_encoder_aspect.h" - > - </File> - <File - RelativePath=".\include\private\ogg_helper.h" - > - </File> - <File - RelativePath=".\include\private\ogg_mapping.h" - > - </File> - <File - RelativePath=".\include\protected\stream_decoder.h" - > - </File> - <File - RelativePath=".\include\protected\stream_encoder.h" - > - </File> - <File - RelativePath=".\include\private\stream_encoder_framing.h" - > - </File> - <File - RelativePath=".\include\private\window.h" - > - </File> - </Filter> - <Filter - Name="Public Header Files" - > - <File - RelativePath="..\..\include\FLAC\all.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\assert.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\callback.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\export.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\format.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\metadata.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\ordinals.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\stream_decoder.h" - > - </File> - <File - RelativePath="..\..\include\FLAC\stream_encoder.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\bitmath.c" - > - </File> - <File - RelativePath=".\bitreader.c" - > - </File> - <File - RelativePath=".\bitwriter.c" - > - </File> - <File - RelativePath=".\cpu.c" - > - </File> - <File - RelativePath=".\crc.c" - > - </File> - <File - RelativePath=".\fixed.c" - > - </File> - <File - RelativePath=".\float.c" - > - </File> - <File - RelativePath=".\format.c" - > - </File> - <File - RelativePath=".\lpc.c" - > - </File> - <File - RelativePath=".\md5.c" - > - </File> - <File - RelativePath=".\memory.c" - > - </File> - <File - RelativePath=".\metadata_iterators.c" - > - </File> - <File - RelativePath=".\metadata_object.c" - > - </File> - <File - RelativePath=".\ogg_decoder_aspect.c" - > - </File> - <File - RelativePath=".\ogg_encoder_aspect.c" - > - </File> - <File - RelativePath=".\ogg_helper.c" - > - </File> - <File - RelativePath=".\ogg_mapping.c" - > - </File> - <File - RelativePath=".\stream_decoder.c" - > - </File> - <File - RelativePath=".\stream_encoder.c" - > - </File> - <File - RelativePath=".\stream_encoder_framing.c" - > - </File> - <File - RelativePath=".\window.c" - > - </File> - </Filter> - <File - RelativePath=".\ia32\bitreader_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
" - AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h" - Outputs="ia32/bitreader_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/bitreader_asm.nasm -o ia32/bitreader_asm.obj
" - AdditionalDependencies="ia32/bitreader_asm.nasm;ia32/nasm.h" - Outputs="ia32/bitreader_asm.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\ia32\cpu_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
" - AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h" - Outputs="ia32/cpu_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/cpu_asm.nasm -o ia32/cpu_asm.obj
" - AdditionalDependencies="ia32/cpu_asm.nasm;ia32/nasm.h" - Outputs="ia32/cpu_asm.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\ia32\fixed_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
" - AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h" - Outputs="ia32/fixed_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/fixed_asm.nasm -o ia32/fixed_asm.obj
" - AdditionalDependencies="ia32/fixed_asm.nasm;ia32/nasm.h" - Outputs="ia32/fixed_asm.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\ia32\lpc_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
" - AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h" - Outputs="ia32/lpc_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/lpc_asm.nasm -o ia32/lpc_asm.obj
" - AdditionalDependencies="ia32/lpc_asm.nasm;ia32/nasm.h" - Outputs="ia32/lpc_asm.obj" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\ia32\stream_encoder_asm.nasm" - > - <FileConfiguration - Name="Debug|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
" - AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h" - Outputs="ia32/stream_encoder_asm.obj" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - > - <Tool - Name="VCCustomBuildTool" - CommandLine="nasmw.exe -f win32 -d OBJ_FORMAT_win32 -i ia32/ ia32/stream_encoder_asm.nasm -o ia32/stream_encoder_asm.obj
" - AdditionalDependencies="ia32/stream_encoder_asm.nasm;ia32/nasm.h" - Outputs="ia32/stream_encoder_asm.obj" - /> - </FileConfiguration> - </File> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/libFLAC/lpc.c b/3rdparty/libflac/src/libFLAC/lpc.c index 00bbab44c1c..bcb8673c3fc 100644 --- a/3rdparty/libflac/src/libFLAC/lpc.c +++ b/3rdparty/libflac/src/libFLAC/lpc.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,41 +35,84 @@ #endif #include <math.h> +#include <stdlib.h> + #include "FLAC/assert.h" #include "FLAC/format.h" +#include "share/compat.h" #include "private/bitmath.h" #include "private/lpc.h" -#if defined DEBUG || defined FLAC__OVERFLOW_DETECT || defined FLAC__OVERFLOW_DETECT_VERBOSE +#include "private/macros.h" + +#if !defined(NDEBUG) || defined FLAC__OVERFLOW_DETECT || defined FLAC__OVERFLOW_DETECT_VERBOSE #include <stdio.h> #endif +/* OPT: #undef'ing this may improve the speed on some architectures */ +#define FLAC__LPC_UNROLLED_FILTER_LOOPS + #ifndef FLAC__INTEGER_ONLY_LIBRARY -#ifndef M_LN2 -/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */ -#define M_LN2 0.69314718055994530942 +#if defined(_MSC_VER) && (_MSC_VER < 1800) +#include <float.h> +static inline long int lround(double x) { + return (long)(x + _copysign(0.5, x)); +} +#elif !defined(HAVE_LROUND) && defined(__GNUC__) +static inline long int lround(double x) { + return (long)(x + __builtin_copysign(0.5, x)); +} +/* If this fails, we are in the presence of a mid 90's compiler, move along... */ #endif -/* OPT: #undef'ing this may improve the speed on some architectures */ -#define FLAC__LPC_UNROLLED_FILTER_LOOPS - +void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len) +{ + uint32_t i; + for(i = 0; i < data_len; i++) + out[i] = in[i] * window[i]; +} -void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], unsigned data_len) +void FLAC__lpc_window_data_wide(const FLAC__int64 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len) { - unsigned i; + uint32_t i; for(i = 0; i < data_len; i++) out[i] = in[i] * window[i]; } -#if defined(__GNUC__) && defined(__i386__) && (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) -__attribute__((optimize("O0"))) -#endif -void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]) +void FLAC__lpc_window_data_partial(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len, uint32_t part_size, uint32_t data_shift) +{ + uint32_t i, j; + if((part_size + data_shift) < data_len){ + for(i = 0; i < part_size; i++) + out[i] = in[data_shift+i] * window[i]; + i = flac_min(i,data_len - part_size - data_shift); + for(j = data_len - part_size; j < data_len; i++, j++) + out[i] = in[data_shift+i] * window[j]; + if(i < data_len) + out[i] = 0.0f; + } +} + +void FLAC__lpc_window_data_partial_wide(const FLAC__int64 in[], const FLAC__real window[], FLAC__real out[], uint32_t data_len, uint32_t part_size, uint32_t data_shift) +{ + uint32_t i, j; + if((part_size + data_shift) < data_len){ + for(i = 0; i < part_size; i++) + out[i] = in[data_shift+i] * window[i]; + i = flac_min(i,data_len - part_size - data_shift); + for(j = data_len - part_size; j < data_len; i++, j++) + out[i] = in[data_shift+i] * window[j]; + if(i < data_len) + out[i] = 0.0f; + } +} + +void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) { /* a readable, but slower, version */ #if 0 - FLAC__real d; - unsigned i; + double d; + uint32_t i; FLAC__ASSERT(lag > 0); FLAC__ASSERT(lag <= data_len); @@ -82,44 +126,57 @@ void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_le */ while(lag--) { for(i = lag, d = 0.0; i < data_len; i++) - d += data[i] * data[i - lag]; + d += data[i] * (double)data[i - lag]; autoc[lag] = d; } #endif - - /* - * this version tends to run faster because of better data locality - * ('data_len' is usually much larger than 'lag') - */ - FLAC__real d, tmp; - unsigned sample, coeff; - const unsigned limit = data_len - lag; - - FLAC__ASSERT(lag > 0); - FLAC__ASSERT(lag <= data_len); - - for(coeff = 0; coeff < lag; coeff++) - autoc[coeff] = 0.0; - for(sample = 0; sample <= limit; sample++) { - d = data[sample]; - for(coeff = 0; coeff < lag; coeff++) { - tmp = d * data[sample+coeff]; - autoc[coeff] += tmp; + if (data_len < FLAC__MAX_LPC_ORDER || lag > 16) { + /* + * this version tends to run faster because of better data locality + * ('data_len' is usually much larger than 'lag') + */ + double d; + uint32_t sample, coeff; + const uint32_t limit = data_len - lag; + + FLAC__ASSERT(lag > 0); + FLAC__ASSERT(lag <= data_len); + + for(coeff = 0; coeff < lag; coeff++) + autoc[coeff] = 0.0; + for(sample = 0; sample <= limit; sample++) { + d = data[sample]; + for(coeff = 0; coeff < lag; coeff++) + autoc[coeff] += d * data[sample+coeff]; } - } - for(; sample < data_len; sample++) { - d = data[sample]; - for(coeff = 0; coeff < data_len - sample; coeff++) { - tmp = d * data[sample+coeff]; - autoc[coeff] += tmp; + for(; sample < data_len; sample++) { + d = data[sample]; + for(coeff = 0; coeff < data_len - sample; coeff++) + autoc[coeff] += d * data[sample+coeff]; } } + else if(lag <= 8) { + #undef MAX_LAG + #define MAX_LAG 8 + #include "deduplication/lpc_compute_autocorrelation_intrin.c" + } + else if(lag <= 12) { + #undef MAX_LAG + #define MAX_LAG 12 + #include "deduplication/lpc_compute_autocorrelation_intrin.c" + } + else if(lag <= 16) { + #undef MAX_LAG + #define MAX_LAG 16 + #include "deduplication/lpc_compute_autocorrelation_intrin.c" + } + } -void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__double error[]) +void FLAC__lpc_compute_lp_coefficients(const double autoc[], uint32_t *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], double error[]) { - unsigned i, j; - FLAC__double r, err, lpc[FLAC__MAX_LPC_ORDER]; + uint32_t i, j; + double r, err, lpc[FLAC__MAX_LPC_ORDER]; FLAC__ASSERT(0 != max_order); FLAC__ASSERT(0 < *max_order); @@ -133,12 +190,12 @@ void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_o r = -autoc[i+1]; for(j = 0; j < i; j++) r -= lpc[j] * autoc[i-j]; - r/=err; + r /= err; /* Update LPC coefficients and total error. */ lpc[i]=r; for(j = 0; j < (i>>1); j++) { - FLAC__double tmp = lpc[j]; + double tmp = lpc[j]; lpc[j] += r * lpc[i-1-j]; lpc[i-1-j] += r * tmp; } @@ -152,7 +209,7 @@ void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_o lp_coeff[i][j] = (FLAC__real)(-lpc[j]); /* negate FIR filter coeff to get predictor coeff */ error[i] = err; - /* see SF bug #1601812 http://sourceforge.net/tracker/index.php?func=detail&aid=1601812&group_id=13478&atid=113478 */ + /* see SF bug https://sourceforge.net/p/flac/bugs/234/ */ if(err == 0.0) { *max_order = i+1; return; @@ -160,10 +217,10 @@ void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_o } } -int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift) +int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], uint32_t order, uint32_t precision, FLAC__int32 qlp_coeff[], int *shift) { - unsigned i; - FLAC__double cmax; + uint32_t i; + double cmax; FLAC__int32 qmax, qmin; FLAC__ASSERT(precision > 0); @@ -178,7 +235,7 @@ int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, /* calc cmax = max( |lp_coeff[i]| ) */ cmax = 0.0; for(i = 0; i < order; i++) { - const FLAC__double d = fabs(lp_coeff[i]); + const double d = fabs(lp_coeff[i]); if(d > cmax) cmax = d; } @@ -203,18 +260,12 @@ int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, } if(*shift >= 0) { - FLAC__double error = 0.0; + double error = 0.0; FLAC__int32 q; for(i = 0; i < order; i++) { error += lp_coeff[i] * (1 << *shift); -#if 1 /* unfortunately lround() is C99 */ - if(error >= 0.0) - q = (FLAC__int32)(error + 0.5); - else - q = (FLAC__int32)(error - 0.5); -#else q = lround(error); -#endif + #ifdef FLAC__OVERFLOW_DETECT if(q > qmax+1) /* we expect q==qmax+1 occasionally due to rounding */ fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q>qmax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmax,*shift,cmax,precision+1,i,lp_coeff[i]); @@ -230,26 +281,19 @@ int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, } } /* negative shift is very rare but due to design flaw, negative shift is - * a NOP in the decoder, so it must be handled specially by scaling down - * coeffs + * not allowed in the decoder, so it must be handled specially by scaling + * down coeffs */ else { const int nshift = -(*shift); - FLAC__double error = 0.0; + double error = 0.0; FLAC__int32 q; -#ifdef DEBUG +#ifndef NDEBUG fprintf(stderr,"FLAC__lpc_quantize_coefficients: negative shift=%d order=%u cmax=%f\n", *shift, order, cmax); #endif for(i = 0; i < order; i++) { error += lp_coeff[i] / (1 << nshift); -#if 1 /* unfortunately lround() is C99 */ - if(error >= 0.0) - q = (FLAC__int32)(error + 0.5); - else - q = (FLAC__int32)(error - 0.5); -#else q = lround(error); -#endif #ifdef FLAC__OVERFLOW_DETECT if(q > qmax+1) /* we expect q==qmax+1 occasionally due to rounding */ fprintf(stderr,"FLAC__lpc_quantize_coefficients: quantizer overflow: q>qmax %d>%d shift=%d cmax=%f precision=%u lpc[%u]=%f\n",q,qmax,*shift,cmax,precision+1,i,lp_coeff[i]); @@ -269,11 +313,16 @@ int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, return 0; } -void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]) +#if defined(_MSC_VER) +// silence MSVC warnings about __restrict modifier +#pragma warning ( disable : 4028 ) +#endif + +void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 * flac_restrict data, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict residual) #if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS) { FLAC__int64 sumo; - unsigned i, j; + uint32_t i, j; FLAC__int32 sum; const FLAC__int32 *history; @@ -292,13 +341,8 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, u for(j = 0; j < order; j++) { sum += qlp_coeff[j] * (*(--history)); sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history); -#if defined _MSC_VER - if(sumo > 2147483647I64 || sumo < -2147483648I64) - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n",i,j,qlp_coeff[j],*history,sumo); -#else if(sumo > 2147483647ll || sumo < -2147483648ll) - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,(long long)sumo); -#endif + fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%" PRId64 "\n",i,j,qlp_coeff[j],*history,sumo); } *(residual++) = *(data++) - (sum >> lp_quantization); } @@ -496,25 +540,25 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, u for(i = 0; i < (int)data_len; i++) { sum = 0; switch(order) { - case 32: sum += qlp_coeff[31] * data[i-32]; - case 31: sum += qlp_coeff[30] * data[i-31]; - case 30: sum += qlp_coeff[29] * data[i-30]; - case 29: sum += qlp_coeff[28] * data[i-29]; - case 28: sum += qlp_coeff[27] * data[i-28]; - case 27: sum += qlp_coeff[26] * data[i-27]; - case 26: sum += qlp_coeff[25] * data[i-26]; - case 25: sum += qlp_coeff[24] * data[i-25]; - case 24: sum += qlp_coeff[23] * data[i-24]; - case 23: sum += qlp_coeff[22] * data[i-23]; - case 22: sum += qlp_coeff[21] * data[i-22]; - case 21: sum += qlp_coeff[20] * data[i-21]; - case 20: sum += qlp_coeff[19] * data[i-20]; - case 19: sum += qlp_coeff[18] * data[i-19]; - case 18: sum += qlp_coeff[17] * data[i-18]; - case 17: sum += qlp_coeff[16] * data[i-17]; - case 16: sum += qlp_coeff[15] * data[i-16]; - case 15: sum += qlp_coeff[14] * data[i-15]; - case 14: sum += qlp_coeff[13] * data[i-14]; + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ case 13: sum += qlp_coeff[12] * data[i-13]; sum += qlp_coeff[11] * data[i-12]; sum += qlp_coeff[10] * data[i-11]; @@ -535,10 +579,10 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, u } #endif -void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]) +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 * flac_restrict data, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict residual) #if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS) { - unsigned i, j; + uint32_t i, j; FLAC__int64 sum; const FLAC__int32 *history; @@ -555,20 +599,8 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da history = data; for(j = 0; j < order; j++) sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history)); - if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) { -#if defined _MSC_VER - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization); -#else - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization)); -#endif - break; - } - if(FLAC__bitmath_silog2_wide((FLAC__int64)(*data) - (sum >> lp_quantization)) > 32) { -#if defined _MSC_VER - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%I64d, residual=%I64d\n", i, *data, sum >> lp_quantization, (FLAC__int64)(*data) - (sum >> lp_quantization)); -#else - fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%lld, residual=%lld\n", i, *data, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*data) - (sum >> lp_quantization))); -#endif + if(FLAC__bitmath_silog2((FLAC__int64)(*data) - (sum >> lp_quantization)) > 32) { + fprintf(stderr,"FLAC__lpc_compute_residual_from_qlp_coefficients_wide: OVERFLOW, i=%u, data=%d, sum=%" PRId64 ", residual=%" PRId64 "\n", i, *data, (int64_t)(sum >> lp_quantization), ((FLAC__int64)(*data) - (sum >> lp_quantization))); break; } *(residual++) = *(data++) - (FLAC__int32)(sum >> lp_quantization); @@ -605,7 +637,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } else { /* order == 11 */ @@ -622,7 +654,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } } @@ -640,7 +672,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } else { /* order == 9 */ @@ -655,7 +687,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } } @@ -673,7 +705,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } else { /* order == 7 */ @@ -686,7 +718,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } } @@ -700,7 +732,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } else { /* order == 5 */ @@ -711,7 +743,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } } @@ -725,7 +757,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } else { /* order == 3 */ @@ -734,7 +766,7 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } } @@ -744,12 +776,12 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum = 0; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } else { /* order == 1 */ for(i = 0; i < (int)data_len; i++) - residual[i] = data[i] - (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization); + residual[i] = data[i] - ((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization); } } } @@ -758,25 +790,25 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da for(i = 0; i < (int)data_len; i++) { sum = 0; switch(order) { - case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32]; - case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31]; - case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30]; - case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29]; - case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28]; - case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27]; - case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26]; - case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25]; - case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24]; - case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23]; - case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22]; - case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21]; - case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20]; - case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19]; - case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18]; - case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17]; - case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16]; - case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; - case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; + case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; /* Falls through. */ case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13]; sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; @@ -791,19 +823,160 @@ void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *da sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; } - residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + residual[i] = data[i] - (sum >> lp_quantization); } } } #endif +FLAC__bool FLAC__lpc_compute_residual_from_qlp_coefficients_limit_residual(const FLAC__int32 * flac_restrict data, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict residual) +{ + int i; + FLAC__int64 sum, residual_to_check; + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13]; /* Falls through. */ + case 12: sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; /* Falls through. */ + case 11: sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; /* Falls through. */ + case 10: sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; /* Falls through. */ + case 9: sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; /* Falls through. */ + case 8: sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; /* Falls through. */ + case 7: sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; /* Falls through. */ + case 6: sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; /* Falls through. */ + case 5: sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; /* Falls through. */ + case 4: sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; /* Falls through. */ + case 3: sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; /* Falls through. */ + case 2: sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; /* Falls through. */ + case 1: sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; + } + residual_to_check = data[i] - (sum >> lp_quantization); + /* residual must not be INT32_MIN because abs(INT32_MIN) is undefined */ + if(residual_to_check <= INT32_MIN || residual_to_check > INT32_MAX) + return false; + else + residual[i] = residual_to_check; + } + return true; +} + +FLAC__bool FLAC__lpc_compute_residual_from_qlp_coefficients_limit_residual_33bit(const FLAC__int64 * flac_restrict data, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict residual) +{ + int i; + FLAC__int64 sum, residual_to_check; + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * data[i-13]; /* Falls through. */ + case 12: sum += qlp_coeff[11] * data[i-12]; /* Falls through. */ + case 11: sum += qlp_coeff[10] * data[i-11]; /* Falls through. */ + case 10: sum += qlp_coeff[ 9] * data[i-10]; /* Falls through. */ + case 9: sum += qlp_coeff[ 8] * data[i- 9]; /* Falls through. */ + case 8: sum += qlp_coeff[ 7] * data[i- 8]; /* Falls through. */ + case 7: sum += qlp_coeff[ 6] * data[i- 7]; /* Falls through. */ + case 6: sum += qlp_coeff[ 5] * data[i- 6]; /* Falls through. */ + case 5: sum += qlp_coeff[ 4] * data[i- 5]; /* Falls through. */ + case 4: sum += qlp_coeff[ 3] * data[i- 4]; /* Falls through. */ + case 3: sum += qlp_coeff[ 2] * data[i- 3]; /* Falls through. */ + case 2: sum += qlp_coeff[ 1] * data[i- 2]; /* Falls through. */ + case 1: sum += qlp_coeff[ 0] * data[i- 1]; + } + residual_to_check = data[i] - (sum >> lp_quantization); + /* residual must not be INT32_MIN because abs(INT32_MIN) is undefined */ + if(residual_to_check <= INT32_MIN || residual_to_check > INT32_MAX) + return false; + else + residual[i] = residual_to_check; + } + return true; +} + #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ -void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]) +uint32_t FLAC__lpc_max_prediction_before_shift_bps(uint32_t subframe_bps, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order) +{ + /* This used to be subframe_bps + qlp_coeff_precision + FLAC__bitmath_ilog2(order) + * but that treats both the samples as well as the predictor as unknown. The + * predictor is known however, so taking the log2 of the sum of the absolute values + * of all coefficients is a more accurate representation of the predictor */ + FLAC__int32 abs_sum_of_qlp_coeff = 0; + uint32_t i; + for(i = 0; i < order; i++) + abs_sum_of_qlp_coeff += abs(qlp_coeff[i]); + if(abs_sum_of_qlp_coeff == 0) + abs_sum_of_qlp_coeff = 1; + return subframe_bps + FLAC__bitmath_silog2(abs_sum_of_qlp_coeff); +} + + +uint32_t FLAC__lpc_max_residual_bps(uint32_t subframe_bps, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization) +{ + FLAC__int32 predictor_sum_bps = FLAC__lpc_max_prediction_before_shift_bps(subframe_bps, qlp_coeff, order) - lp_quantization; + if((int)subframe_bps > predictor_sum_bps) + return subframe_bps + 1; + else + return predictor_sum_bps + 1; +} + +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && !defined(FUZZING_BUILD_MODE_FLAC_SANITIZE_SIGNED_INTEGER_OVERFLOW) +/* The attribute below is to silence the undefined sanitizer of oss-fuzz. + * Because fuzzing feeds bogus predictors and residual samples to the + * decoder, having overflows in this section is unavoidable. Also, + * because the calculated values are audio path only, there is no + * potential for security problems */ +__attribute__((no_sanitize("signed-integer-overflow"))) +#endif +void FLAC__lpc_restore_signal(const FLAC__int32 * flac_restrict residual, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict data) #if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS) { FLAC__int64 sumo; - unsigned i, j; + uint32_t i, j; FLAC__int32 sum; const FLAC__int32 *r = residual, *history; @@ -822,12 +995,9 @@ void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c for(j = 0; j < order; j++) { sum += qlp_coeff[j] * (*(--history)); sumo += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*history); -#if defined _MSC_VER - if(sumo > 2147483647I64 || sumo < -2147483648I64) - fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%I64d\n",i,j,qlp_coeff[j],*history,sumo); -#else +#ifdef FLAC__OVERFLOW_DETECT if(sumo > 2147483647ll || sumo < -2147483648ll) - fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%lld\n",i,j,qlp_coeff[j],*history,(long long)sumo); + fprintf(stderr,"FLAC__lpc_restore_signal: OVERFLOW, i=%u, j=%u, c=%d, d=%d, sumo=%" PRId64 "\n",i,j,qlp_coeff[j],*history,sumo); #endif } *(data++) = *(r++) + (sum >> lp_quantization); @@ -1026,25 +1196,25 @@ void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c for(i = 0; i < (int)data_len; i++) { sum = 0; switch(order) { - case 32: sum += qlp_coeff[31] * data[i-32]; - case 31: sum += qlp_coeff[30] * data[i-31]; - case 30: sum += qlp_coeff[29] * data[i-30]; - case 29: sum += qlp_coeff[28] * data[i-29]; - case 28: sum += qlp_coeff[27] * data[i-28]; - case 27: sum += qlp_coeff[26] * data[i-27]; - case 26: sum += qlp_coeff[25] * data[i-26]; - case 25: sum += qlp_coeff[24] * data[i-25]; - case 24: sum += qlp_coeff[23] * data[i-24]; - case 23: sum += qlp_coeff[22] * data[i-23]; - case 22: sum += qlp_coeff[21] * data[i-22]; - case 21: sum += qlp_coeff[20] * data[i-21]; - case 20: sum += qlp_coeff[19] * data[i-20]; - case 19: sum += qlp_coeff[18] * data[i-19]; - case 18: sum += qlp_coeff[17] * data[i-18]; - case 17: sum += qlp_coeff[16] * data[i-17]; - case 16: sum += qlp_coeff[15] * data[i-16]; - case 15: sum += qlp_coeff[14] * data[i-15]; - case 14: sum += qlp_coeff[13] * data[i-14]; + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ case 13: sum += qlp_coeff[12] * data[i-13]; sum += qlp_coeff[11] * data[i-12]; sum += qlp_coeff[10] * data[i-11]; @@ -1065,10 +1235,10 @@ void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, c } #endif -void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]) +void FLAC__lpc_restore_signal_wide(const FLAC__int32 * flac_restrict residual, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int32 * flac_restrict data) #if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS) { - unsigned i, j; + uint32_t i, j; FLAC__int64 sum; const FLAC__int32 *r = residual, *history; @@ -1085,23 +1255,13 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l history = data; for(j = 0; j < order; j++) sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history)); - if(FLAC__bitmath_silog2_wide(sum >> lp_quantization) > 32) { -#ifdef _MSC_VER - fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%I64d\n", i, sum >> lp_quantization); -#else - fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, sum=%lld\n", i, (long long)(sum >> lp_quantization)); -#endif +#ifdef FLAC__OVERFLOW_DETECT + if(FLAC__bitmath_silog2((FLAC__int64)(*r) + (sum >> lp_quantization)) > 32) { + fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%" PRId64 ", data=%" PRId64 "\n", i, *r, (sum >> lp_quantization), ((FLAC__int64)(*r) + (sum >> lp_quantization))); break; } - if(FLAC__bitmath_silog2_wide((FLAC__int64)(*r) + (sum >> lp_quantization)) > 32) { -#ifdef _MSC_VER - fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%I64d, data=%I64d\n", i, *r, sum >> lp_quantization, (FLAC__int64)(*r) + (sum >> lp_quantization)); -#else - fprintf(stderr,"FLAC__lpc_restore_signal_wide: OVERFLOW, i=%u, residual=%d, sum=%lld, data=%lld\n", i, *r, (long long)(sum >> lp_quantization), (long long)((FLAC__int64)(*r) + (sum >> lp_quantization))); #endif - break; - } - *(data++) = *(r++) + (FLAC__int32)(sum >> lp_quantization); + *(data++) = (FLAC__int32)(*(r++) + (sum >> lp_quantization)); } } #else /* fully unrolled version for normal use */ @@ -1135,7 +1295,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } else { /* order == 11 */ @@ -1152,7 +1312,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } } @@ -1170,7 +1330,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } else { /* order == 9 */ @@ -1185,7 +1345,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } } @@ -1203,7 +1363,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } else { /* order == 7 */ @@ -1216,7 +1376,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } } @@ -1230,7 +1390,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } else { /* order == 5 */ @@ -1241,7 +1401,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } } @@ -1255,7 +1415,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } else { /* order == 3 */ @@ -1264,7 +1424,7 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } } @@ -1274,12 +1434,12 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum = 0; sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); } } else { /* order == 1 */ for(i = 0; i < (int)data_len; i++) - data[i] = residual[i] + (FLAC__int32)((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization); + data[i] = (FLAC__int32)(residual[i] + ((qlp_coeff[0] * (FLAC__int64)data[i-1]) >> lp_quantization)); } } } @@ -1288,25 +1448,25 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l for(i = 0; i < (int)data_len; i++) { sum = 0; switch(order) { - case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32]; - case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31]; - case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30]; - case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29]; - case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28]; - case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27]; - case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26]; - case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25]; - case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24]; - case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23]; - case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22]; - case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21]; - case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20]; - case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19]; - case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18]; - case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17]; - case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16]; - case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; - case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; + case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; /* Falls through. */ case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13]; sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; @@ -1321,29 +1481,114 @@ void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_l sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; } - data[i] = residual[i] + (FLAC__int32)(sum >> lp_quantization); + data[i] = (FLAC__int32) (residual[i] + (sum >> lp_quantization)); + } + } +} +#endif + +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && !defined(FUZZING_BUILD_MODE_FLAC_SANITIZE_SIGNED_INTEGER_OVERFLOW) +/* The attribute below is to silence the undefined sanitizer of oss-fuzz. + * Because fuzzing feeds bogus predictors and residual samples to the + * decoder, having overflows in this section is unavoidable. Also, + * because the calculated values are audio path only, there is no + * potential for security problems */ +__attribute__((no_sanitize("signed-integer-overflow"))) +#endif +void FLAC__lpc_restore_signal_wide_33bit(const FLAC__int32 * flac_restrict residual, uint32_t data_len, const FLAC__int32 * flac_restrict qlp_coeff, uint32_t order, int lp_quantization, FLAC__int64 * flac_restrict data) +#if defined(FLAC__OVERFLOW_DETECT) || !defined(FLAC__LPC_UNROLLED_FILTER_LOOPS) +{ + uint32_t i, j; + FLAC__int64 sum; + const FLAC__int32 *r = residual; + const FLAC__int64 *history; + + FLAC__ASSERT(order > 0); + + for(i = 0; i < data_len; i++) { + sum = 0; + history = data; + for(j = 0; j < order; j++) + sum += (FLAC__int64)qlp_coeff[j] * (FLAC__int64)(*(--history)); +#ifdef FLAC__OVERFLOW_DETECT + if(FLAC__bitmath_silog2((FLAC__int64)(*r) + (sum >> lp_quantization)) > 33) { + fprintf(stderr,"FLAC__lpc_restore_signal_33bit: OVERFLOW, i=%u, residual=%d, sum=%" PRId64 ", data=%" PRId64 "\n", i, *r, (sum >> lp_quantization), ((FLAC__int64)(*r) + (sum >> lp_quantization))); + break; + } +#endif + *(data++) = (FLAC__int64)(*(r++)) + (sum >> lp_quantization); + } +} +#else /* unrolled version for normal use */ +{ + int i; + FLAC__int64 sum; + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * data[i-13]; /* Falls through. */ + case 12: sum += qlp_coeff[11] * data[i-12]; /* Falls through. */ + case 11: sum += qlp_coeff[10] * data[i-11]; /* Falls through. */ + case 10: sum += qlp_coeff[ 9] * data[i-10]; /* Falls through. */ + case 9: sum += qlp_coeff[ 8] * data[i- 9]; /* Falls through. */ + case 8: sum += qlp_coeff[ 7] * data[i- 8]; /* Falls through. */ + case 7: sum += qlp_coeff[ 6] * data[i- 7]; /* Falls through. */ + case 6: sum += qlp_coeff[ 5] * data[i- 6]; /* Falls through. */ + case 5: sum += qlp_coeff[ 4] * data[i- 5]; /* Falls through. */ + case 4: sum += qlp_coeff[ 3] * data[i- 4]; /* Falls through. */ + case 3: sum += qlp_coeff[ 2] * data[i- 3]; /* Falls through. */ + case 2: sum += qlp_coeff[ 1] * data[i- 2]; /* Falls through. */ + case 1: sum += qlp_coeff[ 0] * data[i- 1]; } + data[i] = residual[i] + (sum >> lp_quantization); } } #endif +#if defined(_MSC_VER) +#pragma warning ( default : 4028 ) +#endif + #ifndef FLAC__INTEGER_ONLY_LIBRARY -FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__double lpc_error, unsigned total_samples) +double FLAC__lpc_compute_expected_bits_per_residual_sample(double lpc_error, uint32_t total_samples) { - FLAC__double error_scale; + double error_scale; FLAC__ASSERT(total_samples > 0); - error_scale = 0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples; + error_scale = 0.5 / (double)total_samples; return FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error, error_scale); } -FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(FLAC__double lpc_error, FLAC__double error_scale) +double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(double lpc_error, double error_scale) { if(lpc_error > 0.0) { - FLAC__double bps = (FLAC__double)0.5 * log(error_scale * lpc_error) / M_LN2; + double bps = (double)0.5 * log(error_scale * lpc_error) / M_LN2; if(bps >= 0.0) return bps; else @@ -1357,28 +1602,28 @@ FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scal } } -unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order) +uint32_t FLAC__lpc_compute_best_order(const double lpc_error[], uint32_t max_order, uint32_t total_samples, uint32_t overhead_bits_per_order) { - unsigned order, index, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_error[0] is for order==1, lpc_error[1] is for order==2, etc */ - FLAC__double bits, best_bits, error_scale; + uint32_t order, indx, best_index; /* 'index' the index into lpc_error; index==order-1 since lpc_error[0] is for order==1, lpc_error[1] is for order==2, etc */ + double bits, best_bits, error_scale; FLAC__ASSERT(max_order > 0); FLAC__ASSERT(total_samples > 0); - error_scale = 0.5 * M_LN2 * M_LN2 / (FLAC__double)total_samples; + error_scale = 0.5 / (double)total_samples; best_index = 0; - best_bits = (unsigned)(-1); + best_bits = (uint32_t)(-1); - for(index = 0, order = 1; index < max_order; index++, order++) { - bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[index], error_scale) * (FLAC__double)(total_samples - order) + (FLAC__double)(order * overhead_bits_per_order); + for(indx = 0, order = 1; indx < max_order; indx++, order++) { + bits = FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(lpc_error[indx], error_scale) * (double)(total_samples - order) + (double)(order * overhead_bits_per_order); if(bits < best_bits) { - best_index = index; + best_index = indx; best_bits = bits; } } - return best_index+1; /* +1 since index of lpc_error[] is order-1 */ + return best_index+1; /* +1 since indx of lpc_error[] is order-1 */ } #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/lpc_intrin_avx2.c b/3rdparty/libflac/src/libFLAC/lpc_intrin_avx2.c new file mode 100644 index 00000000000..7f1c03ed202 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/lpc_intrin_avx2.c @@ -0,0 +1,1122 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +#include "private/lpc.h" +#ifdef FLAC__AVX2_SUPPORTED + +#include "FLAC/assert.h" +#include "FLAC/format.h" + +#include <immintrin.h> /* AVX2 */ + +FLAC__SSE_TARGET("avx2") +void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]) +{ + int i; + FLAC__int32 sum; + const __m128i cnt = _mm_cvtsi32_si128(lp_quantization); + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + if(order <= 12) { + if(order > 8) { + if(order > 10) { + if(order == 12) { + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(0xffff & qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(0xffff & qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(0xffff & qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(0xffff & qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(0xffff & qlp_coeff[7 ]); + q8 = _mm256_set1_epi32(0xffff & qlp_coeff[8 ]); + q9 = _mm256_set1_epi32(0xffff & qlp_coeff[9 ]); + q10 = _mm256_set1_epi32(0xffff & qlp_coeff[10]); + q11 = _mm256_set1_epi32(0xffff & qlp_coeff[11]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q11, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-12))); + mull = _mm256_madd_epi16(q10, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-11))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q9, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-10))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q8, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-9 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 11 */ + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(0xffff & qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(0xffff & qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(0xffff & qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(0xffff & qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(0xffff & qlp_coeff[7 ]); + q8 = _mm256_set1_epi32(0xffff & qlp_coeff[8 ]); + q9 = _mm256_set1_epi32(0xffff & qlp_coeff[9 ]); + q10 = _mm256_set1_epi32(0xffff & qlp_coeff[10]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q10, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-11))); + mull = _mm256_madd_epi16(q9, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-10))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q8, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-9 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 10) { + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(0xffff & qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(0xffff & qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(0xffff & qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(0xffff & qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(0xffff & qlp_coeff[7 ]); + q8 = _mm256_set1_epi32(0xffff & qlp_coeff[8 ]); + q9 = _mm256_set1_epi32(0xffff & qlp_coeff[9 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q9, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-10))); + mull = _mm256_madd_epi16(q8, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-9 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 9 */ + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(0xffff & qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(0xffff & qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(0xffff & qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(0xffff & qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(0xffff & qlp_coeff[7 ]); + q8 = _mm256_set1_epi32(0xffff & qlp_coeff[8 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q8, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-9 ))); + mull = _mm256_madd_epi16(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + } + else if(order > 4) { + if(order > 6) { + if(order == 8) { + __m256i q0, q1, q2, q3, q4, q5, q6, q7; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(0xffff & qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(0xffff & qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(0xffff & qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(0xffff & qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(0xffff & qlp_coeff[7 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8 ))); + mull = _mm256_madd_epi16(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 7 */ + __m256i q0, q1, q2, q3, q4, q5, q6; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(0xffff & qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(0xffff & qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(0xffff & qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(0xffff & qlp_coeff[6 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7 ))); + mull = _mm256_madd_epi16(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 6) { + __m256i q0, q1, q2, q3, q4, q5; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(0xffff & qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(0xffff & qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(0xffff & qlp_coeff[5 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6 ))); + mull = _mm256_madd_epi16(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 5 */ + __m256i q0, q1, q2, q3, q4; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(0xffff & qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(0xffff & qlp_coeff[4 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5 ))); + mull = _mm256_madd_epi16(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + } + else { + if(order > 2) { + if(order == 4) { + __m256i q0, q1, q2, q3; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(0xffff & qlp_coeff[3 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4 ))); + mull = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 3 */ + __m256i q0, q1, q2; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(0xffff & qlp_coeff[2 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3 ))); + mull = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 2) { + __m256i q0, q1; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(0xffff & qlp_coeff[1 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_madd_epi16(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2 ))); + mull = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 1 */ + __m256i q0; + q0 = _mm256_set1_epi32(0xffff & qlp_coeff[0 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ; + summ = _mm256_madd_epi16(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1 ))); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + } + for(; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 12: sum += qlp_coeff[11] * data[i-12]; /* Falls through. */ + case 11: sum += qlp_coeff[10] * data[i-11]; /* Falls through. */ + case 10: sum += qlp_coeff[ 9] * data[i-10]; /* Falls through. */ + case 9: sum += qlp_coeff[ 8] * data[i- 9]; /* Falls through. */ + case 8: sum += qlp_coeff[ 7] * data[i- 8]; /* Falls through. */ + case 7: sum += qlp_coeff[ 6] * data[i- 7]; /* Falls through. */ + case 6: sum += qlp_coeff[ 5] * data[i- 6]; /* Falls through. */ + case 5: sum += qlp_coeff[ 4] * data[i- 5]; /* Falls through. */ + case 4: sum += qlp_coeff[ 3] * data[i- 4]; /* Falls through. */ + case 3: sum += qlp_coeff[ 2] * data[i- 3]; /* Falls through. */ + case 2: sum += qlp_coeff[ 1] * data[i- 2]; /* Falls through. */ + case 1: sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } + else { /* order > 12 */ + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * data[i-13]; + sum += qlp_coeff[11] * data[i-12]; + sum += qlp_coeff[10] * data[i-11]; + sum += qlp_coeff[ 9] * data[i-10]; + sum += qlp_coeff[ 8] * data[i- 9]; + sum += qlp_coeff[ 7] * data[i- 8]; + sum += qlp_coeff[ 6] * data[i- 7]; + sum += qlp_coeff[ 5] * data[i- 6]; + sum += qlp_coeff[ 4] * data[i- 5]; + sum += qlp_coeff[ 3] * data[i- 4]; + sum += qlp_coeff[ 2] * data[i- 3]; + sum += qlp_coeff[ 1] * data[i- 2]; + sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } + _mm256_zeroupper(); +} + +FLAC__SSE_TARGET("avx2") +void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]) +{ + int i; + FLAC__int32 sum; + const __m128i cnt = _mm_cvtsi32_si128(lp_quantization); + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + if(order <= 12) { + if(order > 8) { + if(order > 10) { + if(order == 12) { + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(qlp_coeff[7 ]); + q8 = _mm256_set1_epi32(qlp_coeff[8 ]); + q9 = _mm256_set1_epi32(qlp_coeff[9 ]); + q10 = _mm256_set1_epi32(qlp_coeff[10]); + q11 = _mm256_set1_epi32(qlp_coeff[11]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q11, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-12))); + mull = _mm256_mullo_epi32(q10, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-11))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q9, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-10))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q8, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-9))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 11 */ + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(qlp_coeff[7 ]); + q8 = _mm256_set1_epi32(qlp_coeff[8 ]); + q9 = _mm256_set1_epi32(qlp_coeff[9 ]); + q10 = _mm256_set1_epi32(qlp_coeff[10]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q10, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-11))); + mull = _mm256_mullo_epi32(q9, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-10))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q8, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-9))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 10) { + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(qlp_coeff[7 ]); + q8 = _mm256_set1_epi32(qlp_coeff[8 ]); + q9 = _mm256_set1_epi32(qlp_coeff[9 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q9, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-10))); + mull = _mm256_mullo_epi32(q8, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-9))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 9 */ + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(qlp_coeff[7 ]); + q8 = _mm256_set1_epi32(qlp_coeff[8 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q8, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-9))); + mull = _mm256_mullo_epi32(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + } + else if(order > 4) { + if(order > 6) { + if(order == 8) { + __m256i q0, q1, q2, q3, q4, q5, q6, q7; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(qlp_coeff[6 ]); + q7 = _mm256_set1_epi32(qlp_coeff[7 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q7, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-8))); + mull = _mm256_mullo_epi32(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 7 */ + __m256i q0, q1, q2, q3, q4, q5, q6; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(qlp_coeff[5 ]); + q6 = _mm256_set1_epi32(qlp_coeff[6 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q6, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-7))); + mull = _mm256_mullo_epi32(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 6) { + __m256i q0, q1, q2, q3, q4, q5; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(qlp_coeff[4 ]); + q5 = _mm256_set1_epi32(qlp_coeff[5 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q5, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-6))); + mull = _mm256_mullo_epi32(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 5 */ + __m256i q0, q1, q2, q3, q4; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(qlp_coeff[3 ]); + q4 = _mm256_set1_epi32(qlp_coeff[4 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q4, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-5))); + mull = _mm256_mullo_epi32(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + } + else { + if(order > 2) { + if(order == 4) { + __m256i q0, q1, q2, q3; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + q3 = _mm256_set1_epi32(qlp_coeff[3 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q3, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-4))); + mull = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 3 */ + __m256i q0, q1, q2; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + q2 = _mm256_set1_epi32(qlp_coeff[2 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q2, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-3))); + mull = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); summ = _mm256_add_epi32(summ, mull); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 2) { + __m256i q0, q1; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + q1 = _mm256_set1_epi32(qlp_coeff[1 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ, mull; + summ = _mm256_mullo_epi32(q1, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-2))); + mull = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); summ = _mm256_add_epi32(summ, mull); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 1 */ + __m256i q0; + q0 = _mm256_set1_epi32(qlp_coeff[0 ]); + + for(i = 0; i < (int)data_len-7; i+=8) { + __m256i summ; + summ = _mm256_mullo_epi32(q0, _mm256_loadu_si256((const __m256i*)(const void*)(data+i-1))); + summ = _mm256_sra_epi32(summ, cnt); + _mm256_storeu_si256((__m256i*)(void*)(residual+i), _mm256_sub_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(data+i)), summ)); + } + } + } + } + for(; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 12: sum += qlp_coeff[11] * data[i-12]; /* Falls through. */ + case 11: sum += qlp_coeff[10] * data[i-11]; /* Falls through. */ + case 10: sum += qlp_coeff[ 9] * data[i-10]; /* Falls through. */ + case 9: sum += qlp_coeff[ 8] * data[i- 9]; /* Falls through. */ + case 8: sum += qlp_coeff[ 7] * data[i- 8]; /* Falls through. */ + case 7: sum += qlp_coeff[ 6] * data[i- 7]; /* Falls through. */ + case 6: sum += qlp_coeff[ 5] * data[i- 6]; /* Falls through. */ + case 5: sum += qlp_coeff[ 4] * data[i- 5]; /* Falls through. */ + case 4: sum += qlp_coeff[ 3] * data[i- 4]; /* Falls through. */ + case 3: sum += qlp_coeff[ 2] * data[i- 3]; /* Falls through. */ + case 2: sum += qlp_coeff[ 1] * data[i- 2]; /* Falls through. */ + case 1: sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } + else { /* order > 12 */ + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * data[i-13]; + sum += qlp_coeff[11] * data[i-12]; + sum += qlp_coeff[10] * data[i-11]; + sum += qlp_coeff[ 9] * data[i-10]; + sum += qlp_coeff[ 8] * data[i- 9]; + sum += qlp_coeff[ 7] * data[i- 8]; + sum += qlp_coeff[ 6] * data[i- 7]; + sum += qlp_coeff[ 5] * data[i- 6]; + sum += qlp_coeff[ 4] * data[i- 5]; + sum += qlp_coeff[ 3] * data[i- 4]; + sum += qlp_coeff[ 2] * data[i- 3]; + sum += qlp_coeff[ 1] * data[i- 2]; + sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } + _mm256_zeroupper(); +} + +static FLAC__int32 pack_arr[8] = { 0, 2, 4, 6, 1, 3, 5, 7 }; + +FLAC__SSE_TARGET("avx2") +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]) +{ + int i; + FLAC__int64 sum; + const __m128i cnt = _mm_cvtsi32_si128(lp_quantization); + const __m256i pack = _mm256_loadu_si256((const __m256i *)(const void*)pack_arr); + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + FLAC__ASSERT(lp_quantization <= 32); /* there's no _mm256_sra_epi64() so we have to use _mm256_srl_epi64() */ + + if(order <= 12) { + if(order > 8) { + if(order > 10) { + if(order == 12) { + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + q3 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[3 ])); + q4 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[4 ])); + q5 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[5 ])); + q6 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[6 ])); + q7 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[7 ])); + q8 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[8 ])); + q9 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[9 ])); + q10 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[10])); + q11 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[11])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q11, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-12)))); + mull = _mm256_mul_epi32(q10, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-11)))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q9, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-10)))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q8, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-9 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q7, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-8 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q6, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-7 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q5, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-6 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q4, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-5 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q3, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-4 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + else { /* order == 11 */ + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + q3 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[3 ])); + q4 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[4 ])); + q5 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[5 ])); + q6 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[6 ])); + q7 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[7 ])); + q8 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[8 ])); + q9 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[9 ])); + q10 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[10])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q10, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-11)))); + mull = _mm256_mul_epi32(q9, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-10)))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q8, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-9 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q7, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-8 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q6, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-7 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q5, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-6 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q4, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-5 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q3, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-4 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + } + else { + if(order == 10) { + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + q3 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[3 ])); + q4 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[4 ])); + q5 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[5 ])); + q6 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[6 ])); + q7 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[7 ])); + q8 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[8 ])); + q9 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[9 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q9, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-10)))); + mull = _mm256_mul_epi32(q8, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-9 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q7, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-8 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q6, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-7 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q5, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-6 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q4, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-5 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q3, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-4 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + else { /* order == 9 */ + __m256i q0, q1, q2, q3, q4, q5, q6, q7, q8; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + q3 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[3 ])); + q4 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[4 ])); + q5 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[5 ])); + q6 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[6 ])); + q7 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[7 ])); + q8 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[8 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q8, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-9 )))); + mull = _mm256_mul_epi32(q7, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-8 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q6, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-7 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q5, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-6 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q4, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-5 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q3, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-4 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + } + } + else if(order > 4) { + if(order > 6) { + if(order == 8) { + __m256i q0, q1, q2, q3, q4, q5, q6, q7; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + q3 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[3 ])); + q4 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[4 ])); + q5 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[5 ])); + q6 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[6 ])); + q7 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[7 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q7, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-8 )))); + mull = _mm256_mul_epi32(q6, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-7 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q5, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-6 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q4, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-5 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q3, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-4 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + else { /* order == 7 */ + __m256i q0, q1, q2, q3, q4, q5, q6; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + q3 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[3 ])); + q4 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[4 ])); + q5 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[5 ])); + q6 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[6 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q6, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-7 )))); + mull = _mm256_mul_epi32(q5, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-6 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q4, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-5 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q3, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-4 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + } + else { + if(order == 6) { + __m256i q0, q1, q2, q3, q4, q5; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + q3 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[3 ])); + q4 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[4 ])); + q5 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[5 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q5, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-6 )))); + mull = _mm256_mul_epi32(q4, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-5 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q3, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-4 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + else { /* order == 5 */ + __m256i q0, q1, q2, q3, q4; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + q3 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[3 ])); + q4 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[4 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q4, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-5 )))); + mull = _mm256_mul_epi32(q3, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-4 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + } + } + else { + if(order > 2) { + if(order == 4) { + __m256i q0, q1, q2, q3; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + q3 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[3 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q3, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-4 )))); + mull = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + else { /* order == 3 */ + __m256i q0, q1, q2; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + q2 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[2 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q2, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-3 )))); + mull = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); summ = _mm256_add_epi64(summ, mull); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + } + else { + if(order == 2) { + __m256i q0, q1; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + q1 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[1 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ, mull; + summ = _mm256_mul_epi32(q1, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-2 )))); + mull = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); summ = _mm256_add_epi64(summ, mull); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + else { /* order == 1 */ + __m256i q0; + q0 = _mm256_cvtepu32_epi64(_mm_set1_epi32(qlp_coeff[0 ])); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m256i summ; + summ = _mm256_mul_epi32(q0, _mm256_cvtepu32_epi64(_mm_loadu_si128((const __m128i*)(const void*)(data+i-1 )))); + summ = _mm256_permutevar8x32_epi32(_mm256_srl_epi64(summ, cnt), pack); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), _mm256_castsi256_si128(summ))); + } + } + } + } + for(; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 12: sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; /* Falls through. */ + case 11: sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; /* Falls through. */ + case 10: sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; /* Falls through. */ + case 9: sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; /* Falls through. */ + case 8: sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; /* Falls through. */ + case 7: sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; /* Falls through. */ + case 6: sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; /* Falls through. */ + case 5: sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; /* Falls through. */ + case 4: sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; /* Falls through. */ + case 3: sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; /* Falls through. */ + case 2: sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; /* Falls through. */ + case 1: sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; + } + residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + } + } + else { /* order > 12 */ + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13]; + sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; + sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; + sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; + sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; + sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; + sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; + sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; + sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; + sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; + sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; + sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; + sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; + } + residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + } + } + _mm256_zeroupper(); +} + +#endif /* FLAC__AVX2_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/lpc_intrin_fma.c b/3rdparty/libflac/src/libFLAC/lpc_intrin_fma.c new file mode 100644 index 00000000000..c0740a88ae6 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/lpc_intrin_fma.c @@ -0,0 +1,73 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2022-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#ifndef FLAC__NO_ASM +#if defined FLAC__CPU_X86_64 && FLAC__HAS_X86INTRIN +#include "private/lpc.h" +#ifdef FLAC__FMA_SUPPORTED + +#include "FLAC/assert.h" + +FLAC__SSE_TARGET("fma") +void FLAC__lpc_compute_autocorrelation_intrin_fma_lag_8(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) +{ +#undef MAX_LAG +#define MAX_LAG 8 +#include "deduplication/lpc_compute_autocorrelation_intrin.c" +} + +FLAC__SSE_TARGET("fma") +void FLAC__lpc_compute_autocorrelation_intrin_fma_lag_12(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) +{ +#undef MAX_LAG +#define MAX_LAG 12 +#include "deduplication/lpc_compute_autocorrelation_intrin.c" +} +FLAC__SSE_TARGET("fma") +void FLAC__lpc_compute_autocorrelation_intrin_fma_lag_16(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) +{ +#undef MAX_LAG +#define MAX_LAG 16 +#include "deduplication/lpc_compute_autocorrelation_intrin.c" + +} + +#endif /* FLAC__FMA_SUPPORTED */ +#endif /* FLAC__CPU_X86_64 && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/lpc_intrin_neon.c b/3rdparty/libflac/src/libFLAC/lpc_intrin_neon.c new file mode 100644 index 00000000000..b9945d58c27 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/lpc_intrin_neon.c @@ -0,0 +1,1273 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "private/cpu.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#ifndef FLAC__NO_ASM +#if defined FLAC__CPU_ARM64 && FLAC__HAS_NEONINTRIN +#include "private/lpc.h" +#include "FLAC/assert.h" +#include "FLAC/format.h" +#include "private/macros.h" +#include <arm_neon.h> + +#if FLAC__HAS_A64NEONINTRIN +void FLAC__lpc_compute_autocorrelation_intrin_neon_lag_14(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) +{ +#undef MAX_LAG +#define MAX_LAG 14 +#include "deduplication/lpc_compute_autocorrelation_intrin_neon.c" +} + +void FLAC__lpc_compute_autocorrelation_intrin_neon_lag_10(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) +{ +#undef MAX_LAG +#define MAX_LAG 10 +#include "deduplication/lpc_compute_autocorrelation_intrin_neon.c" +} + +void FLAC__lpc_compute_autocorrelation_intrin_neon_lag_8(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) +{ +#undef MAX_LAG +#define MAX_LAG 8 +#include "deduplication/lpc_compute_autocorrelation_intrin_neon.c" +} + +#endif /* ifdef FLAC__HAS_A64NEONINTRIN */ + + +#define MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_vec, lane) \ + summ_0 = vmulq_laneq_s32(tmp_vec[0], qlp_coeff_vec, lane); \ + summ_1 = vmulq_laneq_s32(tmp_vec[4], qlp_coeff_vec, lane); \ + summ_2 = vmulq_laneq_s32(tmp_vec[8], qlp_coeff_vec, lane); + + +#define MACC_32BIT_LOOP_UNROOL_3(tmp_vec_ind, qlp_coeff_vec, lane) \ + summ_0 = vmlaq_laneq_s32(summ_0,tmp_vec[tmp_vec_ind] ,qlp_coeff_vec, lane); \ + summ_1 = vmlaq_laneq_s32(summ_1,tmp_vec[tmp_vec_ind+4] ,qlp_coeff_vec, lane); \ + summ_2 = vmlaq_laneq_s32(summ_2,tmp_vec[tmp_vec_ind+8] ,qlp_coeff_vec, lane); + +void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_neon(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]) +{ + int i; + FLAC__int32 sum; + int32x4_t tmp_vec[20]; + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + // Using prologue reads is valid as encoder->private_->local_lpc_compute_residual_from_qlp_coefficients(signal+order,....) + if(order <= 12) { + if(order > 8) { + if(order > 10) { + if (order == 12) { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], qlp_coeff[7]}; + int32x4_t qlp_coeff_2 = {qlp_coeff[8], qlp_coeff[9], qlp_coeff[10], qlp_coeff[11]}; + + tmp_vec[0] = vld1q_s32(data - 12); + tmp_vec[1] = vld1q_s32(data - 11); + tmp_vec[2] = vld1q_s32(data - 10); + tmp_vec[3] = vld1q_s32(data - 9); + tmp_vec[4] = vld1q_s32(data - 8); + tmp_vec[5] = vld1q_s32(data - 7); + tmp_vec[6] = vld1q_s32(data - 6); + tmp_vec[7] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + + tmp_vec[8] = vld1q_s32(data + i - 4); + tmp_vec[9] = vld1q_s32(data+i-3); + tmp_vec[10] = vld1q_s32(data+i-2); + tmp_vec[11] = vld1q_s32(data+i-1); + tmp_vec[12] = vld1q_s32(data+i); + tmp_vec[13] = vld1q_s32(data+i+1); + tmp_vec[14] = vld1q_s32(data+i+2); + tmp_vec[15] = vld1q_s32(data+i+3); + tmp_vec[16] = vld1q_s32(data + i + 4); + tmp_vec[17] = vld1q_s32(data + i + 5); + tmp_vec[18] = vld1q_s32(data + i + 6); + tmp_vec[19] = vld1q_s32(data + i + 7); + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_2, 3) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_2, 2) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_2, 1) + MACC_32BIT_LOOP_UNROOL_3(3, qlp_coeff_2, 0) + MACC_32BIT_LOOP_UNROOL_3(4, qlp_coeff_1, 3) + MACC_32BIT_LOOP_UNROOL_3(5, qlp_coeff_1, 2) + MACC_32BIT_LOOP_UNROOL_3(6, qlp_coeff_1, 1) + MACC_32BIT_LOOP_UNROOL_3(7, qlp_coeff_1, 0) + MACC_32BIT_LOOP_UNROOL_3(8, qlp_coeff_0, 3) + MACC_32BIT_LOOP_UNROOL_3(9, qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(10, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(11, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + tmp_vec[4] = tmp_vec[16]; + tmp_vec[5] = tmp_vec[17]; + tmp_vec[6] = tmp_vec[18]; + tmp_vec[7] = tmp_vec[19]; + } + } + + else { /* order == 11 */ + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], qlp_coeff[7]}; + int32x4_t qlp_coeff_2 = {qlp_coeff[8], qlp_coeff[9], qlp_coeff[10], 0}; + + tmp_vec[0] = vld1q_s32(data - 11); + tmp_vec[1] = vld1q_s32(data - 10); + tmp_vec[2] = vld1q_s32(data - 9); + tmp_vec[3] = vld1q_s32(data - 8); + tmp_vec[4] = vld1q_s32(data - 7); + tmp_vec[5] = vld1q_s32(data - 6); + tmp_vec[6] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[7] = vld1q_s32(data + i - 4); + tmp_vec[8] = vld1q_s32(data + i - 3); + tmp_vec[9] = vld1q_s32(data + i - 2); + tmp_vec[10] = vld1q_s32(data + i - 1); + tmp_vec[11] = vld1q_s32(data + i - 0); + tmp_vec[12] = vld1q_s32(data + i + 1); + tmp_vec[13] = vld1q_s32(data + i + 2); + tmp_vec[14] = vld1q_s32(data + i + 3); + tmp_vec[15] = vld1q_s32(data + i + 4); + tmp_vec[16] = vld1q_s32(data + i + 5); + tmp_vec[17] = vld1q_s32(data + i + 6); + tmp_vec[18] = vld1q_s32(data + i + 7); + + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_2, 2) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_2, 1) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_2, 0) + MACC_32BIT_LOOP_UNROOL_3(3, qlp_coeff_1, 3) + MACC_32BIT_LOOP_UNROOL_3(4, qlp_coeff_1, 2) + MACC_32BIT_LOOP_UNROOL_3(5, qlp_coeff_1, 1) + MACC_32BIT_LOOP_UNROOL_3(6, qlp_coeff_1, 0) + MACC_32BIT_LOOP_UNROOL_3(7, qlp_coeff_0, 3) + MACC_32BIT_LOOP_UNROOL_3(8, qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(9, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(10, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + tmp_vec[4] = tmp_vec[16]; + tmp_vec[5] = tmp_vec[17]; + tmp_vec[6] = tmp_vec[18]; + } + } + } + else { + if(order == 10) { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], qlp_coeff[7]}; + int32x4_t qlp_coeff_2 = {qlp_coeff[8], qlp_coeff[9], 0, 0}; + + tmp_vec[0] = vld1q_s32(data - 10); + tmp_vec[1] = vld1q_s32(data - 9); + tmp_vec[2] = vld1q_s32(data - 8); + tmp_vec[3] = vld1q_s32(data - 7); + tmp_vec[4] = vld1q_s32(data - 6); + tmp_vec[5] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[6] = vld1q_s32(data + i - 4); + tmp_vec[7] = vld1q_s32(data + i - 3); + tmp_vec[8] = vld1q_s32(data + i - 2); + tmp_vec[9] = vld1q_s32(data + i - 1); + tmp_vec[10] = vld1q_s32(data + i - 0); + tmp_vec[11] = vld1q_s32(data + i + 1); + tmp_vec[12] = vld1q_s32(data + i + 2); + tmp_vec[13] = vld1q_s32(data + i + 3); + tmp_vec[14] = vld1q_s32(data + i + 4); + tmp_vec[15] = vld1q_s32(data + i + 5); + tmp_vec[16] = vld1q_s32(data + i + 6); + tmp_vec[17] = vld1q_s32(data + i + 7); + + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_2, 1) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_2, 0) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_1, 3) + MACC_32BIT_LOOP_UNROOL_3(3, qlp_coeff_1, 2) + MACC_32BIT_LOOP_UNROOL_3(4, qlp_coeff_1, 1) + MACC_32BIT_LOOP_UNROOL_3(5, qlp_coeff_1, 0) + MACC_32BIT_LOOP_UNROOL_3(6, qlp_coeff_0, 3) + MACC_32BIT_LOOP_UNROOL_3(7, qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(8, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(9, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + tmp_vec[4] = tmp_vec[16]; + tmp_vec[5] = tmp_vec[17]; + } + } + else { /* order == 9 */ + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], qlp_coeff[7]}; + int32x4_t qlp_coeff_2 = {qlp_coeff[8], 0, 0, 0}; + + tmp_vec[0] = vld1q_s32(data - 9); + tmp_vec[1] = vld1q_s32(data - 8); + tmp_vec[2] = vld1q_s32(data - 7); + tmp_vec[3] = vld1q_s32(data - 6); + tmp_vec[4] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[5] = vld1q_s32(data + i - 4); + tmp_vec[6] = vld1q_s32(data + i - 3); + tmp_vec[7] = vld1q_s32(data + i - 2); + tmp_vec[8] = vld1q_s32(data + i - 1); + tmp_vec[9] = vld1q_s32(data + i - 0); + tmp_vec[10] = vld1q_s32(data + i + 1); + tmp_vec[11] = vld1q_s32(data + i + 2); + tmp_vec[12] = vld1q_s32(data + i + 3); + tmp_vec[13] = vld1q_s32(data + i + 4); + tmp_vec[14] = vld1q_s32(data + i + 5); + tmp_vec[15] = vld1q_s32(data + i + 6); + tmp_vec[16] = vld1q_s32(data + i + 7); + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_2, 0) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_1, 3) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_1, 2) + MACC_32BIT_LOOP_UNROOL_3(3, qlp_coeff_1, 1) + MACC_32BIT_LOOP_UNROOL_3(4, qlp_coeff_1, 0) + MACC_32BIT_LOOP_UNROOL_3(5, qlp_coeff_0, 3) + MACC_32BIT_LOOP_UNROOL_3(6, qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(7, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(8, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + tmp_vec[4] = tmp_vec[16]; + } + } + } + } + else if(order > 4) { + if(order > 6) { + if(order == 8) { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], qlp_coeff[7]}; + + tmp_vec[0] = vld1q_s32(data - 8); + tmp_vec[1] = vld1q_s32(data - 7); + tmp_vec[2] = vld1q_s32(data - 6); + tmp_vec[3] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[4] = vld1q_s32(data + i - 4); + tmp_vec[5] = vld1q_s32(data + i - 3); + tmp_vec[6] = vld1q_s32(data + i - 2); + tmp_vec[7] = vld1q_s32(data + i - 1); + tmp_vec[8] = vld1q_s32(data + i - 0); + tmp_vec[9] = vld1q_s32(data + i + 1); + tmp_vec[10] = vld1q_s32(data + i + 2); + tmp_vec[11] = vld1q_s32(data + i + 3); + tmp_vec[12] = vld1q_s32(data + i + 4); + tmp_vec[13] = vld1q_s32(data + i + 5); + tmp_vec[14] = vld1q_s32(data + i + 6); + tmp_vec[15] = vld1q_s32(data + i + 7); + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_1, 3) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_1, 2) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_1, 1) + MACC_32BIT_LOOP_UNROOL_3(3, qlp_coeff_1, 0) + MACC_32BIT_LOOP_UNROOL_3(4, qlp_coeff_0, 3) + MACC_32BIT_LOOP_UNROOL_3(5, qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(6, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(7, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + } + } + else { /* order == 7 */ + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], 0}; + + tmp_vec[0] = vld1q_s32(data - 7); + tmp_vec[1] = vld1q_s32(data - 6); + tmp_vec[2] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[3] = vld1q_s32(data + i - 4); + tmp_vec[4] = vld1q_s32(data + i - 3); + tmp_vec[5] = vld1q_s32(data + i - 2); + tmp_vec[6] = vld1q_s32(data + i - 1); + tmp_vec[7] = vld1q_s32(data + i - 0); + tmp_vec[8] = vld1q_s32(data + i + 1); + tmp_vec[9] = vld1q_s32(data + i + 2); + tmp_vec[10] = vld1q_s32(data + i + 3); + tmp_vec[11] = vld1q_s32(data + i + 4); + tmp_vec[12] = vld1q_s32(data + i + 5); + tmp_vec[13] = vld1q_s32(data + i + 6); + tmp_vec[14] = vld1q_s32(data + i + 7); + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_1, 2) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_1, 1) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_1, 0) + MACC_32BIT_LOOP_UNROOL_3(3, qlp_coeff_0, 3) + MACC_32BIT_LOOP_UNROOL_3(4, qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(5, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(6, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + } + } + } + else { + if(order == 6) { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], 0, 0}; + + tmp_vec[0] = vld1q_s32(data - 6); + tmp_vec[1] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[2] = vld1q_s32(data + i - 4); + tmp_vec[3] = vld1q_s32(data + i - 3); + tmp_vec[4] = vld1q_s32(data + i - 2); + tmp_vec[5] = vld1q_s32(data + i - 1); + tmp_vec[6] = vld1q_s32(data + i - 0); + tmp_vec[7] = vld1q_s32(data + i + 1); + tmp_vec[8] = vld1q_s32(data + i + 2); + tmp_vec[9] = vld1q_s32(data + i + 3); + tmp_vec[10] = vld1q_s32(data + i + 4); + tmp_vec[11] = vld1q_s32(data + i + 5); + tmp_vec[12] = vld1q_s32(data + i + 6); + tmp_vec[13] = vld1q_s32(data + i + 7); + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_1, 1) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_1, 0) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_0, 3) + MACC_32BIT_LOOP_UNROOL_3(3, qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(4, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(5, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + } + } + else { /* order == 5 */ + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], 0, 0, 0}; + + tmp_vec[0] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + + tmp_vec[1] = vld1q_s32(data + i - 4); + tmp_vec[2] = vld1q_s32(data + i - 3); + tmp_vec[3] = vld1q_s32(data + i - 2); + tmp_vec[4] = vld1q_s32(data + i - 1); + tmp_vec[5] = vld1q_s32(data + i - 0); + tmp_vec[6] = vld1q_s32(data + i + 1); + tmp_vec[7] = vld1q_s32(data + i + 2); + tmp_vec[8] = vld1q_s32(data + i + 3); + tmp_vec[9] = vld1q_s32(data + i + 4); + tmp_vec[10] = vld1q_s32(data + i + 5); + tmp_vec[11] = vld1q_s32(data + i + 6); + tmp_vec[12] = vld1q_s32(data + i + 7); + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_1, 0) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_0, 3) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(3, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(4, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + + tmp_vec[0] = tmp_vec[12]; + } + } + } + } + else { + if(order > 2) { + if(order == 4) { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[0] = vld1q_s32(data + i - 4); + tmp_vec[1] = vld1q_s32(data + i - 3); + tmp_vec[2] = vld1q_s32(data + i - 2); + tmp_vec[3] = vld1q_s32(data + i - 1); + tmp_vec[4] = vld1q_s32(data + i - 0); + tmp_vec[5] = vld1q_s32(data + i + 1); + tmp_vec[6] = vld1q_s32(data + i + 2); + tmp_vec[7] = vld1q_s32(data + i + 3); + tmp_vec[8] = vld1q_s32(data + i + 4); + tmp_vec[9] = vld1q_s32(data + i + 5); + tmp_vec[10] = vld1q_s32(data + i + 6); + tmp_vec[11] = vld1q_s32(data + i + 7); + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_0, 3) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(3, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + } + } + else { /* order == 3 */ + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], 0}; + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[0] = vld1q_s32(data + i - 3); + tmp_vec[1] = vld1q_s32(data + i - 2); + tmp_vec[2] = vld1q_s32(data + i - 1); + tmp_vec[4] = vld1q_s32(data + i + 1); + tmp_vec[5] = vld1q_s32(data + i + 2); + tmp_vec[6] = vld1q_s32(data + i + 3); + tmp_vec[8] = vld1q_s32(data + i + 5); + tmp_vec[9] = vld1q_s32(data + i + 6); + tmp_vec[10] = vld1q_s32(data + i + 7); + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_0, 2) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(2, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + } + } + } + else { + if(order == 2) { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], 0, 0}; + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[0] = vld1q_s32(data + i - 2); + tmp_vec[1] = vld1q_s32(data + i - 1); + tmp_vec[4] = vld1q_s32(data + i + 2); + tmp_vec[5] = vld1q_s32(data + i + 3); + tmp_vec[8] = vld1q_s32(data + i + 6); + tmp_vec[9] = vld1q_s32(data + i + 7); + + MUL_32_BIT_LOOP_UNROOL_3(qlp_coeff_0, 1) + MACC_32BIT_LOOP_UNROOL_3(1, qlp_coeff_0, 0) + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + } + } + else { /* order == 1 */ + int32x4_t qlp_coeff_0 = vdupq_n_s32(qlp_coeff[0]); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int32x4_t summ_0, summ_1, summ_2; + tmp_vec[0] = vld1q_s32(data + i - 1); + tmp_vec[4] = vld1q_s32(data + i + 3); + tmp_vec[8] = vld1q_s32(data + i + 7); + + summ_0 = vmulq_s32(tmp_vec[0], qlp_coeff_0); + summ_1 = vmulq_s32(tmp_vec[4], qlp_coeff_0); + summ_2 = vmulq_s32(tmp_vec[8], qlp_coeff_0); + + vst1q_s32(residual+i + 0, vsubq_s32(vld1q_s32(data+i + 0) , vshlq_s32(summ_0,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 4, vsubq_s32(vld1q_s32(data+i + 4) , vshlq_s32(summ_1,vdupq_n_s32(-lp_quantization)))); + vst1q_s32(residual+i + 8, vsubq_s32(vld1q_s32(data+i + 8) , vshlq_s32(summ_2,vdupq_n_s32(-lp_quantization)))); + } + } + } + } + for(; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 12: sum += qlp_coeff[11] * data[i-12]; /* Falls through. */ + case 11: sum += qlp_coeff[10] * data[i-11]; /* Falls through. */ + case 10: sum += qlp_coeff[ 9] * data[i-10]; /* Falls through. */ + case 9: sum += qlp_coeff[ 8] * data[i- 9]; /* Falls through. */ + case 8: sum += qlp_coeff[ 7] * data[i- 8]; /* Falls through. */ + case 7: sum += qlp_coeff[ 6] * data[i- 7]; /* Falls through. */ + case 6: sum += qlp_coeff[ 5] * data[i- 6]; /* Falls through. */ + case 5: sum += qlp_coeff[ 4] * data[i- 5]; /* Falls through. */ + case 4: sum += qlp_coeff[ 3] * data[i- 4]; /* Falls through. */ + case 3: sum += qlp_coeff[ 2] * data[i- 3]; /* Falls through. */ + case 2: sum += qlp_coeff[ 1] * data[i- 2]; /* Falls through. */ + case 1: sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } + else { /* order > 12 */ + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * data[i-13]; + sum += qlp_coeff[11] * data[i-12]; + sum += qlp_coeff[10] * data[i-11]; + sum += qlp_coeff[ 9] * data[i-10]; + sum += qlp_coeff[ 8] * data[i- 9]; + sum += qlp_coeff[ 7] * data[i- 8]; + sum += qlp_coeff[ 6] * data[i- 7]; + sum += qlp_coeff[ 5] * data[i- 6]; + sum += qlp_coeff[ 4] * data[i- 5]; + sum += qlp_coeff[ 3] * data[i- 4]; + sum += qlp_coeff[ 2] * data[i- 3]; + sum += qlp_coeff[ 1] * data[i- 2]; + sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } +} + + + +#define MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_vec, lane) \ + summ_l_0 = vmull_laneq_s32(vget_low_s32(tmp_vec[0]),qlp_coeff_vec, lane); \ + summ_h_0 = vmull_high_laneq_s32(tmp_vec[0], qlp_coeff_vec, lane);\ + summ_l_1 = vmull_laneq_s32(vget_low_s32(tmp_vec[4]),qlp_coeff_vec, lane); \ + summ_h_1 = vmull_high_laneq_s32(tmp_vec[4], qlp_coeff_vec, lane);\ + summ_l_2 = vmull_laneq_s32(vget_low_s32(tmp_vec[8]),qlp_coeff_vec, lane);\ + summ_h_2 = vmull_high_laneq_s32(tmp_vec[8], qlp_coeff_vec, lane); + + +#define MACC_64_BIT_LOOP_UNROOL_3(tmp_vec_ind, qlp_coeff_vec, lane) \ + summ_l_0 = vmlal_laneq_s32(summ_l_0,vget_low_s32(tmp_vec[tmp_vec_ind]),qlp_coeff_vec, lane); \ + summ_h_0 = vmlal_high_laneq_s32(summ_h_0, tmp_vec[tmp_vec_ind], qlp_coeff_vec, lane); \ + summ_l_1 = vmlal_laneq_s32(summ_l_1, vget_low_s32(tmp_vec[tmp_vec_ind+4]),qlp_coeff_vec, lane); \ + summ_h_1 = vmlal_high_laneq_s32(summ_h_1, tmp_vec[tmp_vec_ind+4], qlp_coeff_vec, lane); \ + summ_l_2 = vmlal_laneq_s32(summ_l_2, vget_low_s32(tmp_vec[tmp_vec_ind+8]),qlp_coeff_vec, lane);\ + summ_h_2 = vmlal_high_laneq_s32(summ_h_2,tmp_vec[tmp_vec_ind+8], qlp_coeff_vec, lane); + +#define SHIFT_SUMS_64BITS_AND_STORE_SUB() \ + res0 = vuzp1q_s32(vreinterpretq_s32_s64(vshlq_s64(summ_l_0,lp_quantization_vec)), vreinterpretq_s32_s64(vshlq_s64(summ_h_0,lp_quantization_vec))); \ + res1 = vuzp1q_s32(vreinterpretq_s32_s64(vshlq_s64(summ_l_1,lp_quantization_vec)), vreinterpretq_s32_s64(vshlq_s64(summ_h_1,lp_quantization_vec))); \ + res2 = vuzp1q_s32(vreinterpretq_s32_s64(vshlq_s64(summ_l_2,lp_quantization_vec)), vreinterpretq_s32_s64(vshlq_s64(summ_h_2,lp_quantization_vec))); \ + vst1q_s32(residual+i+0, vsubq_s32(vld1q_s32(data+i+0), res0));\ + vst1q_s32(residual+i+4, vsubq_s32(vld1q_s32(data+i+4), res1));\ + vst1q_s32(residual+i+8, vsubq_s32(vld1q_s32(data+i+8), res2)); + +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_neon(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]) { + int i; + FLAC__int64 sum; + + int32x4_t tmp_vec[20]; + int32x4_t res0, res1, res2; + int64x2_t lp_quantization_vec = vdupq_n_s64(-lp_quantization); + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + // Using prologue reads is valid as encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit(signal+order,....) + if(order <= 12) { + if(order > 8) { + if(order > 10) { + if(order == 12) { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4],qlp_coeff[5],qlp_coeff[6],qlp_coeff[7]}; + int32x4_t qlp_coeff_2 = {qlp_coeff[8],qlp_coeff[9],qlp_coeff[10],qlp_coeff[11]}; + + tmp_vec[0] = vld1q_s32(data - 12); + tmp_vec[1] = vld1q_s32(data - 11); + tmp_vec[2] = vld1q_s32(data - 10); + tmp_vec[3] = vld1q_s32(data - 9); + tmp_vec[4] = vld1q_s32(data - 8); + tmp_vec[5] = vld1q_s32(data - 7); + tmp_vec[6] = vld1q_s32(data - 6); + tmp_vec[7] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + + tmp_vec[8] = vld1q_s32(data+i-4); + tmp_vec[9] = vld1q_s32(data+i-3); + tmp_vec[10] = vld1q_s32(data+i-2); + tmp_vec[11] = vld1q_s32(data+i-1); + tmp_vec[12] = vld1q_s32(data+i); + tmp_vec[13] = vld1q_s32(data+i+1); + tmp_vec[14] = vld1q_s32(data+i+2); + tmp_vec[15] = vld1q_s32(data+i+3); + tmp_vec[16] = vld1q_s32(data + i + 4); + tmp_vec[17] = vld1q_s32(data + i + 5); + tmp_vec[18] = vld1q_s32(data + i + 6); + tmp_vec[19] = vld1q_s32(data + i + 7); + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_2, 3) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_2, 2) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_2, 1) + MACC_64_BIT_LOOP_UNROOL_3(3, qlp_coeff_2, 0) + MACC_64_BIT_LOOP_UNROOL_3(4, qlp_coeff_1, 3) + MACC_64_BIT_LOOP_UNROOL_3(5, qlp_coeff_1, 2) + MACC_64_BIT_LOOP_UNROOL_3(6, qlp_coeff_1, 1) + MACC_64_BIT_LOOP_UNROOL_3(7, qlp_coeff_1, 0) + MACC_64_BIT_LOOP_UNROOL_3(8, qlp_coeff_0, 3) + MACC_64_BIT_LOOP_UNROOL_3(9, qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(10,qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(11,qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + tmp_vec[4] = tmp_vec[16]; + tmp_vec[5] = tmp_vec[17]; + tmp_vec[6] = tmp_vec[18]; + tmp_vec[7] = tmp_vec[19]; + } + } + else { /* order == 11 */ + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4],qlp_coeff[5],qlp_coeff[6],qlp_coeff[7]}; + int32x4_t qlp_coeff_2 = {qlp_coeff[8],qlp_coeff[9],qlp_coeff[10],0}; + + tmp_vec[0] = vld1q_s32(data - 11); + tmp_vec[1] = vld1q_s32(data - 10); + tmp_vec[2] = vld1q_s32(data - 9); + tmp_vec[3] = vld1q_s32(data - 8); + tmp_vec[4] = vld1q_s32(data - 7); + tmp_vec[5] = vld1q_s32(data - 6); + tmp_vec[6] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + + tmp_vec[7] = vld1q_s32(data+i-4); + tmp_vec[8] = vld1q_s32(data+i-3); + tmp_vec[9] = vld1q_s32(data+i-2); + tmp_vec[10] = vld1q_s32(data+i-1); + tmp_vec[11] = vld1q_s32(data+i); + tmp_vec[12] = vld1q_s32(data+i+1); + tmp_vec[13] = vld1q_s32(data+i+2); + tmp_vec[14] = vld1q_s32(data+i+3); + tmp_vec[15] = vld1q_s32(data + i + 4); + tmp_vec[16] = vld1q_s32(data + i + 5); + tmp_vec[17] = vld1q_s32(data + i + 6); + tmp_vec[18] = vld1q_s32(data + i + 7); + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_2, 2) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_2, 1) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_2, 0) + MACC_64_BIT_LOOP_UNROOL_3(3, qlp_coeff_1, 3) + MACC_64_BIT_LOOP_UNROOL_3(4, qlp_coeff_1, 2) + MACC_64_BIT_LOOP_UNROOL_3(5, qlp_coeff_1, 1) + MACC_64_BIT_LOOP_UNROOL_3(6, qlp_coeff_1, 0) + MACC_64_BIT_LOOP_UNROOL_3(7, qlp_coeff_0, 3) + MACC_64_BIT_LOOP_UNROOL_3(8, qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(9, qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(10,qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + tmp_vec[4] = tmp_vec[16]; + tmp_vec[5] = tmp_vec[17]; + tmp_vec[6] = tmp_vec[18]; + } + } + } + else + { + if (order == 10) { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], qlp_coeff[7]}; + int32x4_t qlp_coeff_2 = {qlp_coeff[8], qlp_coeff[9], 0, 0}; + + tmp_vec[0] = vld1q_s32(data - 10); + tmp_vec[1] = vld1q_s32(data - 9); + tmp_vec[2] = vld1q_s32(data - 8); + tmp_vec[3] = vld1q_s32(data - 7); + tmp_vec[4] = vld1q_s32(data - 6); + tmp_vec[5] = vld1q_s32(data - 5); + + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + + tmp_vec[6] = vld1q_s32(data + i - 4); + tmp_vec[7] = vld1q_s32(data + i - 3); + tmp_vec[8] = vld1q_s32(data + i - 2); + tmp_vec[9] = vld1q_s32(data + i - 1); + tmp_vec[10] = vld1q_s32(data + i - 0); + tmp_vec[11] = vld1q_s32(data + i + 1); + tmp_vec[12] = vld1q_s32(data + i + 2); + tmp_vec[13] = vld1q_s32(data + i + 3); + tmp_vec[14] = vld1q_s32(data + i + 4); + tmp_vec[15] = vld1q_s32(data + i + 5); + tmp_vec[16] = vld1q_s32(data + i + 6); + tmp_vec[17] = vld1q_s32(data + i + 7); + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_2, 1) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_2, 0) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_1, 3) + MACC_64_BIT_LOOP_UNROOL_3(3, qlp_coeff_1, 2) + MACC_64_BIT_LOOP_UNROOL_3(4, qlp_coeff_1, 1) + MACC_64_BIT_LOOP_UNROOL_3(5, qlp_coeff_1, 0) + MACC_64_BIT_LOOP_UNROOL_3(6, qlp_coeff_0, 3) + MACC_64_BIT_LOOP_UNROOL_3(7, qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(8, qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(9, qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + tmp_vec[4] = tmp_vec[16]; + tmp_vec[5] = tmp_vec[17]; + } + } + + else /* order == 9 */ { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], qlp_coeff[7]}; + int32x4_t qlp_coeff_2 = {qlp_coeff[8], 0, 0, 0}; + + tmp_vec[0] = vld1q_s32(data - 9); + tmp_vec[1] = vld1q_s32(data - 8); + tmp_vec[2] = vld1q_s32(data - 7); + tmp_vec[3] = vld1q_s32(data - 6); + tmp_vec[4] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + + tmp_vec[5] = vld1q_s32(data + i - 4); + tmp_vec[6] = vld1q_s32(data + i - 3); + tmp_vec[7] = vld1q_s32(data + i - 2); + tmp_vec[8] = vld1q_s32(data + i - 1); + tmp_vec[9] = vld1q_s32(data + i - 0); + tmp_vec[10] = vld1q_s32(data + i + 1); + tmp_vec[11] = vld1q_s32(data + i + 2); + tmp_vec[12] = vld1q_s32(data + i + 3); + tmp_vec[13] = vld1q_s32(data + i + 4); + tmp_vec[14] = vld1q_s32(data + i + 5); + tmp_vec[15] = vld1q_s32(data + i + 6); + tmp_vec[16] = vld1q_s32(data + i + 7); + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_2, 0) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_1, 3) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_1, 2) + MACC_64_BIT_LOOP_UNROOL_3(3, qlp_coeff_1, 1) + MACC_64_BIT_LOOP_UNROOL_3(4, qlp_coeff_1, 0) + MACC_64_BIT_LOOP_UNROOL_3(5, qlp_coeff_0, 3) + MACC_64_BIT_LOOP_UNROOL_3(6, qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(7, qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(8, qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + tmp_vec[4] = tmp_vec[16]; + } + } + } + } + else if (order > 4) + { + if (order > 6) + { + if (order == 8) + { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], qlp_coeff[7]}; + + tmp_vec[0] = vld1q_s32(data - 8); + tmp_vec[1] = vld1q_s32(data - 7); + tmp_vec[2] = vld1q_s32(data - 6); + tmp_vec[3] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + + tmp_vec[4] = vld1q_s32(data + i - 4); + tmp_vec[5] = vld1q_s32(data + i - 3); + tmp_vec[6] = vld1q_s32(data + i - 2); + tmp_vec[7] = vld1q_s32(data + i - 1); + tmp_vec[8] = vld1q_s32(data + i - 0); + tmp_vec[9] = vld1q_s32(data + i + 1); + tmp_vec[10] = vld1q_s32(data + i + 2); + tmp_vec[11] = vld1q_s32(data + i + 3); + tmp_vec[12] = vld1q_s32(data + i + 4); + tmp_vec[13] = vld1q_s32(data + i + 5); + tmp_vec[14] = vld1q_s32(data + i + 6); + tmp_vec[15] = vld1q_s32(data + i + 7); + + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_1, 3) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_1, 2) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_1, 1) + MACC_64_BIT_LOOP_UNROOL_3(3, qlp_coeff_1, 0) + MACC_64_BIT_LOOP_UNROOL_3(4, qlp_coeff_0, 3) + MACC_64_BIT_LOOP_UNROOL_3(5, qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(6, qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(7, qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + tmp_vec[3] = tmp_vec[15]; + } + } + else /* order == 7 */ + { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], 0}; + + tmp_vec[0] = vld1q_s32(data - 7); + tmp_vec[1] = vld1q_s32(data - 6); + tmp_vec[2] = vld1q_s32(data - 5); + + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + tmp_vec[3] = vld1q_s32(data +i - 4); + tmp_vec[4] = vld1q_s32(data + i - 3); + tmp_vec[5] = vld1q_s32(data + i - 2); + tmp_vec[6] = vld1q_s32(data + i - 1); + tmp_vec[7] = vld1q_s32(data + i - 0); + tmp_vec[8] = vld1q_s32(data + i + 1); + tmp_vec[9] = vld1q_s32(data + i + 2); + tmp_vec[10] = vld1q_s32(data + i + 3); + tmp_vec[11] = vld1q_s32(data + i + 4); + tmp_vec[12] = vld1q_s32(data + i + 5); + tmp_vec[13] = vld1q_s32(data + i + 6); + tmp_vec[14] = vld1q_s32(data + i + 7); + + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_1, 2) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_1, 1) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_1, 0) + MACC_64_BIT_LOOP_UNROOL_3(3, qlp_coeff_0, 3) + MACC_64_BIT_LOOP_UNROOL_3(4, qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(5, qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(6, qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + tmp_vec[2] = tmp_vec[14]; + } + } + } + else + { + if (order == 6) { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], 0, 0}; + + tmp_vec[0] = vld1q_s32(data - 6); + tmp_vec[1] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + + tmp_vec[2] = vld1q_s32(data + i - 4); + tmp_vec[3] = vld1q_s32(data + i - 3); + tmp_vec[4] = vld1q_s32(data + i - 2); + tmp_vec[5] = vld1q_s32(data + i - 1); + tmp_vec[6] = vld1q_s32(data + i - 0); + tmp_vec[7] = vld1q_s32(data + i + 1); + tmp_vec[8] = vld1q_s32(data + i + 2); + tmp_vec[9] = vld1q_s32(data + i + 3); + tmp_vec[10] = vld1q_s32(data + i + 4); + tmp_vec[11] = vld1q_s32(data + i + 5); + tmp_vec[12] = vld1q_s32(data + i + 6); + tmp_vec[13] = vld1q_s32(data + i + 7); + + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_1, 1) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_1, 0) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_0, 3) + MACC_64_BIT_LOOP_UNROOL_3(3, qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(4, qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(5, qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + + tmp_vec[0] = tmp_vec[12]; + tmp_vec[1] = tmp_vec[13]; + } + } + + else + { /* order == 5 */ + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + int32x4_t qlp_coeff_1 = {qlp_coeff[4], 0, 0, 0}; + + tmp_vec[0] = vld1q_s32(data - 5); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + tmp_vec[1] = vld1q_s32(data + i - 4); + tmp_vec[2] = vld1q_s32(data + i - 3); + tmp_vec[3] = vld1q_s32(data + i - 2); + tmp_vec[4] = vld1q_s32(data + i - 1); + tmp_vec[5] = vld1q_s32(data + i - 0); + tmp_vec[6] = vld1q_s32(data + i + 1); + tmp_vec[7] = vld1q_s32(data + i + 2); + tmp_vec[8] = vld1q_s32(data + i + 3); + tmp_vec[9] = vld1q_s32(data + i + 4); + tmp_vec[10] = vld1q_s32(data + i + 5); + tmp_vec[11] = vld1q_s32(data + i + 6); + tmp_vec[12] = vld1q_s32(data + i + 7); + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_1, 0) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_0, 3) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(3, qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(4, qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + + tmp_vec[0] = tmp_vec[12]; + } + } + } + } + else + { + if (order > 2) + { + if (order == 4) + { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + tmp_vec[0] = vld1q_s32(data + i - 4); + tmp_vec[1] = vld1q_s32(data + i - 3); + tmp_vec[2] = vld1q_s32(data + i - 2); + tmp_vec[3] = vld1q_s32(data + i - 1); + tmp_vec[4] = vld1q_s32(data + i - 0); + tmp_vec[5] = vld1q_s32(data + i + 1); + tmp_vec[6] = vld1q_s32(data + i + 2); + tmp_vec[7] = vld1q_s32(data + i + 3); + tmp_vec[8] = vld1q_s32(data + i + 4); + tmp_vec[9] = vld1q_s32(data + i + 5); + tmp_vec[10] = vld1q_s32(data + i + 6); + tmp_vec[11] = vld1q_s32(data + i + 7); + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_0, 3) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(3, qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + } + } + else + { /* order == 3 */ + + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], 0}; + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + tmp_vec[0] = vld1q_s32(data + i - 3); + tmp_vec[1] = vld1q_s32(data + i - 2); + tmp_vec[2] = vld1q_s32(data + i - 1); + tmp_vec[4] = vld1q_s32(data + i + 1); + tmp_vec[5] = vld1q_s32(data + i + 2); + tmp_vec[6] = vld1q_s32(data + i + 3); + tmp_vec[8] = vld1q_s32(data + i + 5); + tmp_vec[9] = vld1q_s32(data + i + 6); + tmp_vec[10] = vld1q_s32(data + i + 7); + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_0, 2) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(2, qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + } + } + } + else + { + if (order == 2) + { + int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], 0, 0}; + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + tmp_vec[0] = vld1q_s32(data + i - 2); + tmp_vec[1] = vld1q_s32(data + i - 1); + tmp_vec[4] = vld1q_s32(data + i + 2); + tmp_vec[5] = vld1q_s32(data + i + 3); + tmp_vec[8] = vld1q_s32(data + i + 6); + tmp_vec[9] = vld1q_s32(data + i + 7); + + MUL_64_BIT_LOOP_UNROOL_3(qlp_coeff_0, 1) + MACC_64_BIT_LOOP_UNROOL_3(1, qlp_coeff_0, 0) + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + } + } + + else + { /* order == 1 */ + + int32x2_t qlp_coeff_0_2 = vdup_n_s32(qlp_coeff[0]); + int32x4_t qlp_coeff_0_4 = vdupq_n_s32(qlp_coeff[0]); + + for (i = 0; i < (int)data_len - 11; i += 12) + { + int64x2_t summ_l_0, summ_h_0, summ_l_1, summ_h_1, summ_l_2, summ_h_2; + tmp_vec[0] = vld1q_s32(data + i - 1); + tmp_vec[4] = vld1q_s32(data + i + 3); + tmp_vec[8] = vld1q_s32(data + i + 7); + + summ_l_0 = vmull_s32(vget_low_s32(tmp_vec[0]), qlp_coeff_0_2); + summ_h_0 = vmull_high_s32(tmp_vec[0], qlp_coeff_0_4); + + summ_l_1 = vmull_s32(vget_low_s32(tmp_vec[4]), qlp_coeff_0_2); + summ_h_1 = vmull_high_s32(tmp_vec[4], qlp_coeff_0_4); + + summ_l_2 = vmull_s32(vget_low_s32(tmp_vec[8]), qlp_coeff_0_2); + summ_h_2 = vmull_high_s32(tmp_vec[8], qlp_coeff_0_4); + + SHIFT_SUMS_64BITS_AND_STORE_SUB() + } + } + } + } + for (; i < (int)data_len; i++) + { + sum = 0; + switch (order) + { + case 12: + sum += qlp_coeff[11] * (FLAC__int64)data[i - 12]; /* Falls through. */ + case 11: + sum += qlp_coeff[10] * (FLAC__int64)data[i - 11]; /* Falls through. */ + case 10: + sum += qlp_coeff[9] * (FLAC__int64)data[i - 10]; /* Falls through. */ + case 9: + sum += qlp_coeff[8] * (FLAC__int64)data[i - 9]; /* Falls through. */ + case 8: + sum += qlp_coeff[7] * (FLAC__int64)data[i - 8]; /* Falls through. */ + case 7: + sum += qlp_coeff[6] * (FLAC__int64)data[i - 7]; /* Falls through. */ + case 6: + sum += qlp_coeff[5] * (FLAC__int64)data[i - 6]; /* Falls through. */ + case 5: + sum += qlp_coeff[4] * (FLAC__int64)data[i - 5]; /* Falls through. */ + case 4: + sum += qlp_coeff[3] * (FLAC__int64)data[i - 4]; /* Falls through. */ + case 3: + sum += qlp_coeff[2] * (FLAC__int64)data[i - 3]; /* Falls through. */ + case 2: + sum += qlp_coeff[1] * (FLAC__int64)data[i - 2]; /* Falls through. */ + case 1: + sum += qlp_coeff[0] * (FLAC__int64)data[i - 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } + else + { /* order > 12 */ + for (i = 0; i < (int)data_len; i++) + { + sum = 0; + switch (order) + { + case 32: + sum += qlp_coeff[31] * (FLAC__int64)data[i - 32]; /* Falls through. */ + case 31: + sum += qlp_coeff[30] * (FLAC__int64)data[i - 31]; /* Falls through. */ + case 30: + sum += qlp_coeff[29] * (FLAC__int64)data[i - 30]; /* Falls through. */ + case 29: + sum += qlp_coeff[28] * (FLAC__int64)data[i - 29]; /* Falls through. */ + case 28: + sum += qlp_coeff[27] * (FLAC__int64)data[i - 28]; /* Falls through. */ + case 27: + sum += qlp_coeff[26] * (FLAC__int64)data[i - 27]; /* Falls through. */ + case 26: + sum += qlp_coeff[25] * (FLAC__int64)data[i - 26]; /* Falls through. */ + case 25: + sum += qlp_coeff[24] * (FLAC__int64)data[i - 25]; /* Falls through. */ + case 24: + sum += qlp_coeff[23] * (FLAC__int64)data[i - 24]; /* Falls through. */ + case 23: + sum += qlp_coeff[22] * (FLAC__int64)data[i - 23]; /* Falls through. */ + case 22: + sum += qlp_coeff[21] * (FLAC__int64)data[i - 22]; /* Falls through. */ + case 21: + sum += qlp_coeff[20] * (FLAC__int64)data[i - 21]; /* Falls through. */ + case 20: + sum += qlp_coeff[19] * (FLAC__int64)data[i - 20]; /* Falls through. */ + case 19: + sum += qlp_coeff[18] * (FLAC__int64)data[i - 19]; /* Falls through. */ + case 18: + sum += qlp_coeff[17] * (FLAC__int64)data[i - 18]; /* Falls through. */ + case 17: + sum += qlp_coeff[16] * (FLAC__int64)data[i - 17]; /* Falls through. */ + case 16: + sum += qlp_coeff[15] * (FLAC__int64)data[i - 16]; /* Falls through. */ + case 15: + sum += qlp_coeff[14] * (FLAC__int64)data[i - 15]; /* Falls through. */ + case 14: + sum += qlp_coeff[13] * (FLAC__int64)data[i - 14]; /* Falls through. */ + case 13: + sum += qlp_coeff[12] * (FLAC__int64)data[i - 13]; + sum += qlp_coeff[11] * (FLAC__int64)data[i - 12]; + sum += qlp_coeff[10] * (FLAC__int64)data[i - 11]; + sum += qlp_coeff[9] * (FLAC__int64)data[i - 10]; + sum += qlp_coeff[8] * (FLAC__int64)data[i - 9]; + sum += qlp_coeff[7] * (FLAC__int64)data[i - 8]; + sum += qlp_coeff[6] * (FLAC__int64)data[i - 7]; + sum += qlp_coeff[5] * (FLAC__int64)data[i - 6]; + sum += qlp_coeff[4] * (FLAC__int64)data[i - 5]; + sum += qlp_coeff[3] * (FLAC__int64)data[i - 4]; + sum += qlp_coeff[2] * (FLAC__int64)data[i - 3]; + sum += qlp_coeff[1] * (FLAC__int64)data[i - 2]; + sum += qlp_coeff[0] * (FLAC__int64)data[i - 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } + + return; +} + +#endif /* FLAC__CPU_ARM64 && FLAC__HAS_ARCH64INTRIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/lpc_intrin_sse2.c b/3rdparty/libflac/src/libFLAC/lpc_intrin_sse2.c new file mode 100644 index 00000000000..d16a085fba3 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/lpc_intrin_sse2.c @@ -0,0 +1,966 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +#include "private/lpc.h" +#ifdef FLAC__SSE2_SUPPORTED + +#include "FLAC/assert.h" +#include "FLAC/format.h" + +#include <emmintrin.h> /* SSE2 */ + +#define RESIDUAL32_RESULT(xmmN) residual[i] = data[i] - (_mm_cvtsi128_si32(xmmN) >> lp_quantization); +#define DATA32_RESULT(xmmN) data[i] = residual[i] + (_mm_cvtsi128_si32(xmmN) >> lp_quantization); + + +FLAC__SSE_TARGET("sse2") +void FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_8(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) +{ +#undef MAX_LAG +#define MAX_LAG 8 +#include "deduplication/lpc_compute_autocorrelation_intrin_sse2.c" +} + +FLAC__SSE_TARGET("sse2") +void FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_10(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) +{ +#undef MAX_LAG +#define MAX_LAG 10 +#include "deduplication/lpc_compute_autocorrelation_intrin_sse2.c" +} + + +FLAC__SSE_TARGET("sse2") +void FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_14(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]) +{ +#undef MAX_LAG +#define MAX_LAG 14 +#include "deduplication/lpc_compute_autocorrelation_intrin_sse2.c" +} + +FLAC__SSE_TARGET("sse2") +void FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]) +{ + int i; + FLAC__int32 sum; + const __m128i cnt = _mm_cvtsi32_si128(lp_quantization); + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + if(order <= 12) { + if(order > 8) { + if(order > 10) { + if(order == 12) { + __m128i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(0xffff & qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(0xffff & qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(0xffff & qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(0xffff & qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(0xffff & qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + q8 = _mm_cvtsi32_si128(0xffff & qlp_coeff[8]); q8 = _mm_shuffle_epi32(q8, _MM_SHUFFLE(0,0,0,0)); + q9 = _mm_cvtsi32_si128(0xffff & qlp_coeff[9]); q9 = _mm_shuffle_epi32(q9, _MM_SHUFFLE(0,0,0,0)); + q10 = _mm_cvtsi32_si128(0xffff & qlp_coeff[10]); q10 = _mm_shuffle_epi32(q10, _MM_SHUFFLE(0,0,0,0)); + q11 = _mm_cvtsi32_si128(0xffff & qlp_coeff[11]); q11 = _mm_shuffle_epi32(q11, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q11, _mm_loadu_si128((const __m128i*)(const void*)(data+i-12))); + mull = _mm_madd_epi16(q10, _mm_loadu_si128((const __m128i*)(const void*)(data+i-11))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q9, _mm_loadu_si128((const __m128i*)(const void*)(data+i-10))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q8, _mm_loadu_si128((const __m128i*)(const void*)(data+i-9))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 11 */ + __m128i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(0xffff & qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(0xffff & qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(0xffff & qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(0xffff & qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(0xffff & qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + q8 = _mm_cvtsi32_si128(0xffff & qlp_coeff[8]); q8 = _mm_shuffle_epi32(q8, _MM_SHUFFLE(0,0,0,0)); + q9 = _mm_cvtsi32_si128(0xffff & qlp_coeff[9]); q9 = _mm_shuffle_epi32(q9, _MM_SHUFFLE(0,0,0,0)); + q10 = _mm_cvtsi32_si128(0xffff & qlp_coeff[10]); q10 = _mm_shuffle_epi32(q10, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q10, _mm_loadu_si128((const __m128i*)(const void*)(data+i-11))); + mull = _mm_madd_epi16(q9, _mm_loadu_si128((const __m128i*)(const void*)(data+i-10))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q8, _mm_loadu_si128((const __m128i*)(const void*)(data+i-9))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 10) { + __m128i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(0xffff & qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(0xffff & qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(0xffff & qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(0xffff & qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(0xffff & qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + q8 = _mm_cvtsi32_si128(0xffff & qlp_coeff[8]); q8 = _mm_shuffle_epi32(q8, _MM_SHUFFLE(0,0,0,0)); + q9 = _mm_cvtsi32_si128(0xffff & qlp_coeff[9]); q9 = _mm_shuffle_epi32(q9, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q9, _mm_loadu_si128((const __m128i*)(const void*)(data+i-10))); + mull = _mm_madd_epi16(q8, _mm_loadu_si128((const __m128i*)(const void*)(data+i-9))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 9 */ + __m128i q0, q1, q2, q3, q4, q5, q6, q7, q8; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(0xffff & qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(0xffff & qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(0xffff & qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(0xffff & qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(0xffff & qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + q8 = _mm_cvtsi32_si128(0xffff & qlp_coeff[8]); q8 = _mm_shuffle_epi32(q8, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q8, _mm_loadu_si128((const __m128i*)(const void*)(data+i-9))); + mull = _mm_madd_epi16(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + } + else if(order > 4) { + if(order > 6) { + if(order == 8) { + __m128i q0, q1, q2, q3, q4, q5, q6, q7; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(0xffff & qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(0xffff & qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(0xffff & qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(0xffff & qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(0xffff & qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); + mull = _mm_madd_epi16(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 7 */ + __m128i q0, q1, q2, q3, q4, q5, q6; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(0xffff & qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(0xffff & qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(0xffff & qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(0xffff & qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); + mull = _mm_madd_epi16(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 6) { + __m128i q0, q1, q2, q3, q4, q5; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(0xffff & qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(0xffff & qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(0xffff & qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); + mull = _mm_madd_epi16(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 5 */ + __m128i q0, q1, q2, q3, q4; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(0xffff & qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(0xffff & qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); + mull = _mm_madd_epi16(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + } + else { + if(order > 2) { + if(order == 4) { + __m128i q0, q1, q2, q3; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(0xffff & qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); + mull = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 3 */ + __m128i q0, q1, q2; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(0xffff & qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); + mull = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 2) { + __m128i q0, q1; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(0xffff & qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_madd_epi16(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); + mull = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 1 */ + __m128i q0; + q0 = _mm_cvtsi32_si128(0xffff & qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ; + summ = _mm_madd_epi16(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + } + for(; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 12: sum += qlp_coeff[11] * data[i-12]; /* Falls through. */ + case 11: sum += qlp_coeff[10] * data[i-11]; /* Falls through. */ + case 10: sum += qlp_coeff[ 9] * data[i-10]; /* Falls through. */ + case 9: sum += qlp_coeff[ 8] * data[i- 9]; /* Falls through. */ + case 8: sum += qlp_coeff[ 7] * data[i- 8]; /* Falls through. */ + case 7: sum += qlp_coeff[ 6] * data[i- 7]; /* Falls through. */ + case 6: sum += qlp_coeff[ 5] * data[i- 6]; /* Falls through. */ + case 5: sum += qlp_coeff[ 4] * data[i- 5]; /* Falls through. */ + case 4: sum += qlp_coeff[ 3] * data[i- 4]; /* Falls through. */ + case 3: sum += qlp_coeff[ 2] * data[i- 3]; /* Falls through. */ + case 2: sum += qlp_coeff[ 1] * data[i- 2]; /* Falls through. */ + case 1: sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } + else { /* order > 12 */ + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * data[i-13]; + sum += qlp_coeff[11] * data[i-12]; + sum += qlp_coeff[10] * data[i-11]; + sum += qlp_coeff[ 9] * data[i-10]; + sum += qlp_coeff[ 8] * data[i- 9]; + sum += qlp_coeff[ 7] * data[i- 8]; + sum += qlp_coeff[ 6] * data[i- 7]; + sum += qlp_coeff[ 5] * data[i- 6]; + sum += qlp_coeff[ 4] * data[i- 5]; + sum += qlp_coeff[ 3] * data[i- 4]; + sum += qlp_coeff[ 2] * data[i- 3]; + sum += qlp_coeff[ 1] * data[i- 2]; + sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } +} + +#if defined FLAC__CPU_IA32 /* unused for x86_64 */ + +FLAC__SSE_TARGET("sse2") +void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]) +{ + int i; + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + if(order <= 12) { + if(order > 8) { /* order == 9, 10, 11, 12 */ + if(order > 10) { /* order == 11, 12 */ + if(order == 12) { + __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); // 0 0 q[1] q[0] + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); // 0 0 q[3] q[2] + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); // 0 0 q[5] q[4] + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); // 0 0 q[7] q[6] + xmm4 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+8)); // 0 0 q[9] q[8] + xmm5 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+10)); // 0 0 q[11] q[10] + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); // 0 q[1] 0 q[0] + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); // 0 q[3] 0 q[2] + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); // 0 q[5] 0 q[4] + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); // 0 q[7] 0 q[6] + xmm4 = _mm_shuffle_epi32(xmm4, _MM_SHUFFLE(3,1,2,0)); // 0 q[9] 0 q[8] + xmm5 = _mm_shuffle_epi32(xmm5, _MM_SHUFFLE(3,1,2,0)); // 0 q[11] 0 q[10] + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[11] * data[i-12]; + //sum += qlp_coeff[10] * data[i-11]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-12)); // 0 0 d[i-11] d[i-12] + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); // 0 d[i-12] 0 d[i-11] + xmm7 = _mm_mul_epu32(xmm7, xmm5); /* we use _unsigned_ multiplication and discard high dword of the result values */ + + //sum += qlp_coeff[9] * data[i-10]; + //sum += qlp_coeff[8] * data[i-9]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-10)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm4); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[7] * data[i-8]; + //sum += qlp_coeff[6] * data[i-7]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm3); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[5] * data[i-6]; + //sum += qlp_coeff[4] * data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm2); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[3] * data[i-4]; + //sum += qlp_coeff[2] * data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm1); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + else { /* order == 11 */ + __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); + xmm4 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+8)); + xmm5 = _mm_cvtsi32_si128(qlp_coeff[10]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); + xmm4 = _mm_shuffle_epi32(xmm4, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[10] * data[i-11]; + xmm7 = _mm_cvtsi32_si128(data[i-11]); + xmm7 = _mm_mul_epu32(xmm7, xmm5); + + //sum += qlp_coeff[9] * data[i-10]; + //sum += qlp_coeff[8] * data[i-9]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-10)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm4); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[7] * data[i-8]; + //sum += qlp_coeff[6] * data[i-7]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm3); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[5] * data[i-6]; + //sum += qlp_coeff[4] * data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm2); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[3] * data[i-4]; + //sum += qlp_coeff[2] * data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm1); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + } + else { /* order == 9, 10 */ + if(order == 10) { + __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); + xmm4 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+8)); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); + xmm4 = _mm_shuffle_epi32(xmm4, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[9] * data[i-10]; + //sum += qlp_coeff[8] * data[i-9]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-10)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epu32(xmm7, xmm4); + + //sum += qlp_coeff[7] * data[i-8]; + //sum += qlp_coeff[6] * data[i-7]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm3); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[5] * data[i-6]; + //sum += qlp_coeff[4] * data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm2); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[3] * data[i-4]; + //sum += qlp_coeff[2] * data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm1); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + else { /* order == 9 */ + __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); + xmm4 = _mm_cvtsi32_si128(qlp_coeff[8]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[8] * data[i-9]; + xmm7 = _mm_cvtsi32_si128(data[i-9]); + xmm7 = _mm_mul_epu32(xmm7, xmm4); + + //sum += qlp_coeff[7] * data[i-8]; + //sum += qlp_coeff[6] * data[i-7]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm3); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[5] * data[i-6]; + //sum += qlp_coeff[4] * data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm2); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[3] * data[i-4]; + //sum += qlp_coeff[2] * data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm1); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + } + } + else if(order > 4) { /* order == 5, 6, 7, 8 */ + if(order > 6) { /* order == 7, 8 */ + if(order == 8) { + __m128i xmm0, xmm1, xmm2, xmm3, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[7] * data[i-8]; + //sum += qlp_coeff[6] * data[i-7]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epu32(xmm7, xmm3); + + //sum += qlp_coeff[5] * data[i-6]; + //sum += qlp_coeff[4] * data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm2); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[3] * data[i-4]; + //sum += qlp_coeff[2] * data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm1); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + else { /* order == 7 */ + __m128i xmm0, xmm1, xmm2, xmm3, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_cvtsi32_si128(qlp_coeff[6]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[6] * data[i-7]; + xmm7 = _mm_cvtsi32_si128(data[i-7]); + xmm7 = _mm_mul_epu32(xmm7, xmm3); + + //sum += qlp_coeff[5] * data[i-6]; + //sum += qlp_coeff[4] * data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm2); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[3] * data[i-4]; + //sum += qlp_coeff[2] * data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm1); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + } + else { /* order == 5, 6 */ + if(order == 6) { + __m128i xmm0, xmm1, xmm2, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[5] * data[i-6]; + //sum += qlp_coeff[4] * data[i-5]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epu32(xmm7, xmm2); + + //sum += qlp_coeff[3] * data[i-4]; + //sum += qlp_coeff[2] * data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm1); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + else { /* order == 5 */ + __m128i xmm0, xmm1, xmm2, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_cvtsi32_si128(qlp_coeff[4]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[4] * data[i-5]; + xmm7 = _mm_cvtsi32_si128(data[i-5]); + xmm7 = _mm_mul_epu32(xmm7, xmm2); + + //sum += qlp_coeff[3] * data[i-4]; + //sum += qlp_coeff[2] * data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm1); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + } + } + else { /* order == 1, 2, 3, 4 */ + if(order > 2) { /* order == 3, 4 */ + if(order == 4) { + __m128i xmm0, xmm1, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[3] * data[i-4]; + //sum += qlp_coeff[2] * data[i-3]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epu32(xmm7, xmm1); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + else { /* order == 3 */ + __m128i xmm0, xmm1, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_cvtsi32_si128(qlp_coeff[2]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[2] * data[i-3]; + xmm7 = _mm_cvtsi32_si128(data[i-3]); + xmm7 = _mm_mul_epu32(xmm7, xmm1); + + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epu32(xmm6, xmm0); + xmm7 = _mm_add_epi32(xmm7, xmm6); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + } + else { /* order == 1, 2 */ + if(order == 2) { + __m128i xmm0, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[1] * data[i-2]; + //sum += qlp_coeff[0] * data[i-1]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epu32(xmm7, xmm0); + + xmm7 = _mm_add_epi32(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL32_RESULT(xmm7); + } + } + else { /* order == 1 */ + for(i = 0; i < (int)data_len; i++) + residual[i] = data[i] - ((qlp_coeff[0] * data[i-1]) >> lp_quantization); + } + } + } + } + else { /* order > 12 */ + FLAC__int32 sum; + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * data[i-13]; + sum += qlp_coeff[11] * data[i-12]; + sum += qlp_coeff[10] * data[i-11]; + sum += qlp_coeff[ 9] * data[i-10]; + sum += qlp_coeff[ 8] * data[i- 9]; + sum += qlp_coeff[ 7] * data[i- 8]; + sum += qlp_coeff[ 6] * data[i- 7]; + sum += qlp_coeff[ 5] * data[i- 6]; + sum += qlp_coeff[ 4] * data[i- 5]; + sum += qlp_coeff[ 3] * data[i- 4]; + sum += qlp_coeff[ 2] * data[i- 3]; + sum += qlp_coeff[ 1] * data[i- 2]; + sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } +} + +#endif /* FLAC__CPU_IA32 */ +#endif /* FLAC__SSE2_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/lpc_intrin_sse41.c b/3rdparty/libflac/src/libFLAC/lpc_intrin_sse41.c new file mode 100644 index 00000000000..756c5dd80b8 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/lpc_intrin_sse41.c @@ -0,0 +1,950 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__INTEGER_ONLY_LIBRARY +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +#include "private/lpc.h" +#ifdef FLAC__SSE4_1_SUPPORTED + +#include "FLAC/assert.h" +#include "FLAC/format.h" + +#include <smmintrin.h> /* SSE4.1 */ + +#if defined FLAC__CPU_IA32 /* unused for x64 */ + +#define RESIDUAL64_RESULT(xmmN) residual[i] = data[i] - _mm_cvtsi128_si32(_mm_srl_epi64(xmmN, cnt)) +#define RESIDUAL64_RESULT1(xmmN) residual[i] = data[i] - _mm_cvtsi128_si32(_mm_srli_epi64(xmmN, lp_quantization)) + +FLAC__SSE_TARGET("sse4.1") +void FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]) +{ + int i; + const __m128i cnt = _mm_cvtsi32_si128(lp_quantization); + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + FLAC__ASSERT(lp_quantization <= 32); /* there's no _mm_sra_epi64() so we have to use _mm_srl_epi64() */ + + if(order <= 12) { + if(order > 8) { /* order == 9, 10, 11, 12 */ + if(order > 10) { /* order == 11, 12 */ + if(order == 12) { + __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); // 0 0 q[1] q[0] + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); // 0 0 q[3] q[2] + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); // 0 0 q[5] q[4] + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); // 0 0 q[7] q[6] + xmm4 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+8)); // 0 0 q[9] q[8] + xmm5 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+10)); // 0 0 q[11] q[10] + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); // 0 q[1] 0 q[0] + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); // 0 q[3] 0 q[2] + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); // 0 q[5] 0 q[4] + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); // 0 q[7] 0 q[6] + xmm4 = _mm_shuffle_epi32(xmm4, _MM_SHUFFLE(3,1,2,0)); // 0 q[9] 0 q[8] + xmm5 = _mm_shuffle_epi32(xmm5, _MM_SHUFFLE(3,1,2,0)); // 0 q[11] 0 q[10] + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; + //sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-12)); // 0 0 d[i-11] d[i-12] + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); // 0 d[i-12] 0 d[i-11] + xmm7 = _mm_mul_epi32(xmm7, xmm5); + + //sum += qlp_coeff[9] * (FLAC__int64)data[i-10]; + //sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-10)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm4); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; + //sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm3); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; + //sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm2); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; + //sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm1); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT1(xmm7); + } + } + else { /* order == 11 */ + __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); + xmm4 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+8)); + xmm5 = _mm_cvtsi32_si128(qlp_coeff[10]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); + xmm4 = _mm_shuffle_epi32(xmm4, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[10] * (FLAC__int64)data[i-11]; + xmm7 = _mm_cvtsi32_si128(data[i-11]); + xmm7 = _mm_mul_epi32(xmm7, xmm5); + + //sum += qlp_coeff[9] * (FLAC__int64)data[i-10]; + //sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-10)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm4); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; + //sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm3); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; + //sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm2); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; + //sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm1); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT1(xmm7); + } + } + } + else { /* order == 9, 10 */ + if(order == 10) { + __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); + xmm4 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+8)); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); + xmm4 = _mm_shuffle_epi32(xmm4, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[9] * (FLAC__int64)data[i-10]; + //sum += qlp_coeff[8] * (FLAC__int64)data[i-9]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-10)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epi32(xmm7, xmm4); + + //sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; + //sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm3); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; + //sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm2); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; + //sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm1); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT(xmm7); + } + } + else { /* order == 9 */ + __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); + xmm4 = _mm_cvtsi32_si128(qlp_coeff[8]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[8] * (FLAC__int64)data[i-9]; + xmm7 = _mm_cvtsi32_si128(data[i-9]); + xmm7 = _mm_mul_epi32(xmm7, xmm4); + + //sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; + //sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm3); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; + //sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm2); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; + //sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm1); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT(xmm7); + } + } + } + } + else if(order > 4) { /* order == 5, 6, 7, 8 */ + if(order > 6) { /* order == 7, 8 */ + if(order == 8) { + __m128i xmm0, xmm1, xmm2, xmm3, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+6)); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + xmm3 = _mm_shuffle_epi32(xmm3, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[7] * (FLAC__int64)data[i-8]; + //sum += qlp_coeff[6] * (FLAC__int64)data[i-7]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-8)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epi32(xmm7, xmm3); + + //sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; + //sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm2); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; + //sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm1); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT(xmm7); + } + } + else { /* order == 7 */ + __m128i xmm0, xmm1, xmm2, xmm3, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + xmm3 = _mm_cvtsi32_si128(qlp_coeff[6]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[6] * (FLAC__int64)data[i-7]; + xmm7 = _mm_cvtsi32_si128(data[i-7]); + xmm7 = _mm_mul_epi32(xmm7, xmm3); + + //sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; + //sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm2); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; + //sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm1); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT(xmm7); + } + } + } + else { /* order == 5, 6 */ + if(order == 6) { + __m128i xmm0, xmm1, xmm2, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+4)); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + xmm2 = _mm_shuffle_epi32(xmm2, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[5] * (FLAC__int64)data[i-6]; + //sum += qlp_coeff[4] * (FLAC__int64)data[i-5]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-6)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epi32(xmm7, xmm2); + + //sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; + //sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm1); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT(xmm7); + } + } + else { /* order == 5 */ + __m128i xmm0, xmm1, xmm2, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + xmm2 = _mm_cvtsi32_si128(qlp_coeff[4]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[4] * (FLAC__int64)data[i-5]; + xmm7 = _mm_cvtsi32_si128(data[i-5]); + xmm7 = _mm_mul_epi32(xmm7, xmm2); + + //sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; + //sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm1); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT(xmm7); + } + } + } + } + else { /* order == 1, 2, 3, 4 */ + if(order > 2) { /* order == 3, 4 */ + if(order == 4) { + __m128i xmm0, xmm1, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+2)); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + xmm1 = _mm_shuffle_epi32(xmm1, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[3] * (FLAC__int64)data[i-4]; + //sum += qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-4)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epi32(xmm7, xmm1); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT(xmm7); + } + } + else { /* order == 3 */ + __m128i xmm0, xmm1, xmm6, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm1 = _mm_cvtsi32_si128(qlp_coeff[2]); + + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum = qlp_coeff[2] * (FLAC__int64)data[i-3]; + xmm7 = _mm_cvtsi32_si128(data[i-3]); + xmm7 = _mm_mul_epi32(xmm7, xmm1); + + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm6 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm6 = _mm_shuffle_epi32(xmm6, _MM_SHUFFLE(2,0,3,1)); + xmm6 = _mm_mul_epi32(xmm6, xmm0); + xmm7 = _mm_add_epi64(xmm7, xmm6); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT(xmm7); + } + } + } + else { /* order == 1, 2 */ + if(order == 2) { + __m128i xmm0, xmm7; + xmm0 = _mm_loadl_epi64((const __m128i*)(const void*)(qlp_coeff+0)); + xmm0 = _mm_shuffle_epi32(xmm0, _MM_SHUFFLE(3,1,2,0)); + + for(i = 0; i < (int)data_len; i++) { + //sum = 0; + //sum += qlp_coeff[1] * (FLAC__int64)data[i-2]; + //sum += qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm7 = _mm_loadl_epi64((const __m128i*)(const void*)(data+i-2)); + xmm7 = _mm_shuffle_epi32(xmm7, _MM_SHUFFLE(2,0,3,1)); + xmm7 = _mm_mul_epi32(xmm7, xmm0); + + xmm7 = _mm_add_epi64(xmm7, _mm_srli_si128(xmm7, 8)); + RESIDUAL64_RESULT(xmm7); + } + } + else { /* order == 1 */ + __m128i xmm0, xmm7; + xmm0 = _mm_cvtsi32_si128(qlp_coeff[0]); + + for(i = 0; i < (int)data_len; i++) { + //sum = qlp_coeff[0] * (FLAC__int64)data[i-1]; + xmm7 = _mm_cvtsi32_si128(data[i-1]); + xmm7 = _mm_mul_epi32(xmm7, xmm0); + RESIDUAL64_RESULT(xmm7); + } + } + } + } + } + else { /* order > 12 */ + FLAC__int64 sum; + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * (FLAC__int64)data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * (FLAC__int64)data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * (FLAC__int64)data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * (FLAC__int64)data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * (FLAC__int64)data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * (FLAC__int64)data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * (FLAC__int64)data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * (FLAC__int64)data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * (FLAC__int64)data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * (FLAC__int64)data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * (FLAC__int64)data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * (FLAC__int64)data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * (FLAC__int64)data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * (FLAC__int64)data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * (FLAC__int64)data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * (FLAC__int64)data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * (FLAC__int64)data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * (FLAC__int64)data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * (FLAC__int64)data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * (FLAC__int64)data[i-13]; + sum += qlp_coeff[11] * (FLAC__int64)data[i-12]; + sum += qlp_coeff[10] * (FLAC__int64)data[i-11]; + sum += qlp_coeff[ 9] * (FLAC__int64)data[i-10]; + sum += qlp_coeff[ 8] * (FLAC__int64)data[i- 9]; + sum += qlp_coeff[ 7] * (FLAC__int64)data[i- 8]; + sum += qlp_coeff[ 6] * (FLAC__int64)data[i- 7]; + sum += qlp_coeff[ 5] * (FLAC__int64)data[i- 6]; + sum += qlp_coeff[ 4] * (FLAC__int64)data[i- 5]; + sum += qlp_coeff[ 3] * (FLAC__int64)data[i- 4]; + sum += qlp_coeff[ 2] * (FLAC__int64)data[i- 3]; + sum += qlp_coeff[ 1] * (FLAC__int64)data[i- 2]; + sum += qlp_coeff[ 0] * (FLAC__int64)data[i- 1]; + } + residual[i] = data[i] - (FLAC__int32)(sum >> lp_quantization); + } + } +} + +#endif /* defined FLAC__CPU_IA32 */ + +FLAC__SSE_TARGET("sse4.1") +void FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]) +{ + int i; + FLAC__int32 sum; + const __m128i cnt = _mm_cvtsi32_si128(lp_quantization); + + FLAC__ASSERT(order > 0); + FLAC__ASSERT(order <= 32); + + if(order <= 12) { + if(order > 8) { + if(order > 10) { + if(order == 12) { + __m128i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + q8 = _mm_cvtsi32_si128(qlp_coeff[8]); q8 = _mm_shuffle_epi32(q8, _MM_SHUFFLE(0,0,0,0)); + q9 = _mm_cvtsi32_si128(qlp_coeff[9]); q9 = _mm_shuffle_epi32(q9, _MM_SHUFFLE(0,0,0,0)); + q10 = _mm_cvtsi32_si128(qlp_coeff[10]); q10 = _mm_shuffle_epi32(q10, _MM_SHUFFLE(0,0,0,0)); + q11 = _mm_cvtsi32_si128(qlp_coeff[11]); q11 = _mm_shuffle_epi32(q11, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q11, _mm_loadu_si128((const __m128i*)(const void*)(data+i-12))); + mull = _mm_mullo_epi32(q10, _mm_loadu_si128((const __m128i*)(const void*)(data+i-11))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q9, _mm_loadu_si128((const __m128i*)(const void*)(data+i-10))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q8, _mm_loadu_si128((const __m128i*)(const void*)(data+i-9))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 11 */ + __m128i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + q8 = _mm_cvtsi32_si128(qlp_coeff[8]); q8 = _mm_shuffle_epi32(q8, _MM_SHUFFLE(0,0,0,0)); + q9 = _mm_cvtsi32_si128(qlp_coeff[9]); q9 = _mm_shuffle_epi32(q9, _MM_SHUFFLE(0,0,0,0)); + q10 = _mm_cvtsi32_si128(qlp_coeff[10]); q10 = _mm_shuffle_epi32(q10, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q10, _mm_loadu_si128((const __m128i*)(const void*)(data+i-11))); + mull = _mm_mullo_epi32(q9, _mm_loadu_si128((const __m128i*)(const void*)(data+i-10))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q8, _mm_loadu_si128((const __m128i*)(const void*)(data+i-9))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 10) { + __m128i q0, q1, q2, q3, q4, q5, q6, q7, q8, q9; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + q8 = _mm_cvtsi32_si128(qlp_coeff[8]); q8 = _mm_shuffle_epi32(q8, _MM_SHUFFLE(0,0,0,0)); + q9 = _mm_cvtsi32_si128(qlp_coeff[9]); q9 = _mm_shuffle_epi32(q9, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q9, _mm_loadu_si128((const __m128i*)(const void*)(data+i-10))); + mull = _mm_mullo_epi32(q8, _mm_loadu_si128((const __m128i*)(const void*)(data+i-9))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 9 */ + __m128i q0, q1, q2, q3, q4, q5, q6, q7, q8; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + q8 = _mm_cvtsi32_si128(qlp_coeff[8]); q8 = _mm_shuffle_epi32(q8, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q8, _mm_loadu_si128((const __m128i*)(const void*)(data+i-9))); + mull = _mm_mullo_epi32(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + } + else if(order > 4) { + if(order > 6) { + if(order == 8) { + __m128i q0, q1, q2, q3, q4, q5, q6, q7; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + q7 = _mm_cvtsi32_si128(qlp_coeff[7]); q7 = _mm_shuffle_epi32(q7, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q7, _mm_loadu_si128((const __m128i*)(const void*)(data+i-8))); + mull = _mm_mullo_epi32(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 7 */ + __m128i q0, q1, q2, q3, q4, q5, q6; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + q6 = _mm_cvtsi32_si128(qlp_coeff[6]); q6 = _mm_shuffle_epi32(q6, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q6, _mm_loadu_si128((const __m128i*)(const void*)(data+i-7))); + mull = _mm_mullo_epi32(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 6) { + __m128i q0, q1, q2, q3, q4, q5; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + q5 = _mm_cvtsi32_si128(qlp_coeff[5]); q5 = _mm_shuffle_epi32(q5, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q5, _mm_loadu_si128((const __m128i*)(const void*)(data+i-6))); + mull = _mm_mullo_epi32(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 5 */ + __m128i q0, q1, q2, q3, q4; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + q4 = _mm_cvtsi32_si128(qlp_coeff[4]); q4 = _mm_shuffle_epi32(q4, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q4, _mm_loadu_si128((const __m128i*)(const void*)(data+i-5))); + mull = _mm_mullo_epi32(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + } + else { + if(order > 2) { + if(order == 4) { + __m128i q0, q1, q2, q3; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + q3 = _mm_cvtsi32_si128(qlp_coeff[3]); q3 = _mm_shuffle_epi32(q3, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q3, _mm_loadu_si128((const __m128i*)(const void*)(data+i-4))); + mull = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 3 */ + __m128i q0, q1, q2; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + q2 = _mm_cvtsi32_si128(qlp_coeff[2]); q2 = _mm_shuffle_epi32(q2, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q2, _mm_loadu_si128((const __m128i*)(const void*)(data+i-3))); + mull = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); summ = _mm_add_epi32(summ, mull); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + else { + if(order == 2) { + __m128i q0, q1; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + q1 = _mm_cvtsi32_si128(qlp_coeff[1]); q1 = _mm_shuffle_epi32(q1, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ, mull; + summ = _mm_mullo_epi32(q1, _mm_loadu_si128((const __m128i*)(const void*)(data+i-2))); + mull = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); summ = _mm_add_epi32(summ, mull); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + else { /* order == 1 */ + __m128i q0; + q0 = _mm_cvtsi32_si128(qlp_coeff[0]); q0 = _mm_shuffle_epi32(q0, _MM_SHUFFLE(0,0,0,0)); + + for(i = 0; i < (int)data_len-3; i+=4) { + __m128i summ; + summ = _mm_mullo_epi32(q0, _mm_loadu_si128((const __m128i*)(const void*)(data+i-1))); + summ = _mm_sra_epi32(summ, cnt); + _mm_storeu_si128((__m128i*)(void*)(residual+i), _mm_sub_epi32(_mm_loadu_si128((const __m128i*)(const void*)(data+i)), summ)); + } + } + } + } + for(; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 12: sum += qlp_coeff[11] * data[i-12]; /* Falls through. */ + case 11: sum += qlp_coeff[10] * data[i-11]; /* Falls through. */ + case 10: sum += qlp_coeff[ 9] * data[i-10]; /* Falls through. */ + case 9: sum += qlp_coeff[ 8] * data[i- 9]; /* Falls through. */ + case 8: sum += qlp_coeff[ 7] * data[i- 8]; /* Falls through. */ + case 7: sum += qlp_coeff[ 6] * data[i- 7]; /* Falls through. */ + case 6: sum += qlp_coeff[ 5] * data[i- 6]; /* Falls through. */ + case 5: sum += qlp_coeff[ 4] * data[i- 5]; /* Falls through. */ + case 4: sum += qlp_coeff[ 3] * data[i- 4]; /* Falls through. */ + case 3: sum += qlp_coeff[ 2] * data[i- 3]; /* Falls through. */ + case 2: sum += qlp_coeff[ 1] * data[i- 2]; /* Falls through. */ + case 1: sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } + else { /* order > 12 */ + for(i = 0; i < (int)data_len; i++) { + sum = 0; + switch(order) { + case 32: sum += qlp_coeff[31] * data[i-32]; /* Falls through. */ + case 31: sum += qlp_coeff[30] * data[i-31]; /* Falls through. */ + case 30: sum += qlp_coeff[29] * data[i-30]; /* Falls through. */ + case 29: sum += qlp_coeff[28] * data[i-29]; /* Falls through. */ + case 28: sum += qlp_coeff[27] * data[i-28]; /* Falls through. */ + case 27: sum += qlp_coeff[26] * data[i-27]; /* Falls through. */ + case 26: sum += qlp_coeff[25] * data[i-26]; /* Falls through. */ + case 25: sum += qlp_coeff[24] * data[i-25]; /* Falls through. */ + case 24: sum += qlp_coeff[23] * data[i-24]; /* Falls through. */ + case 23: sum += qlp_coeff[22] * data[i-23]; /* Falls through. */ + case 22: sum += qlp_coeff[21] * data[i-22]; /* Falls through. */ + case 21: sum += qlp_coeff[20] * data[i-21]; /* Falls through. */ + case 20: sum += qlp_coeff[19] * data[i-20]; /* Falls through. */ + case 19: sum += qlp_coeff[18] * data[i-19]; /* Falls through. */ + case 18: sum += qlp_coeff[17] * data[i-18]; /* Falls through. */ + case 17: sum += qlp_coeff[16] * data[i-17]; /* Falls through. */ + case 16: sum += qlp_coeff[15] * data[i-16]; /* Falls through. */ + case 15: sum += qlp_coeff[14] * data[i-15]; /* Falls through. */ + case 14: sum += qlp_coeff[13] * data[i-14]; /* Falls through. */ + case 13: sum += qlp_coeff[12] * data[i-13]; + sum += qlp_coeff[11] * data[i-12]; + sum += qlp_coeff[10] * data[i-11]; + sum += qlp_coeff[ 9] * data[i-10]; + sum += qlp_coeff[ 8] * data[i- 9]; + sum += qlp_coeff[ 7] * data[i- 8]; + sum += qlp_coeff[ 6] * data[i- 7]; + sum += qlp_coeff[ 5] * data[i- 6]; + sum += qlp_coeff[ 4] * data[i- 5]; + sum += qlp_coeff[ 3] * data[i- 4]; + sum += qlp_coeff[ 2] * data[i- 3]; + sum += qlp_coeff[ 1] * data[i- 2]; + sum += qlp_coeff[ 0] * data[i- 1]; + } + residual[i] = data[i] - (sum >> lp_quantization); + } + } +} + +#endif /* FLAC__SSE4_1_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ +#endif /* FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/libFLAC/md5.c b/3rdparty/libflac/src/libFLAC/md5.c index af350e01d16..09933d7ec5e 100644 --- a/3rdparty/libflac/src/libFLAC/md5.c +++ b/3rdparty/libflac/src/libFLAC/md5.c @@ -7,10 +7,8 @@ #include "private/md5.h" #include "share/alloc.h" - -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif +#include "share/compat.h" +#include "share/endswap.h" /* * This code implements the MD5 message-digest algorithm. @@ -139,11 +137,11 @@ static void FLAC__MD5Transform(FLAC__uint32 buf[4], FLAC__uint32 const in[16]) #if WORDS_BIGENDIAN //@@@@@@ OPT: use bswap/intrinsics -static void byteSwap(FLAC__uint32 *buf, unsigned words) +static void byteSwap(FLAC__uint32 *buf, uint32_t words) { register FLAC__uint32 x; do { - x = *buf; + x = *buf; x = ((x << 8) & 0xff00ff00) | ((x >> 8) & 0x00ff00ff); *buf++ = (x >> 16) | (x << 16); } while (--words); @@ -178,7 +176,7 @@ static void byteSwapX16(FLAC__uint32 *buf) * Update context to reflect the concatenation of another buffer full * of bytes. */ -static void FLAC__MD5Update(FLAC__MD5Context *ctx, FLAC__byte const *buf, unsigned len) +static void FLAC__MD5Update(FLAC__MD5Context *ctx, FLAC__byte const *buf, uint32_t len) { FLAC__uint32 t; @@ -227,7 +225,7 @@ void FLAC__MD5Init(FLAC__MD5Context *ctx) ctx->bytes[0] = 0; ctx->bytes[1] = 0; - ctx->internal_buf = 0; + ctx->internal_buf.p8 = 0; ctx->capacity = 0; } @@ -263,9 +261,9 @@ void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx) byteSwap(ctx->buf, 4); memcpy(digest, ctx->buf, 16); - if(0 != ctx->internal_buf) { - free(ctx->internal_buf); - ctx->internal_buf = 0; + if (0 != ctx->internal_buf.p8) { + free(ctx->internal_buf.p8); + ctx->internal_buf.p8 = 0; ctx->capacity = 0; } memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ @@ -274,58 +272,124 @@ void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *ctx) /* * Convert the incoming audio signal to a byte stream */ -static void format_input_(FLAC__byte *buf, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample) +static void format_input_(FLAC__multibyte *mbuf, const FLAC__int32 * const signal[], uint32_t channels, uint32_t samples, uint32_t bytes_per_sample) { - unsigned channel, sample; - register FLAC__int32 a_word; - register FLAC__byte *buf_ = buf; + FLAC__byte *buf_ = mbuf->p8; + FLAC__int16 *buf16 = mbuf->p16; + FLAC__int32 *buf32 = mbuf->p32; + FLAC__int32 a_word; + uint32_t channel, sample; + + /* Storage in the output buffer, buf, is little endian. */ + +#define BYTES_CHANNEL_SELECTOR(bytes, channels) (bytes * 100 + channels) + + /* First do the most commonly used combinations. */ + switch (BYTES_CHANNEL_SELECTOR (bytes_per_sample, channels)) { + /* One byte per sample. */ + case (BYTES_CHANNEL_SELECTOR (1, 1)): + for (sample = 0; sample < samples; sample++) + *buf_++ = signal[0][sample]; + return; + + case (BYTES_CHANNEL_SELECTOR (1, 2)): + for (sample = 0; sample < samples; sample++) { + *buf_++ = signal[0][sample]; + *buf_++ = signal[1][sample]; + } + return; + + case (BYTES_CHANNEL_SELECTOR (1, 4)): + for (sample = 0; sample < samples; sample++) { + *buf_++ = signal[0][sample]; + *buf_++ = signal[1][sample]; + *buf_++ = signal[2][sample]; + *buf_++ = signal[3][sample]; + } + return; + + case (BYTES_CHANNEL_SELECTOR (1, 6)): + for (sample = 0; sample < samples; sample++) { + *buf_++ = signal[0][sample]; + *buf_++ = signal[1][sample]; + *buf_++ = signal[2][sample]; + *buf_++ = signal[3][sample]; + *buf_++ = signal[4][sample]; + *buf_++ = signal[5][sample]; + } + return; + + case (BYTES_CHANNEL_SELECTOR (1, 8)): + for (sample = 0; sample < samples; sample++) { + *buf_++ = signal[0][sample]; + *buf_++ = signal[1][sample]; + *buf_++ = signal[2][sample]; + *buf_++ = signal[3][sample]; + *buf_++ = signal[4][sample]; + *buf_++ = signal[5][sample]; + *buf_++ = signal[6][sample]; + *buf_++ = signal[7][sample]; + } + return; + + /* Two bytes per sample. */ + case (BYTES_CHANNEL_SELECTOR (2, 1)): + for (sample = 0; sample < samples; sample++) + *buf16++ = H2LE_16(signal[0][sample]); + return; + + case (BYTES_CHANNEL_SELECTOR (2, 2)): + for (sample = 0; sample < samples; sample++) { + *buf16++ = H2LE_16(signal[0][sample]); + *buf16++ = H2LE_16(signal[1][sample]); + } + return; + + case (BYTES_CHANNEL_SELECTOR (2, 4)): + for (sample = 0; sample < samples; sample++) { + *buf16++ = H2LE_16(signal[0][sample]); + *buf16++ = H2LE_16(signal[1][sample]); + *buf16++ = H2LE_16(signal[2][sample]); + *buf16++ = H2LE_16(signal[3][sample]); + } + return; + + case (BYTES_CHANNEL_SELECTOR (2, 6)): + for (sample = 0; sample < samples; sample++) { + *buf16++ = H2LE_16(signal[0][sample]); + *buf16++ = H2LE_16(signal[1][sample]); + *buf16++ = H2LE_16(signal[2][sample]); + *buf16++ = H2LE_16(signal[3][sample]); + *buf16++ = H2LE_16(signal[4][sample]); + *buf16++ = H2LE_16(signal[5][sample]); + } + return; + + case (BYTES_CHANNEL_SELECTOR (2, 8)): + for (sample = 0; sample < samples; sample++) { + *buf16++ = H2LE_16(signal[0][sample]); + *buf16++ = H2LE_16(signal[1][sample]); + *buf16++ = H2LE_16(signal[2][sample]); + *buf16++ = H2LE_16(signal[3][sample]); + *buf16++ = H2LE_16(signal[4][sample]); + *buf16++ = H2LE_16(signal[5][sample]); + *buf16++ = H2LE_16(signal[6][sample]); + *buf16++ = H2LE_16(signal[7][sample]); + } + return; -#if WORDS_BIGENDIAN -#else - if(channels == 2 && bytes_per_sample == 2) { - FLAC__int16 *buf1_ = ((FLAC__int16*)buf_) + 1; - memcpy(buf_, signal[0], sizeof(FLAC__int32) * samples); - for(sample = 0; sample < samples; sample++, buf1_+=2) - *buf1_ = (FLAC__int16)signal[1][sample]; - } - else if(channels == 1 && bytes_per_sample == 2) { - FLAC__int16 *buf1_ = (FLAC__int16*)buf_; - for(sample = 0; sample < samples; sample++) - *buf1_++ = (FLAC__int16)signal[0][sample]; - } - else -#endif - if(bytes_per_sample == 2) { - if(channels == 2) { - for(sample = 0; sample < samples; sample++) { + /* Three bytes per sample. */ + case (BYTES_CHANNEL_SELECTOR (3, 1)): + for (sample = 0; sample < samples; sample++) { a_word = signal[0][sample]; *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - a_word = signal[1][sample]; *buf_++ = (FLAC__byte)a_word; a_word >>= 8; *buf_++ = (FLAC__byte)a_word; } - } - else if(channels == 1) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } - else { - for(sample = 0; sample < samples; sample++) { - for(channel = 0; channel < channels; channel++) { - a_word = signal[channel][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } - } - } - else if(bytes_per_sample == 3) { - if(channels == 2) { - for(sample = 0; sample < samples; sample++) { + return; + + case (BYTES_CHANNEL_SELECTOR (3, 2)): + for (sample = 0; sample < samples; sample++) { a_word = signal[0][sample]; *buf_++ = (FLAC__byte)a_word; a_word >>= 8; *buf_++ = (FLAC__byte)a_word; a_word >>= 8; @@ -335,90 +399,119 @@ static void format_input_(FLAC__byte *buf, const FLAC__int32 * const signal[], u *buf_++ = (FLAC__byte)a_word; a_word >>= 8; *buf_++ = (FLAC__byte)a_word; } - } - else if(channels == 1) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; + return; + + /* Four bytes per sample. */ + case (BYTES_CHANNEL_SELECTOR (4, 1)): + for (sample = 0; sample < samples; sample++) + *buf32++ = H2LE_32(signal[0][sample]); + return; + + case (BYTES_CHANNEL_SELECTOR (4, 2)): + for (sample = 0; sample < samples; sample++) { + *buf32++ = H2LE_32(signal[0][sample]); + *buf32++ = H2LE_32(signal[1][sample]); } - } - else { - for(sample = 0; sample < samples; sample++) { - for(channel = 0; channel < channels; channel++) { - a_word = signal[channel][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } + return; + + case (BYTES_CHANNEL_SELECTOR (4, 4)): + for (sample = 0; sample < samples; sample++) { + *buf32++ = H2LE_32(signal[0][sample]); + *buf32++ = H2LE_32(signal[1][sample]); + *buf32++ = H2LE_32(signal[2][sample]); + *buf32++ = H2LE_32(signal[3][sample]); } - } - } - else if(bytes_per_sample == 1) { - if(channels == 2) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; - a_word = signal[1][sample]; - *buf_++ = (FLAC__byte)a_word; + return; + + case (BYTES_CHANNEL_SELECTOR (4, 6)): + for (sample = 0; sample < samples; sample++) { + *buf32++ = H2LE_32(signal[0][sample]); + *buf32++ = H2LE_32(signal[1][sample]); + *buf32++ = H2LE_32(signal[2][sample]); + *buf32++ = H2LE_32(signal[3][sample]); + *buf32++ = H2LE_32(signal[4][sample]); + *buf32++ = H2LE_32(signal[5][sample]); } - } - else if(channels == 1) { - for(sample = 0; sample < samples; sample++) { - a_word = signal[0][sample]; - *buf_++ = (FLAC__byte)a_word; + return; + + case (BYTES_CHANNEL_SELECTOR (4, 8)): + for (sample = 0; sample < samples; sample++) { + *buf32++ = H2LE_32(signal[0][sample]); + *buf32++ = H2LE_32(signal[1][sample]); + *buf32++ = H2LE_32(signal[2][sample]); + *buf32++ = H2LE_32(signal[3][sample]); + *buf32++ = H2LE_32(signal[4][sample]); + *buf32++ = H2LE_32(signal[5][sample]); + *buf32++ = H2LE_32(signal[6][sample]); + *buf32++ = H2LE_32(signal[7][sample]); } - } - else { - for(sample = 0; sample < samples; sample++) { - for(channel = 0; channel < channels; channel++) { + return; + + default: + break; + } + + /* General version. */ + switch (bytes_per_sample) { + case 1: + for (sample = 0; sample < samples; sample++) + for (channel = 0; channel < channels; channel++) + *buf_++ = signal[channel][sample]; + return; + + case 2: + for (sample = 0; sample < samples; sample++) + for (channel = 0; channel < channels; channel++) + *buf16++ = H2LE_16(signal[channel][sample]); + return; + + case 3: + for (sample = 0; sample < samples; sample++) + for (channel = 0; channel < channels; channel++) { a_word = signal[channel][sample]; + *buf_++ = (FLAC__byte)a_word; a_word >>= 8; + *buf_++ = (FLAC__byte)a_word; a_word >>= 8; *buf_++ = (FLAC__byte)a_word; } - } - } - } - else { /* bytes_per_sample == 4, maybe optimize more later */ - for(sample = 0; sample < samples; sample++) { - for(channel = 0; channel < channels; channel++) { - a_word = signal[channel][sample]; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; a_word >>= 8; - *buf_++ = (FLAC__byte)a_word; - } - } + return; + + case 4: + for (sample = 0; sample < samples; sample++) + for (channel = 0; channel < channels; channel++) + *buf32++ = H2LE_32(signal[channel][sample]); + return; + + default: + break; } } /* * Convert the incoming audio signal to a byte stream and FLAC__MD5Update it. */ -FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample) +FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], uint32_t channels, uint32_t samples, uint32_t bytes_per_sample) { const size_t bytes_needed = (size_t)channels * (size_t)samples * (size_t)bytes_per_sample; /* overflow check */ - if((size_t)channels > SIZE_MAX / (size_t)bytes_per_sample) + if ((size_t)channels > SIZE_MAX / (size_t)bytes_per_sample) return false; - if((size_t)channels * (size_t)bytes_per_sample > SIZE_MAX / (size_t)samples) + if ((size_t)channels * (size_t)bytes_per_sample > SIZE_MAX / (size_t)samples) return false; - if(ctx->capacity < bytes_needed) { - FLAC__byte *tmp = (FLAC__byte*)realloc(ctx->internal_buf, bytes_needed); - if(0 == tmp) { - free(ctx->internal_buf); - if(0 == (ctx->internal_buf = (FLAC__byte*)safe_malloc_(bytes_needed))) + if (ctx->capacity < bytes_needed) { + if (0 == (ctx->internal_buf.p8 = safe_realloc_(ctx->internal_buf.p8, bytes_needed))) { + if (0 == (ctx->internal_buf.p8 = safe_malloc_(bytes_needed))) { + ctx->capacity = 0; return false; + } } - ctx->internal_buf = tmp; ctx->capacity = bytes_needed; } - format_input_(ctx->internal_buf, signal, channels, samples, bytes_per_sample); + format_input_(&ctx->internal_buf, signal, channels, samples, bytes_per_sample); - FLAC__MD5Update(ctx, ctx->internal_buf, bytes_needed); + FLAC__MD5Update(ctx, ctx->internal_buf.p8, bytes_needed); return true; } diff --git a/3rdparty/libflac/src/libFLAC/memory.c b/3rdparty/libflac/src/libFLAC/memory.c index 48f381b7e8c..ad5371ee90e 100644 --- a/3rdparty/libflac/src/libFLAC/memory.c +++ b/3rdparty/libflac/src/libFLAC/memory.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,8 +34,13 @@ # include <config.h> #endif +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif + #include "private/memory.h" #include "FLAC/assert.h" +#include "share/compat.h" #include "share/alloc.h" void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address) @@ -45,25 +51,8 @@ void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address) #ifdef FLAC__ALIGN_MALLOC_DATA /* align on 32-byte (256-bit) boundary */ - x = safe_malloc_add_2op_(bytes, /*+*/31); -#ifdef SIZEOF_VOIDP -#if SIZEOF_VOIDP == 4 - /* could do *aligned_address = x + ((unsigned) (32 - (((unsigned)x) & 31))) & 31; */ - *aligned_address = (void*)(((unsigned)x + 31) & -32); -#elif SIZEOF_VOIDP == 8 - *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32))); -#else -# error Unsupported sizeof(void*) -#endif -#else - /* there's got to be a better way to do this right for all archs */ - if(sizeof(void*) == sizeof(unsigned)) - *aligned_address = (void*)(((unsigned)x + 31) & -32); - else if(sizeof(void*) == sizeof(FLAC__uint64)) - *aligned_address = (void*)(((FLAC__uint64)x + 31) & (FLAC__uint64)(-((FLAC__int64)32))); - else - return 0; -#endif + x = safe_malloc_add_2op_(bytes, /*+*/31L); + *aligned_address = (void*)(((uintptr_t)x + 31L) & -32L); #else x = safe_malloc_(bytes); *aligned_address = x; @@ -87,7 +76,7 @@ FLAC__bool FLAC__memory_alloc_aligned_int32_array(size_t elements, FLAC__int32 * if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; - pu = (FLAC__int32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); + pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); if(0 == pu) { return false; } @@ -100,7 +89,6 @@ FLAC__bool FLAC__memory_alloc_aligned_int32_array(size_t elements, FLAC__int32 * } } - FLAC__bool FLAC__memory_alloc_aligned_uint32_array(size_t elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer) { FLAC__uint32 *pu; /* unaligned pointer */ @@ -117,7 +105,7 @@ FLAC__bool FLAC__memory_alloc_aligned_uint32_array(size_t elements, FLAC__uint32 if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; - pu = (FLAC__uint32*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); + pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); if(0 == pu) { return false; } @@ -130,11 +118,11 @@ FLAC__bool FLAC__memory_alloc_aligned_uint32_array(size_t elements, FLAC__uint32 } } -FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer) +FLAC__bool FLAC__memory_alloc_aligned_int64_array(size_t elements, FLAC__int64 **unaligned_pointer, FLAC__int64 **aligned_pointer) { - FLAC__uint64 *pu; /* unaligned pointer */ + FLAC__int64 *pu; /* unaligned pointer */ union { /* union needed to comply with C99 pointer aliasing rules */ - FLAC__uint64 *pa; /* aligned pointer */ + FLAC__int64 *pa; /* aligned pointer */ void *pv; /* aligned pointer alias */ } u; @@ -146,7 +134,7 @@ FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64 if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; - pu = (FLAC__uint64*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); + pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); if(0 == pu) { return false; } @@ -159,12 +147,12 @@ FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64 } } -FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, unsigned **unaligned_pointer, unsigned **aligned_pointer) +FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer) { - unsigned *pu; /* unaligned pointer */ + FLAC__uint64 *pu; /* unaligned pointer */ union { /* union needed to comply with C99 pointer aliasing rules */ - unsigned *pa; /* aligned pointer */ - void *pv; /* aligned pointer alias */ + FLAC__uint64 *pa; /* aligned pointer */ + void *pv; /* aligned pointer alias */ } u; FLAC__ASSERT(elements > 0); @@ -175,7 +163,7 @@ FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, unsigned * if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; - pu = (unsigned*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); + pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); if(0 == pu) { return false; } @@ -206,7 +194,7 @@ FLAC__bool FLAC__memory_alloc_aligned_real_array(size_t elements, FLAC__real **u if(elements > SIZE_MAX / sizeof(*pu)) /* overflow check */ return false; - pu = (FLAC__real*)FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); + pu = FLAC__memory_alloc_aligned(sizeof(*pu) * elements, &u.pv); if(0 == pu) { return false; } @@ -220,3 +208,12 @@ FLAC__bool FLAC__memory_alloc_aligned_real_array(size_t elements, FLAC__real **u } #endif + +void *safe_malloc_mul_2op_p(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/3rdparty/libflac/src/libFLAC/metadata_iterators.c b/3rdparty/libflac/src/libFLAC/metadata_iterators.c index f88795bcf82..20e926becf0 100644 --- a/3rdparty/libflac/src/libFLAC/metadata_iterators.c +++ b/3rdparty/libflac/src/libFLAC/metadata_iterators.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,24 +38,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdarg.h> -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ -#if defined __BORLANDC__ -#include <utime.h> /* for utime() */ -#else -#include <sys/utime.h> /* for utime() */ -#endif -#include <io.h> /* for chmod() */ -#include <sys/types.h> /* for off_t */ -#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#else -#include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */ -#include <utime.h> /* for utime() */ -#include <unistd.h> /* for chown(), unlink() */ -#endif #include <sys/stat.h> /* for stat(), maybe chmod() */ #include "private/metadata.h" @@ -62,16 +47,13 @@ #include "FLAC/assert.h" #include "FLAC/stream_decoder.h" #include "share/alloc.h" +#include "share/compat.h" +#include "share/macros.h" +#include "private/macros.h" +#include "private/memory.h" -#ifdef max -#undef max -#endif -#define max(a,b) ((a)>(b)?(a):(b)) -#ifdef min -#undef min -#endif -#define min(a,b) ((a)<(b)?(a):(b)) - +/* Alias the first (in share/alloc.h) to the second (in src/libFLAC/memory.c). */ +#define safe_malloc_mul_2op_ safe_malloc_mul_2op_p /**************************************************************************** * @@ -79,56 +61,56 @@ * ***************************************************************************/ -static void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes); -static void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes); -static void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, unsigned bytes); -static FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes); -static FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes); -static FLAC__uint64 unpack_uint64_(FLAC__byte *b, unsigned bytes); +static void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, uint32_t bytes); +static void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, uint32_t bytes); +static void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, uint32_t bytes); +static FLAC__uint32 unpack_uint32_(FLAC__byte *b, uint32_t bytes); +static FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, uint32_t bytes); +static FLAC__uint64 unpack_uint64_(FLAC__byte *b, uint32_t bytes); static FLAC__bool read_metadata_block_header_(FLAC__Metadata_SimpleIterator *iterator); static FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block); -static FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, unsigned *length); +static FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, uint32_t *length); static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata *block); static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_StreamInfo *block); -static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, unsigned block_length); -static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, unsigned block_length); -static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, unsigned block_length); -static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry); -static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment *block); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, uint32_t block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, uint32_t block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, uint32_t block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry, uint32_t max_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_VorbisComment *block, uint32_t block_length); static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet_Track *track); static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet *block); static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Picture *block); -static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, unsigned block_length); +static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, uint32_t block_length); static FLAC__bool write_metadata_block_header_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block); static FLAC__bool write_metadata_block_data_(FILE *file, FLAC__Metadata_SimpleIteratorStatus *status, const FLAC__StreamMetadata *block); static FLAC__bool write_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block); static FLAC__bool write_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata *block); static FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block); -static FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, unsigned block_length); -static FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, unsigned block_length); +static FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, uint32_t block_length); +static FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, uint32_t block_length); static FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_SeekTable *block); static FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_VorbisComment *block); static FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_CueSheet *block); static FLAC__bool write_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Picture *block); -static FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, unsigned block_length); +static FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, uint32_t block_length); static FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *iterator, const FLAC__StreamMetadata *block); -static FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last); +static FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, uint32_t padding_length, FLAC__bool padding_is_last); static FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append); static void simple_iterator_push_(FLAC__Metadata_SimpleIterator *iterator); static FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator); -static unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb); -static unsigned seek_to_first_metadata_block_(FILE *f); +static uint32_t seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb); +static uint32_t seek_to_first_metadata_block_(FILE *f); static FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append); -static FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, off_t fixup_is_last_flag_offset, FLAC__bool backup); +static FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, FLAC__off_t fixup_is_last_flag_offset, FLAC__bool backup); -static FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status); -static FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status); +static FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status); +static FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, FLAC__off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status); static FLAC__bool copy_remaining_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__Metadata_SimpleIteratorStatus *status); static FLAC__bool copy_remaining_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Eof eof_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, FLAC__Metadata_SimpleIteratorStatus *status); @@ -136,8 +118,8 @@ static FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status); static void cleanup_tempfile_(FILE **tempfile, char **tempfilename); -static FLAC__bool get_file_stats_(const char *filename, struct stat *stats); -static void set_file_stats_(const char *filename, struct stat *stats); +static FLAC__bool get_file_stats_(const char *filename, struct flac_stat_s *stats); +static void set_file_stats_(const char *filename, struct flac_stat_s *stats); static int fseek_wrapper_(FLAC__IOHandle handle, FLAC__int64 offset, int whence); static FLAC__int64 ftell_wrapper_(FLAC__IOHandle handle); @@ -282,7 +264,7 @@ void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErro cd->got_error = true; } -FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **picture, FLAC__StreamMetadata_Picture_Type type, const char *mime_type, const FLAC__byte *description, unsigned max_width, unsigned max_height, unsigned max_depth, unsigned max_colors) +FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__StreamMetadata **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__Metadata_SimpleIterator *it; FLAC__uint64 max_area_seen = 0; @@ -303,27 +285,32 @@ FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__Strea do { if(FLAC__metadata_simple_iterator_get_block_type(it) == FLAC__METADATA_TYPE_PICTURE) { FLAC__StreamMetadata *obj = FLAC__metadata_simple_iterator_get_block(it); - FLAC__uint64 area = (FLAC__uint64)obj->data.picture.width * (FLAC__uint64)obj->data.picture.height; - /* check constraints */ - if( - (type == (FLAC__StreamMetadata_Picture_Type)(-1) || type == obj->data.picture.type) && - (mime_type == 0 || !strcmp(mime_type, obj->data.picture.mime_type)) && - (description == 0 || !strcmp((const char *)description, (const char *)obj->data.picture.description)) && - obj->data.picture.width <= max_width && - obj->data.picture.height <= max_height && - obj->data.picture.depth <= max_depth && - obj->data.picture.colors <= max_colors && - (area > max_area_seen || (area == max_area_seen && obj->data.picture.depth > max_depth_seen)) - ) { - if(*picture) - FLAC__metadata_object_delete(*picture); - *picture = obj; - max_area_seen = area; - max_depth_seen = obj->data.picture.depth; - } - else { - FLAC__metadata_object_delete(obj); + if(0 != obj) { + FLAC__uint64 area = (FLAC__uint64)obj->data.picture.width * (FLAC__uint64)obj->data.picture.height; + + /* check constraints */ + if( + (type == (FLAC__StreamMetadata_Picture_Type)(-1) || type == obj->data.picture.type) && + (mime_type == 0 || !strcmp(mime_type, obj->data.picture.mime_type)) && + (description == 0 || !strcmp((const char *)description, (const char *)obj->data.picture.description)) && + obj->data.picture.width <= max_width && + obj->data.picture.height <= max_height && + obj->data.picture.depth <= max_depth && + obj->data.picture.colors <= max_colors && + (area > max_area_seen || (area == max_area_seen && obj->data.picture.depth > max_depth_seen)) + ) { + if(*picture) + FLAC__metadata_object_delete(*picture); + *picture = obj; + max_area_seen = area; + max_depth_seen = obj->data.picture.depth; + } + else { + FLAC__metadata_object_delete(obj); + } } + else + break; } } while(FLAC__metadata_simple_iterator_next(it)); @@ -345,17 +332,17 @@ FLAC_API FLAC__bool FLAC__metadata_get_picture(const char *filename, FLAC__Strea struct FLAC__Metadata_SimpleIterator { FILE *file; char *filename, *tempfile_path_prefix; - struct stat stats; + struct flac_stat_s stats; FLAC__bool has_stats; FLAC__bool is_writable; FLAC__Metadata_SimpleIteratorStatus status; - off_t offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH]; - off_t first_offset; /* this is the offset to the STREAMINFO block */ - unsigned depth; + FLAC__off_t offset[SIMPLE_ITERATOR_MAX_PUSH_DEPTH]; + FLAC__off_t first_offset; /* this is the offset to the STREAMINFO block */ + uint32_t depth; /* this is the metadata block header of the current block we are pointing to: */ FLAC__bool is_last; FLAC__MetadataType type; - unsigned length; + uint32_t length; }; FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[] = { @@ -377,7 +364,7 @@ FLAC_API const char * const FLAC__Metadata_SimpleIteratorStatusString[] = { FLAC_API FLAC__Metadata_SimpleIterator *FLAC__metadata_simple_iterator_new(void) { - FLAC__Metadata_SimpleIterator *iterator = (FLAC__Metadata_SimpleIterator*)calloc(1, sizeof(FLAC__Metadata_SimpleIterator)); + FLAC__Metadata_SimpleIterator *iterator = calloc(1, sizeof(FLAC__Metadata_SimpleIterator)); if(0 != iterator) { iterator->file = 0; @@ -434,14 +421,14 @@ FLAC_API FLAC__Metadata_SimpleIteratorStatus FLAC__metadata_simple_iterator_stat static FLAC__bool simple_iterator_prime_input_(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool read_only) { - unsigned ret; + uint32_t ret; FLAC__ASSERT(0 != iterator); - if(read_only || 0 == (iterator->file = fopen(iterator->filename, "r+b"))) { + if(read_only || 0 == (iterator->file = flac_fopen(iterator->filename, "r+b"))) { iterator->is_writable = false; if(read_only || errno == EACCES) { - if(0 == (iterator->file = fopen(iterator->filename, "rb"))) { + if(0 == (iterator->file = flac_fopen(iterator->filename, "rb"))) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE; return false; } @@ -460,7 +447,15 @@ static FLAC__bool simple_iterator_prime_input_(FLAC__Metadata_SimpleIterator *it case 0: iterator->depth = 0; iterator->first_offset = iterator->offset[iterator->depth] = ftello(iterator->file); - return read_metadata_block_header_(iterator); + ret = read_metadata_block_header_(iterator); + /* The first metadata block must be a streaminfo. If this is not the + * case, the file is invalid and assumptions made elsewhere in the + * code are invalid */ + if(iterator->type != FLAC__METADATA_TYPE_STREAMINFO) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA; + return false; + } + return ret; case 1: iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; return false; @@ -496,7 +491,7 @@ FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *it FLAC_API FLAC__bool FLAC__metadata_simple_iterator_init(FLAC__Metadata_SimpleIterator *iterator, const char *filename, FLAC__bool read_only, FLAC__bool preserve_file_stats) { - const char *tempfile_path_prefix = 0; /*@@@ search for comments near 'rename(...)' for what it will take to finish implementing this */ + const char *tempfile_path_prefix = 0; /*@@@ search for comments near 'flac_rename(...)' for what it will take to finish implementing this */ FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != filename); @@ -530,6 +525,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIte { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); if(iterator->is_last) return false; @@ -546,10 +542,11 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_next(FLAC__Metadata_SimpleIte FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIterator *iterator) { - off_t this_offset; + FLAC__off_t this_offset; FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); if(iterator->offset[iterator->depth] == iterator->first_offset) return false; @@ -563,7 +560,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_prev(FLAC__Metadata_SimpleIte return false; /* we ignore any error from ftello() and catch it in fseeko() */ - while(ftello(iterator->file) + (off_t)iterator->length < iterator->offset[iterator->depth]) { + while(ftello(iterator->file) + (FLAC__off_t)iterator->length < iterator->offset[iterator->depth]) { if(0 != fseeko(iterator->file, iterator->length, SEEK_CUR)) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; return false; @@ -583,6 +580,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_is_last(const FLAC__Metadata_ { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); return iterator->is_last; } @@ -592,23 +590,26 @@ FLAC_API off_t FLAC__metadata_simple_iterator_get_block_offset(const FLAC__Metad { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); - return iterator->offset[iterator->depth]; + return (off_t)iterator->offset[iterator->depth]; } FLAC_API FLAC__MetadataType FLAC__metadata_simple_iterator_get_block_type(const FLAC__Metadata_SimpleIterator *iterator) { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); return iterator->type; } /*@@@@add to tests*/ -FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator) +FLAC_API uint32_t FLAC__metadata_simple_iterator_get_block_length(const FLAC__Metadata_SimpleIterator *iterator) { FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); return iterator->length; } @@ -616,11 +617,12 @@ FLAC_API unsigned FLAC__metadata_simple_iterator_get_block_length(const FLAC__Me /*@@@@add to tests*/ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_get_application_id(FLAC__Metadata_SimpleIterator *iterator, FLAC__byte *id) { - const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; + const uint32_t id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); FLAC__ASSERT(0 != id); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); if(iterator->type != FLAC__METADATA_TYPE_APPLICATION) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT; @@ -647,6 +649,7 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Me FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); if(0 != block) { block->is_last = iterator->is_last; @@ -672,12 +675,13 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_simple_iterator_get_block(FLAC__Me FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding) { - FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth];) + FLAC__ASSERT_DECLARATION(FLAC__off_t debug_target_offset = iterator->offset[iterator->depth];) FLAC__bool ret; FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); FLAC__ASSERT(0 != block); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); if(!iterator->is_writable) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE; @@ -699,18 +703,19 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_Simp if(use_padding && iterator->length >= FLAC__STREAM_METADATA_HEADER_LENGTH + block->length) { ret = write_metadata_block_stationary_with_padding_(iterator, block, iterator->length - FLAC__STREAM_METADATA_HEADER_LENGTH - block->length, block->is_last); FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); - FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); return ret; } else { - ret = rewrite_whole_file_(iterator, block, /*append=*/false); - FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); - FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + if((ret = rewrite_whole_file_(iterator, block, /*append=*/false))) { + FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + } return ret; } } else /* iterator->length < block->length */ { - unsigned padding_leftover = 0; + uint32_t padding_leftover = 0; FLAC__bool padding_is_last = false; if(use_padding) { /* first see if we can even use padding */ @@ -718,7 +723,7 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_Simp use_padding = false; } else { - const unsigned extra_padding_bytes_required = block->length - iterator->length; + const uint32_t extra_padding_bytes_required = block->length - iterator->length; simple_iterator_push_(iterator); if(!FLAC__metadata_simple_iterator_next(iterator)) { (void)simple_iterator_pop_(iterator); @@ -748,21 +753,22 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_Simp if(padding_leftover == 0) { ret = write_metadata_block_stationary_(iterator, block); FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); - FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); return ret; } else { FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH); ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last); FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); - FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); return ret; } } else { - ret = rewrite_whole_file_(iterator, block, /*append=*/false); - FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); - FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + if((ret = rewrite_whole_file_(iterator, block, /*append=*/false))) { + FLAC__ASSERT(!ret || iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(!ret || ftello(iterator->file) == debug_target_offset + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + } return ret; } } @@ -770,18 +776,21 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_set_block(FLAC__Metadata_Simp FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool use_padding) { - unsigned padding_leftover = 0; + uint32_t padding_leftover = 0; FLAC__bool padding_is_last = false; - FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length;) + FLAC__ASSERT_DECLARATION(FLAC__off_t debug_target_offset = iterator->offset[iterator->depth] + FLAC__STREAM_METADATA_HEADER_LENGTH + iterator->length;) FLAC__bool ret; FLAC__ASSERT(0 != iterator); FLAC__ASSERT(0 != iterator->file); FLAC__ASSERT(0 != block); + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); - if(!iterator->is_writable) + if(!iterator->is_writable) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE; return false; + } if(block->type == FLAC__METADATA_TYPE_STREAMINFO) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT; @@ -828,30 +837,38 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_insert_block_after(FLAC__Meta if(padding_leftover == 0) { ret = write_metadata_block_stationary_(iterator, block); FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset); - FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); return ret; } else { FLAC__ASSERT(padding_leftover >= FLAC__STREAM_METADATA_HEADER_LENGTH); ret = write_metadata_block_stationary_with_padding_(iterator, block, padding_leftover - FLAC__STREAM_METADATA_HEADER_LENGTH, padding_is_last); FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset); - FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); return ret; } } else { - ret = rewrite_whole_file_(iterator, block, /*append=*/true); - FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset); - FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + if((ret = rewrite_whole_file_(iterator, block, /*append=*/true))) { + FLAC__ASSERT(iterator->offset[iterator->depth] == debug_target_offset); + FLAC__ASSERT(ftello(iterator->file) == debug_target_offset + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + } return ret; } } FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_SimpleIterator *iterator, FLAC__bool use_padding) { - FLAC__ASSERT_DECLARATION(off_t debug_target_offset = iterator->offset[iterator->depth];) + FLAC__ASSERT_DECLARATION(FLAC__off_t debug_target_offset = iterator->offset[iterator->depth];) FLAC__bool ret; + FLAC__ASSERT(iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); + + if(!iterator->is_writable) { + iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_NOT_WRITABLE; + return false; + } + if(iterator->type == FLAC__METADATA_TYPE_STREAMINFO) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT; return false; @@ -871,14 +888,15 @@ FLAC_API FLAC__bool FLAC__metadata_simple_iterator_delete_block(FLAC__Metadata_S FLAC__metadata_object_delete(padding); if(!FLAC__metadata_simple_iterator_prev(iterator)) return false; - FLAC__ASSERT(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset); - FLAC__ASSERT(ftello(iterator->file) + (off_t)iterator->length == debug_target_offset); + FLAC__ASSERT(iterator->offset[iterator->depth] + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (FLAC__off_t)iterator->length == debug_target_offset); + FLAC__ASSERT(ftello(iterator->file) + (FLAC__off_t)iterator->length == debug_target_offset); return true; } else { - ret = rewrite_whole_file_(iterator, 0, /*append=*/false); - FLAC__ASSERT(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length == debug_target_offset); - FLAC__ASSERT(ftello(iterator->file) + (off_t)iterator->length == debug_target_offset); + if((ret = rewrite_whole_file_(iterator, 0, /*append=*/false))) { + FLAC__ASSERT(iterator->offset[iterator->depth] + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (FLAC__off_t)iterator->length == debug_target_offset); + FLAC__ASSERT(ftello(iterator->file) + (FLAC__off_t)iterator->length == debug_target_offset); + } return ret; } } @@ -902,15 +920,15 @@ struct FLAC__Metadata_Chain { FLAC__bool is_ogg; FLAC__Metadata_Node *head; FLAC__Metadata_Node *tail; - unsigned nodes; + uint32_t nodes; FLAC__Metadata_ChainStatus status; - off_t first_offset, last_offset; + FLAC__off_t first_offset, last_offset; /* * This is the length of the chain initially read from the FLAC file. * it is used to compare against the current length to decide whether * or not the whole file has to be rewritten. */ - off_t initial_length; + FLAC__off_t initial_length; /* @@@ hacky, these are currently only needed by ogg reader */ FLAC__IOHandle handle; FLAC__IOCallback_Read read_cb; @@ -943,7 +961,7 @@ FLAC_API const char * const FLAC__Metadata_ChainStatusString[] = { static FLAC__Metadata_Node *node_new_(void) { - return (FLAC__Metadata_Node*)calloc(1, sizeof(FLAC__Metadata_Node)); + return calloc(1, sizeof(FLAC__Metadata_Node)); } static void node_delete_(FLAC__Metadata_Node *node) @@ -1034,10 +1052,10 @@ static void chain_delete_node_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node node_delete_(node); } -static off_t chain_calculate_length_(FLAC__Metadata_Chain *chain) +static FLAC__off_t chain_calculate_length_(FLAC__Metadata_Chain *chain) { const FLAC__Metadata_Node *node; - off_t length = 0; + FLAC__off_t length = 0; for(node = chain->head; node; node = node->next) length += (FLAC__STREAM_METADATA_HEADER_LENGTH + node->data->length); return length; @@ -1099,8 +1117,8 @@ static void iterator_insert_node_after_(FLAC__Metadata_Iterator *iterator, FLAC_ static FLAC__bool chain_merge_adjacent_padding_(FLAC__Metadata_Chain *chain, FLAC__Metadata_Node *node) { if(node->data->type == FLAC__METADATA_TYPE_PADDING && 0 != node->next && node->next->data->type == FLAC__METADATA_TYPE_PADDING) { - const unsigned growth = FLAC__STREAM_METADATA_HEADER_LENGTH + node->next->data->length; - node->data->length += growth; + const uint32_t growth = FLAC__STREAM_METADATA_HEADER_LENGTH + node->next->data->length; + node->data->length += growth; /* new block size can be greater than max metadata block size, but it'll be fixed later in chain_prepare_for_write_() */ chain_delete_node_(chain, node->next); return true; @@ -1109,6 +1127,11 @@ static FLAC__bool chain_merge_adjacent_padding_(FLAC__Metadata_Chain *chain, FLA return false; } +#if defined(_MSC_VER) +// silence three MSVC warnings 'conversion from 'conversion from 'const __int64' to 'uint32_t', possible loss of data' +#pragma warning ( disable : 4244 ) +#endif + /* Returns the new length of the chain, or 0 if there was an error. */ /* WATCHOUT: This can get called multiple times before a write, so * it should still work when this happens. @@ -1116,20 +1139,26 @@ static FLAC__bool chain_merge_adjacent_padding_(FLAC__Metadata_Chain *chain, FLA /* WATCHOUT: Make sure to also update the logic in * FLAC__metadata_chain_check_if_tempfile_needed() if the logic here changes. */ -static off_t chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool use_padding) +static FLAC__off_t chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool use_padding) { - off_t current_length = chain_calculate_length_(chain); + FLAC__off_t current_length = chain_calculate_length_(chain); + FLAC__Metadata_Node * i; + + /* Check all is_last settings on the blocks */ + for(i = chain->head; i->next != NULL; i = i->next) + i->data->is_last = 0; + chain->tail->data->is_last = 1; if(use_padding) { /* if the metadata shrank and the last block is padding, we just extend the last padding block */ if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) { - const off_t delta = chain->initial_length - current_length; + const FLAC__off_t delta = chain->initial_length - current_length; chain->tail->data->length += delta; current_length += delta; FLAC__ASSERT(current_length == chain->initial_length); } /* if the metadata shrank more than 4 bytes then there's room to add another padding block */ - else if(current_length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) { + else if(current_length + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) { FLAC__StreamMetadata *padding; FLAC__Metadata_Node *node; if(0 == (padding = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING))) { @@ -1149,16 +1178,16 @@ static off_t chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool us } /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */ else if(current_length > chain->initial_length) { - const off_t delta = current_length - chain->initial_length; + const FLAC__off_t delta = current_length - chain->initial_length; if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) { /* if the delta is exactly the size of the last padding block, remove the padding block */ - if((off_t)chain->tail->data->length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta) { + if((FLAC__off_t)chain->tail->data->length + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta) { chain_delete_node_(chain, chain->tail); current_length = chain_calculate_length_(chain); FLAC__ASSERT(current_length == chain->initial_length); } /* if there is at least 'delta' bytes of padding, trim the padding down */ - else if((off_t)chain->tail->data->length >= delta) { + else if((FLAC__off_t)chain->tail->data->length >= delta) { chain->tail->data->length -= delta; current_length -= delta; FLAC__ASSERT(current_length == chain->initial_length); @@ -1167,9 +1196,29 @@ static off_t chain_prepare_for_write_(FLAC__Metadata_Chain *chain, FLAC__bool us } } + /* check sizes of all metadata blocks; reduce padding size if necessary */ + { + FLAC__Metadata_Node *node; + for (node = chain->head; node; node = node->next) { + if(node->data->length >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) { + if(node->data->type == FLAC__METADATA_TYPE_PADDING) { + node->data->length = (1u << FLAC__STREAM_METADATA_LENGTH_LEN) - 1; + current_length = chain_calculate_length_(chain); + } else { + chain->status = FLAC__METADATA_CHAIN_STATUS_BAD_METADATA; + return 0; + } + } + } + } + return current_length; } +#if defined(_MSC_VER) +#pragma warning ( default : 4244 ) +#endif + static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__IOCallback_Tell tell_cb) { FLAC__Metadata_Node *node; @@ -1201,13 +1250,13 @@ static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle han chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR; return false; } - chain->first_offset = (off_t)pos; + chain->first_offset = (FLAC__off_t)pos; } { FLAC__bool is_last; FLAC__MetadataType type; - unsigned length; + uint32_t length; do { node = node_new_(); @@ -1217,6 +1266,7 @@ static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle han } if(!read_metadata_block_header_cb_(handle, read_cb, &is_last, &type, &length)) { + node_delete_(node); chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR; return false; } @@ -1246,7 +1296,12 @@ static FLAC__bool chain_read_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle han chain->status = FLAC__METADATA_CHAIN_STATUS_READ_ERROR; return false; } - chain->last_offset = (off_t)pos; + chain->last_offset = (FLAC__off_t)pos; + } + + if(chain->head->data->type != FLAC__METADATA_TYPE_STREAMINFO) { + chain->status = FLAC__METADATA_CHAIN_STATUS_BAD_METADATA; + return false; } chain->initial_length = chain_calculate_length_(chain); @@ -1341,6 +1396,12 @@ static FLAC__bool chain_read_ogg_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHandle chain->initial_length = chain_calculate_length_(chain); + if(chain->initial_length == 0 || chain->head->data->type != FLAC__METADATA_TYPE_STREAMINFO) { + /* Ogg FLAC file must have at least streaminfo and vorbis comment */ + chain->status = FLAC__METADATA_CHAIN_STATUS_BAD_METADATA; + return false; + } + return true; } @@ -1380,7 +1441,7 @@ static FLAC__bool chain_rewrite_metadata_in_place_(FLAC__Metadata_Chain *chain) FLAC__ASSERT(0 != chain->filename); - if(0 == (file = fopen(chain->filename, "r+b"))) { + if(0 == (file = flac_fopen(chain->filename, "r+b"))) { chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE; return false; } @@ -1395,7 +1456,7 @@ static FLAC__bool chain_rewrite_metadata_in_place_(FLAC__Metadata_Chain *chain) static FLAC__bool chain_rewrite_file_(FLAC__Metadata_Chain *chain, const char *tempfile_path_prefix) { - FILE *f, *tempfile; + FILE *f, *tempfile = NULL; char *tempfilename; FLAC__Metadata_SimpleIteratorStatus status; const FLAC__Metadata_Node *node; @@ -1405,44 +1466,40 @@ static FLAC__bool chain_rewrite_file_(FLAC__Metadata_Chain *chain, const char *t FLAC__ASSERT(0 != chain->head); /* copy the file prefix (data up to first metadata block */ - if(0 == (f = fopen(chain->filename, "rb"))) { + if(0 == (f = flac_fopen(chain->filename, "rb"))) { chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE; return false; } if(!open_tempfile_(chain->filename, tempfile_path_prefix, &tempfile, &tempfilename, &status)) { chain->status = get_equivalent_status_(status); - cleanup_tempfile_(&tempfile, &tempfilename); - return false; + goto err; } if(!copy_n_bytes_from_file_(f, tempfile, chain->first_offset, &status)) { chain->status = get_equivalent_status_(status); - cleanup_tempfile_(&tempfile, &tempfilename); - return false; + goto err; } /* write the metadata */ for(node = chain->head; node; node = node->next) { if(!write_metadata_block_header_(tempfile, &status, node->data)) { chain->status = get_equivalent_status_(status); - return false; + goto err; } if(!write_metadata_block_data_(tempfile, &status, node->data)) { chain->status = get_equivalent_status_(status); - return false; + goto err; } } /*FLAC__ASSERT(fflush(), ftello() == chain->last_offset);*/ /* copy the file postfix (everything after the metadata) */ if(0 != fseeko(f, chain->last_offset, SEEK_SET)) { - cleanup_tempfile_(&tempfile, &tempfilename); chain->status = FLAC__METADATA_CHAIN_STATUS_SEEK_ERROR; - return false; + goto err; } if(!copy_remaining_bytes_from_file_(f, tempfile, &status)) { - cleanup_tempfile_(&tempfile, &tempfilename); chain->status = get_equivalent_status_(status); - return false; + goto err; } /* move the tempfile on top of the original */ @@ -1451,6 +1508,11 @@ static FLAC__bool chain_rewrite_file_(FLAC__Metadata_Chain *chain, const char *t return false; return true; + +err: + (void)fclose(f); + cleanup_tempfile_(&tempfile, &tempfilename); + return false; } /* assumes 'handle' is already at beginning of file */ @@ -1497,7 +1559,7 @@ static FLAC__bool chain_rewrite_file_cb_(FLAC__Metadata_Chain *chain, FLAC__IOHa FLAC_API FLAC__Metadata_Chain *FLAC__metadata_chain_new(void) { - FLAC__Metadata_Chain *chain = (FLAC__Metadata_Chain*)calloc(1, sizeof(FLAC__Metadata_Chain)); + FLAC__Metadata_Chain *chain = calloc(1, sizeof(FLAC__Metadata_Chain)); if(0 != chain) chain_init_(chain); @@ -1542,7 +1604,7 @@ static FLAC__bool chain_read_(FLAC__Metadata_Chain *chain, const char *filename, chain->is_ogg = is_ogg; - if(0 == (file = fopen(filename, "rb"))) { + if(0 == (file = flac_fopen(filename, "rb"))) { chain->status = FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE; return false; } @@ -1610,45 +1672,104 @@ FLAC_API FLAC__bool FLAC__metadata_chain_read_ogg_with_callbacks(FLAC__Metadata_ return chain_read_with_callbacks_(chain, handle, callbacks, /*is_ogg=*/true); } +typedef enum { + LBS_NONE = 0, + LBS_SIZE_CHANGED, + LBS_BLOCK_ADDED, + LBS_BLOCK_REMOVED +} LastBlockState; + +#if defined(_MSC_VER) +// silence three MSVC warnings 'conversion from 'conversion from 'const __int64' to 'uint32_t', possible loss of data' +#pragma warning ( disable : 4244 ) +#endif + FLAC_API FLAC__bool FLAC__metadata_chain_check_if_tempfile_needed(FLAC__Metadata_Chain *chain, FLAC__bool use_padding) { /* This does all the same checks that are in chain_prepare_for_write_() * but doesn't actually alter the chain. Make sure to update the logic * here if chain_prepare_for_write_() changes. */ - const off_t current_length = chain_calculate_length_(chain); + FLAC__off_t current_length; + LastBlockState lbs_state = LBS_NONE; + uint32_t lbs_size = 0; FLAC__ASSERT(0 != chain); + current_length = chain_calculate_length_(chain); + if(use_padding) { + const FLAC__Metadata_Node * const node = chain->tail; /* if the metadata shrank and the last block is padding, we just extend the last padding block */ - if(current_length < chain->initial_length && chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) - return false; + if(current_length < chain->initial_length && node->data->type == FLAC__METADATA_TYPE_PADDING) { + lbs_state = LBS_SIZE_CHANGED; + lbs_size = node->data->length + (chain->initial_length - current_length); + } /* if the metadata shrank more than 4 bytes then there's room to add another padding block */ - else if(current_length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) - return false; + else if(current_length + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH <= chain->initial_length) { + lbs_state = LBS_BLOCK_ADDED; + lbs_size = chain->initial_length - (current_length + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH); + } /* if the metadata grew but the last block is padding, try cutting the padding to restore the original length so we don't have to rewrite the whole file */ else if(current_length > chain->initial_length) { - const off_t delta = current_length - chain->initial_length; - if(chain->tail->data->type == FLAC__METADATA_TYPE_PADDING) { + const FLAC__off_t delta = current_length - chain->initial_length; + if(node->data->type == FLAC__METADATA_TYPE_PADDING) { /* if the delta is exactly the size of the last padding block, remove the padding block */ - if((off_t)chain->tail->data->length + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta) - return false; + if((FLAC__off_t)node->data->length + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH == delta) { + lbs_state = LBS_BLOCK_REMOVED; + lbs_size = 0; + } /* if there is at least 'delta' bytes of padding, trim the padding down */ - else if((off_t)chain->tail->data->length >= delta) - return false; + else if((FLAC__off_t)node->data->length >= delta) { + lbs_state = LBS_SIZE_CHANGED; + lbs_size = node->data->length - delta; + } } } } + current_length = 0; + /* check sizes of all metadata blocks; reduce padding size if necessary */ + { + const FLAC__Metadata_Node *node; + for(node = chain->head; node; node = node->next) { + uint32_t block_len = node->data->length; + if(node == chain->tail) { + if(lbs_state == LBS_BLOCK_REMOVED) + continue; + else if(lbs_state == LBS_SIZE_CHANGED) + block_len = lbs_size; + } + if(block_len >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) { + if(node->data->type == FLAC__METADATA_TYPE_PADDING) + block_len = (1u << FLAC__STREAM_METADATA_LENGTH_LEN) - 1; + else + return false /* the return value doesn't matter */; + } + current_length += (FLAC__STREAM_METADATA_HEADER_LENGTH + block_len); + } + + if(lbs_state == LBS_BLOCK_ADDED) { + /* test added padding block */ + uint32_t block_len = lbs_size; + if(block_len >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) + block_len = (1u << FLAC__STREAM_METADATA_LENGTH_LEN) - 1; + current_length += (FLAC__STREAM_METADATA_HEADER_LENGTH + block_len); + } + } + return (current_length != chain->initial_length); } +#if defined(_MSC_VER) +#pragma warning ( default : 4244 ) +#endif + FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__bool preserve_file_stats) { - struct stat stats; + struct flac_stat_s stats; const char *tempfile_path_prefix = 0; - off_t current_length; + FLAC__off_t current_length; FLAC__ASSERT(0 != chain); @@ -1697,7 +1818,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_write(FLAC__Metadata_Chain *chain, FLAC FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks) { - off_t current_length; + FLAC__off_t current_length; FLAC__ASSERT(0 != chain); @@ -1734,7 +1855,7 @@ FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks(FLAC__Metadata_Cha FLAC_API FLAC__bool FLAC__metadata_chain_write_with_callbacks_and_tempfile(FLAC__Metadata_Chain *chain, FLAC__bool use_padding, FLAC__IOHandle handle, FLAC__IOCallbacks callbacks, FLAC__IOHandle temp_handle, FLAC__IOCallbacks temp_callbacks) { - off_t current_length; + FLAC__off_t current_length; FLAC__ASSERT(0 != chain); @@ -1806,7 +1927,7 @@ FLAC_API void FLAC__metadata_chain_merge_padding(FLAC__Metadata_Chain *chain) FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain) { FLAC__Metadata_Node *node, *save; - unsigned i; + uint32_t i; FLAC__ASSERT(0 != chain); @@ -1832,7 +1953,7 @@ FLAC_API void FLAC__metadata_chain_sort_padding(FLAC__Metadata_Chain *chain) FLAC_API FLAC__Metadata_Iterator *FLAC__metadata_iterator_new(void) { - FLAC__Metadata_Iterator *iterator = (FLAC__Metadata_Iterator*)calloc(1, sizeof(FLAC__Metadata_Iterator)); + FLAC__Metadata_Iterator *iterator = calloc(1, sizeof(FLAC__Metadata_Iterator)); /* calloc() implies: iterator->current = 0; @@ -1983,9 +2104,9 @@ FLAC_API FLAC__bool FLAC__metadata_iterator_insert_block_after(FLAC__Metadata_It * ***************************************************************************/ -void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes) +void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, uint32_t bytes) { - unsigned i; + uint32_t i; b += bytes; @@ -1995,9 +2116,9 @@ void pack_uint32_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes) } } -void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes) +void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, uint32_t bytes) { - unsigned i; + uint32_t i; for(i = 0; i < bytes; i++) { *(b++) = (FLAC__byte)(val & 0xff); @@ -2005,9 +2126,9 @@ void pack_uint32_little_endian_(FLAC__uint32 val, FLAC__byte *b, unsigned bytes) } } -void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, unsigned bytes) +void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, uint32_t bytes) { - unsigned i; + uint32_t i; b += bytes; @@ -2017,10 +2138,10 @@ void pack_uint64_(FLAC__uint64 val, FLAC__byte *b, unsigned bytes) } } -FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes) +FLAC__uint32 unpack_uint32_(FLAC__byte *b, uint32_t bytes) { FLAC__uint32 ret = 0; - unsigned i; + uint32_t i; for(i = 0; i < bytes; i++) ret = (ret << 8) | (FLAC__uint32)(*b++); @@ -2028,10 +2149,10 @@ FLAC__uint32 unpack_uint32_(FLAC__byte *b, unsigned bytes) return ret; } -FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes) +FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, uint32_t bytes) { FLAC__uint32 ret = 0; - unsigned i; + uint32_t i; b += bytes; @@ -2041,10 +2162,10 @@ FLAC__uint32 unpack_uint32_little_endian_(FLAC__byte *b, unsigned bytes) return ret; } -FLAC__uint64 unpack_uint64_(FLAC__byte *b, unsigned bytes) +FLAC__uint64 unpack_uint64_(FLAC__byte *b, uint32_t bytes) { FLAC__uint64 ret = 0; - unsigned i; + uint32_t i; for(i = 0; i < bytes; i++) ret = (ret << 8) | (FLAC__uint64)(*b++); @@ -2075,7 +2196,7 @@ FLAC__bool read_metadata_block_data_(FLAC__Metadata_SimpleIterator *iterator, FL return (iterator->status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK); } -FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, unsigned *length) +FLAC__bool read_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__bool *is_last, FLAC__MetadataType *type, uint32_t *length) { FLAC__byte raw_header[FLAC__STREAM_METADATA_HEADER_LENGTH]; @@ -2106,7 +2227,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cb_(FLAC__IOHandle case FLAC__METADATA_TYPE_SEEKTABLE: return read_metadata_block_data_seektable_cb_(handle, read_cb, &block->data.seek_table, block->length); case FLAC__METADATA_TYPE_VORBIS_COMMENT: - return read_metadata_block_data_vorbis_comment_cb_(handle, read_cb, &block->data.vorbis_comment); + return read_metadata_block_data_vorbis_comment_cb_(handle, read_cb, seek_cb, &block->data.vorbis_comment, block->length); case FLAC__METADATA_TYPE_CUESHEET: return read_metadata_block_data_cuesheet_cb_(handle, read_cb, &block->data.cue_sheet); case FLAC__METADATA_TYPE_PICTURE: @@ -2133,16 +2254,16 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_streaminfo_cb_(FLAC block->max_blocksize = unpack_uint32_(b, 2); b += 2; block->min_framesize = unpack_uint32_(b, 3); b += 3; block->max_framesize = unpack_uint32_(b, 3); b += 3; - block->sample_rate = (unpack_uint32_(b, 2) << 4) | ((unsigned)(b[2] & 0xf0) >> 4); - block->channels = (unsigned)((b[2] & 0x0e) >> 1) + 1; - block->bits_per_sample = ((((unsigned)(b[2] & 0x01)) << 4) | (((unsigned)(b[3] & 0xf0)) >> 4)) + 1; + block->sample_rate = (unpack_uint32_(b, 2) << 4) | ((uint32_t)(b[2] & 0xf0) >> 4); + block->channels = (uint32_t)((b[2] & 0x0e) >> 1) + 1; + block->bits_per_sample = ((((uint32_t)(b[2] & 0x01)) << 4) | (((uint32_t)(b[3] & 0xf0)) >> 4)) + 1; block->total_samples = (((FLAC__uint64)(b[3] & 0x0f)) << 32) | unpack_uint64_(b+4, 4); memcpy(block->md5sum, b+8, 16); return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, unsigned block_length) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_Padding *block, uint32_t block_length) { (void)block; /* nothing to do; we don't care about reading the padding bytes */ @@ -2152,9 +2273,9 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_padding_cb_(FLAC__I return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, unsigned block_length) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Application *block, uint32_t block_length) { - const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; + const uint32_t id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; if(read_cb(block->id, 1, id_bytes, handle) != id_bytes) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; @@ -2168,7 +2289,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLA block->data = 0; } else { - if(0 == (block->data = (FLAC__byte*)malloc(block_length))) + if(0 == (block->data = malloc(block_length))) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; if(read_cb(block->data, 1, block_length, handle) != block_length) @@ -2178,18 +2299,19 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_application_cb_(FLA return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, unsigned block_length) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_SeekTable *block, uint32_t block_length) { - unsigned i; + uint32_t i; FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH]; - FLAC__ASSERT(block_length % FLAC__STREAM_METADATA_SEEKPOINT_LENGTH == 0); + if(block_length % FLAC__STREAM_METADATA_SEEKPOINT_LENGTH != 0) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA; block->num_points = block_length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; if(block->num_points == 0) block->points = 0; - else if(0 == (block->points = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(block->num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) + else if(0 == (block->points = safe_malloc_mul_2op_p(block->num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; for(i = 0; i < block->num_points; i++) { @@ -2204,48 +2326,58 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_seektable_cb_(FLAC_ return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_entry_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment_Entry *entry, uint32_t max_length) { - const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; + const uint32_t entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; FLAC__byte buffer[4]; /* magic number is asserted below */ FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8 == sizeof(buffer)); + if(max_length < entry_length_len) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA; + + max_length -= entry_length_len; if(read_cb(buffer, 1, entry_length_len, handle) != entry_length_len) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; entry->length = unpack_uint32_little_endian_(buffer, entry_length_len); + if(max_length < entry->length) { + entry->length = 0; + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA; + } if(0 != entry->entry) free(entry->entry); - if(entry->length == 0) { - entry->entry = 0; - } - else { - if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_2op_(entry->length, /*+*/1))) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + if(0 == (entry->entry = safe_malloc_add_2op_(entry->length, /*+*/1))) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; - if(read_cb(entry->entry, 1, entry->length, handle) != entry->length) - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; + if(entry->length > 0 && read_cb(entry->entry, 1, entry->length, handle) != entry->length) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; - entry->entry[entry->length] = '\0'; - } + entry->entry[entry->length] = '\0'; return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_VorbisComment *block) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb, FLAC__StreamMetadata_VorbisComment *block, uint32_t block_length) { - unsigned i; + uint32_t i; FLAC__Metadata_SimpleIteratorStatus status; - const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; + const uint32_t num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; FLAC__byte buffer[4]; /* magic number is asserted below */ FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8 == sizeof(buffer)); - if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, &(block->vendor_string)))) + status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, &(block->vendor_string), block_length); + if(block_length >= 4) + block_length -= 4; + if(status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA) + goto skip; + else if(status != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK) return status; + block_length -= block->vendor_string.length; + if(block_length < num_comments_len) goto skip; else block_length -= num_comments_len; if(read_cb(buffer, 1, num_comments_len, handle) != num_comments_len) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; block->num_comments = unpack_uint32_little_endian_(buffer, num_comments_len); @@ -2253,20 +2385,40 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_vorbis_comment_cb_( if(block->num_comments == 0) { block->comments = 0; } - else if(0 == (block->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)calloc(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) + else if(block->num_comments > (block_length >> 2)) { /* each comment needs at least 4 byte */ + block->num_comments = 0; + status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA; + goto skip; + } + else if(0 == (block->comments = calloc(block->num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) { + block->num_comments = 0; return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; + } for(i = 0; i < block->num_comments; i++) { - if(FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK != (status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, block->comments + i))) - return status; + status = read_metadata_block_data_vorbis_comment_entry_cb_(handle, read_cb, block->comments + i, block_length); + if(block_length >= 4) block_length -= 4; + if(status == FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA) { + block->num_comments = i; + goto skip; + } + else if(status != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK) return status; + block_length -= block->comments[i].length; } - return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; + skip: + if(block_length > 0) { + /* bad metadata */ + if(0 != seek_cb(handle, block_length, SEEK_CUR)) + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; + } + + return status; } FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet_Track *track) { - unsigned i, len; + uint32_t i, len; FLAC__byte buffer[32]; /* asserted below that this is big enough */ FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64)); @@ -2308,7 +2460,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_( if(track->num_indices == 0) { track->indices = 0; } - else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) + else if(0 == (track->indices = calloc(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; for(i = 0; i < track->num_indices; i++) { @@ -2335,7 +2487,7 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_track_cb_( FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_CueSheet *block) { - unsigned i, len; + uint32_t i, len; FLAC__Metadata_SimpleIteratorStatus status; FLAC__byte buffer[1024]; /* MSVC needs a constant expression so we put a magic number and assert */ @@ -2366,9 +2518,9 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_cuesheet_cb_(FLAC__ block->num_tracks = unpack_uint32_(buffer, len); if(block->num_tracks == 0) { - block->tracks = 0; + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA; } - else if(0 == (block->tracks = (FLAC__StreamMetadata_CueSheet_Track*)calloc(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) + else if(0 == (block->tracks = calloc(block->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; for(i = 0; i < block->num_tracks; i++) { @@ -2394,10 +2546,13 @@ static FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cstr return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; *length = unpack_uint32_(buffer, length_len); + if(*length > (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) /* data cannot be larger than FLAC metadata block */ + return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_BAD_METADATA; + if(0 != *data) free(*data); - if(0 == (*data = (FLAC__byte*)safe_malloc_add_2op_(*length, /*+*/1))) + if(0 == (*data = safe_malloc_add_2op_(*length, /*+*/1))) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; if(*length > 0) { @@ -2465,13 +2620,13 @@ FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_picture_cb_(FLAC__I return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; } -FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, unsigned block_length) +FLAC__Metadata_SimpleIteratorStatus read_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Unknown *block, uint32_t block_length) { if(block_length == 0) { block->data = 0; } else { - if(0 == (block->data = (FLAC__byte*)malloc(block_length))) + if(0 == (block->data = malloc(block_length))) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; if(read_cb(block->data, 1, block_length, handle) != block_length) @@ -2514,6 +2669,9 @@ FLAC__bool write_metadata_block_header_cb_(FLAC__IOHandle handle, FLAC__IOCallba FLAC__byte buffer[FLAC__STREAM_METADATA_HEADER_LENGTH]; FLAC__ASSERT(block->length < (1u << FLAC__STREAM_METADATA_LENGTH_LEN)); + /* double protection */ + if(block->length >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) + return false; buffer[0] = (block->is_last? 0x80 : 0) | (FLAC__byte)block->type; pack_uint32_(block->length, buffer + 1, 3); @@ -2551,8 +2709,8 @@ FLAC__bool write_metadata_block_data_cb_(FLAC__IOHandle handle, FLAC__IOCallback FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_StreamInfo *block) { FLAC__byte buffer[FLAC__STREAM_METADATA_STREAMINFO_LENGTH]; - const unsigned channels1 = block->channels - 1; - const unsigned bps1 = block->bits_per_sample - 1; + const uint32_t channels1 = block->channels - 1; + const uint32_t bps1 = block->bits_per_sample - 1; /* we are using hardcoded numbers for simplicity but we should * probably eventually write a bit-level packer and use the @@ -2575,9 +2733,9 @@ FLAC__bool write_metadata_block_data_streaminfo_cb_(FLAC__IOHandle handle, FLAC_ return true; } -FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, unsigned block_length) +FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Padding *block, uint32_t block_length) { - unsigned i, n = block_length; + uint32_t i, n = block_length; FLAC__byte buffer[1024]; (void)block; @@ -2596,9 +2754,9 @@ FLAC__bool write_metadata_block_data_padding_cb_(FLAC__IOHandle handle, FLAC__IO return true; } -FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, unsigned block_length) +FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Application *block, uint32_t block_length) { - const unsigned id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; + const uint32_t id_bytes = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8; if(write_cb(block->id, 1, id_bytes, handle) != id_bytes) return false; @@ -2613,7 +2771,7 @@ FLAC__bool write_metadata_block_data_application_cb_(FLAC__IOHandle handle, FLAC FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_SeekTable *block) { - unsigned i; + uint32_t i; FLAC__byte buffer[FLAC__STREAM_METADATA_SEEKPOINT_LENGTH]; for(i = 0; i < block->num_points; i++) { @@ -2630,12 +2788,12 @@ FLAC__bool write_metadata_block_data_seektable_cb_(FLAC__IOHandle handle, FLAC__ FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_VorbisComment *block) { - unsigned i; - const unsigned entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; - const unsigned num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; + uint32_t i; + const uint32_t entry_length_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; + const uint32_t num_comments_len = FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN / 8; FLAC__byte buffer[4]; /* magic number is asserted below */ - FLAC__ASSERT(max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8 == sizeof(buffer)); + FLAC__ASSERT(flac_max(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN, FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8 == sizeof(buffer)); pack_uint32_little_endian_(block->vendor_string.length, buffer, entry_length_len); if(write_cb(buffer, 1, entry_length_len, handle) != entry_length_len) @@ -2660,7 +2818,7 @@ FLAC__bool write_metadata_block_data_vorbis_comment_cb_(FLAC__IOHandle handle, F FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_CueSheet *block) { - unsigned i, j, len; + uint32_t i, j, len; FLAC__byte buffer[1024]; /* asserted below that this is big enough */ FLAC__ASSERT(sizeof(buffer) >= sizeof(FLAC__uint64)); @@ -2727,17 +2885,17 @@ FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__I return false; for(j = 0; j < track->num_indices; j++) { - FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j; + FLAC__StreamMetadata_CueSheet_Index *indx = track->indices + j; FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN % 8 == 0); len = FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN / 8; - pack_uint64_(index->offset, buffer, len); + pack_uint64_(indx->offset, buffer, len); if(write_cb(buffer, 1, len, handle) != len) return false; FLAC__ASSERT(FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN % 8 == 0); len = FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN / 8; - pack_uint32_(index->number, buffer, len); + pack_uint32_(indx->number, buffer, len); if(write_cb(buffer, 1, len, handle) != len) return false; @@ -2754,7 +2912,7 @@ FLAC__bool write_metadata_block_data_cuesheet_cb_(FLAC__IOHandle handle, FLAC__I FLAC__bool write_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Picture *block) { - unsigned len; + uint32_t len; size_t slen; FLAC__byte buffer[4]; /* magic number is asserted below */ @@ -2826,7 +2984,7 @@ FLAC__bool write_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IO return true; } -FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, unsigned block_length) +FLAC__bool write_metadata_block_data_unknown_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Write write_cb, const FLAC__StreamMetadata_Unknown *block, uint32_t block_length) { if(write_cb(block->data, 1, block_length, handle) != block_length) return false; @@ -2855,7 +3013,7 @@ FLAC__bool write_metadata_block_stationary_(FLAC__Metadata_SimpleIterator *itera return read_metadata_block_header_(iterator); } -FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, unsigned padding_length, FLAC__bool padding_is_last) +FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, uint32_t padding_length, FLAC__bool padding_is_last) { FLAC__StreamMetadata *padding; @@ -2900,10 +3058,10 @@ FLAC__bool write_metadata_block_stationary_with_padding_(FLAC__Metadata_SimpleIt FLAC__bool rewrite_whole_file_(FLAC__Metadata_SimpleIterator *iterator, FLAC__StreamMetadata *block, FLAC__bool append) { - FILE *tempfile; - char *tempfilename; + FILE *tempfile = NULL; + char *tempfilename = NULL; int fixup_is_last_code = 0; /* 0 => no need to change any is_last flags */ - off_t fixup_is_last_flag_offset = -1; + FLAC__off_t fixup_is_last_flag_offset = -1; FLAC__ASSERT(0 != block || append == false); @@ -2974,11 +3132,11 @@ FLAC__bool simple_iterator_pop_(FLAC__Metadata_SimpleIterator *iterator) * 2: seek error * 3: not a FLAC file */ -unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb) +uint32_t seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOCallback_Seek seek_cb) { FLAC__byte buffer[4]; size_t n; - unsigned i; + uint32_t i; FLAC__ASSERT(FLAC__STREAM_SYNC_LENGTH == sizeof(buffer)); @@ -2990,7 +3148,7 @@ unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallbac else if(n != 4) return 3; else if(0 == memcmp(buffer, "ID3", 3)) { - unsigned tag_length = 0; + uint32_t tag_length = 0; /* skip to the tag length */ if(seek_cb(handle, 2, SEEK_CUR) < 0) @@ -3024,14 +3182,14 @@ unsigned seek_to_first_metadata_block_cb_(FLAC__IOHandle handle, FLAC__IOCallbac return 3; } -unsigned seek_to_first_metadata_block_(FILE *f) +uint32_t seek_to_first_metadata_block_(FILE *f) { return seek_to_first_metadata_block_cb_((FLAC__IOHandle)f, (FLAC__IOCallback_Read)fread, fseek_wrapper_); } FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, FLAC__bool append) { - const off_t offset_end = append? iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length : iterator->offset[iterator->depth]; + const FLAC__off_t offset_end = append? iterator->offset[iterator->depth] + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (FLAC__off_t)iterator->length : iterator->offset[iterator->depth]; if(0 != fseeko(iterator->file, 0, SEEK_SET)) { iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; @@ -3049,12 +3207,12 @@ FLAC__bool simple_iterator_copy_file_prefix_(FLAC__Metadata_SimpleIterator *iter return true; } -FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, off_t fixup_is_last_flag_offset, FLAC__bool backup) +FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *iterator, FILE **tempfile, char **tempfilename, int fixup_is_last_code, FLAC__off_t fixup_is_last_flag_offset, FLAC__bool backup) { - off_t save_offset = iterator->offset[iterator->depth]; + FLAC__off_t save_offset = iterator->offset[iterator->depth]; FLAC__ASSERT(0 != *tempfile); - if(0 != fseeko(iterator->file, save_offset + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length, SEEK_SET)) { + if(0 != fseeko(iterator->file, save_offset + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (FLAC__off_t)iterator->length, SEEK_SET)) { cleanup_tempfile_(tempfile, tempfilename); iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_SEEK_ERROR; return false; @@ -3114,7 +3272,7 @@ FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *ite if(!simple_iterator_prime_input_(iterator, !iterator->is_writable)) return false; if(backup) { - while(iterator->offset[iterator->depth] + (off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (off_t)iterator->length < save_offset) + while(iterator->offset[iterator->depth] + (FLAC__off_t)FLAC__STREAM_METADATA_HEADER_LENGTH + (FLAC__off_t)iterator->length < save_offset) if(!FLAC__metadata_simple_iterator_next(iterator)) return false; return true; @@ -3128,14 +3286,14 @@ FLAC__bool simple_iterator_copy_file_postfix_(FLAC__Metadata_SimpleIterator *ite } } -FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status) +FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, FLAC__off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status) { FLAC__byte buffer[8192]; size_t n; FLAC__ASSERT(bytes >= 0); while(bytes > 0) { - n = min(sizeof(buffer), (size_t)bytes); + n = flac_min(sizeof(buffer), (size_t)bytes); if(fread(buffer, 1, n, file) != n) { *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; return false; @@ -3150,14 +3308,14 @@ FLAC__bool copy_n_bytes_from_file_(FILE *file, FILE *tempfile, off_t bytes, FLAC return true; } -FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status) +FLAC__bool copy_n_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__IOHandle temp_handle, FLAC__IOCallback_Write temp_write_cb, FLAC__off_t bytes, FLAC__Metadata_SimpleIteratorStatus *status) { FLAC__byte buffer[8192]; size_t n; FLAC__ASSERT(bytes >= 0); while(bytes > 0) { - n = min(sizeof(buffer), (size_t)bytes); + n = flac_min(sizeof(buffer), (size_t)bytes); if(read_cb(buffer, 1, n, handle) != n) { *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; return false; @@ -3212,35 +3370,62 @@ FLAC__bool copy_remaining_bytes_from_file_cb_(FLAC__IOHandle handle, FLAC__IOCal return true; } +static int +local_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; +} + FLAC__bool open_tempfile_(const char *filename, const char *tempfile_path_prefix, FILE **tempfile, char **tempfilename, FLAC__Metadata_SimpleIteratorStatus *status) { static const char *tempfile_suffix = ".metadata_edit"; if(0 == tempfile_path_prefix) { - if(0 == (*tempfilename = (char*)safe_malloc_add_3op_(strlen(filename), /*+*/strlen(tempfile_suffix), /*+*/1))) { + size_t dest_len = strlen(filename) + strlen(tempfile_suffix) + 1; + if(0 == (*tempfilename = safe_malloc_(dest_len))) { *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; return false; } - strcpy(*tempfilename, filename); - strcat(*tempfilename, tempfile_suffix); + local_snprintf(*tempfilename, dest_len, "%s%s", filename, tempfile_suffix); } else { const char *p = strrchr(filename, '/'); + size_t dest_len; if(0 == p) p = filename; else p++; - if(0 == (*tempfilename = (char*)safe_malloc_add_4op_(strlen(tempfile_path_prefix), /*+*/strlen(p), /*+*/strlen(tempfile_suffix), /*+*/2))) { + dest_len = strlen(tempfile_path_prefix) + strlen(p) + strlen(tempfile_suffix) + 2; + + if(0 == (*tempfilename = safe_malloc_(dest_len))) { *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_MEMORY_ALLOCATION_ERROR; return false; } - strcpy(*tempfilename, tempfile_path_prefix); - strcat(*tempfilename, "/"); - strcat(*tempfilename, p); - strcat(*tempfilename, tempfile_suffix); + local_snprintf(*tempfilename, dest_len, "%s/%s%s", tempfile_path_prefix, p, tempfile_suffix); } - if(0 == (*tempfile = fopen(*tempfilename, "w+b"))) { + if(0 == (*tempfile = flac_fopen(*tempfilename, "w+b"))) { *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE; return false; } @@ -3261,16 +3446,16 @@ FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, char **tem *tempfile = 0; #if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ || defined __EMX__ - /* on some flavors of windows, rename() will fail if the destination already exists */ - if(unlink(filename) < 0) { + /* on some flavors of windows, flac_rename() will fail if the destination already exists */ + if(flac_unlink(filename) < 0) { cleanup_tempfile_(tempfile, tempfilename); *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_UNLINK_ERROR; return false; } #endif - /*@@@ to fully support the tempfile_path_prefix we need to update this piece to actually copy across filesystems instead of just rename(): */ - if(0 != rename(*tempfilename, filename)) { + /*@@@ to fully support the tempfile_path_prefix we need to update this piece to actually copy across filesystems instead of just flac_rename(): */ + if(0 != flac_rename(*tempfilename, filename)) { cleanup_tempfile_(tempfile, tempfilename); *status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_RENAME_ERROR; return false; @@ -3289,39 +3474,45 @@ void cleanup_tempfile_(FILE **tempfile, char **tempfilename) } if(0 != *tempfilename) { - (void)unlink(*tempfilename); + (void)flac_unlink(*tempfilename); free(*tempfilename); *tempfilename = 0; } } -FLAC__bool get_file_stats_(const char *filename, struct stat *stats) +FLAC__bool get_file_stats_(const char *filename, struct flac_stat_s *stats) { FLAC__ASSERT(0 != filename); FLAC__ASSERT(0 != stats); - return (0 == stat(filename, stats)); + return (0 == flac_stat(filename, stats)); } -void set_file_stats_(const char *filename, struct stat *stats) +void set_file_stats_(const char *filename, struct flac_stat_s *stats) { +#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) && !defined(_WIN32) + 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); - srctime.actime = stats->st_atime; - srctime.modtime = stats->st_mtime; - (void)chmod(filename, stats->st_mode); - (void)utime(filename, &srctime); -#if !defined _MSC_VER && !defined __BORLANDC__ && !defined __MINGW32__ && !defined __EMX__ - (void)chown(filename, stats->st_uid, -1); - (void)chown(filename, -1, stats->st_gid); + (void)flac_chmod(filename, stats->st_mode); + (void)flac_utime(filename, &srctime); +#if !defined _MSC_VER && !defined __BORLANDC__ && !defined __MINGW32__ + FLAC_CHECK_RETURN(chown(filename, stats->st_uid, -1)); + FLAC_CHECK_RETURN(chown(filename, -1, stats->st_gid)); #endif } int fseek_wrapper_(FLAC__IOHandle handle, FLAC__int64 offset, int whence) { - return fseeko((FILE*)handle, (off_t)offset, whence); + return fseeko((FILE*)handle, (FLAC__off_t)offset, whence); } FLAC__int64 ftell_wrapper_(FLAC__IOHandle handle) diff --git a/3rdparty/libflac/src/libFLAC/metadata_object.c b/3rdparty/libflac/src/libFLAC/metadata_object.c index 6f8bccf4563..73e76076e16 100644 --- a/3rdparty/libflac/src/libFLAC/metadata_object.c +++ b/3rdparty/libflac/src/libFLAC/metadata_object.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,9 +38,16 @@ #include <string.h> #include "private/metadata.h" +#include "private/memory.h" +#include "private/stream_encoder_framing.h" #include "FLAC/assert.h" +#include "FLAC/stream_decoder.h" #include "share/alloc.h" +#include "share/compat.h" + +/* Alias the first (in share/alloc.h) to the second (in src/libFLAC/memory.c). */ +#define safe_malloc_mul_2op_ safe_malloc_mul_2op_p /**************************************************************************** @@ -56,19 +64,17 @@ * else ASSERT * malloc error leaves 'to' unchanged */ -static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned bytes) +static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, uint32_t bytes) { - FLAC__ASSERT(0 != to); - if(bytes > 0 && 0 != from) { + FLAC__ASSERT(to != NULL); + if (bytes > 0 && from != NULL) { FLAC__byte *x; - if(0 == (x = (FLAC__byte*)safe_malloc_(bytes))) + if ((x = safe_malloc_(bytes)) == NULL) return false; memcpy(x, from, bytes); *to = x; } else { - FLAC__ASSERT(0 == from); - FLAC__ASSERT(bytes == 0); *to = 0; } return true; @@ -76,13 +82,12 @@ static FLAC__bool copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned #if 0 /* UNUSED */ /* like copy_bytes_(), but free()s the original '*to' if the copy succeeds and the original '*to' is non-NULL */ -static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsigned bytes) +static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, uint32_t bytes) { FLAC__byte *copy; - FLAC__ASSERT(0 != to); - if(copy_bytes_(©, from, bytes)) { - if(*to) - free(*to); + FLAC__ASSERT(to != NULL); + if (copy_bytes_(©, from, bytes)) { + free(*to); *to = copy; return true; } @@ -93,10 +98,10 @@ static FLAC__bool free_copy_bytes_(FLAC__byte **to, const FLAC__byte *from, unsi /* reallocate entry to 1 byte larger and add a terminating NUL */ /* realloc() failure leaves entry unchanged */ -static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length) +static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, uint32_t length) { - FLAC__byte *x = (FLAC__byte*)safe_realloc_add_2op_(*entry, length, /*+*/1); - if(0 != x) { + FLAC__byte *x = safe_realloc_nofree_add_2op_(*entry, length, /*+*/1); + if (x != NULL) { x[length] = '\0'; *entry = x; return true; @@ -112,10 +117,9 @@ static FLAC__bool ensure_null_terminated_(FLAC__byte **entry, unsigned length) static FLAC__bool copy_cstring_(char **to, const char *from) { char *copy = strdup(from); - FLAC__ASSERT(to); - if(copy) { - if(*to) - free(*to); + FLAC__ASSERT(to != NULL); + if (copy) { + free(*to); *to = copy; return true; } @@ -126,14 +130,15 @@ static FLAC__bool copy_cstring_(char **to, const char *from) static FLAC__bool copy_vcentry_(FLAC__StreamMetadata_VorbisComment_Entry *to, const FLAC__StreamMetadata_VorbisComment_Entry *from) { to->length = from->length; - if(0 == from->entry) { + if (from->entry == 0) { FLAC__ASSERT(from->length == 0); - to->entry = 0; + if ((to->entry = safe_malloc_(1)) == NULL) + return false; + to->entry[0] = '\0'; } else { FLAC__byte *x; - FLAC__ASSERT(from->length > 0); - if(0 == (x = (FLAC__byte*)safe_malloc_add_2op_(from->length, /*+*/1))) + if ((x = safe_malloc_add_2op_(from->length, /*+*/1)) == NULL) return false; memcpy(x, from->entry, from->length); x[from->length] = '\0'; @@ -145,13 +150,13 @@ static FLAC__bool copy_vcentry_(FLAC__StreamMetadata_VorbisComment_Entry *to, co static FLAC__bool copy_track_(FLAC__StreamMetadata_CueSheet_Track *to, const FLAC__StreamMetadata_CueSheet_Track *from) { memcpy(to, from, sizeof(FLAC__StreamMetadata_CueSheet_Track)); - if(0 == from->indices) { + if (from->indices == 0) { FLAC__ASSERT(from->num_indices == 0); } else { FLAC__StreamMetadata_CueSheet_Index *x; FLAC__ASSERT(from->num_indices > 0); - if(0 == (x = (FLAC__StreamMetadata_CueSheet_Index*)safe_malloc_mul_2op_(from->num_indices, /*times*/sizeof(FLAC__StreamMetadata_CueSheet_Index)))) + if ((x = safe_malloc_mul_2op_p(from->num_indices, /*times*/sizeof(FLAC__StreamMetadata_CueSheet_Index))) == NULL) return false; memcpy(x, from->indices, from->num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index)); to->indices = x; @@ -161,23 +166,23 @@ static FLAC__bool copy_track_(FLAC__StreamMetadata_CueSheet_Track *to, const FLA static void seektable_calculate_length_(FLAC__StreamMetadata *object) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); object->length = object->data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; } -static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points) +static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(uint32_t num_points) { FLAC__StreamMetadata_SeekPoint *object_array; FLAC__ASSERT(num_points > 0); - object_array = (FLAC__StreamMetadata_SeekPoint*)safe_malloc_mul_2op_(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)); + object_array = safe_malloc_mul_2op_p(num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)); - if(0 != object_array) { - unsigned i; - for(i = 0; i < num_points; i++) { + if (object_array != NULL) { + uint32_t i; + for (i = 0; i < num_points; i++) { object_array[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; object_array[i].stream_offset = 0; object_array[i].frame_samples = 0; @@ -189,54 +194,52 @@ static FLAC__StreamMetadata_SeekPoint *seekpoint_array_new_(unsigned num_points) static void vorbiscomment_calculate_length_(FLAC__StreamMetadata *object) { - unsigned i; + uint32_t i; FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); object->length = (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN) / 8; object->length += object->data.vorbis_comment.vendor_string.length; object->length += (FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN) / 8; - for(i = 0; i < object->data.vorbis_comment.num_comments; i++) { + for (i = 0; i < object->data.vorbis_comment.num_comments; i++) { object->length += (FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8); object->length += object->data.vorbis_comment.comments[i].length; } } -static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_new_(unsigned num_comments) +static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_new_(uint32_t num_comments) { FLAC__ASSERT(num_comments > 0); - return (FLAC__StreamMetadata_VorbisComment_Entry*)safe_calloc_(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); + return safe_calloc_(num_comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); } -static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments) +static void vorbiscomment_entry_array_delete_(FLAC__StreamMetadata_VorbisComment_Entry *object_array, uint32_t num_comments) { - unsigned i; + uint32_t i; - FLAC__ASSERT(0 != object_array && num_comments > 0); + FLAC__ASSERT(object_array != NULL); - for(i = 0; i < num_comments; i++) - if(0 != object_array[i].entry) - free(object_array[i].entry); + for (i = 0; i < num_comments; i++) + free(object_array[i].entry); - if(0 != object_array) - free(object_array); + free(object_array); } -static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_copy_(const FLAC__StreamMetadata_VorbisComment_Entry *object_array, unsigned num_comments) +static FLAC__StreamMetadata_VorbisComment_Entry *vorbiscomment_entry_array_copy_(const FLAC__StreamMetadata_VorbisComment_Entry *object_array, uint32_t num_comments) { FLAC__StreamMetadata_VorbisComment_Entry *return_array; - FLAC__ASSERT(0 != object_array); + FLAC__ASSERT(object_array != NULL); FLAC__ASSERT(num_comments > 0); return_array = vorbiscomment_entry_array_new_(num_comments); - if(0 != return_array) { - unsigned i; + if (return_array != NULL) { + uint32_t i; - for(i = 0; i < num_comments; i++) { - if(!copy_vcentry_(return_array+i, object_array+i)) { + for (i = 0; i < num_comments; i++) { + if (!copy_vcentry_(return_array+i, object_array+i)) { vorbiscomment_entry_array_delete_(return_array, num_comments); return 0; } @@ -250,18 +253,18 @@ static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetadata *object, FLAC__S { FLAC__byte *save; - FLAC__ASSERT(0 != object); - FLAC__ASSERT(0 != dest); - FLAC__ASSERT(0 != src); + FLAC__ASSERT(object != NULL); + FLAC__ASSERT(dest != NULL); + FLAC__ASSERT(src != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - FLAC__ASSERT((0 != src->entry && src->length > 0) || (0 == src->entry && src->length == 0)); + FLAC__ASSERT((src->entry != NULL && src->length > 0) || (src->entry == NULL && src->length == 0)); save = dest->entry; - if(0 != src->entry && src->length > 0) { - if(copy) { + if (src->entry != NULL) { + if (copy) { /* do the copy first so that if we fail we leave the dest object untouched */ - if(!copy_vcentry_(dest, src)) + if (!copy_vcentry_(dest, src)) return false; } else { @@ -275,7 +278,7 @@ static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetadata *object, FLAC__S * precise, the 'own' flavor would be a separate function with a * non-const source pointer. But it's not, so we hack away. */ - if(!ensure_null_terminated_((FLAC__byte**)(&src->entry), src->length)) + if (!ensure_null_terminated_((FLAC__byte**)(&src->entry), src->length)) return false; *dest = *src; } @@ -285,23 +288,22 @@ static FLAC__bool vorbiscomment_set_entry_(FLAC__StreamMetadata *object, FLAC__S *dest = *src; } - if(0 != save) - free(save); + free(save); vorbiscomment_calculate_length_(object); return true; } -static int vorbiscomment_find_entry_from_(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name, unsigned field_name_length) +static int vorbiscomment_find_entry_from_(const FLAC__StreamMetadata *object, uint32_t offset, const char *field_name, uint32_t field_name_length) { - unsigned i; + uint32_t i; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - FLAC__ASSERT(0 != field_name); + FLAC__ASSERT(field_name != NULL); - for(i = offset; i < object->data.vorbis_comment.num_comments; i++) { - if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) + for (i = offset; i < object->data.vorbis_comment.num_comments; i++) { + if (FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) return (int)i; } @@ -310,7 +312,7 @@ static int vorbiscomment_find_entry_from_(const FLAC__StreamMetadata *object, un static void cuesheet_calculate_length_(FLAC__StreamMetadata *object) { - unsigned i; + uint32_t i; FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); @@ -332,7 +334,7 @@ static void cuesheet_calculate_length_(FLAC__StreamMetadata *object) FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN ) / 8; - for(i = 0; i < object->data.cue_sheet.num_tracks; i++) { + for (i = 0; i < object->data.cue_sheet.num_tracks; i++) { object->length += object->data.cue_sheet.tracks[i].num_indices * ( FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN + FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN + @@ -341,51 +343,50 @@ static void cuesheet_calculate_length_(FLAC__StreamMetadata *object) } } -static FLAC__StreamMetadata_CueSheet_Index *cuesheet_track_index_array_new_(unsigned num_indices) +static FLAC__StreamMetadata_CueSheet_Index *cuesheet_track_index_array_new_(uint32_t num_indices) { FLAC__ASSERT(num_indices > 0); - return (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)); + return safe_calloc_(num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)); } -static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_new_(unsigned num_tracks) +static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_new_(uint32_t num_tracks) { FLAC__ASSERT(num_tracks > 0); - return (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)); + return safe_calloc_(num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)); } -static void cuesheet_track_array_delete_(FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks) +static void cuesheet_track_array_delete_(FLAC__StreamMetadata_CueSheet_Track *object_array, uint32_t num_tracks) { - unsigned i; + uint32_t i; - FLAC__ASSERT(0 != object_array && num_tracks > 0); + FLAC__ASSERT(object_array != NULL && num_tracks > 0); - for(i = 0; i < num_tracks; i++) { - if(0 != object_array[i].indices) { + for (i = 0; i < num_tracks; i++) { + if (object_array[i].indices != 0) { FLAC__ASSERT(object_array[i].num_indices > 0); free(object_array[i].indices); } } - if(0 != object_array) - free(object_array); + free(object_array); } -static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_copy_(const FLAC__StreamMetadata_CueSheet_Track *object_array, unsigned num_tracks) +static FLAC__StreamMetadata_CueSheet_Track *cuesheet_track_array_copy_(const FLAC__StreamMetadata_CueSheet_Track *object_array, uint32_t num_tracks) { FLAC__StreamMetadata_CueSheet_Track *return_array; - FLAC__ASSERT(0 != object_array); + FLAC__ASSERT(object_array != NULL); FLAC__ASSERT(num_tracks > 0); return_array = cuesheet_track_array_new_(num_tracks); - if(0 != return_array) { - unsigned i; + if (return_array != NULL) { + uint32_t i; - for(i = 0; i < num_tracks; i++) { - if(!copy_track_(return_array+i, object_array+i)) { + for (i = 0; i < num_tracks; i++) { + if (!copy_track_(return_array+i, object_array+i)) { cuesheet_track_array_delete_(return_array, num_tracks); return 0; } @@ -399,25 +400,24 @@ static FLAC__bool cuesheet_set_track_(FLAC__StreamMetadata *object, FLAC__Stream { FLAC__StreamMetadata_CueSheet_Index *save; - FLAC__ASSERT(0 != object); - FLAC__ASSERT(0 != dest); - FLAC__ASSERT(0 != src); + FLAC__ASSERT(object != NULL); + FLAC__ASSERT(dest != NULL); + FLAC__ASSERT(src != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); - FLAC__ASSERT((0 != src->indices && src->num_indices > 0) || (0 == src->indices && src->num_indices == 0)); + FLAC__ASSERT((src->indices != NULL && src->num_indices > 0) || (src->indices == NULL && src->num_indices == 0)); save = dest->indices; /* do the copy first so that if we fail we leave the object untouched */ - if(copy) { - if(!copy_track_(dest, src)) + if (copy) { + if (!copy_track_(dest, src)) return false; } else { *dest = *src; } - if(0 != save) - free(save); + free(save); cuesheet_calculate_length_(object); return true; @@ -434,11 +434,11 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type { FLAC__StreamMetadata *object; - if(type > FLAC__MAX_METADATA_TYPE_CODE) + if (type > FLAC__MAX_METADATA_TYPE) return 0; - object = (FLAC__StreamMetadata*)calloc(1, sizeof(FLAC__StreamMetadata)); - if(0 != object) { + object = calloc(1, sizeof(FLAC__StreamMetadata)); + if (object != NULL) { object->is_last = false; object->type = type; switch(type) { @@ -464,8 +464,8 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type */ break; case FLAC__METADATA_TYPE_VORBIS_COMMENT: - object->data.vorbis_comment.vendor_string.length = (unsigned)strlen(FLAC__VENDOR_STRING); - if(!copy_bytes_(&object->data.vorbis_comment.vendor_string.entry, (const FLAC__byte*)FLAC__VENDOR_STRING, object->data.vorbis_comment.vendor_string.length+1)) { + object->data.vorbis_comment.vendor_string.length = (uint32_t)strlen(FLAC__VENDOR_STRING); + if (!copy_bytes_(&object->data.vorbis_comment.vendor_string.entry, (const FLAC__byte*)FLAC__VENDOR_STRING, object->data.vorbis_comment.vendor_string.length+1)) { free(object); return 0; } @@ -498,13 +498,12 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_new(FLAC__MetadataType type object->data.picture.data = 0; */ /* now initialize mime_type and description with empty strings to make things easier on the client */ - if(!copy_cstring_(&object->data.picture.mime_type, "")) { + if (!copy_cstring_(&object->data.picture.mime_type, "")) { free(object); return 0; } - if(!copy_cstring_((char**)(&object->data.picture.description), "")) { - if(object->data.picture.mime_type) - free(object->data.picture.mime_type); + if (!copy_cstring_((char**)(&object->data.picture.description), "")) { + free(object->data.picture.mime_type); free(object); return 0; } @@ -525,9 +524,9 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMet { FLAC__StreamMetadata *to; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); - if(0 != (to = FLAC__metadata_object_new(object->type))) { + if ((to = FLAC__metadata_object_new(object->type)) != NULL) { to->is_last = object->is_last; to->type = object->type; to->length = object->length; @@ -538,44 +537,43 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMet case FLAC__METADATA_TYPE_PADDING: break; case FLAC__METADATA_TYPE_APPLICATION: - if(to->length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) { /* underflow check */ + if (to->length < FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8) { /* underflow check */ FLAC__metadata_object_delete(to); return 0; } memcpy(&to->data.application.id, &object->data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8); - if(!copy_bytes_(&to->data.application.data, object->data.application.data, object->length - FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)) { + if (!copy_bytes_(&to->data.application.data, object->data.application.data, object->length - FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8)) { FLAC__metadata_object_delete(to); return 0; } break; case FLAC__METADATA_TYPE_SEEKTABLE: to->data.seek_table.num_points = object->data.seek_table.num_points; - if(to->data.seek_table.num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) { /* overflow check */ + if (to->data.seek_table.num_points > UINT32_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) { /* overflow check */ FLAC__metadata_object_delete(to); return 0; } - if(!copy_bytes_((FLAC__byte**)&to->data.seek_table.points, (FLAC__byte*)object->data.seek_table.points, object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint))) { + if (!copy_bytes_((FLAC__byte**)&to->data.seek_table.points, (FLAC__byte*)object->data.seek_table.points, object->data.seek_table.num_points * sizeof(FLAC__StreamMetadata_SeekPoint))) { FLAC__metadata_object_delete(to); return 0; } break; case FLAC__METADATA_TYPE_VORBIS_COMMENT: - if(0 != to->data.vorbis_comment.vendor_string.entry) { + if (to->data.vorbis_comment.vendor_string.entry != NULL) { free(to->data.vorbis_comment.vendor_string.entry); to->data.vorbis_comment.vendor_string.entry = 0; } - if(!copy_vcentry_(&to->data.vorbis_comment.vendor_string, &object->data.vorbis_comment.vendor_string)) { + if (!copy_vcentry_(&to->data.vorbis_comment.vendor_string, &object->data.vorbis_comment.vendor_string)) { FLAC__metadata_object_delete(to); return 0; } - if(object->data.vorbis_comment.num_comments == 0) { - FLAC__ASSERT(0 == object->data.vorbis_comment.comments); + if (object->data.vorbis_comment.num_comments == 0) { to->data.vorbis_comment.comments = 0; } else { - FLAC__ASSERT(0 != object->data.vorbis_comment.comments); to->data.vorbis_comment.comments = vorbiscomment_entry_array_copy_(object->data.vorbis_comment.comments, object->data.vorbis_comment.num_comments); - if(0 == to->data.vorbis_comment.comments) { + if (to->data.vorbis_comment.comments == NULL) { + to->data.vorbis_comment.num_comments = 0; FLAC__metadata_object_delete(to); return 0; } @@ -584,13 +582,13 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMet break; case FLAC__METADATA_TYPE_CUESHEET: memcpy(&to->data.cue_sheet, &object->data.cue_sheet, sizeof(FLAC__StreamMetadata_CueSheet)); - if(object->data.cue_sheet.num_tracks == 0) { - FLAC__ASSERT(0 == object->data.cue_sheet.tracks); + if (object->data.cue_sheet.num_tracks == 0) { + FLAC__ASSERT(object->data.cue_sheet.tracks == NULL); } else { - FLAC__ASSERT(0 != object->data.cue_sheet.tracks); + FLAC__ASSERT(object->data.cue_sheet.tracks != 0); to->data.cue_sheet.tracks = cuesheet_track_array_copy_(object->data.cue_sheet.tracks, object->data.cue_sheet.num_tracks); - if(0 == to->data.cue_sheet.tracks) { + if (to->data.cue_sheet.tracks == NULL) { FLAC__metadata_object_delete(to); return 0; } @@ -598,11 +596,11 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMet break; case FLAC__METADATA_TYPE_PICTURE: to->data.picture.type = object->data.picture.type; - if(!copy_cstring_(&to->data.picture.mime_type, object->data.picture.mime_type)) { + if (!copy_cstring_(&to->data.picture.mime_type, object->data.picture.mime_type)) { FLAC__metadata_object_delete(to); return 0; } - if(!copy_cstring_((char**)(&to->data.picture.description), (const char*)object->data.picture.description)) { + if (!copy_cstring_((char**)(&to->data.picture.description), (const char*)object->data.picture.description)) { FLAC__metadata_object_delete(to); return 0; } @@ -611,13 +609,13 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMet to->data.picture.depth = object->data.picture.depth; to->data.picture.colors = object->data.picture.colors; to->data.picture.data_length = object->data.picture.data_length; - if(!copy_bytes_((&to->data.picture.data), object->data.picture.data, object->data.picture.data_length)) { + if (!copy_bytes_((&to->data.picture.data), object->data.picture.data, object->data.picture.data_length)) { FLAC__metadata_object_delete(to); return 0; } break; default: - if(!copy_bytes_(&to->data.unknown.data, object->data.unknown.data, object->length)) { + if (!copy_bytes_(&to->data.unknown.data, object->data.unknown.data, object->length)) { FLAC__metadata_object_delete(to); return 0; } @@ -630,58 +628,61 @@ FLAC_API FLAC__StreamMetadata *FLAC__metadata_object_clone(const FLAC__StreamMet void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); switch(object->type) { case FLAC__METADATA_TYPE_STREAMINFO: case FLAC__METADATA_TYPE_PADDING: break; case FLAC__METADATA_TYPE_APPLICATION: - if(0 != object->data.application.data) { + if (object->data.application.data != NULL) { free(object->data.application.data); - object->data.application.data = 0; + object->data.application.data = NULL; } break; case FLAC__METADATA_TYPE_SEEKTABLE: - if(0 != object->data.seek_table.points) { + if (object->data.seek_table.points != NULL) { free(object->data.seek_table.points); - object->data.seek_table.points = 0; + object->data.seek_table.points = NULL; } break; case FLAC__METADATA_TYPE_VORBIS_COMMENT: - if(0 != object->data.vorbis_comment.vendor_string.entry) { + if (object->data.vorbis_comment.vendor_string.entry != NULL) { free(object->data.vorbis_comment.vendor_string.entry); object->data.vorbis_comment.vendor_string.entry = 0; } - if(0 != object->data.vorbis_comment.comments) { - FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0); + if (object->data.vorbis_comment.comments != NULL) { vorbiscomment_entry_array_delete_(object->data.vorbis_comment.comments, object->data.vorbis_comment.num_comments); + object->data.vorbis_comment.comments = NULL; + object->data.vorbis_comment.num_comments = 0; } break; case FLAC__METADATA_TYPE_CUESHEET: - if(0 != object->data.cue_sheet.tracks) { + if (object->data.cue_sheet.tracks != NULL) { FLAC__ASSERT(object->data.cue_sheet.num_tracks > 0); cuesheet_track_array_delete_(object->data.cue_sheet.tracks, object->data.cue_sheet.num_tracks); + object->data.cue_sheet.tracks = NULL; + object->data.cue_sheet.num_tracks = 0; } break; case FLAC__METADATA_TYPE_PICTURE: - if(0 != object->data.picture.mime_type) { + if (object->data.picture.mime_type != NULL) { free(object->data.picture.mime_type); - object->data.picture.mime_type = 0; + object->data.picture.mime_type = NULL; } - if(0 != object->data.picture.description) { + if (object->data.picture.description != NULL) { free(object->data.picture.description); - object->data.picture.description = 0; + object->data.picture.description = NULL; } - if(0 != object->data.picture.data) { + if (object->data.picture.data != NULL) { free(object->data.picture.data); - object->data.picture.data = 0; + object->data.picture.data = NULL; } break; default: - if(0 != object->data.unknown.data) { + if (object->data.unknown.data != NULL) { free(object->data.unknown.data); - object->data.unknown.data = 0; + object->data.unknown.data = NULL; } break; } @@ -695,58 +696,58 @@ FLAC_API void FLAC__metadata_object_delete(FLAC__StreamMetadata *object) static FLAC__bool compare_block_data_streaminfo_(const FLAC__StreamMetadata_StreamInfo *block1, const FLAC__StreamMetadata_StreamInfo *block2) { - if(block1->min_blocksize != block2->min_blocksize) + if (block1->min_blocksize != block2->min_blocksize) return false; - if(block1->max_blocksize != block2->max_blocksize) + if (block1->max_blocksize != block2->max_blocksize) return false; - if(block1->min_framesize != block2->min_framesize) + if (block1->min_framesize != block2->min_framesize) return false; - if(block1->max_framesize != block2->max_framesize) + if (block1->max_framesize != block2->max_framesize) return false; - if(block1->sample_rate != block2->sample_rate) + if (block1->sample_rate != block2->sample_rate) return false; - if(block1->channels != block2->channels) + if (block1->channels != block2->channels) return false; - if(block1->bits_per_sample != block2->bits_per_sample) + if (block1->bits_per_sample != block2->bits_per_sample) return false; - if(block1->total_samples != block2->total_samples) + if (block1->total_samples != block2->total_samples) return false; - if(0 != memcmp(block1->md5sum, block2->md5sum, 16)) + if (memcmp(block1->md5sum, block2->md5sum, 16) != 0) return false; return true; } -static FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Application *block1, const FLAC__StreamMetadata_Application *block2, unsigned block_length) +static FLAC__bool compare_block_data_application_(const FLAC__StreamMetadata_Application *block1, const FLAC__StreamMetadata_Application *block2, uint32_t block_length) { - FLAC__ASSERT(0 != block1); - FLAC__ASSERT(0 != block2); + FLAC__ASSERT(block1 != NULL); + FLAC__ASSERT(block2 != NULL); FLAC__ASSERT(block_length >= sizeof(block1->id)); - if(0 != memcmp(block1->id, block2->id, sizeof(block1->id))) + if (memcmp(block1->id, block2->id, sizeof(block1->id)) != 0) return false; - if(0 != block1->data && 0 != block2->data) - return 0 == memcmp(block1->data, block2->data, block_length - sizeof(block1->id)); + if (block1->data != NULL && block2->data != NULL) + return memcmp(block1->data, block2->data, block_length - sizeof(block1->id)) == 0; else return block1->data == block2->data; } static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekTable *block1, const FLAC__StreamMetadata_SeekTable *block2) { - unsigned i; + uint32_t i; - FLAC__ASSERT(0 != block1); - FLAC__ASSERT(0 != block2); + FLAC__ASSERT(block1 != NULL); + FLAC__ASSERT(block2 != NULL); - if(block1->num_points != block2->num_points) + if (block1->num_points != block2->num_points) return false; - if(0 != block1->points && 0 != block2->points) { - for(i = 0; i < block1->num_points; i++) { - if(block1->points[i].sample_number != block2->points[i].sample_number) + if (block1->points != NULL && block2->points != NULL) { + for (i = 0; i < block1->num_points; i++) { + if (block1->points[i].sample_number != block2->points[i].sample_number) return false; - if(block1->points[i].stream_offset != block2->points[i].stream_offset) + if (block1->points[i].stream_offset != block2->points[i].stream_offset) return false; - if(block1->points[i].frame_samples != block2->points[i].frame_samples) + if (block1->points[i].frame_samples != block2->points[i].frame_samples) return false; } return true; @@ -757,27 +758,27 @@ static FLAC__bool compare_block_data_seektable_(const FLAC__StreamMetadata_SeekT static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_VorbisComment *block1, const FLAC__StreamMetadata_VorbisComment *block2) { - unsigned i; + uint32_t i; - if(block1->vendor_string.length != block2->vendor_string.length) + if (block1->vendor_string.length != block2->vendor_string.length) return false; - if(0 != block1->vendor_string.entry && 0 != block2->vendor_string.entry) { - if(0 != memcmp(block1->vendor_string.entry, block2->vendor_string.entry, block1->vendor_string.length)) + if (block1->vendor_string.entry != NULL && block2->vendor_string.entry != NULL) { + if (memcmp(block1->vendor_string.entry, block2->vendor_string.entry, block1->vendor_string.length) != 0) return false; } - else if(block1->vendor_string.entry != block2->vendor_string.entry) + else if (block1->vendor_string.entry != block2->vendor_string.entry) return false; - if(block1->num_comments != block2->num_comments) + if (block1->num_comments != block2->num_comments) return false; - for(i = 0; i < block1->num_comments; i++) { - if(0 != block1->comments[i].entry && 0 != block2->comments[i].entry) { - if(0 != memcmp(block1->comments[i].entry, block2->comments[i].entry, block1->comments[i].length)) + for (i = 0; i < block1->num_comments; i++) { + if (block1->comments[i].entry != NULL && block2->comments[i].entry != NULL) { + if (memcmp(block1->comments[i].entry, block2->comments[i].entry, block1->comments[i].length) != 0) return false; } - else if(block1->comments[i].entry != block2->comments[i].entry) + else if (block1->comments[i].entry != block2->comments[i].entry) return false; } return true; @@ -785,99 +786,99 @@ static FLAC__bool compare_block_data_vorbiscomment_(const FLAC__StreamMetadata_V static FLAC__bool compare_block_data_cuesheet_(const FLAC__StreamMetadata_CueSheet *block1, const FLAC__StreamMetadata_CueSheet *block2) { - unsigned i, j; + uint32_t i, j; - if(0 != strcmp(block1->media_catalog_number, block2->media_catalog_number)) + if (strcmp(block1->media_catalog_number, block2->media_catalog_number) != 0) return false; - if(block1->lead_in != block2->lead_in) + if (block1->lead_in != block2->lead_in) return false; - if(block1->is_cd != block2->is_cd) + if (block1->is_cd != block2->is_cd) return false; - if(block1->num_tracks != block2->num_tracks) + if (block1->num_tracks != block2->num_tracks) return false; - if(0 != block1->tracks && 0 != block2->tracks) { + if (block1->tracks != NULL && block2->tracks != NULL) { FLAC__ASSERT(block1->num_tracks > 0); - for(i = 0; i < block1->num_tracks; i++) { - if(block1->tracks[i].offset != block2->tracks[i].offset) + for (i = 0; i < block1->num_tracks; i++) { + if (block1->tracks[i].offset != block2->tracks[i].offset) return false; - if(block1->tracks[i].number != block2->tracks[i].number) + if (block1->tracks[i].number != block2->tracks[i].number) return false; - if(0 != memcmp(block1->tracks[i].isrc, block2->tracks[i].isrc, sizeof(block1->tracks[i].isrc))) + if (memcmp(block1->tracks[i].isrc, block2->tracks[i].isrc, sizeof(block1->tracks[i].isrc)) != 0) return false; - if(block1->tracks[i].type != block2->tracks[i].type) + if (block1->tracks[i].type != block2->tracks[i].type) return false; - if(block1->tracks[i].pre_emphasis != block2->tracks[i].pre_emphasis) + if (block1->tracks[i].pre_emphasis != block2->tracks[i].pre_emphasis) return false; - if(block1->tracks[i].num_indices != block2->tracks[i].num_indices) + if (block1->tracks[i].num_indices != block2->tracks[i].num_indices) return false; - if(0 != block1->tracks[i].indices && 0 != block2->tracks[i].indices) { + if (block1->tracks[i].indices != NULL && block2->tracks[i].indices != NULL) { FLAC__ASSERT(block1->tracks[i].num_indices > 0); - for(j = 0; j < block1->tracks[i].num_indices; j++) { - if(block1->tracks[i].indices[j].offset != block2->tracks[i].indices[j].offset) + for (j = 0; j < block1->tracks[i].num_indices; j++) { + if (block1->tracks[i].indices[j].offset != block2->tracks[i].indices[j].offset) return false; - if(block1->tracks[i].indices[j].number != block2->tracks[i].indices[j].number) + if (block1->tracks[i].indices[j].number != block2->tracks[i].indices[j].number) return false; } } - else if(block1->tracks[i].indices != block2->tracks[i].indices) + else if (block1->tracks[i].indices != block2->tracks[i].indices) return false; } } - else if(block1->tracks != block2->tracks) + else if (block1->tracks != block2->tracks) return false; return true; } static FLAC__bool compare_block_data_picture_(const FLAC__StreamMetadata_Picture *block1, const FLAC__StreamMetadata_Picture *block2) { - if(block1->type != block2->type) + if (block1->type != block2->type) return false; - if(block1->mime_type != block2->mime_type && (0 == block1->mime_type || 0 == block2->mime_type || strcmp(block1->mime_type, block2->mime_type))) + if (block1->mime_type != block2->mime_type && (block1->mime_type == 0 || block2->mime_type == 0 || strcmp(block1->mime_type, block2->mime_type))) return false; - if(block1->description != block2->description && (0 == block1->description || 0 == block2->description || strcmp((const char *)block1->description, (const char *)block2->description))) + if (block1->description != block2->description && (block1->description == 0 || block2->description == 0 || strcmp((const char *)block1->description, (const char *)block2->description))) return false; - if(block1->width != block2->width) + if (block1->width != block2->width) return false; - if(block1->height != block2->height) + if (block1->height != block2->height) return false; - if(block1->depth != block2->depth) + if (block1->depth != block2->depth) return false; - if(block1->colors != block2->colors) + if (block1->colors != block2->colors) return false; - if(block1->data_length != block2->data_length) + if (block1->data_length != block2->data_length) return false; - if(block1->data != block2->data && (0 == block1->data || 0 == block2->data || memcmp(block1->data, block2->data, block1->data_length))) + if (block1->data != block2->data && (block1->data == NULL || block2->data == NULL || memcmp(block1->data, block2->data, block1->data_length))) return false; return true; } -static FLAC__bool compare_block_data_unknown_(const FLAC__StreamMetadata_Unknown *block1, const FLAC__StreamMetadata_Unknown *block2, unsigned block_length) +static FLAC__bool compare_block_data_unknown_(const FLAC__StreamMetadata_Unknown *block1, const FLAC__StreamMetadata_Unknown *block2, uint32_t block_length) { - FLAC__ASSERT(0 != block1); - FLAC__ASSERT(0 != block2); + FLAC__ASSERT(block1 != NULL); + FLAC__ASSERT(block2 != NULL); - if(0 != block1->data && 0 != block2->data) - return 0 == memcmp(block1->data, block2->data, block_length); + if (block1->data != NULL && block2->data != NULL) + return memcmp(block1->data, block2->data, block_length) == 0; else return block1->data == block2->data; } FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *block1, const FLAC__StreamMetadata *block2) { - FLAC__ASSERT(0 != block1); - FLAC__ASSERT(0 != block2); + FLAC__ASSERT(block1 != NULL); + FLAC__ASSERT(block2 != NULL); - if(block1->type != block2->type) { + if (block1->type != block2->type) { return false; } - if(block1->is_last != block2->is_last) { + if (block1->is_last != block2->is_last) { return false; } - if(block1->length != block2->length) { + if (block1->length != block2->length) { return false; } switch(block1->type) { @@ -900,42 +901,44 @@ FLAC_API FLAC__bool FLAC__metadata_object_is_equal(const FLAC__StreamMetadata *b } } -FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, unsigned length, FLAC__bool copy) +FLAC_API FLAC__bool FLAC__metadata_object_application_set_data(FLAC__StreamMetadata *object, FLAC__byte *data, uint32_t length, FLAC__bool copy) { FLAC__byte *save; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_APPLICATION); - FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false)); + FLAC__ASSERT((data != NULL && length > 0) || (data == NULL && length == 0 && copy == false)); save = object->data.application.data; /* do the copy first so that if we fail we leave the object untouched */ - if(copy) { - if(!copy_bytes_(&object->data.application.data, data, length)) + if (copy) { + if (!copy_bytes_(&object->data.application.data, data, length)) return false; } else { object->data.application.data = data; } - if(0 != save) - free(save); + free(save); object->length = FLAC__STREAM_METADATA_APPLICATION_ID_LEN / 8 + length; return true; } -FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, unsigned new_num_points) +FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMetadata *object, uint32_t new_num_points) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); - if(0 == object->data.seek_table.points) { + if((FLAC__uint64)(new_num_points) * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) + return false; + + if (object->data.seek_table.points == 0) { FLAC__ASSERT(object->data.seek_table.num_points == 0); - if(0 == new_num_points) + if (new_num_points == 0) return true; - else if(0 == (object->data.seek_table.points = seekpoint_array_new_(new_num_points))) + else if ((object->data.seek_table.points = seekpoint_array_new_(new_num_points)) == 0) return false; } else { @@ -943,22 +946,27 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMe const size_t new_size = new_num_points * sizeof(FLAC__StreamMetadata_SeekPoint); /* overflow check */ - if((size_t)new_num_points > SIZE_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) + if (new_num_points > UINT32_MAX / sizeof(FLAC__StreamMetadata_SeekPoint)) return false; FLAC__ASSERT(object->data.seek_table.num_points > 0); - if(new_size == 0) { + if (new_size == 0) { free(object->data.seek_table.points); object->data.seek_table.points = 0; } - else if(0 == (object->data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)realloc(object->data.seek_table.points, new_size))) - return false; + else { + /* Leave object->data.seek_table.points untouched if realloc fails */ + FLAC__StreamMetadata_SeekPoint *tmpptr; + if ((tmpptr = realloc(object->data.seek_table.points, new_size)) == NULL) + return false; + object->data.seek_table.points = tmpptr; + } /* if growing, set new elements to placeholders */ - if(new_size > old_size) { - unsigned i; - for(i = object->data.seek_table.num_points; i < new_num_points; i++) { + if (new_size > old_size) { + uint32_t i; + for (i = object->data.seek_table.num_points; i < new_num_points; i++) { object->data.seek_table.points[i].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER; object->data.seek_table.points[i].stream_offset = 0; object->data.seek_table.points[i].frame_samples = 0; @@ -972,28 +980,28 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_resize_points(FLAC__StreamMe return true; } -FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point) +FLAC_API void FLAC__metadata_object_seektable_set_point(FLAC__StreamMetadata *object, uint32_t point_num, FLAC__StreamMetadata_SeekPoint point) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); FLAC__ASSERT(point_num < object->data.seek_table.num_points); object->data.seek_table.points[point_num] = point; } -FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, unsigned point_num, FLAC__StreamMetadata_SeekPoint point) +FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMetadata *object, uint32_t point_num, FLAC__StreamMetadata_SeekPoint point) { int i; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); FLAC__ASSERT(point_num <= object->data.seek_table.num_points); - if(!FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points+1)) + if (!FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points+1)) return false; /* move all points >= point_num forward one space */ - for(i = (int)object->data.seek_table.num_points-1; i > (int)point_num; i--) + for (i = (int)object->data.seek_table.num_points-1; i > (int)point_num; i--) object->data.seek_table.points[i] = object->data.seek_table.points[i-1]; FLAC__metadata_object_seektable_set_point(object, point_num, point); @@ -1001,16 +1009,16 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_insert_point(FLAC__StreamMet return true; } -FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, unsigned point_num) +FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMetadata *object, uint32_t point_num) { - unsigned i; + uint32_t i; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); FLAC__ASSERT(point_num < object->data.seek_table.num_points); /* move all points > point_num backward one space */ - for(i = point_num; i < object->data.seek_table.num_points-1; i++) + for (i = point_num; i < object->data.seek_table.num_points-1; i++) object->data.seek_table.points[i] = object->data.seek_table.points[i+1]; return FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points-1); @@ -1018,18 +1026,18 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_delete_point(FLAC__StreamMet FLAC_API FLAC__bool FLAC__metadata_object_seektable_is_legal(const FLAC__StreamMetadata *object) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); return FLAC__format_seektable_is_legal(&object->data.seek_table); } -FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, unsigned num) +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_placeholders(FLAC__StreamMetadata *object, uint32_t num) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); - if(num > 0) + if (num > 0) /* WATCHOUT: we rely on the fact that growing the array adds PLACEHOLDERS at the end */ return FLAC__metadata_object_seektable_resize_points(object, object->data.seek_table.num_points + num); else @@ -1040,12 +1048,12 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__ { FLAC__StreamMetadata_SeekTable *seek_table; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); seek_table = &object->data.seek_table; - if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + 1)) + if (!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + 1)) return false; seek_table->points[seek_table->num_points - 1].sample_number = sample_number; @@ -1055,22 +1063,22 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_point(FLAC__ return true; } -FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], unsigned num) +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC__StreamMetadata *object, FLAC__uint64 sample_numbers[], uint32_t num) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); - FLAC__ASSERT(0 != sample_numbers || num == 0); + FLAC__ASSERT(sample_numbers != 0 || num == 0); - if(num > 0) { + if (num > 0) { FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table; - unsigned i, j; + uint32_t i, j; i = seek_table->num_points; - if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num)) + if (!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num)) return false; - for(j = 0; j < num; i++, j++) { + for (j = 0; j < num; i++, j++) { seek_table->points[i].sample_number = sample_numbers[j]; seek_table->points[i].stream_offset = 0; seek_table->points[i].frame_samples = 0; @@ -1080,22 +1088,21 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_points(FLAC_ return true; } -FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, unsigned num, FLAC__uint64 total_samples) +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points(FLAC__StreamMetadata *object, uint32_t num, FLAC__uint64 total_samples) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); - FLAC__ASSERT(total_samples > 0); - if(num > 0 && total_samples > 0) { + if (num > 0 && total_samples > 0) { FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table; - unsigned i, j; + uint32_t i, j; i = seek_table->num_points; - if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num)) + if (!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + num)) return false; - for(j = 0; j < num; i++, j++) { + for (j = 0; j < num; i++, j++) { seek_table->points[i].sample_number = total_samples * (FLAC__uint64)j / (FLAC__uint64)num; seek_table->points[i].stream_offset = 0; seek_table->points[i].frame_samples = 0; @@ -1105,30 +1112,35 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_point return true; } -FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata *object, unsigned samples, FLAC__uint64 total_samples) +FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_points_by_samples(FLAC__StreamMetadata *object, uint32_t samples, FLAC__uint64 total_samples) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); - FLAC__ASSERT(samples > 0); - FLAC__ASSERT(total_samples > 0); - if(samples > 0 && total_samples > 0) { + if (samples > 0 && total_samples > 0) { FLAC__StreamMetadata_SeekTable *seek_table = &object->data.seek_table; - unsigned i, j; + uint32_t i, j; FLAC__uint64 num, sample; num = 1 + total_samples / samples; /* 1+ for the first sample at 0 */ /* now account for the fact that we don't place a seekpoint at "total_samples" since samples are number from 0: */ - if(total_samples % samples == 0) + if (total_samples % samples == 0) num--; + /* Put a strict upper bound on the number of allowed seek points. */ + if (num > 32768) { + /* Set the bound and recalculate samples accordingly. */ + num = 32768; + samples = (uint32_t)(total_samples / num); + } + i = seek_table->num_points; - if(!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + (unsigned)num)) + if (!FLAC__metadata_object_seektable_resize_points(object, seek_table->num_points + (uint32_t)num)) return false; sample = 0; - for(j = 0; j < num; i++, j++, sample += samples) { + for (j = 0; j < num; i++, j++, sample += samples) { seek_table->points[i].sample_number = sample; seek_table->points[i].stream_offset = 0; seek_table->points[i].frame_samples = 0; @@ -1140,9 +1152,9 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_append_spaced_point FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort(FLAC__StreamMetadata *object, FLAC__bool compact) { - unsigned unique; + uint32_t unique; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_SEEKTABLE); unique = FLAC__format_seektable_sort(&object->data.seek_table); @@ -1152,51 +1164,76 @@ FLAC_API FLAC__bool FLAC__metadata_object_seektable_template_sort(FLAC__StreamMe FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_vendor_string(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) { - if(!FLAC__format_vorbiscomment_entry_value_is_legal(entry.entry, entry.length)) + if (!FLAC__format_vorbiscomment_entry_value_is_legal(entry.entry, entry.length)) return false; return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.vendor_string, &entry, copy); } -FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, unsigned new_num_comments) +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__StreamMetadata *object, uint32_t new_num_comments) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - if(0 == object->data.vorbis_comment.comments) { + if (object->data.vorbis_comment.comments == NULL) { FLAC__ASSERT(object->data.vorbis_comment.num_comments == 0); - if(0 == new_num_comments) + if (new_num_comments == 0) return true; - else if(0 == (object->data.vorbis_comment.comments = vorbiscomment_entry_array_new_(new_num_comments))) - return false; + else { + uint32_t i; + if ((object->data.vorbis_comment.comments = vorbiscomment_entry_array_new_(new_num_comments)) == NULL) + return false; + for (i = 0; i < new_num_comments; i++) { + object->data.vorbis_comment.comments[i].length = 0; + if ((object->data.vorbis_comment.comments[i].entry = safe_malloc_(1)) == NULL) { + object->data.vorbis_comment.num_comments = i+1; + return false; + } + object->data.vorbis_comment.comments[i].entry[0] = '\0'; + } + } } else { const size_t old_size = object->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); const size_t new_size = new_num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry); /* overflow check */ - if((size_t)new_num_comments > SIZE_MAX / sizeof(FLAC__StreamMetadata_VorbisComment_Entry)) + if (new_num_comments > UINT32_MAX / sizeof(FLAC__StreamMetadata_VorbisComment_Entry)) return false; FLAC__ASSERT(object->data.vorbis_comment.num_comments > 0); /* if shrinking, free the truncated entries */ - if(new_num_comments < object->data.vorbis_comment.num_comments) { - unsigned i; - for(i = new_num_comments; i < object->data.vorbis_comment.num_comments; i++) - if(0 != object->data.vorbis_comment.comments[i].entry) + if (new_num_comments < object->data.vorbis_comment.num_comments) { + uint32_t i; + for (i = new_num_comments; i < object->data.vorbis_comment.num_comments; i++) + if (object->data.vorbis_comment.comments[i].entry != NULL) free(object->data.vorbis_comment.comments[i].entry); } - if(new_size == 0) { + if (new_size == 0) { free(object->data.vorbis_comment.comments); object->data.vorbis_comment.comments = 0; } - else if(0 == (object->data.vorbis_comment.comments = (FLAC__StreamMetadata_VorbisComment_Entry*)realloc(object->data.vorbis_comment.comments, new_size))) - return false; + else { + /* Leave object->data.vorbis_comment.comments untouched if realloc fails */ + FLAC__StreamMetadata_VorbisComment_Entry *tmpptr; + if ((tmpptr = realloc(object->data.vorbis_comment.comments, new_size)) == NULL) + return false; + object->data.vorbis_comment.comments = tmpptr; + } /* if growing, zero all the length/pointers of new elements */ - if(new_size > old_size) - memset(object->data.vorbis_comment.comments + object->data.vorbis_comment.num_comments, 0, new_size - old_size); + if (new_size > old_size) { + uint32_t i; + for (i = object->data.vorbis_comment.num_comments; i < new_num_comments; i++) { + object->data.vorbis_comment.comments[i].length = 0; + if ((object->data.vorbis_comment.comments[i].entry = safe_malloc_(1)) == NULL) { + object->data.vorbis_comment.num_comments = i+1; + return false; + } + object->data.vorbis_comment.comments[i].entry[0] = '\0'; + } + } } object->data.vorbis_comment.num_comments = new_num_comments; @@ -1205,52 +1242,54 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_resize_comments(FLAC__St return true; } -FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_set_comment(FLAC__StreamMetadata *object, uint32_t comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(comment_num < object->data.vorbis_comment.num_comments); - if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) + if (!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) return false; return vorbiscomment_set_entry_(object, &object->data.vorbis_comment.comments[comment_num], &entry, copy); } -FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, unsigned comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_insert_comment(FLAC__StreamMetadata *object, uint32_t comment_num, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) { FLAC__StreamMetadata_VorbisComment *vc; + FLAC__StreamMetadata_VorbisComment_Entry temp; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); FLAC__ASSERT(comment_num <= object->data.vorbis_comment.num_comments); - if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) + if (!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) return false; vc = &object->data.vorbis_comment; - if(!FLAC__metadata_object_vorbiscomment_resize_comments(object, vc->num_comments+1)) + if (!FLAC__metadata_object_vorbiscomment_resize_comments(object, vc->num_comments+1)) return false; /* move all comments >= comment_num forward one space */ + /* reuse newly added empty comment */ + temp = vc->comments[vc->num_comments-1]; memmove(&vc->comments[comment_num+1], &vc->comments[comment_num], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments-1-comment_num)); - vc->comments[comment_num].length = 0; - vc->comments[comment_num].entry = 0; + vc->comments[comment_num] = temp; return FLAC__metadata_object_vorbiscomment_set_comment(object, comment_num, entry, copy); } FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_append_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool copy) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); return FLAC__metadata_object_vorbiscomment_insert_comment(object, object->data.vorbis_comment.num_comments, entry, copy); } FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__StreamMetadata *object, FLAC__StreamMetadata_VorbisComment_Entry entry, FLAC__bool all, FLAC__bool copy) { - FLAC__ASSERT(0 != entry.entry && entry.length > 0); + FLAC__ASSERT(entry.entry != NULL); - if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) + if (!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) return false; { @@ -1258,23 +1297,26 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__St size_t field_name_length; const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length); - FLAC__ASSERT(0 != eq); - - if(0 == eq) + if (eq == NULL) return false; /* double protection */ field_name_length = eq-entry.entry; - if((i = vorbiscomment_find_entry_from_(object, 0, (const char *)entry.entry, field_name_length)) >= 0) { - unsigned index = (unsigned)i; - if(!FLAC__metadata_object_vorbiscomment_set_comment(object, index, entry, copy)) + i = vorbiscomment_find_entry_from_(object, 0, (const char *)entry.entry, field_name_length); + if (i >= 0) { + uint32_t indx = (uint32_t)i; + if (!FLAC__metadata_object_vorbiscomment_set_comment(object, indx, entry, copy)) return false; - if(all && (index+1 < object->data.vorbis_comment.num_comments)) { - for(i = vorbiscomment_find_entry_from_(object, index+1, (const char *)entry.entry, field_name_length); i >= 0; ) { - if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, (unsigned)i)) + entry = object->data.vorbis_comment.comments[indx]; + indx++; /* skip over replaced comment */ + if (all && indx < object->data.vorbis_comment.num_comments) { + i = vorbiscomment_find_entry_from_(object, indx, (const char *)entry.entry, field_name_length); + while (i >= 0) { + indx = (uint32_t)i; + if (!FLAC__metadata_object_vorbiscomment_delete_comment(object, indx)) return false; - if((unsigned)i < object->data.vorbis_comment.num_comments) - i = vorbiscomment_find_entry_from_(object, (unsigned)i, (const char *)entry.entry, field_name_length); + if (indx < object->data.vorbis_comment.num_comments) + i = vorbiscomment_find_entry_from_(object, indx, (const char *)entry.entry, field_name_length); else i = -1; } @@ -1286,19 +1328,18 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_replace_comment(FLAC__St } } -FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, unsigned comment_num) +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__StreamMetadata *object, uint32_t comment_num) { FLAC__StreamMetadata_VorbisComment *vc; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); FLAC__ASSERT(comment_num < object->data.vorbis_comment.num_comments); vc = &object->data.vorbis_comment; /* free the comment at comment_num */ - if(0 != vc->comments[comment_num].entry) - free(vc->comments[comment_num].entry); + free(vc->comments[comment_num].entry); /* move all comments > comment_num backward one space */ memmove(&vc->comments[comment_num], &vc->comments[comment_num+1], sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*(vc->num_comments-comment_num-1)); @@ -1310,49 +1351,49 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_delete_comment(FLAC__Str FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field_name, const char *field_value) { - FLAC__ASSERT(0 != entry); - FLAC__ASSERT(0 != field_name); - FLAC__ASSERT(0 != field_value); + FLAC__ASSERT(entry != NULL); + FLAC__ASSERT(field_name != NULL); + FLAC__ASSERT(field_value != NULL); - if(!FLAC__format_vorbiscomment_entry_name_is_legal(field_name)) + if (!FLAC__format_vorbiscomment_entry_name_is_legal(field_name)) return false; - if(!FLAC__format_vorbiscomment_entry_value_is_legal((const FLAC__byte *)field_value, (unsigned)(-1))) + if (!FLAC__format_vorbiscomment_entry_value_is_legal((const FLAC__byte *)field_value, (uint32_t)(-1))) return false; { const size_t nn = strlen(field_name); const size_t nv = strlen(field_value); entry->length = nn + 1 /*=*/ + nv; - if(0 == (entry->entry = (FLAC__byte*)safe_malloc_add_4op_(nn, /*+*/1, /*+*/nv, /*+*/1))) + if ((entry->entry = safe_malloc_add_4op_(nn, /*+*/1, /*+*/nv, /*+*/1)) == NULL) return false; memcpy(entry->entry, field_name, nn); entry->entry[nn] = '='; memcpy(entry->entry+nn+1, field_value, nv); entry->entry[entry->length] = '\0'; } - + return true; } FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair(const FLAC__StreamMetadata_VorbisComment_Entry entry, char **field_name, char **field_value) { - FLAC__ASSERT(0 != entry.entry && entry.length > 0); - FLAC__ASSERT(0 != field_name); - FLAC__ASSERT(0 != field_value); + FLAC__ASSERT(entry.entry != NULL); + FLAC__ASSERT(field_name != NULL); + FLAC__ASSERT(field_value != NULL); - if(!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) + if (!FLAC__format_vorbiscomment_entry_is_legal(entry.entry, entry.length)) return false; { const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length); const size_t nn = eq-entry.entry; const size_t nv = entry.length-nn-1; /* -1 for the '=' */ - FLAC__ASSERT(0 != eq); - if(0 == eq) + + if (eq == NULL) return false; /* double protection */ - if(0 == (*field_name = (char*)safe_malloc_add_2op_(nn, /*+*/1))) + if ((*field_name = safe_malloc_add_2op_(nn, /*+*/1)) == NULL) return false; - if(0 == (*field_value = (char*)safe_malloc_add_2op_(nv, /*+*/1))) { + if ((*field_value = safe_malloc_add_2op_(nv, /*+*/1)) == NULL) { free(*field_name); return false; } @@ -1365,39 +1406,33 @@ FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_to_name_value_pair return true; } -FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, unsigned field_name_length) +FLAC_API FLAC__bool FLAC__metadata_object_vorbiscomment_entry_matches(const FLAC__StreamMetadata_VorbisComment_Entry entry, const char *field_name, uint32_t field_name_length) { - FLAC__ASSERT(0 != entry.entry && entry.length > 0); + FLAC__ASSERT(entry.entry != NULL); { const FLAC__byte *eq = (FLAC__byte*)memchr(entry.entry, '=', entry.length); -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ || defined __EMX__ -#define FLAC__STRNCASECMP strnicmp -#else -#define FLAC__STRNCASECMP strncasecmp -#endif - return (0 != eq && (unsigned)(eq-entry.entry) == field_name_length && 0 == FLAC__STRNCASECMP(field_name, (const char *)entry.entry, field_name_length)); -#undef FLAC__STRNCASECMP + return (eq != NULL && (uint32_t)(eq-entry.entry) == field_name_length && FLAC__STRNCASECMP(field_name, (const char *)entry.entry, field_name_length) == 0); } } -FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, unsigned offset, const char *field_name) +FLAC_API int FLAC__metadata_object_vorbiscomment_find_entry_from(const FLAC__StreamMetadata *object, uint32_t offset, const char *field_name) { - FLAC__ASSERT(0 != field_name); + FLAC__ASSERT(field_name != NULL); return vorbiscomment_find_entry_from_(object, offset, field_name, strlen(field_name)); } FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__StreamMetadata *object, const char *field_name) { - const unsigned field_name_length = strlen(field_name); - unsigned i; + const uint32_t field_name_length = strlen(field_name); + uint32_t i; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); - for(i = 0; i < object->data.vorbis_comment.num_comments; i++) { - if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) { - if(!FLAC__metadata_object_vorbiscomment_delete_comment(object, i)) + for (i = 0; i < object->data.vorbis_comment.num_comments; i++) { + if (FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) { + if (!FLAC__metadata_object_vorbiscomment_delete_comment(object, i)) return -1; else return 1; @@ -1410,18 +1445,18 @@ FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entry_matching(FLAC__Str FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__StreamMetadata *object, const char *field_name) { FLAC__bool ok = true; - unsigned matching = 0; - const unsigned field_name_length = strlen(field_name); + uint32_t matching = 0; + const uint32_t field_name_length = strlen(field_name); int i; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); /* must delete from end to start otherwise it will interfere with our iteration */ - for(i = (int)object->data.vorbis_comment.num_comments - 1; ok && i >= 0; i--) { - if(FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) { + for (i = (int)object->data.vorbis_comment.num_comments - 1; ok && i >= 0; i--) { + if (FLAC__metadata_object_vorbiscomment_entry_matches(object->data.vorbis_comment.comments[i], field_name, field_name_length)) { matching++; - ok &= FLAC__metadata_object_vorbiscomment_delete_comment(object, (unsigned)i); + ok &= FLAC__metadata_object_vorbiscomment_delete_comment(object, (uint32_t)i); } } @@ -1430,17 +1465,17 @@ FLAC_API int FLAC__metadata_object_vorbiscomment_remove_entries_matching(FLAC__S FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_new(void) { - return (FLAC__StreamMetadata_CueSheet_Track*)calloc(1, sizeof(FLAC__StreamMetadata_CueSheet_Track)); + return calloc(1, sizeof(FLAC__StreamMetadata_CueSheet_Track)); } FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_track_clone(const FLAC__StreamMetadata_CueSheet_Track *object) { FLAC__StreamMetadata_CueSheet_Track *to; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); - if(0 != (to = FLAC__metadata_object_cuesheet_track_new())) { - if(!copy_track_(to, object)) { + if ((to = FLAC__metadata_object_cuesheet_track_new()) != NULL) { + if (!copy_track_(to, object)) { FLAC__metadata_object_cuesheet_track_delete(to); return 0; } @@ -1451,9 +1486,9 @@ FLAC_API FLAC__StreamMetadata_CueSheet_Track *FLAC__metadata_object_cuesheet_tra void FLAC__metadata_object_cuesheet_track_delete_data(FLAC__StreamMetadata_CueSheet_Track *object) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); - if(0 != object->indices) { + if (object->indices != NULL) { FLAC__ASSERT(object->num_indices > 0); free(object->indices); } @@ -1465,20 +1500,20 @@ FLAC_API void FLAC__metadata_object_cuesheet_track_delete(FLAC__StreamMetadata_C free(object); } -FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, unsigned track_num, unsigned new_num_indices) +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t new_num_indices) { FLAC__StreamMetadata_CueSheet_Track *track; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); track = &object->data.cue_sheet.tracks[track_num]; - if(0 == track->indices) { + if (track->indices == NULL) { FLAC__ASSERT(track->num_indices == 0); - if(0 == new_num_indices) + if (new_num_indices == 0) return true; - else if(0 == (track->indices = cuesheet_track_index_array_new_(new_num_indices))) + else if ((track->indices = cuesheet_track_index_array_new_(new_num_indices)) == NULL) return false; } else { @@ -1486,20 +1521,25 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__St const size_t new_size = new_num_indices * sizeof(FLAC__StreamMetadata_CueSheet_Index); /* overflow check */ - if((size_t)new_num_indices > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Index)) + if (new_num_indices > UINT32_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Index)) return false; FLAC__ASSERT(track->num_indices > 0); - if(new_size == 0) { + if (new_size == 0) { free(track->indices); track->indices = 0; } - else if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)realloc(track->indices, new_size))) - return false; + else { + /* Leave track->indices untouched if realloc fails */ + FLAC__StreamMetadata_CueSheet_Index *tmpptr; + if ((tmpptr = realloc(track->indices, new_size)) == NULL) + return false; + track->indices = tmpptr; + } /* if growing, zero all the lengths/pointers of new elements */ - if(new_size > old_size) + if (new_size > old_size) memset(track->indices + track->num_indices, 0, new_size - old_size); } @@ -1509,40 +1549,40 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_resize_indices(FLAC__St return true; } -FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num, FLAC__StreamMetadata_CueSheet_Index index) +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_index(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t index_num, FLAC__StreamMetadata_CueSheet_Index indx) { FLAC__StreamMetadata_CueSheet_Track *track; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); FLAC__ASSERT(index_num <= object->data.cue_sheet.tracks[track_num].num_indices); track = &object->data.cue_sheet.tracks[track_num]; - if(!FLAC__metadata_object_cuesheet_track_resize_indices(object, track_num, track->num_indices+1)) + if (!FLAC__metadata_object_cuesheet_track_resize_indices(object, track_num, track->num_indices+1)) return false; /* move all indices >= index_num forward one space */ memmove(&track->indices[index_num+1], &track->indices[index_num], sizeof(FLAC__StreamMetadata_CueSheet_Index)*(track->num_indices-1-index_num)); - track->indices[index_num] = index; + track->indices[index_num] = indx; cuesheet_calculate_length_(object); return true; } -FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num) +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_insert_blank_index(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t index_num) { - FLAC__StreamMetadata_CueSheet_Index index; - memset(&index, 0, sizeof(index)); - return FLAC__metadata_object_cuesheet_track_insert_index(object, track_num, index_num, index); + FLAC__StreamMetadata_CueSheet_Index indx; + memset(&indx, 0, sizeof(indx)); + return FLAC__metadata_object_cuesheet_track_insert_index(object, track_num, index_num, indx); } -FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, unsigned track_num, unsigned index_num) +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__StreamMetadata *object, uint32_t track_num, uint32_t index_num) { FLAC__StreamMetadata_CueSheet_Track *track; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); FLAC__ASSERT(index_num < object->data.cue_sheet.tracks[track_num].num_indices); @@ -1557,16 +1597,16 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_track_delete_index(FLAC__Stre return true; } -FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, unsigned new_num_tracks) +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMetadata *object, uint32_t new_num_tracks) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); - if(0 == object->data.cue_sheet.tracks) { + if (object->data.cue_sheet.tracks == NULL) { FLAC__ASSERT(object->data.cue_sheet.num_tracks == 0); - if(0 == new_num_tracks) + if (new_num_tracks == 0) return true; - else if(0 == (object->data.cue_sheet.tracks = cuesheet_track_array_new_(new_num_tracks))) + else if ((object->data.cue_sheet.tracks = cuesheet_track_array_new_(new_num_tracks)) == NULL) return false; } else { @@ -1574,28 +1614,32 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMet const size_t new_size = new_num_tracks * sizeof(FLAC__StreamMetadata_CueSheet_Track); /* overflow check */ - if((size_t)new_num_tracks > SIZE_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Track)) + if (new_num_tracks > UINT32_MAX / sizeof(FLAC__StreamMetadata_CueSheet_Track)) return false; FLAC__ASSERT(object->data.cue_sheet.num_tracks > 0); /* if shrinking, free the truncated entries */ - if(new_num_tracks < object->data.cue_sheet.num_tracks) { - unsigned i; - for(i = new_num_tracks; i < object->data.cue_sheet.num_tracks; i++) - if(0 != object->data.cue_sheet.tracks[i].indices) - free(object->data.cue_sheet.tracks[i].indices); + if (new_num_tracks < object->data.cue_sheet.num_tracks) { + uint32_t i; + for (i = new_num_tracks; i < object->data.cue_sheet.num_tracks; i++) + free(object->data.cue_sheet.tracks[i].indices); } - if(new_size == 0) { + if (new_size == 0) { free(object->data.cue_sheet.tracks); object->data.cue_sheet.tracks = 0; } - else if(0 == (object->data.cue_sheet.tracks = (FLAC__StreamMetadata_CueSheet_Track*)realloc(object->data.cue_sheet.tracks, new_size))) - return false; + else { + /* Leave object->data.cue_sheet.tracks untouched if realloc fails */ + FLAC__StreamMetadata_CueSheet_Track *tmpptr; + if ((tmpptr = realloc(object->data.cue_sheet.tracks, new_size)) == NULL) + return false; + object->data.cue_sheet.tracks = tmpptr; + } /* if growing, zero all the lengths/pointers of new elements */ - if(new_size > old_size) + if (new_size > old_size) memset(object->data.cue_sheet.tracks + object->data.cue_sheet.num_tracks, 0, new_size - old_size); } @@ -1605,25 +1649,25 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_resize_tracks(FLAC__StreamMet return true; } -FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy) +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_set_track(FLAC__StreamMetadata *object, uint32_t track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); return cuesheet_set_track_(object, object->data.cue_sheet.tracks + track_num, track, copy); } -FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, unsigned track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy) +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMetadata *object, uint32_t track_num, FLAC__StreamMetadata_CueSheet_Track *track, FLAC__bool copy) { FLAC__StreamMetadata_CueSheet *cs; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); FLAC__ASSERT(track_num <= object->data.cue_sheet.num_tracks); cs = &object->data.cue_sheet; - if(!FLAC__metadata_object_cuesheet_resize_tracks(object, cs->num_tracks+1)) + if (!FLAC__metadata_object_cuesheet_resize_tracks(object, cs->num_tracks+1)) return false; /* move all tracks >= track_num forward one space */ @@ -1634,26 +1678,25 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_track(FLAC__StreamMeta return FLAC__metadata_object_cuesheet_set_track(object, track_num, track, copy); } -FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, unsigned track_num) +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_insert_blank_track(FLAC__StreamMetadata *object, uint32_t track_num) { FLAC__StreamMetadata_CueSheet_Track track; memset(&track, 0, sizeof(track)); return FLAC__metadata_object_cuesheet_insert_track(object, track_num, &track, /*copy=*/false); } -FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, unsigned track_num) +FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMetadata *object, uint32_t track_num) { FLAC__StreamMetadata_CueSheet *cs; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); FLAC__ASSERT(track_num < object->data.cue_sheet.num_tracks); cs = &object->data.cue_sheet; /* free the track at track_num */ - if(0 != cs->tracks[track_num].indices) - free(cs->tracks[track_num].indices); + free(cs->tracks[track_num].indices); /* move all tracks > track_num backward one space */ memmove(&cs->tracks[track_num], &cs->tracks[track_num+1], sizeof(FLAC__StreamMetadata_CueSheet_Track)*(cs->num_tracks-track_num-1)); @@ -1665,13 +1708,13 @@ FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_delete_track(FLAC__StreamMeta FLAC_API FLAC__bool FLAC__metadata_object_cuesheet_is_legal(const FLAC__StreamMetadata *object, FLAC__bool check_cd_da_subset, const char **violation) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); return FLAC__format_cuesheet_is_legal(&object->data.cue_sheet, check_cd_da_subset, violation); } -static FLAC__uint64 get_index_01_offset_(const FLAC__StreamMetadata_CueSheet *cs, unsigned track) +static FLAC__uint64 get_index_01_offset_(const FLAC__StreamMetadata_CueSheet *cs, uint32_t track) { if (track >= (cs->num_tracks-1) || cs->tracks[track].num_indices < 1) return 0; @@ -1700,7 +1743,7 @@ FLAC_API FLAC__uint32 FLAC__metadata_object_cuesheet_calculate_cddb_id(const FLA { const FLAC__StreamMetadata_CueSheet *cs; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_CUESHEET); cs = &object->data.cue_sheet; @@ -1723,27 +1766,26 @@ FLAC_API FLAC__bool FLAC__metadata_object_picture_set_mime_type(FLAC__StreamMeta char *old; size_t old_length, new_length; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE); - FLAC__ASSERT(0 != mime_type); + FLAC__ASSERT(mime_type != NULL); old = object->data.picture.mime_type; old_length = old? strlen(old) : 0; new_length = strlen(mime_type); /* do the copy first so that if we fail we leave the object untouched */ - if(copy) { - if(new_length >= SIZE_MAX) /* overflow check */ + if (copy) { + if (new_length >= SIZE_MAX) /* overflow check */ return false; - if(!copy_bytes_((FLAC__byte**)(&object->data.picture.mime_type), (FLAC__byte*)mime_type, new_length+1)) + if (!copy_bytes_((FLAC__byte**)(&object->data.picture.mime_type), (FLAC__byte*)mime_type, new_length+1)) return false; } else { object->data.picture.mime_type = mime_type; } - if(0 != old) - free(old); + free(old); object->length -= old_length; object->length += new_length; @@ -1755,27 +1797,26 @@ FLAC_API FLAC__bool FLAC__metadata_object_picture_set_description(FLAC__StreamMe FLAC__byte *old; size_t old_length, new_length; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE); - FLAC__ASSERT(0 != description); + FLAC__ASSERT(description != NULL); old = object->data.picture.description; old_length = old? strlen((const char *)old) : 0; new_length = strlen((const char *)description); /* do the copy first so that if we fail we leave the object untouched */ - if(copy) { - if(new_length >= SIZE_MAX) /* overflow check */ + if (copy) { + if (new_length >= SIZE_MAX) /* overflow check */ return false; - if(!copy_bytes_(&object->data.picture.description, description, new_length+1)) + if (!copy_bytes_(&object->data.picture.description, description, new_length+1)) return false; } else { object->data.picture.description = description; } - if(0 != old) - free(old); + free(old); object->length -= old_length; object->length += new_length; @@ -1786,23 +1827,22 @@ FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data(FLAC__StreamMetadata { FLAC__byte *old; - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE); - FLAC__ASSERT((0 != data && length > 0) || (0 == data && length == 0 && copy == false)); + FLAC__ASSERT((data != NULL && length > 0) || (data == NULL && length == 0 && copy == false)); old = object->data.picture.data; /* do the copy first so that if we fail we leave the object untouched */ - if(copy) { - if(!copy_bytes_(&object->data.picture.data, data, length)) + if (copy) { + if (!copy_bytes_(&object->data.picture.data, data, length)) return false; } else { object->data.picture.data = data; } - if(0 != old) - free(old); + free(old); object->length -= object->data.picture.data_length; object->data.picture.data_length = length; @@ -1812,8 +1852,167 @@ FLAC_API FLAC__bool FLAC__metadata_object_picture_set_data(FLAC__StreamMetadata FLAC_API FLAC__bool FLAC__metadata_object_picture_is_legal(const FLAC__StreamMetadata *object, const char **violation) { - FLAC__ASSERT(0 != object); + FLAC__ASSERT(object != NULL); FLAC__ASSERT(object->type == FLAC__METADATA_TYPE_PICTURE); return FLAC__format_picture_is_legal(&object->data.picture, violation); } + +FLAC_API FLAC__byte * FLAC__metadata_object_get_raw(const FLAC__StreamMetadata *object) +{ + FLAC__BitWriter *bw; + const FLAC__byte * buffer; + FLAC__byte * output; + size_t bytes; + + FLAC__ASSERT(object != NULL); + + if((bw = FLAC__bitwriter_new()) == NULL) + return 0; + if(!FLAC__bitwriter_init(bw)) { + FLAC__bitwriter_delete(bw); + return 0; + } + if(!FLAC__add_metadata_block(object, bw, false)) { + FLAC__bitwriter_delete(bw); + return 0; + } + + if(!FLAC__bitwriter_get_buffer(bw, &buffer, &bytes)) { + FLAC__bitwriter_delete(bw); + return 0; + } + + /* Extra check whether length of bitwriter agrees with length of metadata block */ + if(bytes != (object->length+FLAC__STREAM_METADATA_HEADER_LENGTH)) { + FLAC__bitwriter_delete(bw); + return 0; + } + + output = safe_malloc_(bytes); + if(output == 0) { + FLAC__bitwriter_delete(bw); + return 0; + } + + memcpy(output,buffer,bytes); + FLAC__bitwriter_delete(bw); + return output; +} + +/* The following callbacks are for FLAC__metadata_object_set_raw */ + +static FLAC__StreamDecoderReadStatus 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); + +typedef struct { + FLAC__StreamMetadata *object; + FLAC__bool got_error; + FLAC__byte *buffer; + FLAC__int32 length; + FLAC__int32 tell; +} set_raw_client_data; + +FLAC_API FLAC__StreamMetadata * FLAC__metadata_object_set_raw(FLAC__byte *buffer, FLAC__uint32 length) +{ + set_raw_client_data cd; + FLAC__StreamDecoder * decoder; + + cd.buffer = buffer; + cd.length = length; + cd.got_error = false; + cd.object = 0; + cd.tell = -4; + + decoder = FLAC__stream_decoder_new(); + + if(0 == decoder) + return 0; + + FLAC__stream_decoder_set_md5_checking(decoder, false); + FLAC__stream_decoder_set_metadata_respond_all(decoder); + + if(FLAC__stream_decoder_init_stream(decoder, read_callback_, NULL, NULL, NULL, NULL, write_callback_, metadata_callback_, error_callback_, &cd) != FLAC__STREAM_DECODER_INIT_STATUS_OK || cd.got_error) { + (void)FLAC__stream_decoder_finish(decoder); + FLAC__stream_decoder_delete(decoder); + return 0; + } + + if((!FLAC__stream_decoder_process_until_end_of_metadata(decoder) && FLAC__stream_decoder_get_state(decoder) != FLAC__STREAM_DECODER_END_OF_STREAM) || cd.got_error) { + (void)FLAC__stream_decoder_finish(decoder); + FLAC__stream_decoder_delete(decoder); + if(0 != cd.object) + FLAC__metadata_object_delete(cd.object); + return 0; + } + + (void)FLAC__stream_decoder_finish(decoder); + FLAC__stream_decoder_delete(decoder); + + return cd.object; + +} + +FLAC__StreamDecoderReadStatus read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte *buffer, size_t *bytes, void *client_data) +{ + set_raw_client_data *cd = (set_raw_client_data *)client_data; + (void)decoder; + + if(cd->tell == -4) { + if(*bytes < 4) + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + buffer[0] = 'f'; + buffer[1] = 'L'; + buffer[2] = 'a'; + buffer[3] = 'C'; + *bytes = 4; + cd->tell = 0; + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; + } + else if(cd->tell < 0) + return FLAC__STREAM_DECODER_READ_STATUS_ABORT; + else if(cd->tell == cd->length) { + *bytes = 0; + return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; + } + else { + if((FLAC__int32)(*bytes) > (cd->length - cd->tell)) + *bytes = cd->length - cd->tell; + memcpy(buffer, cd->buffer+cd->tell, *bytes); + cd->tell += *bytes; + return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE; + } +} + +FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) +{ + (void)decoder, (void)frame, (void)buffer, (void)client_data; + + return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; +} + +void metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetadata *metadata, void *client_data) +{ + set_raw_client_data *cd = (set_raw_client_data *)client_data; + (void)decoder; + + /* + * we assume we only get here when the one metadata block we were + * looking for was passed to us + */ + if(!cd->got_error && 0 == cd->object) { + if(0 == (cd->object = FLAC__metadata_object_clone(metadata))) + cd->got_error = true; + } +} + +void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data) +{ + set_raw_client_data *cd = (set_raw_client_data *)client_data; + (void)decoder; + + if(status != FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) + cd->got_error = true; +} diff --git a/3rdparty/libflac/src/libFLAC/ogg_decoder_aspect.c b/3rdparty/libflac/src/libFLAC/ogg_decoder_aspect.c index 945b2c3c0d8..58a2934601a 100644 --- a/3rdparty/libflac/src/libFLAC/ogg_decoder_aspect.c +++ b/3rdparty/libflac/src/libFLAC/ogg_decoder_aspect.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,11 +38,8 @@ #include "FLAC/assert.h" #include "private/ogg_decoder_aspect.h" #include "private/ogg_mapping.h" +#include "private/macros.h" -#ifdef max -#undef max -#endif -#define max(x,y) ((x)>(y)?(x):(y)) /*********************************************************************** * @@ -113,7 +111,7 @@ FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper( * decoder will eventually call the read callback to supply some data, * but how much it asks for depends on how much free space it has in * its internal buffer. It does not try to grow its internal buffer - * to accomodate a whole frame because then the internal buffer size + * to accommodate a whole frame because then the internal buffer size * could not be limited, which is necessary in embedded applications. * * Ogg however grows its internal buffer until a whole page is present; @@ -163,7 +161,7 @@ FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper( /* if it is the first header packet, check for magic and a supported Ogg FLAC mapping version */ if (aspect->working_packet.bytes > 0 && aspect->working_packet.packet[0] == FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE) { const FLAC__byte *b = aspect->working_packet.packet; - const unsigned header_length = + const uint32_t header_length = FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH + FLAC__OGG_MAPPING_MAGIC_LENGTH + FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH + @@ -175,9 +173,9 @@ FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper( if (memcmp(b, FLAC__OGG_MAPPING_MAGIC, FLAC__OGG_MAPPING_MAGIC_LENGTH)) return FLAC__OGG_DECODER_ASPECT_READ_STATUS_NOT_FLAC; b += FLAC__OGG_MAPPING_MAGIC_LENGTH; - aspect->version_major = (unsigned)(*b); + aspect->version_major = (uint32_t)(*b); b += FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH; - aspect->version_minor = (unsigned)(*b); + aspect->version_minor = (uint32_t)(*b); if (aspect->version_major != 1) return FLAC__OGG_DECODER_ASPECT_READ_STATUS_UNSUPPORTED_MAPPING_VERSION; aspect->working_packet.packet += header_length; @@ -210,7 +208,7 @@ FLAC__OggDecoderAspectReadStatus FLAC__ogg_decoder_aspect_read_callback_wrapper( } else if (ret == 0) { /* need more data */ - const size_t ogg_bytes_to_read = max(bytes_requested - *bytes, OGG_BYTES_CHUNK); + const size_t ogg_bytes_to_read = flac_max(bytes_requested - *bytes, OGG_BYTES_CHUNK); char *oggbuf = ogg_sync_buffer(&aspect->sync_state, ogg_bytes_to_read); if(0 == oggbuf) { diff --git a/3rdparty/libflac/src/libFLAC/ogg_encoder_aspect.c b/3rdparty/libflac/src/libFLAC/ogg_encoder_aspect.c index a9928c3d6e1..a88713b14b4 100644 --- a/3rdparty/libflac/src/libFLAC/ogg_encoder_aspect.c +++ b/3rdparty/libflac/src/libFLAC/ogg_encoder_aspect.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -71,7 +72,7 @@ void FLAC__ogg_encoder_aspect_set_serial_number(FLAC__OggEncoderAspect *aspect, aspect->serial_number = value; } -FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, unsigned value) +FLAC__bool FLAC__ogg_encoder_aspect_set_num_metadata(FLAC__OggEncoderAspect *aspect, uint32_t value) { if(value < (1u << FLAC__OGG_MAPPING_NUM_HEADERS_LEN)) { aspect->num_metadata = value; @@ -108,7 +109,7 @@ void FLAC__ogg_encoder_aspect_set_defaults(FLAC__OggEncoderAspect *aspect) * separate write callback for the fLaC magic, and then separate write * callbacks for each metadata block and audio frame. */ -FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data) +FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(FLAC__OggEncoderAspect *aspect, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, FLAC__bool is_last_block, FLAC__OggEncoderAspectWriteCallbackProxy write_callback, void *encoder, void *client_data) { /* WATCHOUT: * This depends on the behavior of FLAC__StreamEncoder that 'samples' @@ -169,14 +170,14 @@ FLAC__StreamEncoderWriteStatus FLAC__ogg_encoder_aspect_write_callback_wrapper(F /* add STREAMINFO */ memcpy(b, buffer, bytes); FLAC__ASSERT(b + bytes - synthetic_first_packet_body == sizeof(synthetic_first_packet_body)); - packet.packet = (unsigned char *)synthetic_first_packet_body; + packet.packet = (uint8_t *)synthetic_first_packet_body; packet.bytes = sizeof(synthetic_first_packet_body); packet.b_o_s = 1; aspect->is_first_packet = false; } else { - packet.packet = (unsigned char *)buffer; + packet.packet = (uint8_t *)buffer; packet.bytes = bytes; } diff --git a/3rdparty/libflac/src/libFLAC/ogg_helper.c b/3rdparty/libflac/src/libFLAC/ogg_helper.c index f406777e047..a4be34d22b9 100644 --- a/3rdparty/libflac/src/libFLAC/ogg_helper.c +++ b/3rdparty/libflac/src/libFLAC/ogg_helper.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2004-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -93,8 +94,8 @@ void simple_ogg_page__clear(ogg_page *page) FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 position, ogg_page *page, FLAC__StreamEncoderSeekCallback seek_callback, FLAC__StreamEncoderReadCallback read_callback, void *client_data) { - static const unsigned OGG_HEADER_FIXED_PORTION_LEN = 27; - static const unsigned OGG_MAX_HEADER_LEN = 27/*OGG_HEADER_FIXED_PORTION_LEN*/ + 255; + static const uint32_t OGG_HEADER_FIXED_PORTION_LEN = 27; + static const uint32_t OGG_MAX_HEADER_LEN = 27/*OGG_HEADER_FIXED_PORTION_LEN*/ + 255; FLAC__byte crc[4]; FLAC__StreamEncoderSeekStatus seek_status; @@ -113,7 +114,7 @@ FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 po } /* allocate space for the page header */ - if(0 == (page->header = (unsigned char *)safe_malloc_(OGG_MAX_HEADER_LEN))) { + if(0 == (page->header = safe_malloc_(OGG_MAX_HEADER_LEN))) { encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -141,10 +142,10 @@ FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 po return false; { - unsigned i; + uint32_t i; /* check to see that it specifies a single packet */ - for(i = 0; i < (unsigned)page->header[26] - 1; i++) { + for(i = 0; i < (uint32_t)page->header[26] - 1; i++) { if(page->header[i + OGG_HEADER_FIXED_PORTION_LEN] != 255) { encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR; return false; @@ -155,7 +156,7 @@ FLAC__bool simple_ogg_page__get_at(FLAC__StreamEncoder *encoder, FLAC__uint64 po } /* allocate space for the page body */ - if(0 == (page->body = (unsigned char *)safe_malloc_(page->body_len))) { + if(0 == (page->body = safe_malloc_(page->body_len))) { encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; return false; } diff --git a/3rdparty/libflac/src/libFLAC/ogg_mapping.c b/3rdparty/libflac/src/libFLAC/ogg_mapping.c index cd87197cb17..756c7165b29 100644 --- a/3rdparty/libflac/src/libFLAC/ogg_mapping.c +++ b/3rdparty/libflac/src/libFLAC/ogg_mapping.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec - * Copyright (C) 2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2004-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,13 +36,13 @@ #include "private/ogg_mapping.h" -const unsigned FLAC__OGG_MAPPING_PACKET_TYPE_LEN = 8; /* bits */ +const uint32_t FLAC__OGG_MAPPING_PACKET_TYPE_LEN = 8; /* bits */ const FLAC__byte FLAC__OGG_MAPPING_FIRST_HEADER_PACKET_TYPE = 0x7f; const FLAC__byte * const FLAC__OGG_MAPPING_MAGIC = (const FLAC__byte * const)"FLAC"; -const unsigned FLAC__OGG_MAPPING_VERSION_MAJOR_LEN = 8; /* bits */ -const unsigned FLAC__OGG_MAPPING_VERSION_MINOR_LEN = 8; /* bits */ +const uint32_t FLAC__OGG_MAPPING_VERSION_MAJOR_LEN = 8; /* bits */ +const uint32_t FLAC__OGG_MAPPING_VERSION_MINOR_LEN = 8; /* bits */ -const unsigned FLAC__OGG_MAPPING_NUM_HEADERS_LEN = 16; /* bits */ +const uint32_t FLAC__OGG_MAPPING_NUM_HEADERS_LEN = 16; /* bits */ diff --git a/3rdparty/libflac/src/libFLAC/ppc/Makefile.am b/3rdparty/libflac/src/libFLAC/ppc/Makefile.am deleted file mode 100644 index 87cd95c63fb..00000000000 --- a/3rdparty/libflac/src/libFLAC/ppc/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2004,2005,2006,2007 Josh Coalson -# -# 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. - -SUBDIRS = as gas diff --git a/3rdparty/libflac/src/libFLAC/ppc/Makefile.in b/3rdparty/libflac/src/libFLAC/ppc/Makefile.in deleted file mode 100644 index 308a21b04cd..00000000000 --- a/3rdparty/libflac/src/libFLAC/ppc/Makefile.in +++ /dev/null @@ -1,533 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2004,2005,2006,2007 Josh Coalson -# -# 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. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -SUBDIRS = as gas -subdir = src/libFLAC/ppc -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = $(SUBDIRS) -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libFLAC/ppc/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - else \ - include_option=--include; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: - -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/libFLAC/ppc/as/Makefile.am b/3rdparty/libflac/src/libFLAC/ppc/as/Makefile.am deleted file mode 100644 index 919938bb423..00000000000 --- a/3rdparty/libflac/src/libFLAC/ppc/as/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2004,2005,2006,2007 Josh Coalson -# -# 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. - -#@@@ -if FLaC__HAS_AS__TEMPORARILY_DISABLED - -SUFFIXES = .s .lo - -STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh - -# For some unknown reason libtool can't figure out the tag for 'as', so -# we fake it with --tag=CC and strip out unwanted options. -.s.lo: - $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) as -force_cpusubtype_ALL -o $@ $< - -noinst_LTLIBRARIES = libFLAC-asm.la -libFLAC_asm_la_SOURCES = \ - lpc_asm.s - -else - -EXTRA_DIST = \ - lpc_asm.s - -endif diff --git a/3rdparty/libflac/src/libFLAC/ppc/as/Makefile.in b/3rdparty/libflac/src/libFLAC/ppc/as/Makefile.in deleted file mode 100644 index 1565e461af5..00000000000 --- a/3rdparty/libflac/src/libFLAC/ppc/as/Makefile.in +++ /dev/null @@ -1,503 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2004,2005,2006,2007 Josh Coalson -# -# 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. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - - -#@@@ -@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@SUFFIXES = .s .lo - -@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh - -@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@noinst_LTLIBRARIES = libFLAC-asm.la -@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@libFLAC_asm_la_SOURCES = \ -@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ lpc_asm.s - - -@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@EXTRA_DIST = \ -@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ lpc_asm.s - -subdir = src/libFLAC/ppc/as -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libFLAC_asm_la_LDFLAGS = -libFLAC_asm_la_LIBADD = -am__libFLAC_asm_la_SOURCES_DIST = lpc_asm.s -@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@am_libFLAC_asm_la_OBJECTS = \ -@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ lpc_asm.lo -libFLAC_asm_la_OBJECTS = $(am_libFLAC_asm_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) -LTCCASCOMPILE = $(LIBTOOL) --mode=compile $(CCAS) $(AM_CCASFLAGS) \ - $(CCASFLAGS) -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(am__libFLAC_asm_la_SOURCES_DIST) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(libFLAC_asm_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libFLAC/ppc/as/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libFLAC-asm.la: $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_DEPENDENCIES) - $(LINK) $(libFLAC_asm_la_LDFLAGS) $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -.s.o: - $(CCASCOMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.s.obj: - $(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -@FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@.s.lo: - $(LTCCASCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am - - -# For some unknown reason libtool can't figure out the tag for 'as', so -# we fake it with --tag=CC and strip out unwanted options. -@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@.s.lo: -@FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) as -force_cpusubtype_ALL -o $@ $< -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/libFLAC/ppc/as/lpc_asm.s b/3rdparty/libflac/src/libFLAC/ppc/as/lpc_asm.s deleted file mode 100644 index ca39c6ffeea..00000000000 --- a/3rdparty/libflac/src/libFLAC/ppc/as/lpc_asm.s +++ /dev/null @@ -1,429 +0,0 @@ -; libFLAC - Free Lossless Audio Codec library -; Copyright (C) 2004,2005,2006,2007 Josh Coalson -; -; 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. - -.text - .align 2 -.globl _FLAC__lpc_restore_signal_asm_ppc_altivec_16 - -.globl _FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8 - -_FLAC__lpc_restore_signal_asm_ppc_altivec_16: -; r3: residual[] -; r4: data_len -; r5: qlp_coeff[] -; r6: order -; r7: lp_quantization -; r8: data[] - -; see src/libFLAC/lpc.c:FLAC__lpc_restore_signal() -; these is a PowerPC/Altivec assembly version which requires bps<=16 (or actual -; bps<=15 for mid-side coding, since that uses an extra bit) - -; these should be fast; the inner loop is unrolled (it takes no more than -; 3*(order%4) instructions, all of which are arithmetic), and all of the -; coefficients and all relevant history stay in registers, so the outer loop -; has only one load from memory (the residual) - -; I have not yet run this through simg4, so there may be some avoidable stalls, -; and there may be a somewhat more clever way to do the outer loop - -; the branch mechanism may prevent dynamic loading; I still need to examine -; this issue, and there may be a more elegant method - - stmw r31,-4(r1) - - addi r9,r1,-28 - li r31,0xf - andc r9,r9,r31 ; for quadword-aligned stack data - - slwi r6,r6,2 ; adjust for word size - slwi r4,r4,2 - add r4,r4,r8 ; r4 = data+data_len - - mfspr r0,256 ; cache old vrsave - addis r31,0,hi16(0xfffffc00) - ori r31,r31,lo16(0xfffffc00) - mtspr 256,r31 ; declare VRs in vrsave - - cmplw cr0,r8,r4 ; i<data_len - bc 4,0,L1400 - - ; load coefficients into v0-v7 and initial history into v8-v15 - li r31,0xf - and r31,r8,r31 ; r31: data%4 - li r11,16 - subf r31,r31,r11 ; r31: 4-(data%4) - slwi r31,r31,3 ; convert to bits for vsro - li r10,-4 - stw r31,-4(r9) - lvewx v0,r10,r9 - vspltisb v18,-1 - vsro v18,v18,v0 ; v18: mask vector - - li r31,0x8 - lvsl v0,0,r31 - vsldoi v0,v0,v0,12 - li r31,0xc - lvsl v1,0,r31 - vspltisb v2,0 - vspltisb v3,-1 - vmrglw v2,v2,v3 - vsel v0,v1,v0,v2 ; v0: reversal permutation vector - - add r10,r5,r6 - lvsl v17,0,r5 ; v17: coefficient alignment permutation vector - vperm v17,v17,v17,v0 ; v17: reversal coefficient alignment permutation vector - - mr r11,r8 - lvsl v16,0,r11 ; v16: history alignment permutation vector - - lvx v0,0,r5 - addi r5,r5,16 - lvx v1,0,r5 - vperm v0,v0,v1,v17 - lvx v8,0,r11 - addi r11,r11,-16 - lvx v9,0,r11 - vperm v8,v9,v8,v16 - cmplw cr0,r5,r10 - bc 12,0,L1101 - vand v0,v0,v18 - addis r31,0,hi16(L1307) - ori r31,r31,lo16(L1307) - b L1199 - -L1101: - addi r5,r5,16 - lvx v2,0,r5 - vperm v1,v1,v2,v17 - addi r11,r11,-16 - lvx v10,0,r11 - vperm v9,v10,v9,v16 - cmplw cr0,r5,r10 - bc 12,0,L1102 - vand v1,v1,v18 - addis r31,0,hi16(L1306) - ori r31,r31,lo16(L1306) - b L1199 - -L1102: - addi r5,r5,16 - lvx v3,0,r5 - vperm v2,v2,v3,v17 - addi r11,r11,-16 - lvx v11,0,r11 - vperm v10,v11,v10,v16 - cmplw cr0,r5,r10 - bc 12,0,L1103 - vand v2,v2,v18 - addis r31,0,hi16(L1305) - ori r31,r31,lo16(L1305) - b L1199 - -L1103: - addi r5,r5,16 - lvx v4,0,r5 - vperm v3,v3,v4,v17 - addi r11,r11,-16 - lvx v12,0,r11 - vperm v11,v12,v11,v16 - cmplw cr0,r5,r10 - bc 12,0,L1104 - vand v3,v3,v18 - addis r31,0,hi16(L1304) - ori r31,r31,lo16(L1304) - b L1199 - -L1104: - addi r5,r5,16 - lvx v5,0,r5 - vperm v4,v4,v5,v17 - addi r11,r11,-16 - lvx v13,0,r11 - vperm v12,v13,v12,v16 - cmplw cr0,r5,r10 - bc 12,0,L1105 - vand v4,v4,v18 - addis r31,0,hi16(L1303) - ori r31,r31,lo16(L1303) - b L1199 - -L1105: - addi r5,r5,16 - lvx v6,0,r5 - vperm v5,v5,v6,v17 - addi r11,r11,-16 - lvx v14,0,r11 - vperm v13,v14,v13,v16 - cmplw cr0,r5,r10 - bc 12,0,L1106 - vand v5,v5,v18 - addis r31,0,hi16(L1302) - ori r31,r31,lo16(L1302) - b L1199 - -L1106: - addi r5,r5,16 - lvx v7,0,r5 - vperm v6,v6,v7,v17 - addi r11,r11,-16 - lvx v15,0,r11 - vperm v14,v15,v14,v16 - cmplw cr0,r5,r10 - bc 12,0,L1107 - vand v6,v6,v18 - addis r31,0,hi16(L1301) - ori r31,r31,lo16(L1301) - b L1199 - -L1107: - addi r5,r5,16 - lvx v19,0,r5 - vperm v7,v7,v19,v17 - addi r11,r11,-16 - lvx v19,0,r11 - vperm v15,v19,v15,v16 - vand v7,v7,v18 - addis r31,0,hi16(L1300) - ori r31,r31,lo16(L1300) - -L1199: - mtctr r31 - - ; set up invariant vectors - vspltish v16,0 ; v16: zero vector - - li r10,-12 - lvsr v17,r10,r8 ; v17: result shift vector - lvsl v18,r10,r3 ; v18: residual shift back vector - - li r10,-4 - stw r7,-4(r9) - lvewx v19,r10,r9 ; v19: lp_quantization vector - -L1200: - vmulosh v20,v0,v8 ; v20: sum vector - bcctr 20,0 - -L1300: - vmulosh v21,v7,v15 - vsldoi v15,v15,v14,4 ; increment history - vaddsws v20,v20,v21 - -L1301: - vmulosh v21,v6,v14 - vsldoi v14,v14,v13,4 - vaddsws v20,v20,v21 - -L1302: - vmulosh v21,v5,v13 - vsldoi v13,v13,v12,4 - vaddsws v20,v20,v21 - -L1303: - vmulosh v21,v4,v12 - vsldoi v12,v12,v11,4 - vaddsws v20,v20,v21 - -L1304: - vmulosh v21,v3,v11 - vsldoi v11,v11,v10,4 - vaddsws v20,v20,v21 - -L1305: - vmulosh v21,v2,v10 - vsldoi v10,v10,v9,4 - vaddsws v20,v20,v21 - -L1306: - vmulosh v21,v1,v9 - vsldoi v9,v9,v8,4 - vaddsws v20,v20,v21 - -L1307: - vsumsws v20,v20,v16 ; v20[3]: sum - vsraw v20,v20,v19 ; v20[3]: sum >> lp_quantization - - lvewx v21,0,r3 ; v21[n]: *residual - vperm v21,v21,v21,v18 ; v21[3]: *residual - vaddsws v20,v21,v20 ; v20[3]: *residual + (sum >> lp_quantization) - vsldoi v18,v18,v18,4 ; increment shift vector - - vperm v21,v20,v20,v17 ; v21[n]: shift for storage - vsldoi v17,v17,v17,12 ; increment shift vector - stvewx v21,0,r8 - - vsldoi v20,v20,v20,12 - vsldoi v8,v8,v20,4 ; insert value onto history - - addi r3,r3,4 - addi r8,r8,4 - cmplw cr0,r8,r4 ; i<data_len - bc 12,0,L1200 - -L1400: - mtspr 256,r0 ; restore old vrsave - lmw r31,-4(r1) - blr - -_FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8: -; r3: residual[] -; r4: data_len -; r5: qlp_coeff[] -; r6: order -; r7: lp_quantization -; r8: data[] - -; see _FLAC__lpc_restore_signal_asm_ppc_altivec_16() above -; this version assumes order<=8; it uses fewer vector registers, which should -; save time in context switches, and has less code, which may improve -; instruction caching - - stmw r31,-4(r1) - - addi r9,r1,-28 - li r31,0xf - andc r9,r9,r31 ; for quadword-aligned stack data - - slwi r6,r6,2 ; adjust for word size - slwi r4,r4,2 - add r4,r4,r8 ; r4 = data+data_len - - mfspr r0,256 ; cache old vrsave - addis r31,0,hi16(0xffc00000) - ori r31,r31,lo16(0xffc00000) - mtspr 256,r31 ; declare VRs in vrsave - - cmplw cr0,r8,r4 ; i<data_len - bc 4,0,L2400 - - ; load coefficients into v0-v1 and initial history into v2-v3 - li r31,0xf - and r31,r8,r31 ; r31: data%4 - li r11,16 - subf r31,r31,r11 ; r31: 4-(data%4) - slwi r31,r31,3 ; convert to bits for vsro - li r10,-4 - stw r31,-4(r9) - lvewx v0,r10,r9 - vspltisb v6,-1 - vsro v6,v6,v0 ; v6: mask vector - - li r31,0x8 - lvsl v0,0,r31 - vsldoi v0,v0,v0,12 - li r31,0xc - lvsl v1,0,r31 - vspltisb v2,0 - vspltisb v3,-1 - vmrglw v2,v2,v3 - vsel v0,v1,v0,v2 ; v0: reversal permutation vector - - add r10,r5,r6 - lvsl v5,0,r5 ; v5: coefficient alignment permutation vector - vperm v5,v5,v5,v0 ; v5: reversal coefficient alignment permutation vector - - mr r11,r8 - lvsl v4,0,r11 ; v4: history alignment permutation vector - - lvx v0,0,r5 - addi r5,r5,16 - lvx v1,0,r5 - vperm v0,v0,v1,v5 - lvx v2,0,r11 - addi r11,r11,-16 - lvx v3,0,r11 - vperm v2,v3,v2,v4 - cmplw cr0,r5,r10 - bc 12,0,L2101 - vand v0,v0,v6 - addis r31,0,hi16(L2301) - ori r31,r31,lo16(L2301) - b L2199 - -L2101: - addi r5,r5,16 - lvx v7,0,r5 - vperm v1,v1,v7,v5 - addi r11,r11,-16 - lvx v7,0,r11 - vperm v3,v7,v3,v4 - vand v1,v1,v6 - addis r31,0,hi16(L2300) - ori r31,r31,lo16(L2300) - -L2199: - mtctr r31 - - ; set up invariant vectors - vspltish v4,0 ; v4: zero vector - - li r10,-12 - lvsr v5,r10,r8 ; v5: result shift vector - lvsl v6,r10,r3 ; v6: residual shift back vector - - li r10,-4 - stw r7,-4(r9) - lvewx v7,r10,r9 ; v7: lp_quantization vector - -L2200: - vmulosh v8,v0,v2 ; v8: sum vector - bcctr 20,0 - -L2300: - vmulosh v9,v1,v3 - vsldoi v3,v3,v2,4 - vaddsws v8,v8,v9 - -L2301: - vsumsws v8,v8,v4 ; v8[3]: sum - vsraw v8,v8,v7 ; v8[3]: sum >> lp_quantization - - lvewx v9,0,r3 ; v9[n]: *residual - vperm v9,v9,v9,v6 ; v9[3]: *residual - vaddsws v8,v9,v8 ; v8[3]: *residual + (sum >> lp_quantization) - vsldoi v6,v6,v6,4 ; increment shift vector - - vperm v9,v8,v8,v5 ; v9[n]: shift for storage - vsldoi v5,v5,v5,12 ; increment shift vector - stvewx v9,0,r8 - - vsldoi v8,v8,v8,12 - vsldoi v2,v2,v8,4 ; insert value onto history - - addi r3,r3,4 - addi r8,r8,4 - cmplw cr0,r8,r4 ; i<data_len - bc 12,0,L2200 - -L2400: - mtspr 256,r0 ; restore old vrsave - lmw r31,-4(r1) - blr diff --git a/3rdparty/libflac/src/libFLAC/ppc/gas/Makefile.am b/3rdparty/libflac/src/libFLAC/ppc/gas/Makefile.am deleted file mode 100644 index 3a66c27ae46..00000000000 --- a/3rdparty/libflac/src/libFLAC/ppc/gas/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2004,2005,2006,2007 Josh Coalson -# -# 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. - -#@@@ -if FLaC__HAS_GAS__TEMPORARILY_DISABLED - -SUFFIXES = .s .lo - -STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh - -# For some unknown reason libtool can't figure out the tag for 'gas', so -# we fake it with --tag=CC and strip out unwanted options. -.s.lo: - $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) gas -force_cpusubtype_ALL -o $@ $< - -noinst_LTLIBRARIES = libFLAC-asm.la -libFLAC_asm_la_SOURCES = \ - lpc_asm.s - -else - -EXTRA_DIST = \ - lpc_asm.s - -endif diff --git a/3rdparty/libflac/src/libFLAC/ppc/gas/Makefile.in b/3rdparty/libflac/src/libFLAC/ppc/gas/Makefile.in deleted file mode 100644 index f4c97bc36d7..00000000000 --- a/3rdparty/libflac/src/libFLAC/ppc/gas/Makefile.in +++ /dev/null @@ -1,503 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2004,2005,2006,2007 Josh Coalson -# -# 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. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - - -#@@@ -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@SUFFIXES = .s .lo - -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@STRIP_NON_ASM = sh $(top_srcdir)/strip_non_asm_libtool_args.sh - -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@noinst_LTLIBRARIES = libFLAC-asm.la -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@libFLAC_asm_la_SOURCES = \ -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ lpc_asm.s - - -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@EXTRA_DIST = \ -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ lpc_asm.s - -subdir = src/libFLAC/ppc/gas -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libFLAC_asm_la_LDFLAGS = -libFLAC_asm_la_LIBADD = -am__libFLAC_asm_la_SOURCES_DIST = lpc_asm.s -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@am_libFLAC_asm_la_OBJECTS = \ -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ lpc_asm.lo -libFLAC_asm_la_OBJECTS = $(am_libFLAC_asm_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS) -LTCCASCOMPILE = $(LIBTOOL) --mode=compile $(CCAS) $(AM_CCASFLAGS) \ - $(CCASFLAGS) -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(am__libFLAC_asm_la_SOURCES_DIST) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(libFLAC_asm_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .lo .o .obj .s -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/libFLAC/ppc/gas/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libFLAC-asm.la: $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_DEPENDENCIES) - $(LINK) $(libFLAC_asm_la_LDFLAGS) $(libFLAC_asm_la_OBJECTS) $(libFLAC_asm_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -.s.o: - $(CCASCOMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.s.obj: - $(CCASCOMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@.s.lo: - $(LTCCASCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am - - -# For some unknown reason libtool can't figure out the tag for 'gas', so -# we fake it with --tag=CC and strip out unwanted options. -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@.s.lo: -@FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ $(LIBTOOL) --tag=CC --mode=compile $(STRIP_NON_ASM) gas -force_cpusubtype_ALL -o $@ $< -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/libFLAC/ppc/gas/lpc_asm.s b/3rdparty/libflac/src/libFLAC/ppc/gas/lpc_asm.s deleted file mode 100644 index 2203570189e..00000000000 --- a/3rdparty/libflac/src/libFLAC/ppc/gas/lpc_asm.s +++ /dev/null @@ -1,431 +0,0 @@ -# libFLAC - Free Lossless Audio Codec library -# Copyright (C) 2004,2005,2006,2007 Josh Coalson -# -# 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. - -.text - .align 2 -.globl _FLAC__lpc_restore_signal_asm_ppc_altivec_16 -.type _FLAC__lpc_restore_signal_asm_ppc_altivec_16, @function - -.globl _FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8 -.type _FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8, @function - -_FLAC__lpc_restore_signal_asm_ppc_altivec_16: -# r3: residual[] -# r4: data_len -# r5: qlp_coeff[] -# r6: order -# r7: lp_quantization -# r8: data[] - -# see src/libFLAC/lpc.c:FLAC__lpc_restore_signal() -# these is a PowerPC/Altivec assembly version which requires bps<=16 (or actual -# bps<=15 for mid-side coding, since that uses an extra bit) - -# these should be fast; the inner loop is unrolled (it takes no more than -# 3*(order%4) instructions, all of which are arithmetic), and all of the -# coefficients and all relevant history stay in registers, so the outer loop -# has only one load from memory (the residual) - -# I have not yet run this through simg4, so there may be some avoidable stalls, -# and there may be a somewhat more clever way to do the outer loop - -# the branch mechanism may prevent dynamic loading; I still need to examine -# this issue, and there may be a more elegant method - - stmw r31,-4(r1) - - addi r9,r1,-28 - li r31,0xf - andc r9,r9,r31 # for quadword-aligned stack data - - slwi r6,r6,2 # adjust for word size - slwi r4,r4,2 - add r4,r4,r8 # r4 = data+data_len - - mfspr r0,256 # cache old vrsave - addis r31,0,0xffff - ori r31,r31,0xfc00 - mtspr 256,r31 # declare VRs in vrsave - - cmplw cr0,r8,r4 # i<data_len - bc 4,0,L1400 - - # load coefficients into v0-v7 and initial history into v8-v15 - li r31,0xf - and r31,r8,r31 # r31: data%4 - li r11,16 - subf r31,r31,r11 # r31: 4-(data%4) - slwi r31,r31,3 # convert to bits for vsro - li r10,-4 - stw r31,-4(r9) - lvewx v0,r10,r9 - vspltisb v18,-1 - vsro v18,v18,v0 # v18: mask vector - - li r31,0x8 - lvsl v0,0,r31 - vsldoi v0,v0,v0,12 - li r31,0xc - lvsl v1,0,r31 - vspltisb v2,0 - vspltisb v3,-1 - vmrglw v2,v2,v3 - vsel v0,v1,v0,v2 # v0: reversal permutation vector - - add r10,r5,r6 - lvsl v17,0,r5 # v17: coefficient alignment permutation vector - vperm v17,v17,v17,v0 # v17: reversal coefficient alignment permutation vector - - mr r11,r8 - lvsl v16,0,r11 # v16: history alignment permutation vector - - lvx v0,0,r5 - addi r5,r5,16 - lvx v1,0,r5 - vperm v0,v0,v1,v17 - lvx v8,0,r11 - addi r11,r11,-16 - lvx v9,0,r11 - vperm v8,v9,v8,v16 - cmplw cr0,r5,r10 - bc 12,0,L1101 - vand v0,v0,v18 - addis r31,0,L1307@ha - ori r31,r31,L1307@l - b L1199 - -L1101: - addi r5,r5,16 - lvx v2,0,r5 - vperm v1,v1,v2,v17 - addi r11,r11,-16 - lvx v10,0,r11 - vperm v9,v10,v9,v16 - cmplw cr0,r5,r10 - bc 12,0,L1102 - vand v1,v1,v18 - addis r31,0,L1306@ha - ori r31,r31,L1306@l - b L1199 - -L1102: - addi r5,r5,16 - lvx v3,0,r5 - vperm v2,v2,v3,v17 - addi r11,r11,-16 - lvx v11,0,r11 - vperm v10,v11,v10,v16 - cmplw cr0,r5,r10 - bc 12,0,L1103 - vand v2,v2,v18 - lis r31,L1305@ha - la r31,L1305@l(r31) - b L1199 - -L1103: - addi r5,r5,16 - lvx v4,0,r5 - vperm v3,v3,v4,v17 - addi r11,r11,-16 - lvx v12,0,r11 - vperm v11,v12,v11,v16 - cmplw cr0,r5,r10 - bc 12,0,L1104 - vand v3,v3,v18 - lis r31,L1304@ha - la r31,L1304@l(r31) - b L1199 - -L1104: - addi r5,r5,16 - lvx v5,0,r5 - vperm v4,v4,v5,v17 - addi r11,r11,-16 - lvx v13,0,r11 - vperm v12,v13,v12,v16 - cmplw cr0,r5,r10 - bc 12,0,L1105 - vand v4,v4,v18 - lis r31,L1303@ha - la r31,L1303@l(r31) - b L1199 - -L1105: - addi r5,r5,16 - lvx v6,0,r5 - vperm v5,v5,v6,v17 - addi r11,r11,-16 - lvx v14,0,r11 - vperm v13,v14,v13,v16 - cmplw cr0,r5,r10 - bc 12,0,L1106 - vand v5,v5,v18 - lis r31,L1302@ha - la r31,L1302@l(r31) - b L1199 - -L1106: - addi r5,r5,16 - lvx v7,0,r5 - vperm v6,v6,v7,v17 - addi r11,r11,-16 - lvx v15,0,r11 - vperm v14,v15,v14,v16 - cmplw cr0,r5,r10 - bc 12,0,L1107 - vand v6,v6,v18 - lis r31,L1301@ha - la r31,L1301@l(r31) - b L1199 - -L1107: - addi r5,r5,16 - lvx v19,0,r5 - vperm v7,v7,v19,v17 - addi r11,r11,-16 - lvx v19,0,r11 - vperm v15,v19,v15,v16 - vand v7,v7,v18 - lis r31,L1300@ha - la r31,L1300@l(r31) - -L1199: - mtctr r31 - - # set up invariant vectors - vspltish v16,0 # v16: zero vector - - li r10,-12 - lvsr v17,r10,r8 # v17: result shift vector - lvsl v18,r10,r3 # v18: residual shift back vector - - li r10,-4 - stw r7,-4(r9) - lvewx v19,r10,r9 # v19: lp_quantization vector - -L1200: - vmulosh v20,v0,v8 # v20: sum vector - bcctr 20,0 - -L1300: - vmulosh v21,v7,v15 - vsldoi v15,v15,v14,4 # increment history - vaddsws v20,v20,v21 - -L1301: - vmulosh v21,v6,v14 - vsldoi v14,v14,v13,4 - vaddsws v20,v20,v21 - -L1302: - vmulosh v21,v5,v13 - vsldoi v13,v13,v12,4 - vaddsws v20,v20,v21 - -L1303: - vmulosh v21,v4,v12 - vsldoi v12,v12,v11,4 - vaddsws v20,v20,v21 - -L1304: - vmulosh v21,v3,v11 - vsldoi v11,v11,v10,4 - vaddsws v20,v20,v21 - -L1305: - vmulosh v21,v2,v10 - vsldoi v10,v10,v9,4 - vaddsws v20,v20,v21 - -L1306: - vmulosh v21,v1,v9 - vsldoi v9,v9,v8,4 - vaddsws v20,v20,v21 - -L1307: - vsumsws v20,v20,v16 # v20[3]: sum - vsraw v20,v20,v19 # v20[3]: sum >> lp_quantization - - lvewx v21,0,r3 # v21[n]: *residual - vperm v21,v21,v21,v18 # v21[3]: *residual - vaddsws v20,v21,v20 # v20[3]: *residual + (sum >> lp_quantization) - vsldoi v18,v18,v18,4 # increment shift vector - - vperm v21,v20,v20,v17 # v21[n]: shift for storage - vsldoi v17,v17,v17,12 # increment shift vector - stvewx v21,0,r8 - - vsldoi v20,v20,v20,12 - vsldoi v8,v8,v20,4 # insert value onto history - - addi r3,r3,4 - addi r8,r8,4 - cmplw cr0,r8,r4 # i<data_len - bc 12,0,L1200 - -L1400: - mtspr 256,r0 # restore old vrsave - lmw r31,-4(r1) - blr - -_FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8: -# r3: residual[] -# r4: data_len -# r5: qlp_coeff[] -# r6: order -# r7: lp_quantization -# r8: data[] - -# see _FLAC__lpc_restore_signal_asm_ppc_altivec_16() above -# this version assumes order<=8; it uses fewer vector registers, which should -# save time in context switches, and has less code, which may improve -# instruction caching - - stmw r31,-4(r1) - - addi r9,r1,-28 - li r31,0xf - andc r9,r9,r31 # for quadword-aligned stack data - - slwi r6,r6,2 # adjust for word size - slwi r4,r4,2 - add r4,r4,r8 # r4 = data+data_len - - mfspr r0,256 # cache old vrsave - addis r31,0,0xffc0 - ori r31,r31,0x0000 - mtspr 256,r31 # declare VRs in vrsave - - cmplw cr0,r8,r4 # i<data_len - bc 4,0,L2400 - - # load coefficients into v0-v1 and initial history into v2-v3 - li r31,0xf - and r31,r8,r31 # r31: data%4 - li r11,16 - subf r31,r31,r11 # r31: 4-(data%4) - slwi r31,r31,3 # convert to bits for vsro - li r10,-4 - stw r31,-4(r9) - lvewx v0,r10,r9 - vspltisb v6,-1 - vsro v6,v6,v0 # v6: mask vector - - li r31,0x8 - lvsl v0,0,r31 - vsldoi v0,v0,v0,12 - li r31,0xc - lvsl v1,0,r31 - vspltisb v2,0 - vspltisb v3,-1 - vmrglw v2,v2,v3 - vsel v0,v1,v0,v2 # v0: reversal permutation vector - - add r10,r5,r6 - lvsl v5,0,r5 # v5: coefficient alignment permutation vector - vperm v5,v5,v5,v0 # v5: reversal coefficient alignment permutation vector - - mr r11,r8 - lvsl v4,0,r11 # v4: history alignment permutation vector - - lvx v0,0,r5 - addi r5,r5,16 - lvx v1,0,r5 - vperm v0,v0,v1,v5 - lvx v2,0,r11 - addi r11,r11,-16 - lvx v3,0,r11 - vperm v2,v3,v2,v4 - cmplw cr0,r5,r10 - bc 12,0,L2101 - vand v0,v0,v6 - lis r31,L2301@ha - la r31,L2301@l(r31) - b L2199 - -L2101: - addi r5,r5,16 - lvx v7,0,r5 - vperm v1,v1,v7,v5 - addi r11,r11,-16 - lvx v7,0,r11 - vperm v3,v7,v3,v4 - vand v1,v1,v6 - lis r31,L2300@ha - la r31,L2300@l(r31) - -L2199: - mtctr r31 - - # set up invariant vectors - vspltish v4,0 # v4: zero vector - - li r10,-12 - lvsr v5,r10,r8 # v5: result shift vector - lvsl v6,r10,r3 # v6: residual shift back vector - - li r10,-4 - stw r7,-4(r9) - lvewx v7,r10,r9 # v7: lp_quantization vector - -L2200: - vmulosh v8,v0,v2 # v8: sum vector - bcctr 20,0 - -L2300: - vmulosh v9,v1,v3 - vsldoi v3,v3,v2,4 - vaddsws v8,v8,v9 - -L2301: - vsumsws v8,v8,v4 # v8[3]: sum - vsraw v8,v8,v7 # v8[3]: sum >> lp_quantization - - lvewx v9,0,r3 # v9[n]: *residual - vperm v9,v9,v9,v6 # v9[3]: *residual - vaddsws v8,v9,v8 # v8[3]: *residual + (sum >> lp_quantization) - vsldoi v6,v6,v6,4 # increment shift vector - - vperm v9,v8,v8,v5 # v9[n]: shift for storage - vsldoi v5,v5,v5,12 # increment shift vector - stvewx v9,0,r8 - - vsldoi v8,v8,v8,12 - vsldoi v2,v2,v8,4 # insert value onto history - - addi r3,r3,4 - addi r8,r8,4 - cmplw cr0,r8,r4 # i<data_len - bc 12,0,L2200 - -L2400: - mtspr 256,r0 # restore old vrsave - lmw r31,-4(r1) - blr diff --git a/3rdparty/libflac/src/libFLAC/stream_decoder.c b/3rdparty/libflac/src/libFLAC/stream_decoder.c index 198d5dcc883..18d8dd3b219 100644 --- a/3rdparty/libflac/src/libFLAC/stream_decoder.c +++ b/3rdparty/libflac/src/libFLAC/stream_decoder.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,27 +34,12 @@ # include <config.h> #endif -#if defined _MSC_VER || defined __MINGW32__ -#include <io.h> /* for _setmode() */ -#include <fcntl.h> /* for _O_BINARY */ -#endif -#if defined __CYGWIN__ || defined __EMX__ -#include <io.h> /* for setmode(), O_BINARY */ -#include <fcntl.h> /* for _O_BINARY */ -#endif #include <stdio.h> #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memset/memcpy() */ -#include <sys/stat.h> /* for stat() */ #include <sys/types.h> /* for off_t */ -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif -#endif +#include <sys/stat.h> /* for stat() */ +#include "share/compat.h" #include "FLAC/assert.h" #include "share/alloc.h" #include "protected/stream_decoder.h" @@ -66,28 +52,11 @@ #include "private/lpc.h" #include "private/md5.h" #include "private/memory.h" - -#ifdef max -#undef max -#endif -#define max(a,b) ((a)>(b)?(a):(b)) - -/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ -#ifdef _MSC_VER -#define FLAC__U64L(x) x -#else -#define FLAC__U64L(x) x##LLU -#endif +#include "private/macros.h" /* technically this should be in an "export.c" but this is convenient enough */ -FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC = -#if FLAC__HAS_OGG - 1 -#else - 0 -#endif -; +FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC = FLAC__HAS_OGG; /*********************************************************************** @@ -96,7 +65,7 @@ FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC = * ***********************************************************************/ -static FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' }; +static const FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' }; /*********************************************************************** * @@ -106,26 +75,27 @@ static FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' }; static void set_defaults_(FLAC__StreamDecoder *decoder); static FILE *get_binary_stdin_(void); -static FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigned channels); +static FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, uint32_t size, uint32_t channels, uint32_t bps); static FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id); static FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder); static FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder); -static FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length); -static FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length); -static FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj); +static FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, uint32_t length); +static FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, uint32_t length); +static FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj, uint32_t length); static FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_CueSheet *obj); static FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_Picture *obj); static FLAC__bool skip_id3v2_tag_(FLAC__StreamDecoder *decoder); static FLAC__bool frame_sync_(FLAC__StreamDecoder *decoder); static FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode); static FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder); -static FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode); -static FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode); -static FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode); -static FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode); -static FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode); -static FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended); +static FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode); +static FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode); +static FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, const uint32_t order, FLAC__bool do_full_decode); +static FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, const uint32_t order, FLAC__bool do_full_decode); +static FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode); +static FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, uint32_t predictor_order, uint32_t partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended); static FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder); +static void undo_channel_coding(FLAC__StreamDecoder *decoder); static FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data); #if FLAC__HAS_OGG static FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes); @@ -150,9 +120,7 @@ static FLAC__bool file_eof_callback_(const FLAC__StreamDecoder *decoder, void *c ***********************************************************************/ typedef struct FLAC__StreamDecoderPrivate { -#if FLAC__HAS_OGG FLAC__bool is_ogg; -#endif FLAC__StreamDecoderReadCallback read_callback; FLAC__StreamDecoderSeekCallback seek_callback; FLAC__StreamDecoderTellCallback tell_callback; @@ -161,22 +129,15 @@ typedef struct FLAC__StreamDecoderPrivate { FLAC__StreamDecoderWriteCallback write_callback; FLAC__StreamDecoderMetadataCallback metadata_callback; FLAC__StreamDecoderErrorCallback error_callback; - /* generic 32-bit datapath: */ - void (*local_lpc_restore_signal)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); - /* generic 64-bit datapath: */ - void (*local_lpc_restore_signal_64bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); - /* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit): */ - void (*local_lpc_restore_signal_16bit)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); - /* for use when the signal is <= 16 bits-per-sample, or <= 15 bits-per-sample on a side channel (which requires 1 extra bit), AND order <= 8: */ - void (*local_lpc_restore_signal_16bit_order8)(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); - FLAC__bool (*local_bitreader_read_rice_signed_block)(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter); void *client_data; FILE *file; /* only used if FLAC__stream_decoder_init_file()/FLAC__stream_decoder_init_file() called, else NULL */ FLAC__BitReader *input; FLAC__int32 *output[FLAC__MAX_CHANNELS]; FLAC__int32 *residual[FLAC__MAX_CHANNELS]; /* WATCHOUT: these are the aligned pointers; the real pointers that should be free()'d are residual_unaligned[] below */ + FLAC__int64 *side_subframe; + FLAC__bool side_subframe_in_use; FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents[FLAC__MAX_CHANNELS]; - unsigned output_capacity, output_channels; + uint32_t output_capacity, output_channels; FLAC__uint32 fixed_block_size, next_fixed_block_size; FLAC__uint64 samples_decoded; FLAC__bool has_stream_info, has_seek_table; @@ -198,13 +159,14 @@ typedef struct FLAC__StreamDecoderPrivate { FLAC__MD5Context md5context; FLAC__byte computed_md5sum[16]; /* this is the sum we computed from the decoded data */ /* (the rest of these are only used for seeking) */ - FLAC__Frame last_frame; /* holds the info of the last frame we seeked to */ + FLAC__Frame last_frame; /* holds the info of the last frame we decoded or seeked to */ + FLAC__bool last_frame_is_set; FLAC__uint64 first_frame_offset; /* hint to the seek routine of where in the stream the first audio frame starts */ + FLAC__uint64 last_seen_framesync; /* if tell callback works, the location of the last seen frame sync code, to rewind to if needed */ FLAC__uint64 target_sample; - unsigned unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */ -#if FLAC__HAS_OGG + uint32_t unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */ FLAC__bool got_a_frame; /* hack needed in Ogg FLAC seek routine to check when process_single() actually writes a frame */ -#endif + FLAC__bool (*local_bitreader_read_rice_signed_block)(FLAC__BitReader *br, int vals[], uint32_t nvals, uint32_t parameter); } FLAC__StreamDecoderPrivate; /*********************************************************************** @@ -268,7 +230,8 @@ FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] = { "FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC", "FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER", "FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH", - "FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM" + "FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM", + "FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA" }; /*********************************************************************** @@ -279,22 +242,22 @@ FLAC_API const char * const FLAC__StreamDecoderErrorStatusString[] = { FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void) { FLAC__StreamDecoder *decoder; - unsigned i; + uint32_t i; FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ - decoder = (FLAC__StreamDecoder*)calloc(1, sizeof(FLAC__StreamDecoder)); + decoder = calloc(1, sizeof(FLAC__StreamDecoder)); if(decoder == 0) { return 0; } - decoder->protected_ = (FLAC__StreamDecoderProtected*)calloc(1, sizeof(FLAC__StreamDecoderProtected)); + decoder->protected_ = calloc(1, sizeof(FLAC__StreamDecoderProtected)); if(decoder->protected_ == 0) { free(decoder); return 0; } - decoder->private_ = (FLAC__StreamDecoderPrivate*)calloc(1, sizeof(FLAC__StreamDecoderPrivate)); + decoder->private_ = calloc(1, sizeof(FLAC__StreamDecoderPrivate)); if(decoder->private_ == 0) { free(decoder->protected_); free(decoder); @@ -310,7 +273,7 @@ FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void) } decoder->private_->metadata_filter_ids_capacity = 16; - if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) { + if(0 == (decoder->private_->metadata_filter_ids = malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) { FLAC__bitreader_delete(decoder->private_->input); free(decoder->private_); free(decoder->protected_); @@ -323,6 +286,8 @@ FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void) decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0; } + decoder->private_->side_subframe = 0; + decoder->private_->output_capacity = 0; decoder->private_->output_channels = 0; decoder->private_->has_seek_table = false; @@ -341,9 +306,11 @@ FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void) FLAC_API void FLAC__stream_decoder_delete(FLAC__StreamDecoder *decoder) { - unsigned i; + uint32_t i; + + if (decoder == NULL) + return ; - FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->protected_); FLAC__ASSERT(0 != decoder->private_); FLAC__ASSERT(0 != decoder->private_->input); @@ -388,10 +355,8 @@ static FLAC__StreamDecoderInitStatus init_stream_internal_( if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) return FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; -#if !FLAC__HAS_OGG - if(is_ogg) + if(FLAC__HAS_OGG == 0 && is_ogg) return FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER; -#endif if( 0 == read_callback || @@ -404,53 +369,21 @@ static FLAC__StreamDecoderInitStatus init_stream_internal_( #if FLAC__HAS_OGG decoder->private_->is_ogg = is_ogg; if(is_ogg && !FLAC__ogg_decoder_aspect_init(&decoder->protected_->ogg_decoder_aspect)) - return decoder->protected_->state = FLAC__STREAM_DECODER_OGG_ERROR; + return decoder->protected_->initstate = FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE; #endif - /* - * get the CPU info and set the function pointers - */ FLAC__cpu_info(&decoder->private_->cpuinfo); - /* first default to the non-asm routines */ - decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal; - decoder->private_->local_lpc_restore_signal_64bit = FLAC__lpc_restore_signal_wide; - decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal; - decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal; decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block; - /* now override with asm where appropriate */ -#ifndef FLAC__NO_ASM - if(decoder->private_->cpuinfo.use_asm) { -#ifdef FLAC__CPU_IA32 - FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32); -#ifdef FLAC__HAS_NASM -#if 1 /*@@@@@@ OPT: not clearly faster, needs more testing */ - if(decoder->private_->cpuinfo.data.ia32.bswap) - decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap; -#endif - if(decoder->private_->cpuinfo.data.ia32.mmx) { - decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_ia32; - decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ia32_mmx; - decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ia32_mmx; - } - else { - decoder->private_->local_lpc_restore_signal = FLAC__lpc_restore_signal_asm_ia32; - decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ia32; - decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ia32; - } -#endif -#elif defined FLAC__CPU_PPC - FLAC__ASSERT(decoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_PPC); - if(decoder->private_->cpuinfo.data.ppc.altivec) { - decoder->private_->local_lpc_restore_signal_16bit = FLAC__lpc_restore_signal_asm_ppc_altivec_16; - decoder->private_->local_lpc_restore_signal_16bit_order8 = FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8; - } -#endif + +#ifdef FLAC__BMI2_SUPPORTED + if (decoder->private_->cpuinfo.x86.bmi2) { + decoder->private_->local_bitreader_read_rice_signed_block = FLAC__bitreader_read_rice_signed_block_bmi2; } #endif /* from here on, errors are fatal */ - if(!FLAC__bitreader_init(decoder->private_->input, decoder->private_->cpuinfo, read_callback_, decoder)) { + if(!FLAC__bitreader_init(decoder->private_->input, read_callback_, decoder)) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return FLAC__STREAM_DECODER_INIT_STATUS_MEMORY_ALLOCATION_ERROR; } @@ -551,10 +484,10 @@ static FLAC__StreamDecoderInitStatus init_FILE_internal_( FLAC__ASSERT(0 != file); if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) - return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; + return decoder->protected_->initstate = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; if(0 == write_callback || 0 == error_callback) - return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS; + return decoder->protected_->initstate = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS; /* * To make sure that our file does not go unclosed after an error, we @@ -625,12 +558,12 @@ static FLAC__StreamDecoderInitStatus init_file_internal_( * in FLAC__stream_decoder_init_FILE() before the FILE* is assigned. */ if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) - return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; + return decoder->protected_->initstate = FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; if(0 == write_callback || 0 == error_callback) - return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS; + return decoder->protected_->initstate = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS; - file = filename? fopen(filename, "rb") : stdin; + file = filename? flac_fopen(filename, "rb") : stdin; if(0 == file) return FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE; @@ -665,7 +598,7 @@ FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_ogg_file( FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder) { FLAC__bool md5_failed = false; - unsigned i; + uint32_t i; FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->private_); @@ -674,23 +607,22 @@ FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder) if(decoder->protected_->state == FLAC__STREAM_DECODER_UNINITIALIZED) return true; - /* see the comment in FLAC__seekable_stream_decoder_reset() as to why we + /* see the comment in FLAC__stream_decoder_reset() as to why we * always call FLAC__MD5Final() */ FLAC__MD5Final(decoder->private_->computed_md5sum, &decoder->private_->md5context); - if(decoder->private_->has_seek_table && 0 != decoder->private_->seek_table.data.seek_table.points) { - free(decoder->private_->seek_table.data.seek_table.points); - decoder->private_->seek_table.data.seek_table.points = 0; - decoder->private_->has_seek_table = false; - } + free(decoder->private_->seek_table.data.seek_table.points); + decoder->private_->seek_table.data.seek_table.points = 0; + decoder->private_->has_seek_table = false; + FLAC__bitreader_free(decoder->private_->input); for(i = 0; i < FLAC__MAX_CHANNELS; i++) { /* WATCHOUT: - * FLAC__lpc_restore_signal_asm_ia32_mmx() requires that the - * output arrays have a buffer of up to 3 zeroes in front - * (at negative indices) for alignment purposes; we use 4 - * to keep the data well-aligned. + * FLAC__lpc_restore_signal_asm_ia32_mmx() and ..._intrin_sseN() + * require that the output arrays have a buffer of up to 3 zeroes + * in front (at negative indices) for alignment purposes; + * we use 4 to keep the data well-aligned. */ if(0 != decoder->private_->output[i]) { free(decoder->private_->output[i]-4); @@ -701,6 +633,10 @@ FLAC_API FLAC__bool FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder) decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0; } } + if(0 != decoder->private_->side_subframe) { + free(decoder->private_->side_subframe); + decoder->private_->side_subframe = 0; + } decoder->private_->output_capacity = 0; decoder->private_->output_channels = 0; @@ -760,9 +696,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecode FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->private_); FLAC__ASSERT(0 != decoder->protected_); - FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE); + FLAC__ASSERT((uint32_t)type <= FLAC__MAX_METADATA_TYPE_CODE); /* double protection */ - if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE) + if((uint32_t)type > FLAC__MAX_METADATA_TYPE_CODE) return false; if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) return false; @@ -787,7 +723,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__ FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids); if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) { - if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) { + if(0 == (decoder->private_->metadata_filter_ids = safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -802,7 +738,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder) { - unsigned i; + uint32_t i; FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->private_); FLAC__ASSERT(0 != decoder->protected_); @@ -819,9 +755,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->private_); FLAC__ASSERT(0 != decoder->protected_); - FLAC__ASSERT((unsigned)type <= FLAC__MAX_METADATA_TYPE_CODE); + FLAC__ASSERT((uint32_t)type <= FLAC__MAX_METADATA_TYPE_CODE); /* double protection */ - if((unsigned)type > FLAC__MAX_METADATA_TYPE_CODE) + if((uint32_t)type > FLAC__MAX_METADATA_TYPE_CODE) return false; if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) return false; @@ -846,7 +782,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__S FLAC__ASSERT(0 != decoder->private_->metadata_filter_ids); if(decoder->private_->metadata_filter_ids_count == decoder->private_->metadata_filter_ids_capacity) { - if(0 == (decoder->private_->metadata_filter_ids = (FLAC__byte*)safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) { + if(0 == (decoder->private_->metadata_filter_ids = safe_realloc_mul_2op_(decoder->private_->metadata_filter_ids, decoder->private_->metadata_filter_ids_capacity, /*times*/2))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -897,7 +833,7 @@ FLAC_API FLAC__uint64 FLAC__stream_decoder_get_total_samples(const FLAC__StreamD return decoder->private_->has_stream_info? decoder->private_->stream_info.data.stream_info.total_samples : 0; } -FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder) +FLAC_API uint32_t FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder) { FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->protected_); @@ -911,21 +847,21 @@ FLAC_API FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(con return decoder->protected_->channel_assignment; } -FLAC_API unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder) +FLAC_API uint32_t FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder) { FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->protected_); return decoder->protected_->bits_per_sample; } -FLAC_API unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder) +FLAC_API uint32_t FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder) { FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->protected_); return decoder->protected_->sample_rate; } -FLAC_API unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder) +FLAC_API uint32_t FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder) { FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->protected_); @@ -938,10 +874,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamD FLAC__ASSERT(0 != decoder->private_); FLAC__ASSERT(0 != position); -#if FLAC__HAS_OGG - if(decoder->private_->is_ogg) + if(FLAC__HAS_OGG && decoder->private_->is_ogg) return false; -#endif + if(0 == decoder->private_->tell_callback) return false; if(decoder->private_->tell_callback(decoder, position, decoder->private_->client_data) != FLAC__STREAM_DECODER_TELL_STATUS_OK) @@ -954,14 +889,24 @@ FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamD return true; } +FLAC_API const void *FLAC__stream_decoder_get_client_data(FLAC__StreamDecoder *decoder) +{ + return decoder->private_->client_data; +} + FLAC_API FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder) { FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder->private_); FLAC__ASSERT(0 != decoder->protected_); + if(!decoder->private_->internal_reset_hack && decoder->protected_->state == FLAC__STREAM_DECODER_UNINITIALIZED) + return false; + decoder->private_->samples_decoded = 0; decoder->private_->do_md5_checking = false; + decoder->private_->last_seen_framesync = 0; + decoder->private_->last_frame_is_set = false; #if FLAC__HAS_OGG if(decoder->private_->is_ogg) @@ -1005,17 +950,15 @@ FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder) if(decoder->private_->seek_callback && decoder->private_->seek_callback(decoder, 0, decoder->private_->client_data) == FLAC__STREAM_DECODER_SEEK_STATUS_ERROR) return false; /* seekable and seek fails, reset fails */ } - else - decoder->private_->internal_reset_hack = false; decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_METADATA; decoder->private_->has_stream_info = false; - if(decoder->private_->has_seek_table && 0 != decoder->private_->seek_table.data.seek_table.points) { - free(decoder->private_->seek_table.data.seek_table.points); - decoder->private_->seek_table.data.seek_table.points = 0; - decoder->private_->has_seek_table = false; - } + + free(decoder->private_->seek_table.data.seek_table.points); + decoder->private_->seek_table.data.seek_table.points = 0; + decoder->private_->has_seek_table = false; + decoder->private_->do_md5_checking = decoder->protected_->md5_checking; /* * This goes in reset() and not flush() because according to the spec, a @@ -1029,10 +972,19 @@ FLAC_API FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder) * FLAC__stream_decoder_finish() to make sure things are always cleaned up * properly. */ + if(!decoder->private_->internal_reset_hack) { + /* Only finish MD5 context when it has been initialized + * (i.e. when internal_reset_hack is not set) */ + FLAC__MD5Final(decoder->private_->computed_md5sum, &decoder->private_->md5context); + } + else + decoder->private_->internal_reset_hack = false; FLAC__MD5Init(&decoder->private_->md5context); decoder->private_->first_frame_offset = 0; decoder->private_->unparseable_frame_count = 0; + decoder->private_->last_seen_framesync = 0; + decoder->private_->last_frame_is_set = false; return true; } @@ -1068,7 +1020,6 @@ FLAC_API FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *dec case FLAC__STREAM_DECODER_ABORTED: return true; default: - FLAC__ASSERT(0); return false; } } @@ -1095,7 +1046,6 @@ FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__Str case FLAC__STREAM_DECODER_ABORTED: return true; default: - FLAC__ASSERT(0); return false; } } @@ -1129,7 +1079,6 @@ FLAC_API FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__Strea case FLAC__STREAM_DECODER_ABORTED: return true; default: - FLAC__ASSERT(0); return false; } } @@ -1160,7 +1109,6 @@ FLAC_API FLAC__bool FLAC__stream_decoder_skip_single_frame(FLAC__StreamDecoder * case FLAC__STREAM_DECODER_ABORTED: return true; default: - FLAC__ASSERT(0); return false; } } @@ -1239,7 +1187,7 @@ FLAC_API FLAC__bool FLAC__stream_decoder_seek_absolute(FLAC__StreamDecoder *deco * ***********************************************************************/ -unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder) +uint32_t FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder) { FLAC__ASSERT(0 != decoder); FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); @@ -1255,9 +1203,7 @@ unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecod void set_defaults_(FLAC__StreamDecoder *decoder) { -#if FLAC__HAS_OGG decoder->private_->is_ogg = false; -#endif decoder->private_->read_callback = 0; decoder->private_->seek_callback = 0; decoder->private_->tell_callback = 0; @@ -1290,9 +1236,6 @@ FILE *get_binary_stdin_(void) */ #if defined _MSC_VER || defined __MINGW32__ _setmode(_fileno(stdin), _O_BINARY); -#elif defined __CYGWIN__ - /* almost certainly not needed for any modern Cygwin, but let's be safe... */ - setmode(_fileno(stdin), _O_BINARY); #elif defined __EMX__ setmode(fileno(stdin), O_BINARY); #endif @@ -1300,12 +1243,13 @@ FILE *get_binary_stdin_(void) return stdin; } -FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigned channels) +FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, uint32_t size, uint32_t channels, uint32_t bps) { - unsigned i; + uint32_t i; FLAC__int32 *tmp; - if(size <= decoder->private_->output_capacity && channels <= decoder->private_->output_channels) + if(size <= decoder->private_->output_capacity && channels <= decoder->private_->output_channels && + (bps < 32 || decoder->private_->side_subframe != 0)) return true; /* simply using realloc() is not practical because the number of channels may change mid-stream */ @@ -1321,14 +1265,19 @@ FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigne } } + if(0 != decoder->private_->side_subframe) { + free(decoder->private_->side_subframe); + decoder->private_->side_subframe = 0; + } + for(i = 0; i < channels; i++) { /* WATCHOUT: - * FLAC__lpc_restore_signal_asm_ia32_mmx() requires that the - * output arrays have a buffer of up to 3 zeroes in front - * (at negative indices) for alignment purposes; we use 4 - * to keep the data well-aligned. + * FLAC__lpc_restore_signal_asm_ia32_mmx() and ..._intrin_sseN() + * require that the output arrays have a buffer of up to 3 zeroes + * in front (at negative indices) for alignment purposes; + * we use 4 to keep the data well-aligned. */ - tmp = (FLAC__int32*)safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/size, /*+*/4/*)*/); + tmp = safe_malloc_muladd2_(sizeof(FLAC__int32), /*times (*/size, /*+*/4/*)*/); if(tmp == 0) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; @@ -1336,15 +1285,20 @@ FLAC__bool allocate_output_(FLAC__StreamDecoder *decoder, unsigned size, unsigne memset(tmp, 0, sizeof(FLAC__int32)*4); decoder->private_->output[i] = tmp + 4; - /* WATCHOUT: - * minimum of quadword alignment for PPC vector optimizations is REQUIRED: - */ if(!FLAC__memory_alloc_aligned_int32_array(size, &decoder->private_->residual_unaligned[i], &decoder->private_->residual[i])) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } } + if(bps == 32) { + decoder->private_->side_subframe = safe_malloc_mul_2op_p(sizeof(FLAC__int64), /*times (*/size); + if(decoder->private_->side_subframe == NULL) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + } + decoder->private_->output_capacity = size; decoder->private_->output_channels = channels; @@ -1368,7 +1322,7 @@ FLAC__bool has_id_filtered_(FLAC__StreamDecoder *decoder, FLAC__byte *id) FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder) { FLAC__uint32 x; - unsigned i, id; + uint32_t i, id; FLAC__bool first = true; FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); @@ -1388,6 +1342,10 @@ FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder) id = 0; continue; } + + if(id >= 3) + return false; + if(x == ID3V2_TAG_[id]) { id++; i = 0; @@ -1409,7 +1367,7 @@ FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder) decoder->private_->lookahead = (FLAC__byte)x; decoder->private_->cached = true; } - else if(x >> 2 == 0x3e) { /* MAGIC NUMBER for the last 6 sync bits */ + else if(x >> 1 == 0x7c) { /* MAGIC NUMBER for the last 6 sync bits and reserved 7th bit */ decoder->private_->header_warmup[1] = (FLAC__byte)x; decoder->protected_->state = FLAC__STREAM_DECODER_READ_FRAME; return true; @@ -1454,22 +1412,27 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder) decoder->private_->metadata_callback(decoder, &decoder->private_->stream_info, decoder->private_->client_data); } else if(type == FLAC__METADATA_TYPE_SEEKTABLE) { - if(!read_metadata_seektable_(decoder, is_last, length)) - return false; + /* just in case we already have a seek table, and reading the next one fails: */ + decoder->private_->has_seek_table = false; + + if(length > 0) { + if(!read_metadata_seektable_(decoder, is_last, length)) + return false; - decoder->private_->has_seek_table = true; - if(!decoder->private_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_SEEKTABLE] && decoder->private_->metadata_callback) - decoder->private_->metadata_callback(decoder, &decoder->private_->seek_table, decoder->private_->client_data); + decoder->private_->has_seek_table = true; + if(!decoder->private_->is_seeking && decoder->private_->metadata_filter[FLAC__METADATA_TYPE_SEEKTABLE] && decoder->private_->metadata_callback) + decoder->private_->metadata_callback(decoder, &decoder->private_->seek_table, decoder->private_->client_data); + } } else { FLAC__bool skip_it = !decoder->private_->metadata_filter[type]; - unsigned real_length = length; + uint32_t real_length = length; FLAC__StreamMetadata block; + memset(&block, 0, sizeof(block)); block.is_last = is_last; block.type = (FLAC__MetadataType)type; block.length = length; - memset(&block.data, 0, sizeof(block.data)); if(type == FLAC__METADATA_TYPE_APPLICATION) { if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.id, FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8)) @@ -1491,36 +1454,38 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder) return false; /* read_callback_ sets the state for us */ } else { + FLAC__bool ok = true; + FLAC__bitreader_set_limit(decoder->private_->input, real_length*8); switch(type) { case FLAC__METADATA_TYPE_PADDING: /* skip the padding bytes */ if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, real_length)) - return false; /* read_callback_ sets the state for us */ + ok = false; /* read_callback_ sets the state for us */ break; case FLAC__METADATA_TYPE_APPLICATION: /* remember, we read the ID already */ if(real_length > 0) { - if(0 == (block.data.application.data = (FLAC__byte*)malloc(real_length))) { + if(0 == (block.data.application.data = malloc(real_length))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; + ok = false; } - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.data, real_length)) - return false; /* read_callback_ sets the state for us */ + else if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.application.data, real_length)) + ok = false; /* read_callback_ sets the state for us */ } else block.data.application.data = 0; break; case FLAC__METADATA_TYPE_VORBIS_COMMENT: - if(!read_metadata_vorbiscomment_(decoder, &block.data.vorbis_comment)) - return false; + if(!read_metadata_vorbiscomment_(decoder, &block.data.vorbis_comment, real_length)) + ok = false; break; case FLAC__METADATA_TYPE_CUESHEET: if(!read_metadata_cuesheet_(decoder, &block.data.cue_sheet)) - return false; + ok = false; break; case FLAC__METADATA_TYPE_PICTURE: if(!read_metadata_picture_(decoder, &block.data.picture)) - return false; + ok = false; break; case FLAC__METADATA_TYPE_STREAMINFO: case FLAC__METADATA_TYPE_SEEKTABLE: @@ -1528,18 +1493,28 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder) break; default: if(real_length > 0) { - if(0 == (block.data.unknown.data = (FLAC__byte*)malloc(real_length))) { + if(0 == (block.data.unknown.data = malloc(real_length))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; - return false; + ok = false; } - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.unknown.data, real_length)) - return false; /* read_callback_ sets the state for us */ + else if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, block.data.unknown.data, real_length)) + ok = false; /* read_callback_ sets the state for us */ } else block.data.unknown.data = 0; break; } - if(!decoder->private_->is_seeking && decoder->private_->metadata_callback) + if(FLAC__bitreader_limit_remaining(decoder->private_->input) > 0) { + /* Content in metadata block didn't fit in block length + * We cannot know whether the length or the content was + * corrupt, so stop parsing metadata */ + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_METADATA); + if(decoder->protected_->state == FLAC__STREAM_DECODER_READ_METADATA) + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + ok = false; + } + FLAC__bitreader_remove_limit(decoder->private_->input); + if(ok && !decoder->private_->is_seeking && decoder->private_->metadata_callback) decoder->private_->metadata_callback(decoder, &block, decoder->private_->client_data); /* now we have to free any malloc()ed data in the block */ @@ -1561,7 +1536,7 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder) free(block.data.vorbis_comment.comments); break; case FLAC__METADATA_TYPE_CUESHEET: - if(block.data.cue_sheet.num_tracks > 0) + if(block.data.cue_sheet.num_tracks > 0 && 0 != block.data.cue_sheet.tracks) for(i = 0; i < block.data.cue_sheet.num_tracks; i++) if(0 != block.data.cue_sheet.tracks[i].indices) free(block.data.cue_sheet.tracks[i].indices); @@ -1584,6 +1559,9 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder) free(block.data.unknown.data); break; } + + if(!ok) /* anything that unsets "ok" should also make sure decoder->protected_->state is updated */ + return false; } } @@ -1597,10 +1575,10 @@ FLAC__bool read_metadata_(FLAC__StreamDecoder *decoder) return true; } -FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length) +FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, uint32_t length) { FLAC__uint32 x; - unsigned bits, used_bits = 0; + uint32_t bits, used_bits = 0; FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); @@ -1661,6 +1639,8 @@ FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is /* skip the rest of the block */ FLAC__ASSERT(used_bits % 8 == 0); + if (length < (used_bits / 8)) + return false; /* read_callback_ sets the state for us */ length -= (used_bits / 8); if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length)) return false; /* read_callback_ sets the state for us */ @@ -1668,7 +1648,7 @@ FLAC__bool read_metadata_streaminfo_(FLAC__StreamDecoder *decoder, FLAC__bool is return true; } -FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length) +FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, uint32_t length) { FLAC__uint32 i, x; FLAC__uint64 xx; @@ -1679,10 +1659,15 @@ FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_ decoder->private_->seek_table.is_last = is_last; decoder->private_->seek_table.length = length; + if(length % FLAC__STREAM_METADATA_SEEKPOINT_LENGTH) { + FLAC__bitreader_limit_invalidate(decoder->private_->input); + return false; + } + decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; /* use realloc since we may pass through here several times (e.g. after seeking) */ - if(0 == (decoder->private_->seek_table.data.seek_table.points = (FLAC__StreamMetadata_SeekPoint*)safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) { + if(0 == (decoder->private_->seek_table.data.seek_table.points = safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -1700,68 +1685,110 @@ FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_ decoder->private_->seek_table.data.seek_table.points[i].frame_samples = x; } length -= (decoder->private_->seek_table.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH); - /* if there is a partial point left, skip over it */ - if(length > 0) { - /*@@@ do a send_error_to_client_() here? there's an argument for either way */ - if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length)) - return false; /* read_callback_ sets the state for us */ - } + + FLAC__ASSERT(length == 0); return true; } -FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj) +FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj, uint32_t length) { FLAC__uint32 i; FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); /* read vendor string */ - FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32); - if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->vendor_string.length)) - return false; /* read_callback_ sets the state for us */ - if(obj->vendor_string.length > 0) { - if(0 == (obj->vendor_string.entry = (FLAC__byte*)safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) { + if (length >= 8) { + length -= 8; /* vendor string length + num comments entries alone take 8 bytes */ + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32); + if (!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->vendor_string.length)) + return false; /* read_callback_ sets the state for us */ + if (length < obj->vendor_string.length) { + obj->vendor_string.length = 0; + obj->vendor_string.entry = 0; + goto skip; + } + else + length -= obj->vendor_string.length; + if (0 == (obj->vendor_string.entry = safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->vendor_string.entry, obj->vendor_string.length)) + if (!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->vendor_string.entry, obj->vendor_string.length)) return false; /* read_callback_ sets the state for us */ obj->vendor_string.entry[obj->vendor_string.length] = '\0'; - } - else - obj->vendor_string.entry = 0; - /* read num comments */ - FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN == 32); - if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->num_comments)) - return false; /* read_callback_ sets the state for us */ + /* read num comments */ + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN == 32); + if (!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->num_comments)) + return false; /* read_callback_ sets the state for us */ - /* read comments */ - if(obj->num_comments > 0) { - if(0 == (obj->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)safe_malloc_mul_2op_(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) { - decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + /* read comments */ + if (obj->num_comments > 100000) { + /* Possibly malicious file. */ + obj->num_comments = 0; return false; } - for(i = 0; i < obj->num_comments; i++) { - FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32); - if(!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length)) - return false; /* read_callback_ sets the state for us */ - if(obj->comments[i].length > 0) { - if(0 == (obj->comments[i].entry = (FLAC__byte*)safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) { + if (obj->num_comments > 0) { + if (0 == (obj->comments = safe_malloc_mul_2op_p(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) { + obj->num_comments = 0; + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + for (i = 0; i < obj->num_comments; i++) { + /* Initialize here just to make sure. */ + obj->comments[i].length = 0; + obj->comments[i].entry = 0; + + FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32); + if (length < 4) { + obj->num_comments = i; + goto skip; + } + else + length -= 4; + if (!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length)) { + obj->num_comments = i; + return false; /* read_callback_ sets the state for us */ + } + if (length < obj->comments[i].length) { + obj->num_comments = i; + FLAC__bitreader_limit_invalidate(decoder->private_->input); + return false; + } + else + length -= obj->comments[i].length; + if (0 == (obj->comments[i].entry = safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + obj->num_comments = i; return false; } - if(!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->comments[i].entry, obj->comments[i].length)) - return false; /* read_callback_ sets the state for us */ + memset (obj->comments[i].entry, 0, obj->comments[i].length) ; + if (!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->comments[i].entry, obj->comments[i].length)) { + /* Current i-th entry is bad, so we delete it. */ + free (obj->comments[i].entry) ; + obj->comments[i].entry = NULL ; + obj->num_comments = i; + goto skip; + } obj->comments[i].entry[obj->comments[i].length] = '\0'; } - else - obj->comments[i].entry = 0; } } else { - obj->comments = 0; + FLAC__bitreader_limit_invalidate(decoder->private_->input); + return false; + } + + skip: + if (length > 0) { + /* length > 0 can only happen on files with invalid data in comments */ + if(obj->num_comments < 1) { + free(obj->comments); + obj->comments = NULL; + } + FLAC__bitreader_limit_invalidate(decoder->private_->input); + return false; } return true; @@ -1794,7 +1821,7 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet obj->num_tracks = x; if(obj->num_tracks > 0) { - if(0 == (obj->tracks = (FLAC__StreamMetadata_CueSheet_Track*)safe_calloc_(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) { + if(0 == (obj->tracks = safe_calloc_(obj->num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -1827,18 +1854,18 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet track->num_indices = (FLAC__byte)x; if(track->num_indices > 0) { - if(0 == (track->indices = (FLAC__StreamMetadata_CueSheet_Index*)safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) { + if(0 == (track->indices = safe_calloc_(track->num_indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } for(j = 0; j < track->num_indices; j++) { - FLAC__StreamMetadata_CueSheet_Index *index = &track->indices[j]; - if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN)) + FLAC__StreamMetadata_CueSheet_Index *indx = &track->indices[j]; + if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &indx->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN)) return false; /* read_callback_ sets the state for us */ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN)) return false; /* read_callback_ sets the state for us */ - index->number = (FLAC__byte)x; + indx->number = (FLAC__byte)x; if(!FLAC__bitreader_skip_bits_no_crc(decoder->private_->input, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN)) return false; /* read_callback_ sets the state for us */ @@ -1846,6 +1873,10 @@ FLAC__bool read_metadata_cuesheet_(FLAC__StreamDecoder *decoder, FLAC__StreamMet } } } + else { /* obj->num_tracks == 0 */ + FLAC__bitreader_limit_invalidate(decoder->private_->input); + return false; + } return true; } @@ -1859,12 +1890,19 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta /* read type */ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_TYPE_LEN)) return false; /* read_callback_ sets the state for us */ - obj->type = x; + if(x < FLAC__STREAM_METADATA_PICTURE_TYPE_UNDEFINED) + obj->type = x; + else + obj->type = FLAC__STREAM_METADATA_PICTURE_TYPE_OTHER; /* read MIME type */ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) return false; /* read_callback_ sets the state for us */ - if(0 == (obj->mime_type = (char*)safe_malloc_add_2op_(x, /*+*/1))) { + if(FLAC__bitreader_limit_remaining(decoder->private_->input) < x){ + FLAC__bitreader_limit_invalidate(decoder->private_->input); + return false; + } + if(0 == (obj->mime_type = safe_malloc_add_2op_(x, /*+*/1))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -1877,7 +1915,11 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta /* read description */ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN)) return false; /* read_callback_ sets the state for us */ - if(0 == (obj->description = (FLAC__byte*)safe_malloc_add_2op_(x, /*+*/1))) { + if(FLAC__bitreader_limit_remaining(decoder->private_->input) < x){ + FLAC__bitreader_limit_invalidate(decoder->private_->input); + return false; + } + if(0 == (obj->description = safe_malloc_add_2op_(x, /*+*/1))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -1906,7 +1948,11 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta /* read data */ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &(obj->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN)) return false; /* read_callback_ sets the state for us */ - if(0 == (obj->data = (FLAC__byte*)safe_malloc_(obj->data_length))) { + if(FLAC__bitreader_limit_remaining(decoder->private_->input) < obj->data_length){ + FLAC__bitreader_limit_invalidate(decoder->private_->input); + return false; + } + if(0 == (obj->data = safe_malloc_(obj->data_length))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -1921,7 +1967,7 @@ FLAC__bool read_metadata_picture_(FLAC__StreamDecoder *decoder, FLAC__StreamMeta FLAC__bool skip_id3v2_tag_(FLAC__StreamDecoder *decoder) { FLAC__uint32 x; - unsigned i, skip; + uint32_t i, skip; /* skip the version and flags bytes */ if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 24)) @@ -1945,15 +1991,6 @@ FLAC__bool frame_sync_(FLAC__StreamDecoder *decoder) FLAC__uint32 x; FLAC__bool first = true; - /* If we know the total number of samples in the stream, stop if we've read that many. */ - /* This will stop us, for example, from wasting time trying to sync on an ID3V1 tag. */ - if(FLAC__stream_decoder_get_total_samples(decoder) > 0) { - if(decoder->private_->samples_decoded >= FLAC__stream_decoder_get_total_samples(decoder)) { - decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM; - return true; - } - } - /* make sure we're byte aligned */ if(!FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)) { if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__bitreader_bits_left_for_byte_alignment(decoder->private_->input))) @@ -1980,9 +2017,15 @@ FLAC__bool frame_sync_(FLAC__StreamDecoder *decoder) decoder->private_->lookahead = (FLAC__byte)x; decoder->private_->cached = true; } - else if(x >> 2 == 0x3e) { /* MAGIC NUMBER for the last 6 sync bits */ + else if(x >> 1 == 0x7c) { /* MAGIC NUMBER for the last 6 sync bits and reserved 7th bit */ decoder->private_->header_warmup[1] = (FLAC__byte)x; decoder->protected_->state = FLAC__STREAM_DECODER_READ_FRAME; + + /* Save location so we can rewind in case the frame turns + * out to be invalid after the header */ + FLAC__bitreader_set_framesync_location(decoder->private_->input); + if(!FLAC__stream_decoder_get_decode_position(decoder, &decoder->private_->last_seen_framesync)) + decoder->private_->last_seen_framesync = 0; return true; } } @@ -1997,13 +2040,13 @@ FLAC__bool frame_sync_(FLAC__StreamDecoder *decoder) FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FLAC__bool do_full_decode) { - unsigned channel; - unsigned i; - FLAC__int32 mid, side; - unsigned frame_crc; /* the one we calculate from the input stream */ + uint32_t channel; + uint32_t i; + uint32_t frame_crc; /* the one we calculate from the input stream */ FLAC__uint32 x; *got_a_frame = false; + decoder->private_->side_subframe_in_use = false; /* init the CRC */ frame_crc = 0; @@ -2015,13 +2058,13 @@ FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FL return false; if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means we didn't sync on a valid header */ return true; - if(!allocate_output_(decoder, decoder->private_->frame.header.blocksize, decoder->private_->frame.header.channels)) + if(!allocate_output_(decoder, decoder->private_->frame.header.blocksize, decoder->private_->frame.header.channels, decoder->private_->frame.header.bits_per_sample)) return false; for(channel = 0; channel < decoder->private_->frame.header.channels; channel++) { /* * first figure the correct bits-per-sample of the subframe */ - unsigned bps = decoder->private_->frame.header.bits_per_sample; + uint32_t bps = decoder->private_->frame.header.bits_per_sample; switch(decoder->private_->frame.header.channel_assignment) { case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT: /* no adjustment needed */ @@ -2047,93 +2090,184 @@ FLAC__bool read_frame_(FLAC__StreamDecoder *decoder, FLAC__bool *got_a_frame, FL /* * now read it */ - if(!read_subframe_(decoder, channel, bps, do_full_decode)) - return false; - if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */ - return true; + if(!read_subframe_(decoder, channel, bps, do_full_decode)){ + /* read_callback_ sets the state for us */ + if(decoder->protected_->state == FLAC__STREAM_DECODER_END_OF_STREAM) + break; + else + return false; + } + if(decoder->protected_->state != FLAC__STREAM_DECODER_READ_FRAME) + break; } - if(!read_zero_padding_(decoder)) - return false; - if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption (i.e. "zero bits" were not all zeroes) */ - return true; + + if(decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM) + if(!read_zero_padding_(decoder)) + return false; /* * Read the frame CRC-16 from the footer and check */ - frame_crc = FLAC__bitreader_get_read_crc16(decoder->private_->input); - if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__FRAME_FOOTER_CRC_LEN)) - return false; /* read_callback_ sets the state for us */ - if(frame_crc == x) { + if(decoder->protected_->state == FLAC__STREAM_DECODER_READ_FRAME) { + frame_crc = FLAC__bitreader_get_read_crc16(decoder->private_->input); + if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__FRAME_FOOTER_CRC_LEN)) { + /* read_callback_ sets the state for us */ + if(decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM) + return false; + } +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + } + if(decoder->protected_->state == FLAC__STREAM_DECODER_READ_FRAME && frame_crc == x) { +#endif if(do_full_decode) { /* Undo any special channel coding */ - switch(decoder->private_->frame.header.channel_assignment) { - case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT: - /* do nothing */ - break; - case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE: - FLAC__ASSERT(decoder->private_->frame.header.channels == 2); - for(i = 0; i < decoder->private_->frame.header.blocksize; i++) - decoder->private_->output[1][i] = decoder->private_->output[0][i] - decoder->private_->output[1][i]; - break; - case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE: - FLAC__ASSERT(decoder->private_->frame.header.channels == 2); - for(i = 0; i < decoder->private_->frame.header.blocksize; i++) - decoder->private_->output[0][i] += decoder->private_->output[1][i]; - break; - case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE: - FLAC__ASSERT(decoder->private_->frame.header.channels == 2); - for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { -#if 1 - mid = decoder->private_->output[0][i]; - side = decoder->private_->output[1][i]; - mid <<= 1; - mid |= (side & 1); /* i.e. if 'side' is odd... */ - decoder->private_->output[0][i] = (mid + side) >> 1; - decoder->private_->output[1][i] = (mid - side) >> 1; -#else - /* OPT: without 'side' temp variable */ - mid = (decoder->private_->output[0][i] << 1) | (decoder->private_->output[1][i] & 1); /* i.e. if 'side' is odd... */ - decoder->private_->output[0][i] = (mid + decoder->private_->output[1][i]) >> 1; - decoder->private_->output[1][i] = (mid - decoder->private_->output[1][i]) >> 1; -#endif + undo_channel_coding(decoder); + /* Check whether decoded data actually fits bps */ + for(channel = 0; channel < decoder->private_->frame.header.channels; channel++) { + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { + int shift_bits = 32 - decoder->private_->frame.header.bits_per_sample; + /* Check whether shift_bits MSBs are 'empty' by shifting up and down */ + if((decoder->private_->output[channel][i] < (INT32_MIN >> shift_bits)) || + (decoder->private_->output[channel][i] > (INT32_MAX >> shift_bits))) { + /* Bad frame, emit error */ + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + break; } - break; - default: - FLAC__ASSERT(0); - break; + } } } } - else { - /* Bad frame, emit error and zero the output signal */ +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + else if (decoder->protected_->state == FLAC__STREAM_DECODER_READ_FRAME) { + /* Bad frame, emit error */ send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_FRAME_CRC_MISMATCH); - if(do_full_decode) { - for(channel = 0; channel < decoder->private_->frame.header.channels; channel++) { - memset(decoder->private_->output[channel], 0, sizeof(FLAC__int32) * decoder->private_->frame.header.blocksize); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + } +#endif + + /* Check whether frames are missing, if so, add silence to compensate */ + if(decoder->private_->last_frame_is_set && decoder->protected_->state == FLAC__STREAM_DECODER_READ_FRAME && !decoder->private_->is_seeking && do_full_decode) { + FLAC__ASSERT(decoder->private_->frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + if(decoder->private_->last_frame.header.number.sample_number + decoder->private_->last_frame.header.blocksize < decoder->private_->frame.header.number.sample_number) { + uint32_t padding_samples_needed = decoder->private_->frame.header.number.sample_number - (decoder->private_->last_frame.header.number.sample_number + decoder->private_->last_frame.header.blocksize); + + /* Do some extra validation to assure last frame an current frame + * header are both valid before adding silence inbetween + * Technically both frames could be valid with differing sample_rates, + * channels and bits_per_sample, but it is quite rare */ + if(decoder->private_->last_frame.header.sample_rate == decoder->private_->frame.header.sample_rate && + decoder->private_->last_frame.header.channels == decoder->private_->frame.header.channels && + decoder->private_->last_frame.header.bits_per_sample == decoder->private_->frame.header.bits_per_sample && + decoder->private_->last_frame.header.blocksize >= 16) { + FLAC__Frame empty_frame; + FLAC__int32 * empty_buffer[FLAC__MAX_CHANNELS] = {NULL}; + empty_frame.header = decoder->private_->last_frame.header; + empty_frame.footer.crc = 0; + for(i = 0; i < empty_frame.header.channels; i++) { + empty_buffer[i] = safe_calloc_(empty_frame.header.blocksize, sizeof(FLAC__int32)); + if(empty_buffer[i] == NULL) { + for(i = 0; i < empty_frame.header.channels; i++) + if(empty_buffer[i] != NULL) + free(empty_buffer[i]); + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + } + /* No repairs larger than 5 seconds or 50 frames are made, to not + * unexpectedly create enormous files when one of the headers was + * corrupt after all */ + if(padding_samples_needed > (5*empty_frame.header.sample_rate)) + padding_samples_needed = 5*empty_frame.header.sample_rate; + if(padding_samples_needed > (50*empty_frame.header.blocksize)) + padding_samples_needed = 50*empty_frame.header.blocksize; + while(padding_samples_needed){ + empty_frame.header.number.sample_number += empty_frame.header.blocksize; + if(padding_samples_needed < empty_frame.header.blocksize) + empty_frame.header.blocksize = padding_samples_needed; + padding_samples_needed -= empty_frame.header.blocksize; + decoder->protected_->blocksize = empty_frame.header.blocksize; + + FLAC__ASSERT(empty_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + decoder->private_->samples_decoded = empty_frame.header.number.sample_number + empty_frame.header.blocksize; + + for(channel = 0; channel < empty_frame.header.channels; channel++) { + empty_frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_CONSTANT; + empty_frame.subframes[channel].data.constant.value = 0; + empty_frame.subframes[channel].wasted_bits = 0; + } + + if(write_audio_frame_to_client_(decoder, &empty_frame, (const FLAC__int32 * const *)empty_buffer) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE) { + decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED; + for(i = 0; i < empty_frame.header.channels; i++) + if(empty_buffer[i] != NULL) + free(empty_buffer[i]); + return false; + } + } + for(i = 0; i < empty_frame.header.channels; i++) + if(empty_buffer[i] != NULL) + free(empty_buffer[i]); + } } } - *got_a_frame = true; + if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC || decoder->protected_->state == FLAC__STREAM_DECODER_END_OF_STREAM) { + /* Got corruption, rewind if possible. Return value of seek + * isn't checked, if the seek fails the decoder will continue anyway */ + if(!FLAC__bitreader_rewind_to_after_last_seen_framesync(decoder->private_->input)){ +#ifndef NDEBUG + fprintf(stderr, "Rewinding, seeking necessary\n"); +#endif + if(decoder->private_->seek_callback && decoder->private_->last_seen_framesync){ + /* Last framesync isn't in bitreader anymore, rewind with seek if possible */ +#ifndef NDEBUG + FLAC__uint64 current_decode_position; + if(FLAC__stream_decoder_get_decode_position(decoder, ¤t_decode_position)) + fprintf(stderr, "Bitreader was %" PRIu64 " bytes short\n", current_decode_position-decoder->private_->last_seen_framesync); +#endif + if(decoder->private_->seek_callback(decoder, decoder->private_->last_seen_framesync, decoder->private_->client_data) == FLAC__STREAM_DECODER_SEEK_STATUS_ERROR) { + decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; + return false; + } + if(!FLAC__bitreader_clear(decoder->private_->input)) { + decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; + return false; + } + } + } +#ifndef NDEBUG + else{ + fprintf(stderr, "Rewinding, seeking not necessary\n"); + } +#endif + } + else { + *got_a_frame = true; - /* we wait to update fixed_block_size until here, when we're sure we've got a proper frame and hence a correct blocksize */ - if(decoder->private_->next_fixed_block_size) - decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size; + /* we wait to update fixed_block_size until here, when we're sure we've got a proper frame and hence a correct blocksize */ + if(decoder->private_->next_fixed_block_size) + decoder->private_->fixed_block_size = decoder->private_->next_fixed_block_size; - /* put the latest values into the public section of the decoder instance */ - decoder->protected_->channels = decoder->private_->frame.header.channels; - decoder->protected_->channel_assignment = decoder->private_->frame.header.channel_assignment; - decoder->protected_->bits_per_sample = decoder->private_->frame.header.bits_per_sample; - decoder->protected_->sample_rate = decoder->private_->frame.header.sample_rate; - decoder->protected_->blocksize = decoder->private_->frame.header.blocksize; + /* put the latest values into the public section of the decoder instance */ + decoder->protected_->channels = decoder->private_->frame.header.channels; + decoder->protected_->channel_assignment = decoder->private_->frame.header.channel_assignment; + decoder->protected_->bits_per_sample = decoder->private_->frame.header.bits_per_sample; + decoder->protected_->sample_rate = decoder->private_->frame.header.sample_rate; + decoder->protected_->blocksize = decoder->private_->frame.header.blocksize; - FLAC__ASSERT(decoder->private_->frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); - decoder->private_->samples_decoded = decoder->private_->frame.header.number.sample_number + decoder->private_->frame.header.blocksize; + FLAC__ASSERT(decoder->private_->frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); + decoder->private_->samples_decoded = decoder->private_->frame.header.number.sample_number + decoder->private_->frame.header.blocksize; - /* write it */ - if(do_full_decode) { - if(write_audio_frame_to_client_(decoder, &decoder->private_->frame, (const FLAC__int32 * const *)decoder->private_->output) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE) - return false; + /* write it */ + if(do_full_decode) { + if(write_audio_frame_to_client_(decoder, &decoder->private_->frame, (const FLAC__int32 * const *)decoder->private_->output) != FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE) { + decoder->protected_->state = FLAC__STREAM_DECODER_ABORTED; + return false; + } + } } decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; @@ -2144,9 +2278,9 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder) { FLAC__uint32 x; FLAC__uint64 xx; - unsigned i, blocksize_hint = 0, sample_rate_hint = 0; + uint32_t i, blocksize_hint = 0, sample_rate_hint = 0; FLAC__byte crc8, raw_header[16]; /* MAGIC NUMBER based on the maximum frame header size, including CRC */ - unsigned raw_header_len; + uint32_t raw_header_len; FLAC__bool is_unparseable = false; FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); @@ -2281,7 +2415,7 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder) FLAC__ASSERT(0); } - x = (unsigned)(raw_header[3] >> 4); + x = (uint32_t)(raw_header[3] >> 4); if(x & 8) { decoder->private_->frame.header.channels = 2; switch(x & 7) { @@ -2300,11 +2434,11 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder) } } else { - decoder->private_->frame.header.channels = (unsigned)x + 1; + decoder->private_->frame.header.channels = (uint32_t)x + 1; decoder->private_->frame.header.channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT; } - switch(x = (unsigned)(raw_header[3] & 0x0e) >> 1) { + switch(x = (uint32_t)(raw_header[3] & 0x0e) >> 1) { case 0: if(decoder->private_->has_stream_info) decoder->private_->frame.header.bits_per_sample = decoder->private_->stream_info.data.stream_info.bits_per_sample; @@ -2317,6 +2451,9 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder) case 2: decoder->private_->frame.header.bits_per_sample = 12; break; + case 3: + is_unparseable = true; + break; case 4: decoder->private_->frame.header.bits_per_sample = 16; break; @@ -2326,18 +2463,19 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder) case 6: decoder->private_->frame.header.bits_per_sample = 24; break; - case 3: case 7: - is_unparseable = true; + decoder->private_->frame.header.bits_per_sample = 32; break; default: FLAC__ASSERT(0); break; } +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION /* check to make sure that reserved bit is 0 */ if(raw_header[3] & 0x01) /* MAGIC NUMBER */ is_unparseable = true; +#endif /* read the frame's starting sample number (or frame number as the case may be) */ if( @@ -2383,6 +2521,14 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder) x = (x << 8) | _x; } decoder->private_->frame.header.blocksize = x+1; + if(decoder->private_->frame.header.blocksize > 65535) { /* invalid blocksize (65536) specified */ + decoder->private_->lookahead = raw_header[raw_header_len-1]; /* back up as much as we can */ + decoder->private_->cached = true; + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + } if(sample_rate_hint) { @@ -2409,11 +2555,13 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder) return false; /* read_callback_ sets the state for us */ crc8 = (FLAC__byte)x; +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION if(FLAC__crc8(raw_header, raw_header_len) != crc8) { send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_BAD_HEADER); decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; return true; } +#endif /* calculate the sample number from the frame number if needed */ decoder->private_->next_fixed_block_size = 0; @@ -2449,11 +2597,11 @@ FLAC__bool read_frame_header_(FLAC__StreamDecoder *decoder) return true; } -FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode) +FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode) { FLAC__uint32 x; FLAC__bool wasted_bits; - unsigned i; + uint32_t i; if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) /* MAGIC NUMBER */ return false; /* read_callback_ sets the state for us */ @@ -2462,10 +2610,15 @@ FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsign x &= 0xfe; if(wasted_bits) { - unsigned u; + uint32_t u; if(!FLAC__bitreader_read_unary_unsigned(decoder->private_->input, &u)) return false; /* read_callback_ sets the state for us */ decoder->private_->frame.subframes[channel].wasted_bits = u+1; + if (decoder->private_->frame.subframes[channel].wasted_bits >= bps) { + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } bps -= decoder->private_->frame.subframes[channel].wasted_bits; } else @@ -2493,7 +2646,13 @@ FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsign return true; } else if(x <= 24) { - if(!read_subframe_fixed_(decoder, channel, bps, (x>>1)&7, do_full_decode)) + uint32_t predictor_order = (x>>1)&7; + if(decoder->private_->frame.header.blocksize <= predictor_order){ + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + if(!read_subframe_fixed_(decoder, channel, bps, predictor_order, do_full_decode)) return false; if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */ return true; @@ -2504,7 +2663,13 @@ FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsign return true; } else { - if(!read_subframe_lpc_(decoder, channel, bps, ((x>>1)&31)+1, do_full_decode)) + uint32_t predictor_order = ((x>>1)&31)+1; + if(decoder->private_->frame.header.blocksize <= predictor_order){ + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + if(!read_subframe_lpc_(decoder, channel, bps, predictor_order, do_full_decode)) return false; if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC) /* means bad sync or got corruption */ return true; @@ -2512,42 +2677,63 @@ FLAC__bool read_subframe_(FLAC__StreamDecoder *decoder, unsigned channel, unsign if(wasted_bits && do_full_decode) { x = decoder->private_->frame.subframes[channel].wasted_bits; - for(i = 0; i < decoder->private_->frame.header.blocksize; i++) - decoder->private_->output[channel][i] <<= x; + if((bps + x) < 33) { + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { + uint32_t val = decoder->private_->output[channel][i]; + decoder->private_->output[channel][i] = (val << x); + } + } + else { + /* When there are wasted bits, bps is never 33 and so + * side_subframe is never already in use */ + FLAC__ASSERT(!decoder->private_->side_subframe_in_use); + decoder->private_->side_subframe_in_use = true; + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { + uint64_t val = decoder->private_->output[channel][i]; + decoder->private_->side_subframe[i] = (val << x); + } + } } return true; } -FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode) +FLAC__bool read_subframe_constant_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode) { FLAC__Subframe_Constant *subframe = &decoder->private_->frame.subframes[channel].data.constant; - FLAC__int32 x; - unsigned i; - FLAC__int32 *output = decoder->private_->output[channel]; + FLAC__int64 x; + uint32_t i; decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_CONSTANT; - if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &x, bps)) + if(!FLAC__bitreader_read_raw_int64(decoder->private_->input, &x, bps)) return false; /* read_callback_ sets the state for us */ subframe->value = x; /* decode the subframe */ if(do_full_decode) { - for(i = 0; i < decoder->private_->frame.header.blocksize; i++) - output[i] = x; + if(bps <= 32) { + FLAC__int32 *output = decoder->private_->output[channel]; + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) + output[i] = x; + } else { + FLAC__int64 *output = decoder->private_->side_subframe; + decoder->private_->side_subframe_in_use = true; + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) + output[i] = x; + } } return true; } -FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode) +FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, const uint32_t order, FLAC__bool do_full_decode) { FLAC__Subframe_Fixed *subframe = &decoder->private_->frame.subframes[channel].data.fixed; - FLAC__int32 i32; + FLAC__int64 i64; FLAC__uint32 u32; - unsigned u; + uint32_t u; decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_FIXED; @@ -2556,9 +2742,9 @@ FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, /* read warm-up samples */ for(u = 0; u < order; u++) { - if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, bps)) + if(!FLAC__bitreader_read_raw_int64(decoder->private_->input, &i64, bps)) return false; /* read_callback_ sets the state for us */ - subframe->warmup[u] = i32; + subframe->warmup[u] = i64; } /* read entropy coding method info */ @@ -2570,6 +2756,12 @@ FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2: if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN)) return false; /* read_callback_ sets the state for us */ + if((decoder->private_->frame.header.blocksize >> u32 < order) || + (decoder->private_->frame.header.blocksize % (1 << u32) > 0)) { + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } subframe->entropy_coding_method.data.partitioned_rice.order = u32; subframe->entropy_coding_method.data.partitioned_rice.contents = &decoder->private_->partitioned_rice_contents[channel]; break; @@ -2592,19 +2784,32 @@ FLAC__bool read_subframe_fixed_(FLAC__StreamDecoder *decoder, unsigned channel, /* decode the subframe */ if(do_full_decode) { - memcpy(decoder->private_->output[channel], subframe->warmup, sizeof(FLAC__int32) * order); - FLAC__fixed_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, order, decoder->private_->output[channel]+order); + if(bps < 33){ + uint32_t i; + for(i = 0; i < order; i++) + decoder->private_->output[channel][i] = subframe->warmup[i]; + if(bps+order <= 32) + FLAC__fixed_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, order, decoder->private_->output[channel]+order); + else + FLAC__fixed_restore_signal_wide(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, order, decoder->private_->output[channel]+order); + } + else { + decoder->private_->side_subframe_in_use = true; + memcpy(decoder->private_->side_subframe, subframe->warmup, sizeof(FLAC__int64) * order); + FLAC__fixed_restore_signal_wide_33bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, order, decoder->private_->side_subframe+order); + } } return true; } -FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, const unsigned order, FLAC__bool do_full_decode) +FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, const uint32_t order, FLAC__bool do_full_decode) { FLAC__Subframe_LPC *subframe = &decoder->private_->frame.subframes[channel].data.lpc; FLAC__int32 i32; + FLAC__int64 i64; FLAC__uint32 u32; - unsigned u; + uint32_t u; decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_LPC; @@ -2613,9 +2818,9 @@ FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, un /* read warm-up samples */ for(u = 0; u < order; u++) { - if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, bps)) + if(!FLAC__bitreader_read_raw_int64(decoder->private_->input, &i64, bps)) return false; /* read_callback_ sets the state for us */ - subframe->warmup[u] = i32; + subframe->warmup[u] = i64; } /* read qlp coeff precision */ @@ -2631,6 +2836,11 @@ FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, un /* read qlp shift */ if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i32, FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN)) return false; /* read_callback_ sets the state for us */ + if(i32 < 0) { + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } subframe->quantization_level = i32; /* read quantized lp coefficiencts */ @@ -2649,6 +2859,12 @@ FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, un case FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2: if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &u32, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN)) return false; /* read_callback_ sets the state for us */ + if((decoder->private_->frame.header.blocksize >> u32 < order) || + (decoder->private_->frame.header.blocksize % (1 << u32) > 0)) { + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } subframe->entropy_coding_method.data.partitioned_rice.order = u32; subframe->entropy_coding_method.data.partitioned_rice.contents = &decoder->private_->partitioned_rice_contents[channel]; break; @@ -2671,76 +2887,80 @@ FLAC__bool read_subframe_lpc_(FLAC__StreamDecoder *decoder, unsigned channel, un /* decode the subframe */ if(do_full_decode) { - memcpy(decoder->private_->output[channel], subframe->warmup, sizeof(FLAC__int32) * order); - /*@@@@@@ technically not pessimistic enough, should be more like - if( (FLAC__uint64)order * ((((FLAC__uint64)1)<<bps)-1) * ((1<<subframe->qlp_coeff_precision)-1) < (((FLAC__uint64)-1) << 32) ) - */ - if(bps + subframe->qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32) - if(bps <= 16 && subframe->qlp_coeff_precision <= 16) { - if(order <= 8) - decoder->private_->local_lpc_restore_signal_16bit_order8(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); - else - decoder->private_->local_lpc_restore_signal_16bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); - } + if(bps <= 32) { + uint32_t i; + for(i = 0; i < order; i++) + decoder->private_->output[channel][i] = subframe->warmup[i]; + if(FLAC__lpc_max_residual_bps(bps, subframe->qlp_coeff, order, subframe->quantization_level) <= 32 && + FLAC__lpc_max_prediction_before_shift_bps(bps, subframe->qlp_coeff, order) <= 32) + FLAC__lpc_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); else - decoder->private_->local_lpc_restore_signal(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); - else - decoder->private_->local_lpc_restore_signal_64bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); + FLAC__lpc_restore_signal_wide(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->output[channel]+order); + } + else { + decoder->private_->side_subframe_in_use = true; + memcpy(decoder->private_->side_subframe, subframe->warmup, sizeof(FLAC__int64) * order); + FLAC__lpc_restore_signal_wide_33bit(decoder->private_->residual[channel], decoder->private_->frame.header.blocksize-order, subframe->qlp_coeff, order, subframe->quantization_level, decoder->private_->side_subframe+order); + } } return true; } -FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, unsigned channel, unsigned bps, FLAC__bool do_full_decode) +FLAC__bool read_subframe_verbatim_(FLAC__StreamDecoder *decoder, uint32_t channel, uint32_t bps, FLAC__bool do_full_decode) { FLAC__Subframe_Verbatim *subframe = &decoder->private_->frame.subframes[channel].data.verbatim; - FLAC__int32 x, *residual = decoder->private_->residual[channel]; - unsigned i; + uint32_t i; decoder->private_->frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_VERBATIM; - subframe->data = residual; + if(bps < 33) { + FLAC__int32 x, *residual = decoder->private_->residual[channel]; - for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { - if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &x, bps)) - return false; /* read_callback_ sets the state for us */ - residual[i] = x; + subframe->data_type = FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT32; + subframe->data.int32 = residual; + + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { + if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &x, bps)) + return false; /* read_callback_ sets the state for us */ + residual[i] = x; + } + + /* decode the subframe */ + if(do_full_decode) + memcpy(decoder->private_->output[channel], subframe->data.int32, sizeof(FLAC__int32) * decoder->private_->frame.header.blocksize); } + else { + FLAC__int64 x, *side = decoder->private_->side_subframe; - /* decode the subframe */ - if(do_full_decode) - memcpy(decoder->private_->output[channel], subframe->data, sizeof(FLAC__int32) * decoder->private_->frame.header.blocksize); + subframe->data_type = FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT64; + subframe->data.int64 = side; + decoder->private_->side_subframe_in_use = true; + + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { + if(!FLAC__bitreader_read_raw_int64(decoder->private_->input, &x, bps)) + return false; /* read_callback_ sets the state for us */ + side[i] = x; + } + } return true; } -FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended) +FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, uint32_t predictor_order, uint32_t partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual, FLAC__bool is_extended) { FLAC__uint32 rice_parameter; int i; - unsigned partition, sample, u; - const unsigned partitions = 1u << partition_order; - const unsigned partition_samples = partition_order > 0? decoder->private_->frame.header.blocksize >> partition_order : decoder->private_->frame.header.blocksize - predictor_order; - const unsigned plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; - const unsigned pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; - - /* sanity checks */ - if(partition_order == 0) { - if(decoder->private_->frame.header.blocksize < predictor_order) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - } - else { - if(partition_samples < predictor_order) { - send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); - decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; - return true; - } - } + uint32_t partition, sample, u; + const uint32_t partitions = 1u << partition_order; + const uint32_t partition_samples = decoder->private_->frame.header.blocksize >> partition_order; + const uint32_t plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; + const uint32_t pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; - if(!FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, max(6, partition_order))) { + /* invalid predictor and partition orders mush be handled in the callers */ + FLAC__ASSERT(partition_order > 0? partition_samples >= predictor_order : decoder->private_->frame.header.blocksize >= predictor_order); + + if(!FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, flac_max(6u, partition_order))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } @@ -2752,19 +2972,34 @@ FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigne partitioned_rice_contents->parameters[partition] = rice_parameter; if(rice_parameter < pesc) { partitioned_rice_contents->raw_bits[partition] = 0; - u = (partition_order == 0 || partition > 0)? partition_samples : partition_samples - predictor_order; - if(!decoder->private_->local_bitreader_read_rice_signed_block(decoder->private_->input, residual + sample, u, rice_parameter)) - return false; /* read_callback_ sets the state for us */ + u = (partition == 0) ? partition_samples - predictor_order : partition_samples; + if(!decoder->private_->local_bitreader_read_rice_signed_block(decoder->private_->input, residual + sample, u, rice_parameter)){ + if(decoder->protected_->state == FLAC__STREAM_DECODER_READ_FRAME) { + /* no error was set, read_callback_ didn't set it, so + * invalid rice symbol was found */ + send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); + decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; + return true; + } + else + return false; /* read_callback_ sets the state for us */ + } sample += u; } else { if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &rice_parameter, FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN)) return false; /* read_callback_ sets the state for us */ partitioned_rice_contents->raw_bits[partition] = rice_parameter; - for(u = (partition_order == 0 || partition > 0)? 0 : predictor_order; u < partition_samples; u++, sample++) { - if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i, rice_parameter)) - return false; /* read_callback_ sets the state for us */ - residual[sample] = i; + if(rice_parameter == 0) { + for(u = (partition == 0)? predictor_order : 0; u < partition_samples; u++, sample++) + residual[sample] = 0; + } + else{ + for(u = (partition == 0)? predictor_order : 0; u < partition_samples; u++, sample++) { + if(!FLAC__bitreader_read_raw_int32(decoder->private_->input, &i, rice_parameter)) + return false; /* read_callback_ sets the state for us */ + residual[sample] = i; + } } } } @@ -2778,10 +3013,12 @@ FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder) FLAC__uint32 zero = 0; if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &zero, FLAC__bitreader_bits_left_for_byte_alignment(decoder->private_->input))) return false; /* read_callback_ sets the state for us */ +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION if(zero != 0) { send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC; } +#endif } return true; } @@ -2866,6 +3103,66 @@ FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data) */ } +#if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) && !defined(FUZZING_BUILD_MODE_FLAC_SANITIZE_SIGNED_INTEGER_OVERFLOW) +/* The attribute below is to silence the undefined sanitizer of oss-fuzz. + * Because fuzzing feeds bogus predictors and residual samples to the + * decoder, having overflows in this section is unavoidable. Also, + * because the calculated values are audio path only, there is no + * potential for security problems */ +__attribute__((no_sanitize("signed-integer-overflow"))) +#endif +void undo_channel_coding(FLAC__StreamDecoder *decoder) { + uint32_t i; + switch(decoder->private_->frame.header.channel_assignment) { + case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT: + /* do nothing */ + break; + case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE: + FLAC__ASSERT(decoder->private_->frame.header.channels == 2); + FLAC__ASSERT(decoder->private_->side_subframe_in_use != /* logical XOR */ (decoder->private_->frame.header.bits_per_sample < 32)); + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) + if(decoder->private_->side_subframe_in_use) + decoder->private_->output[1][i] = decoder->private_->output[0][i] - decoder->private_->side_subframe[i]; + else + decoder->private_->output[1][i] = decoder->private_->output[0][i] - decoder->private_->output[1][i]; + break; + case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE: + FLAC__ASSERT(decoder->private_->frame.header.channels == 2); + FLAC__ASSERT(decoder->private_->side_subframe_in_use != /* logical XOR */ (decoder->private_->frame.header.bits_per_sample < 32)); + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) + if(decoder->private_->side_subframe_in_use) + decoder->private_->output[0][i] = decoder->private_->output[1][i] + decoder->private_->side_subframe[i]; + else + decoder->private_->output[0][i] += decoder->private_->output[1][i]; + break; + case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE: + FLAC__ASSERT(decoder->private_->frame.header.channels == 2); + FLAC__ASSERT(decoder->private_->side_subframe_in_use != /* logical XOR */ (decoder->private_->frame.header.bits_per_sample < 32)); + for(i = 0; i < decoder->private_->frame.header.blocksize; i++) { + if(!decoder->private_->side_subframe_in_use){ + FLAC__int32 mid, side; + mid = decoder->private_->output[0][i]; + side = decoder->private_->output[1][i]; + mid = ((uint32_t) mid) << 1; + mid |= (side & 1); /* i.e. if 'side' is odd... */ + decoder->private_->output[0][i] = (mid + side) >> 1; + decoder->private_->output[1][i] = (mid - side) >> 1; + } + else { /* bps == 32 */ + FLAC__int64 mid; + mid = ((uint64_t)decoder->private_->output[0][i]) << 1; + mid |= (decoder->private_->side_subframe[i] & 1); /* i.e. if 'side' is odd... */ + decoder->private_->output[0][i] = (mid + decoder->private_->side_subframe[i]) >> 1; + decoder->private_->output[1][i] = (mid - decoder->private_->side_subframe[i]) >> 1; + } + } + break; + default: + FLAC__ASSERT(0); + break; + } +} + #if FLAC__HAS_OGG FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes) { @@ -2914,6 +3211,8 @@ FLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[]) { + decoder->private_->last_frame = *frame; /* save the frame */ + decoder->private_->last_frame_is_set = true; if(decoder->private_->is_seeking) { FLAC__uint64 this_frame_sample = frame->header.number.sample_number; FLAC__uint64 next_frame_sample = this_frame_sample + (FLAC__uint64)frame->header.blocksize; @@ -2924,17 +3223,20 @@ FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder #if FLAC__HAS_OGG decoder->private_->got_a_frame = true; #endif - decoder->private_->last_frame = *frame; /* save the frame */ if(this_frame_sample <= target_sample && target_sample < next_frame_sample) { /* we hit our target frame */ - unsigned delta = (unsigned)(target_sample - this_frame_sample); + uint32_t delta = (uint32_t)(target_sample - this_frame_sample); /* kick out of seek mode */ decoder->private_->is_seeking = false; /* shift out the samples before target_sample */ if(delta > 0) { - unsigned channel; + uint32_t channel; const FLAC__int32 *newbuffer[FLAC__MAX_CHANNELS]; - for(channel = 0; channel < frame->header.channels; channel++) + for(channel = 0; channel < frame->header.channels; channel++) { newbuffer[channel] = buffer[channel] + delta; + decoder->private_->last_frame.subframes[channel].type = FLAC__SUBFRAME_TYPE_VERBATIM; + decoder->private_->last_frame.subframes[channel].data.verbatim.data_type = FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT32; + decoder->private_->last_frame.subframes[channel].data.verbatim.data.int32 = newbuffer[channel]; + } decoder->private_->last_frame.header.blocksize -= delta; decoder->private_->last_frame.header.number.sample_number += (FLAC__uint64)delta; /* write the relevant samples */ @@ -2977,16 +3279,16 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s FLAC__uint64 first_frame_offset = decoder->private_->first_frame_offset, lower_bound, upper_bound, lower_bound_sample, upper_bound_sample, this_frame_sample; FLAC__int64 pos = -1; int i; - unsigned approx_bytes_per_frame; - FLAC__bool first_seek = true; + uint32_t approx_bytes_per_frame; + FLAC__bool first_seek = true, seek_from_lower_bound = false; const FLAC__uint64 total_samples = FLAC__stream_decoder_get_total_samples(decoder); - const unsigned min_blocksize = decoder->private_->stream_info.data.stream_info.min_blocksize; - const unsigned max_blocksize = decoder->private_->stream_info.data.stream_info.max_blocksize; - const unsigned max_framesize = decoder->private_->stream_info.data.stream_info.max_framesize; - const unsigned min_framesize = decoder->private_->stream_info.data.stream_info.min_framesize; + const uint32_t min_blocksize = decoder->private_->stream_info.data.stream_info.min_blocksize; + const uint32_t max_blocksize = decoder->private_->stream_info.data.stream_info.max_blocksize; + const uint32_t max_framesize = decoder->private_->stream_info.data.stream_info.max_framesize; + const uint32_t min_framesize = decoder->private_->stream_info.data.stream_info.min_framesize; /* take these from the current frame in case they've changed mid-stream */ - unsigned channels = FLAC__stream_decoder_get_channels(decoder); - unsigned bps = FLAC__stream_decoder_get_bits_per_sample(decoder); + uint32_t channels = FLAC__stream_decoder_get_channels(decoder); + uint32_t bps = FLAC__stream_decoder_get_bits_per_sample(decoder); const FLAC__StreamMetadata_SeekTable *seek_table = decoder->private_->has_seek_table? &decoder->private_->seek_table.data.seek_table : 0; /* use values from stream info if we didn't decode a frame */ @@ -3005,7 +3307,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s * min_blocksize might be zero. */ else if(min_blocksize == max_blocksize && min_blocksize > 0) { - /* note there are no () around 'bps/8' to keep precision up since it's an integer calulation */ + /* note there are no () around 'bps/8' to keep precision up since it's an integer calculation */ approx_bytes_per_frame = min_blocksize * channels * bps/8 + 64; } else @@ -3013,22 +3315,36 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s /* * First, we set an upper and lower bound on where in the - * stream we will search. For now we assume the worst case - * scenario, which is our best guess at the beginning of - * the first frame and end of the stream. + * stream we will search. For now we take the current position + * as one bound and, depending on where the target position lies, + * the beginning of the first frame or the end of the stream as + * the other bound. */ lower_bound = first_frame_offset; lower_bound_sample = 0; upper_bound = stream_length; upper_bound_sample = total_samples > 0 ? total_samples : target_sample /*estimate it*/; + if(decoder->protected_->state == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC && + decoder->private_->samples_decoded != 0) { + if(target_sample < decoder->private_->samples_decoded) { + if(FLAC__stream_decoder_get_decode_position(decoder, &upper_bound)) + upper_bound_sample = decoder->private_->samples_decoded; + } else { + if(FLAC__stream_decoder_get_decode_position(decoder, &lower_bound)) + lower_bound_sample = decoder->private_->samples_decoded; + } + } + /* * Now we refine the bounds if we have a seektable with * suitable points. Note that according to the spec they * must be ordered by ascending sample number. * * Note: to protect against invalid seek tables we will ignore points - * that have frame_samples==0 or sample_number>=total_samples + * that have frame_samples==0 or sample_number>=total_samples. Also, + * because math is limited to 64-bit ints, seekpoints with an offset + * larger than 2^63 (8 exbibyte) are rejected. */ if(seek_table) { FLAC__uint64 new_lower_bound = lower_bound; @@ -3089,25 +3405,34 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s decoder->private_->target_sample = target_sample; while(1) { + /* check whether decoder is still valid so bad state isn't overwritten + * with seek error */ + if(decoder->protected_->state == FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR || + decoder->protected_->state == FLAC__STREAM_DECODER_ABORTED) + return false; /* check if the bounds are still ok */ - if (lower_bound_sample >= upper_bound_sample || lower_bound > upper_bound) { + if (lower_bound_sample >= upper_bound_sample || + lower_bound > upper_bound || + upper_bound >= INT64_MAX) { decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; return false; } + if(seek_from_lower_bound) { + pos = lower_bound; + } + else { #ifndef FLAC__INTEGER_ONLY_LIBRARY -#if defined _MSC_VER || defined __MINGW32__ - /* with VC++ you have to spoon feed it the casting */ - pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(FLAC__int64)(target_sample - lower_bound_sample) / (FLAC__double)(FLAC__int64)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(FLAC__int64)(upper_bound - lower_bound)) - approx_bytes_per_frame; + pos = (FLAC__int64)lower_bound + (FLAC__int64)((double)(target_sample - lower_bound_sample) / (double)(upper_bound_sample - lower_bound_sample) * (double)(upper_bound - lower_bound)) - approx_bytes_per_frame; #else - pos = (FLAC__int64)lower_bound + (FLAC__int64)((FLAC__double)(target_sample - lower_bound_sample) / (FLAC__double)(upper_bound_sample - lower_bound_sample) * (FLAC__double)(upper_bound - lower_bound)) - approx_bytes_per_frame; -#endif -#else - /* a little less accurate: */ - if(upper_bound - lower_bound < 0xffffffff) - pos = (FLAC__int64)lower_bound + (FLAC__int64)(((target_sample - lower_bound_sample) * (upper_bound - lower_bound)) / (upper_bound_sample - lower_bound_sample)) - approx_bytes_per_frame; - else /* @@@ WATCHOUT, ~2TB limit */ - pos = (FLAC__int64)lower_bound + (FLAC__int64)((((target_sample - lower_bound_sample)>>8) * ((upper_bound - lower_bound)>>8)) / ((upper_bound_sample - lower_bound_sample)>>16)) - approx_bytes_per_frame; + /* a little less accurate: */ + if(upper_bound - lower_bound < 0xffffffff) + pos = (FLAC__int64)lower_bound + (FLAC__int64)(((target_sample - lower_bound_sample) * (upper_bound - lower_bound)) / (upper_bound_sample - lower_bound_sample)) - approx_bytes_per_frame; + else { /* @@@ WATCHOUT, ~2TB limit */ + FLAC__uint64 ratio = (1<<16) / (upper_bound_sample - lower_bound_sample); + pos = (FLAC__int64)lower_bound + (FLAC__int64)((((target_sample - lower_bound_sample)>>8) * ((upper_bound - lower_bound)>>8) * ratio)) - approx_bytes_per_frame; + } #endif + } if(pos >= (FLAC__int64)upper_bound) pos = (FLAC__int64)upper_bound - 1; if(pos < (FLAC__int64)lower_bound) @@ -3127,24 +3452,32 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s * FLAC__stream_decoder_process_single() to return false. */ decoder->private_->unparseable_frame_count = 0; - if(!FLAC__stream_decoder_process_single(decoder)) { - decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; - return false; + if(!FLAC__stream_decoder_process_single(decoder) || decoder->protected_->state == FLAC__STREAM_DECODER_ABORTED || 0 == decoder->private_->samples_decoded) { + /* No frame could be decoded */ + if(decoder->protected_->state != FLAC__STREAM_DECODER_ABORTED && decoder->private_->eof_callback(decoder, decoder->private_->client_data) && !seek_from_lower_bound){ + /* decoder has hit end of stream while processing corrupt + * frame. To remedy this, try decoding a frame at the lower + * bound so the seek after that hopefully ends up somewhere + * else */ + seek_from_lower_bound = true; + continue; + } + else { + decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; + return false; + } } + seek_from_lower_bound = false; + /* our write callback will change the state when it gets to the target frame */ /* actually, we could have got_a_frame if our decoder is at FLAC__STREAM_DECODER_END_OF_STREAM so we need to check for that also */ -#if 0 - /*@@@@@@ used to be the following; not clear if the check for end of stream is needed anymore */ - if(decoder->protected_->state != FLAC__SEEKABLE_STREAM_DECODER_SEEKING && decoder->protected_->state != FLAC__STREAM_DECODER_END_OF_STREAM) - break; -#endif if(!decoder->private_->is_seeking) break; FLAC__ASSERT(decoder->private_->last_frame.header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); this_frame_sample = decoder->private_->last_frame.header.number.sample_number; - if (0 == decoder->private_->samples_decoded || (this_frame_sample + decoder->private_->last_frame.header.blocksize >= upper_bound_sample && !first_seek)) { + if(this_frame_sample + decoder->private_->last_frame.header.blocksize >= upper_bound_sample && !first_seek) { if (pos == (FLAC__int64)lower_bound) { /* can't move back any more than the first frame, something is fatally wrong */ decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; @@ -3152,11 +3485,11 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s } /* our last move backwards wasn't big enough, try again */ approx_bytes_per_frame = approx_bytes_per_frame? approx_bytes_per_frame * 2 : 16; - continue; + continue; } /* allow one seek over upper bound, so we can get a correct upper_bound_sample for streams with unknown total_samples */ first_seek = false; - + /* make sure we are not seeking in corrupted stream */ if (this_frame_sample < lower_bound_sample) { decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; @@ -3171,7 +3504,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; return false; } - approx_bytes_per_frame = (unsigned)(2 * (upper_bound - pos) / 3 + 16); + approx_bytes_per_frame = (uint32_t)(2 * (upper_bound - pos) / 3 + 16); } else { /* target_sample >= this_frame_sample + this frame's blocksize */ lower_bound_sample = this_frame_sample + decoder->private_->last_frame.header.blocksize; @@ -3179,7 +3512,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 s decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; return false; } - approx_bytes_per_frame = (unsigned)(2 * (lower_bound - pos) / 3 + 16); + approx_bytes_per_frame = (uint32_t)(2 * (lower_bound - pos) / 3 + 16); } } @@ -3194,14 +3527,14 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint FLAC__uint64 this_frame_sample = (FLAC__uint64)0 - 1; FLAC__uint64 pos = 0; /* only initialized to avoid compiler warning */ FLAC__bool did_a_seek; - unsigned iteration = 0; + uint32_t iteration = 0; - /* In the first iterations, we will calculate the target byte position + /* In the first iterations, we will calculate the target byte position * by the distance from the target sample to left_sample and * right_sample (let's call it "proportional search"). After that, we * will switch to binary search. */ - unsigned BINARY_SEARCH_AFTER_ITERATION = 2; + uint32_t BINARY_SEARCH_AFTER_ITERATION = 2; /* We will switch to a linear search once our current sample is less * than this number of samples ahead of the target sample @@ -3218,18 +3551,19 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint decoder->private_->target_sample = target_sample; for( ; ; iteration++) { + /* Do sanity checks on bounds */ + if(right_pos <= left_pos || right_pos - left_pos < 9) { + /* FLAC frame is at least 9 byte in size */ + decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; + return false; + } if (iteration == 0 || this_frame_sample > target_sample || target_sample - this_frame_sample > LINEAR_SEARCH_WITHIN_SAMPLES) { if (iteration >= BINARY_SEARCH_AFTER_ITERATION) { pos = (right_pos + left_pos) / 2; } else { #ifndef FLAC__INTEGER_ONLY_LIBRARY -#if defined _MSC_VER || defined __MINGW32__ - /* with MSVC you have to spoon feed it the casting */ - pos = (FLAC__uint64)((FLAC__double)(FLAC__int64)(target_sample - left_sample) / (FLAC__double)(FLAC__int64)(right_sample - left_sample) * (FLAC__double)(FLAC__int64)(right_pos - left_pos)); -#else - pos = (FLAC__uint64)((FLAC__double)(target_sample - left_sample) / (FLAC__double)(right_sample - left_sample) * (FLAC__double)(right_pos - left_pos)); -#endif + pos = (FLAC__uint64)((double)(target_sample - left_sample) / (double)(right_sample - left_sample) * (double)(right_pos - left_pos)); #else /* a little less accurate: */ if ((target_sample-left_sample <= 0xffffffff) && (right_pos-left_pos <= 0xffffffff)) @@ -3259,7 +3593,8 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint did_a_seek = false; decoder->private_->got_a_frame = false; - if(!FLAC__stream_decoder_process_single(decoder)) { + if(!FLAC__stream_decoder_process_single(decoder) || + decoder->protected_->state == FLAC__STREAM_DECODER_ABORTED) { decoder->protected_->state = FLAC__STREAM_DECODER_SEEK_ERROR; return false; } @@ -3306,7 +3641,7 @@ FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint } left_pos = pos; } - else if(this_frame_sample > target_sample) { + else { right_sample = this_frame_sample; /* sanity check to avoid infinite loop */ if (right_pos == pos) { @@ -3346,7 +3681,7 @@ FLAC__StreamDecoderSeekStatus file_seek_callback_(const FLAC__StreamDecoder *dec if(decoder->private_->file == stdin) return FLAC__STREAM_DECODER_SEEK_STATUS_UNSUPPORTED; - else if(fseeko(decoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0) + else if(fseeko(decoder->private_->file, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0) return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; else return FLAC__STREAM_DECODER_SEEK_STATUS_OK; @@ -3354,7 +3689,7 @@ FLAC__StreamDecoderSeekStatus file_seek_callback_(const FLAC__StreamDecoder *dec FLAC__StreamDecoderTellStatus file_tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) { - off_t pos; + FLAC__off_t pos; (void)client_data; if(decoder->private_->file == stdin) @@ -3369,12 +3704,18 @@ FLAC__StreamDecoderTellStatus file_tell_callback_(const FLAC__StreamDecoder *dec FLAC__StreamDecoderLengthStatus file_length_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *stream_length, void *client_data) { - struct stat filestats; + struct flac_stat_s filestats; (void)client_data; if(decoder->private_->file == stdin) return FLAC__STREAM_DECODER_LENGTH_STATUS_UNSUPPORTED; - else if(fstat(fileno(decoder->private_->file), &filestats) != 0) + +#ifndef FLAC__USE_FILELENGTHI64 + if(flac_fstat(fileno(decoder->private_->file), &filestats) != 0) +#else + filestats.st_size = _filelengthi64(fileno(decoder->private_->file)); + if(filestats.st_size < 0) +#endif return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR; else { *stream_length = (FLAC__uint64)filestats.st_size; diff --git a/3rdparty/libflac/src/libFLAC/stream_encoder.c b/3rdparty/libflac/src/libFLAC/stream_encoder.c index afc79850096..c1c03e49ed6 100644 --- a/3rdparty/libflac/src/libFLAC/stream_encoder.c +++ b/3rdparty/libflac/src/libFLAC/stream_encoder.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,30 +34,18 @@ # include <config.h> #endif -#if defined _MSC_VER || defined __MINGW32__ -#include <io.h> /* for _setmode() */ -#include <fcntl.h> /* for _O_BINARY */ -#endif -#if defined __CYGWIN__ || defined __EMX__ -#include <io.h> /* for setmode(), O_BINARY */ -#include <fcntl.h> /* for _O_BINARY */ -#endif #include <limits.h> #include <stdio.h> #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcpy() */ #include <sys/types.h> /* for off_t */ -#if defined _MSC_VER || defined __BORLANDC__ || defined __MINGW32__ /* @@@ [2G limit] */ -#ifndef fseeko -#define fseeko fseek -#endif -#ifndef ftello -#define ftello ftell -#endif +#ifdef _WIN32 +#include <windows.h> /* for GetFileType() */ +#include <io.h> /* for _get_osfhandle() */ #endif +#include "share/compat.h" #include "FLAC/assert.h" #include "FLAC/stream_decoder.h" -#include "share/alloc.h" #include "protected/stream_encoder.h" #include "private/bitwriter.h" #include "private/bitmath.h" @@ -67,26 +56,17 @@ #include "private/lpc.h" #include "private/md5.h" #include "private/memory.h" +#include "private/macros.h" #if FLAC__HAS_OGG #include "private/ogg_helper.h" #include "private/ogg_mapping.h" #endif +#include "private/stream_encoder.h" #include "private/stream_encoder_framing.h" #include "private/window.h" +#include "share/alloc.h" +#include "share/private.h" -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif - -#ifdef min -#undef min -#endif -#define min(x,y) ((x)<(y)?(x):(y)) - -#ifdef max -#undef max -#endif -#define max(x,y) ((x)>(y)?(x):(y)) /* Exact Rice codeword length calculation is off by default. The simple * (and fast) estimation (of how many bits a residual value will be @@ -98,48 +78,59 @@ * parameter estimation in this encoder is very good, almost always * yielding compression within 0.1% of the optimal parameters. */ -#undef ENABLE_RICE_PARAMETER_SEARCH +#undef ENABLE_RICE_PARAMETER_SEARCH typedef struct { FLAC__int32 *data[FLAC__MAX_CHANNELS]; - unsigned size; /* of each data[] in samples */ - unsigned tail; + uint32_t size; /* of each data[] in samples */ + uint32_t tail; } verify_input_fifo; typedef struct { const FLAC__byte *data; - unsigned capacity; - unsigned bytes; + uint32_t capacity; + uint32_t bytes; } verify_output; +#ifndef FLAC__INTEGER_ONLY_LIBRARY +typedef struct { + uint32_t a, b, c; + FLAC__ApodizationSpecification * current_apodization; + double autoc_root[FLAC__MAX_LPC_ORDER+1]; + double autoc[FLAC__MAX_LPC_ORDER+1]; +} apply_apodization_state_struct; +#endif + typedef enum { ENCODER_IN_MAGIC = 0, ENCODER_IN_METADATA = 1, ENCODER_IN_AUDIO = 2 } EncoderStateHint; -static struct CompressionLevels { +static const struct CompressionLevels { FLAC__bool do_mid_side_stereo; FLAC__bool loose_mid_side_stereo; - unsigned max_lpc_order; - unsigned qlp_coeff_precision; + uint32_t max_lpc_order; + uint32_t qlp_coeff_precision; FLAC__bool do_qlp_coeff_prec_search; FLAC__bool do_escape_coding; FLAC__bool do_exhaustive_model_search; - unsigned min_residual_partition_order; - unsigned max_residual_partition_order; - unsigned rice_parameter_search_dist; + uint32_t min_residual_partition_order; + uint32_t max_residual_partition_order; + uint32_t rice_parameter_search_dist; + const char *apodization; } compression_levels_[] = { - { false, false, 0, 0, false, false, false, 0, 3, 0 }, - { true , true , 0, 0, false, false, false, 0, 3, 0 }, - { true , false, 0, 0, false, false, false, 0, 3, 0 }, - { false, false, 6, 0, false, false, false, 0, 4, 0 }, - { true , true , 8, 0, false, false, false, 0, 4, 0 }, - { true , false, 8, 0, false, false, false, 0, 5, 0 }, - { true , false, 8, 0, false, false, false, 0, 6, 0 }, - { true , false, 8, 0, false, false, true , 0, 6, 0 }, - { true , false, 12, 0, false, false, true , 0, 6, 0 } + { false, false, 0, 0, false, false, false, 0, 3, 0, "tukey(5e-1)" }, + { true , true , 0, 0, false, false, false, 0, 3, 0, "tukey(5e-1)" }, + { true , false, 0, 0, false, false, false, 0, 3, 0, "tukey(5e-1)" }, + { false, false, 6, 0, false, false, false, 0, 4, 0, "tukey(5e-1)" }, + { true , true , 8, 0, false, false, false, 0, 4, 0, "tukey(5e-1)" }, + { true , false, 8, 0, false, false, false, 0, 5, 0, "tukey(5e-1)" }, + { true , false, 8, 0, false, false, false, 0, 6, 0, "subdivide_tukey(2)" }, + { true , false, 12, 0, false, false, false, 0, 6, 0, "subdivide_tukey(2)" }, + { true , false, 12, 0, false, false, false, 0, 6, 0, "subdivide_tukey(3)" } + /* here we use locale-independent 5e-1 instead of 0.5 or 0,5 */ }; @@ -151,130 +142,140 @@ static struct CompressionLevels { static void set_defaults_(FLAC__StreamEncoder *encoder); static void free_(FLAC__StreamEncoder *encoder); -static FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize); -static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC__bool is_last_block); -static FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool is_last_block); +static FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, uint32_t new_blocksize); +static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, uint32_t samples, FLAC__bool is_last_block); +static FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, FLAC__bool is_last_block); static void update_metadata_(const FLAC__StreamEncoder *encoder); #if FLAC__HAS_OGG static void update_ogg_metadata_(FLAC__StreamEncoder *encoder); #endif -static FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block, FLAC__bool is_last_block); -static FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block); +static FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_last_block); +static FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder); static FLAC__bool process_subframe_( FLAC__StreamEncoder *encoder, - unsigned min_partition_order, - unsigned max_partition_order, + uint32_t min_partition_order, + uint32_t max_partition_order, const FLAC__FrameHeader *frame_header, - unsigned subframe_bps, - const FLAC__int32 integer_signal[], + uint32_t subframe_bps, + const void *integer_signal, FLAC__Subframe *subframe[2], FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2], FLAC__int32 *residual[2], - unsigned *best_subframe, - unsigned *best_bits + uint32_t *best_subframe, + uint32_t *best_bits ); +#ifndef FLAC__INTEGER_ONLY_LIBRARY +static FLAC__bool apply_apodization_( + FLAC__StreamEncoder *encoder, + apply_apodization_state_struct *apply_apodization_state, + uint32_t blocksize, + double *lpc_error, + uint32_t *max_lpc_order_this_apodization, + uint32_t subframe_bps, + const void *integer_signal, + uint32_t *guess_lpc_order +); +#endif + static FLAC__bool add_subframe_( FLAC__StreamEncoder *encoder, - unsigned blocksize, - unsigned subframe_bps, + uint32_t blocksize, + uint32_t subframe_bps, const FLAC__Subframe *subframe, FLAC__BitWriter *frame ); -static unsigned evaluate_constant_subframe_( +static uint32_t evaluate_constant_subframe_( FLAC__StreamEncoder *encoder, - const FLAC__int32 signal, - unsigned blocksize, - unsigned subframe_bps, + const FLAC__int64 signal, + uint32_t blocksize, + uint32_t subframe_bps, FLAC__Subframe *subframe ); -static unsigned evaluate_fixed_subframe_( +static uint32_t evaluate_fixed_subframe_( FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], + const void *signal, FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], - unsigned blocksize, - unsigned subframe_bps, - unsigned order, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, + uint32_t raw_bits_per_partition[], + uint32_t blocksize, + uint32_t subframe_bps, + uint32_t order, + uint32_t rice_parameter_limit, + uint32_t min_partition_order, + uint32_t max_partition_order, FLAC__bool do_escape_coding, - unsigned rice_parameter_search_dist, + uint32_t rice_parameter_search_dist, FLAC__Subframe *subframe, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents ); #ifndef FLAC__INTEGER_ONLY_LIBRARY -static unsigned evaluate_lpc_subframe_( +static uint32_t evaluate_lpc_subframe_( FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], + const void *signal, FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], + uint32_t raw_bits_per_partition[], const FLAC__real lp_coeff[], - unsigned blocksize, - unsigned subframe_bps, - unsigned order, - unsigned qlp_coeff_precision, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, + uint32_t blocksize, + uint32_t subframe_bps, + uint32_t order, + uint32_t qlp_coeff_precision, + uint32_t rice_parameter_limit, + uint32_t min_partition_order, + uint32_t max_partition_order, FLAC__bool do_escape_coding, - unsigned rice_parameter_search_dist, + uint32_t rice_parameter_search_dist, FLAC__Subframe *subframe, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents ); #endif -static unsigned evaluate_verbatim_subframe_( - FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], - unsigned blocksize, - unsigned subframe_bps, +static uint32_t evaluate_verbatim_subframe_( + FLAC__StreamEncoder *encoder, + const void *signal, + uint32_t blocksize, + uint32_t subframe_bps, FLAC__Subframe *subframe ); -static unsigned find_best_partition_order_( +static uint32_t find_best_partition_order_( struct FLAC__StreamEncoderPrivate *private_, const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], - unsigned residual_samples, - unsigned predictor_order, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, - unsigned bps, + uint32_t raw_bits_per_partition[], + uint32_t residual_samples, + uint32_t predictor_order, + uint32_t rice_parameter_limit, + uint32_t min_partition_order, + uint32_t max_partition_order, + uint32_t bps, FLAC__bool do_escape_coding, - unsigned rice_parameter_search_dist, + uint32_t rice_parameter_search_dist, FLAC__EntropyCodingMethod *best_ecm ); static void precompute_partition_info_sums_( const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], - unsigned residual_samples, - unsigned predictor_order, - unsigned min_partition_order, - unsigned max_partition_order, - unsigned bps + uint32_t residual_samples, + uint32_t predictor_order, + uint32_t min_partition_order, + uint32_t max_partition_order, + uint32_t bps ); static void precompute_partition_info_escapes_( const FLAC__int32 residual[], - unsigned raw_bits_per_partition[], - unsigned residual_samples, - unsigned predictor_order, - unsigned min_partition_order, - unsigned max_partition_order + uint32_t raw_bits_per_partition[], + uint32_t residual_samples, + uint32_t predictor_order, + uint32_t min_partition_order, + uint32_t max_partition_order ); static FLAC__bool set_partitioned_rice_( @@ -282,35 +283,35 @@ static FLAC__bool set_partitioned_rice_( const FLAC__int32 residual[], #endif const FLAC__uint64 abs_residual_partition_sums[], - const unsigned raw_bits_per_partition[], - const unsigned residual_samples, - const unsigned predictor_order, - const unsigned suggested_rice_parameter, - const unsigned rice_parameter_limit, - const unsigned rice_parameter_search_dist, - const unsigned partition_order, + const uint32_t raw_bits_per_partition[], + const uint32_t residual_samples, + const uint32_t predictor_order, + const uint32_t rice_parameter_limit, + const uint32_t rice_parameter_search_dist, + const uint32_t partition_order, const FLAC__bool search_for_escapes, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, - unsigned *bits + uint32_t *bits ); -static unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples); +static uint32_t get_wasted_bits_(FLAC__int32 signal[], uint32_t samples); +static uint32_t get_wasted_bits_wide_(FLAC__int64 signal_wide[], FLAC__int32 signal[], uint32_t samples); /* verify-related routines: */ static void append_to_verify_fifo_( verify_input_fifo *fifo, const FLAC__int32 * const input[], - unsigned input_offset, - unsigned channels, - unsigned wide_samples + uint32_t input_offset, + uint32_t channels, + uint32_t wide_samples ); static void append_to_verify_fifo_interleaved_( verify_input_fifo *fifo, const FLAC__int32 input[], - unsigned input_offset, - unsigned channels, - unsigned wide_samples + uint32_t input_offset, + uint32_t channels, + uint32_t wide_samples ); static FLAC__StreamDecoderReadStatus verify_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data); @@ -321,7 +322,7 @@ static void verify_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__Str static FLAC__StreamEncoderReadStatus file_read_callback_(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data); static FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data); static FLAC__StreamEncoderTellStatus file_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data); -static FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data); +static FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data); static FILE *get_binary_stdout_(void); @@ -332,17 +333,18 @@ static FILE *get_binary_stdout_(void); ***********************************************************************/ typedef struct FLAC__StreamEncoderPrivate { - unsigned input_capacity; /* current size (in samples) of the signal and residual buffers */ + uint32_t input_capacity; /* current size (in samples) of the signal and residual buffers */ FLAC__int32 *integer_signal[FLAC__MAX_CHANNELS]; /* the integer version of the input signal */ FLAC__int32 *integer_signal_mid_side[2]; /* the integer version of the mid-side input signal (stereo only) */ + FLAC__int64 *integer_signal_33bit_side; /* 33-bit side for 32-bit stereo decorrelation */ #ifndef FLAC__INTEGER_ONLY_LIBRARY FLAC__real *real_signal[FLAC__MAX_CHANNELS]; /* (@@@ currently unused) the floating-point version of the input signal */ FLAC__real *real_signal_mid_side[2]; /* (@@@ currently unused) the floating-point version of the mid-side input signal (stereo only) */ FLAC__real *window[FLAC__MAX_APODIZATION_FUNCTIONS]; /* the pre-computed floating-point window for each apodization function */ FLAC__real *windowed_signal; /* the integer_signal[] * current window[] */ #endif - unsigned subframe_bps[FLAC__MAX_CHANNELS]; /* the effective bits per sample of the input signal (stream bps - wasted bits) */ - unsigned subframe_bps_mid_side[2]; /* the effective bits per sample of the mid-side input signal (stream bps - wasted bits + 0/1) */ + uint32_t subframe_bps[FLAC__MAX_CHANNELS]; /* the effective bits per sample of the input signal (stream bps - wasted bits) */ + uint32_t subframe_bps_mid_side[2]; /* the effective bits per sample of the mid-side input signal (stream bps - wasted bits + 0/1) */ FLAC__int32 *residual_workspace[FLAC__MAX_CHANNELS][2]; /* each channel has a candidate and best workspace where the subframe residual signals will be stored */ FLAC__int32 *residual_workspace_mid_side[2][2]; FLAC__Subframe subframe_workspace[FLAC__MAX_CHANNELS][2]; @@ -353,42 +355,49 @@ typedef struct FLAC__StreamEncoderPrivate { FLAC__EntropyCodingMethod_PartitionedRiceContents partitioned_rice_contents_workspace_mid_side[FLAC__MAX_CHANNELS][2]; FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr[FLAC__MAX_CHANNELS][2]; FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents_workspace_ptr_mid_side[FLAC__MAX_CHANNELS][2]; - unsigned best_subframe[FLAC__MAX_CHANNELS]; /* index (0 or 1) into 2nd dimension of the above workspaces */ - unsigned best_subframe_mid_side[2]; - unsigned best_subframe_bits[FLAC__MAX_CHANNELS]; /* size in bits of the best subframe for each channel */ - unsigned best_subframe_bits_mid_side[2]; + uint32_t best_subframe[FLAC__MAX_CHANNELS]; /* index (0 or 1) into 2nd dimension of the above workspaces */ + uint32_t best_subframe_mid_side[2]; + uint32_t best_subframe_bits[FLAC__MAX_CHANNELS]; /* size in bits of the best subframe for each channel */ + uint32_t best_subframe_bits_mid_side[2]; FLAC__uint64 *abs_residual_partition_sums; /* workspace where the sum of abs(candidate residual) for each partition is stored */ - unsigned *raw_bits_per_partition; /* workspace where the sum of silog2(candidate residual) for each partition is stored */ + uint32_t *raw_bits_per_partition; /* workspace where the sum of silog2(candidate residual) for each partition is stored */ FLAC__BitWriter *frame; /* the current frame being worked on */ - unsigned loose_mid_side_stereo_frames; /* rounded number of frames the encoder will use before trying both independent and mid/side frames again */ - unsigned loose_mid_side_stereo_frame_count; /* number of frames using the current channel assignment */ + uint32_t loose_mid_side_stereo_frames; /* rounded number of frames the encoder will use before trying both independent and mid/side frames again */ + uint32_t loose_mid_side_stereo_frame_count; /* number of frames using the current channel assignment */ FLAC__ChannelAssignment last_channel_assignment; FLAC__StreamMetadata streaminfo; /* scratchpad for STREAMINFO as it is built */ FLAC__StreamMetadata_SeekTable *seek_table; /* pointer into encoder->protected_->metadata_ where the seek table is */ - unsigned current_sample_number; - unsigned current_frame_number; + uint32_t current_sample_number; + uint32_t current_frame_number; FLAC__MD5Context md5context; FLAC__CPUInfo cpuinfo; + void (*local_precompute_partition_info_sums)(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps); #ifndef FLAC__INTEGER_ONLY_LIBRARY - unsigned (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); + uint32_t (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); + uint32_t (*local_fixed_compute_best_predictor_wide)(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); + uint32_t (*local_fixed_compute_best_predictor_limit_residual)(const FLAC__int32 data[], uint32_t data_len, float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); #else - unsigned (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); + uint32_t (*local_fixed_compute_best_predictor)(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); + uint32_t (*local_fixed_compute_best_predictor_wide)(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); + uint32_t (*local_fixed_compute_best_predictor_limit_residual)(const FLAC__int32 data[], uint32_t data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); #endif #ifndef FLAC__INTEGER_ONLY_LIBRARY - void (*local_lpc_compute_autocorrelation)(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); - void (*local_lpc_compute_residual_from_qlp_coefficients)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); - void (*local_lpc_compute_residual_from_qlp_coefficients_64bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); - void (*local_lpc_compute_residual_from_qlp_coefficients_16bit)(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); + void (*local_lpc_compute_autocorrelation)(const FLAC__real data[], uint32_t data_len, uint32_t lag, double autoc[]); + void (*local_lpc_compute_residual_from_qlp_coefficients)(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); + void (*local_lpc_compute_residual_from_qlp_coefficients_64bit)(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); + void (*local_lpc_compute_residual_from_qlp_coefficients_16bit)(const FLAC__int32 *data, uint32_t data_len, const FLAC__int32 qlp_coeff[], uint32_t order, int lp_quantization, FLAC__int32 residual[]); #endif - FLAC__bool use_wide_by_block; /* use slow 64-bit versions of some functions because of the block size */ - FLAC__bool use_wide_by_partition; /* use slow 64-bit versions of some functions because of the min partition order and blocksize */ - FLAC__bool use_wide_by_order; /* use slow 64-bit versions of some functions because of the lpc order */ + FLAC__bool disable_mmx; + FLAC__bool disable_sse2; + FLAC__bool disable_ssse3; + FLAC__bool disable_sse41; + FLAC__bool disable_sse42; + FLAC__bool disable_avx2; + FLAC__bool disable_fma; FLAC__bool disable_constant_subframes; FLAC__bool disable_fixed_subframes; FLAC__bool disable_verbatim_subframes; -#if FLAC__HAS_OGG FLAC__bool is_ogg; -#endif FLAC__StreamEncoderReadCallback read_callback; /* currently only needed for Ogg FLAC */ FLAC__StreamEncoderSeekCallback seek_callback; FLAC__StreamEncoderTellCallback tell_callback; @@ -396,15 +405,16 @@ typedef struct FLAC__StreamEncoderPrivate { FLAC__StreamEncoderMetadataCallback metadata_callback; FLAC__StreamEncoderProgressCallback progress_callback; void *client_data; - unsigned first_seekpoint_to_check; + uint32_t first_seekpoint_to_check; FILE *file; /* only used when encoding to a file */ FLAC__uint64 bytes_written; FLAC__uint64 samples_written; - unsigned frames_written; - unsigned total_frames_estimate; + uint32_t frames_written; + uint32_t total_frames_estimate; /* unaligned (original) pointers to allocated data */ FLAC__int32 *integer_signal_unaligned[FLAC__MAX_CHANNELS]; FLAC__int32 *integer_signal_mid_side_unaligned[2]; + FLAC__int64 *integer_signal_33bit_side_unaligned; #ifndef FLAC__INTEGER_ONLY_LIBRARY FLAC__real *real_signal_unaligned[FLAC__MAX_CHANNELS]; /* (@@@ currently unused) */ FLAC__real *real_signal_mid_side_unaligned[2]; /* (@@@ currently unused) */ @@ -414,7 +424,7 @@ typedef struct FLAC__StreamEncoderPrivate { FLAC__int32 *residual_workspace_unaligned[FLAC__MAX_CHANNELS][2]; FLAC__int32 *residual_workspace_mid_side_unaligned[2][2]; FLAC__uint64 *abs_residual_partition_sums_unaligned; - unsigned *raw_bits_per_partition_unaligned; + uint32_t *raw_bits_per_partition_unaligned; /* * These fields have been moved here from private function local * declarations merely to save stack space during encoding. @@ -434,9 +444,9 @@ typedef struct FLAC__StreamEncoderPrivate { verify_output output; struct { FLAC__uint64 absolute_sample; - unsigned frame_number; - unsigned channel; - unsigned sample; + uint32_t frame_number; + uint32_t channel; + uint32_t sample; FLAC__int32 expected; FLAC__int32 got; } error_stats; @@ -479,7 +489,7 @@ FLAC_API const char * const FLAC__StreamEncoderInitStatusString[] = { "FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED" }; -FLAC_API const char * const FLAC__treamEncoderReadStatusString[] = { +FLAC_API const char * const FLAC__StreamEncoderReadStatusString[] = { "FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE", "FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM", "FLAC__STREAM_ENCODER_READ_STATUS_ABORT", @@ -514,7 +524,7 @@ FLAC_API const char * const FLAC__StreamEncoderTellStatusString[] = { * WATCHOUT: some parts of the code assert that OVERREAD_ == 1 and there's * not really any reason to change it. */ -static const unsigned OVERREAD_ = 1; +static const uint32_t OVERREAD_ = 1; /*********************************************************************** * @@ -524,22 +534,22 @@ static const unsigned OVERREAD_ = 1; FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void) { FLAC__StreamEncoder *encoder; - unsigned i; + uint32_t i; FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ - encoder = (FLAC__StreamEncoder*)calloc(1, sizeof(FLAC__StreamEncoder)); + encoder = calloc(1, sizeof(FLAC__StreamEncoder)); if(encoder == 0) { return 0; } - encoder->protected_ = (FLAC__StreamEncoderProtected*)calloc(1, sizeof(FLAC__StreamEncoderProtected)); + encoder->protected_ = calloc(1, sizeof(FLAC__StreamEncoderProtected)); if(encoder->protected_ == 0) { free(encoder); return 0; } - encoder->private_ = (FLAC__StreamEncoderPrivate*)calloc(1, sizeof(FLAC__StreamEncoderPrivate)); + encoder->private_ = calloc(1, sizeof(FLAC__StreamEncoderPrivate)); if(encoder->private_ == 0) { free(encoder->protected_); free(encoder); @@ -556,6 +566,8 @@ FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void) encoder->private_->file = 0; + encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED; + set_defaults_(encoder); encoder->private_->is_being_deleted = false; @@ -588,16 +600,16 @@ FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void) for(i = 0; i < 2; i++) FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_extra[i]); - encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED; - return encoder; } FLAC_API void FLAC__stream_encoder_delete(FLAC__StreamEncoder *encoder) { - unsigned i; + uint32_t i; + + if (encoder == NULL) + return ; - FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->protected_); FLAC__ASSERT(0 != encoder->private_); FLAC__ASSERT(0 != encoder->private_->frame); @@ -643,7 +655,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( FLAC__bool is_ogg ) { - unsigned i; + uint32_t i; FLAC__bool metadata_has_seektable, metadata_has_vorbis_comment, metadata_picture_has_type1, metadata_picture_has_type2; FLAC__ASSERT(0 != encoder); @@ -651,10 +663,8 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED; -#if !FLAC__HAS_OGG - if(is_ogg) + if(FLAC__HAS_OGG == 0 && is_ogg) return FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER; -#endif if(0 == write_callback || (seek_callback && 0 == tell_callback)) return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS; @@ -669,10 +679,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( else if(!encoder->protected_->do_mid_side_stereo) encoder->protected_->loose_mid_side_stereo = false; - if(encoder->protected_->bits_per_sample >= 32) - encoder->protected_->do_mid_side_stereo = false; /* since we currenty do 32-bit math, the side channel would have 33 bps and overflow */ - - if(encoder->protected_->bits_per_sample < FLAC__MIN_BITS_PER_SAMPLE || encoder->protected_->bits_per_sample > FLAC__REFERENCE_CODEC_MAX_BITS_PER_SAMPLE) + if(encoder->protected_->bits_per_sample < FLAC__MIN_BITS_PER_SAMPLE || encoder->protected_->bits_per_sample > FLAC__MAX_BITS_PER_SAMPLE) return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_BITS_PER_SAMPLE; if(!FLAC__format_sample_rate_is_valid(encoder->protected_->sample_rate)) @@ -698,7 +705,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( if(encoder->protected_->bits_per_sample < 16) { /* @@@ need some data about how to set this here w.r.t. blocksize and sample rate */ /* @@@ until then we'll make a guess */ - encoder->protected_->qlp_coeff_precision = max(FLAC__MIN_QLP_COEFF_PRECISION, 2 + encoder->protected_->bits_per_sample / 2); + encoder->protected_->qlp_coeff_precision = flac_max(FLAC__MIN_QLP_COEFF_PRECISION, 2 + encoder->protected_->bits_per_sample / 2); } else if(encoder->protected_->bits_per_sample == 16) { if(encoder->protected_->blocksize <= 192) @@ -730,20 +737,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION; if(encoder->protected_->streamable_subset) { - if( - encoder->protected_->blocksize != 192 && - encoder->protected_->blocksize != 576 && - encoder->protected_->blocksize != 1152 && - encoder->protected_->blocksize != 2304 && - encoder->protected_->blocksize != 4608 && - encoder->protected_->blocksize != 256 && - encoder->protected_->blocksize != 512 && - encoder->protected_->blocksize != 1024 && - encoder->protected_->blocksize != 2048 && - encoder->protected_->blocksize != 4096 && - encoder->protected_->blocksize != 8192 && - encoder->protected_->blocksize != 16384 - ) + if(!FLAC__format_blocksize_is_subset(encoder->protected_->blocksize, encoder->protected_->sample_rate)) return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE; if(!FLAC__format_sample_rate_is_subset(encoder->protected_->sample_rate)) return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE; @@ -752,7 +746,8 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( encoder->protected_->bits_per_sample != 12 && encoder->protected_->bits_per_sample != 16 && encoder->protected_->bits_per_sample != 20 && - encoder->protected_->bits_per_sample != 24 + encoder->protected_->bits_per_sample != 24 && + encoder->protected_->bits_per_sample != 32 ) return FLAC__STREAM_ENCODER_INIT_STATUS_NOT_STREAMABLE; if(encoder->protected_->max_residual_partition_order > FLAC__SUBSET_MAX_RICE_PARTITION_ORDER) @@ -774,14 +769,26 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( encoder->protected_->min_residual_partition_order = encoder->protected_->max_residual_partition_order; #if FLAC__HAS_OGG + /* drop any seektable for ogg */ + if(is_ogg && 0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0) { + uint32_t i1; + for(i1 = 0; i1 < encoder->protected_->num_metadata_blocks; i1++) { + if(0 != encoder->protected_->metadata[i1] && encoder->protected_->metadata[i1]->type == FLAC__METADATA_TYPE_SEEKTABLE) { + encoder->protected_->num_metadata_blocks--; + for( ; i1 < encoder->protected_->num_metadata_blocks; i1++) + encoder->protected_->metadata[i1] = encoder->protected_->metadata[i1+1]; + break; + } + } + } /* reorder metadata if necessary to ensure that any VORBIS_COMMENT is the first, according to the mapping spec */ if(is_ogg && 0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 1) { - unsigned i; - for(i = 1; i < encoder->protected_->num_metadata_blocks; i++) { - if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { - FLAC__StreamMetadata *vc = encoder->protected_->metadata[i]; - for( ; i > 0; i--) - encoder->protected_->metadata[i] = encoder->protected_->metadata[i-1]; + uint32_t i1; + for(i1 = 1; i1 < encoder->protected_->num_metadata_blocks; i1++) { + if(0 != encoder->protected_->metadata[i1] && encoder->protected_->metadata[i1]->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { + FLAC__StreamMetadata *vc = encoder->protected_->metadata[i1]; + for( ; i1 > 0; i1--) + encoder->protected_->metadata[i1] = encoder->protected_->metadata[i1-1]; encoder->protected_->metadata[0] = vc; break; } @@ -790,10 +797,10 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( #endif /* keep track of any SEEKTABLE block */ if(0 != encoder->protected_->metadata && encoder->protected_->num_metadata_blocks > 0) { - unsigned i; - for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) { - if(0 != encoder->protected_->metadata[i] && encoder->protected_->metadata[i]->type == FLAC__METADATA_TYPE_SEEKTABLE) { - encoder->private_->seek_table = &encoder->protected_->metadata[i]->data.seek_table; + uint32_t i2; + for(i2 = 0; i2 < encoder->protected_->num_metadata_blocks; i2++) { + if(0 != encoder->protected_->metadata[i2] && encoder->protected_->metadata[i2]->type == FLAC__METADATA_TYPE_SEEKTABLE) { + encoder->private_->seek_table = &encoder->protected_->metadata[i2]->data.seek_table; break; /* take only the first one */ } } @@ -835,7 +842,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( metadata_picture_has_type1 = true; /* standard icon must be 32x32 pixel PNG */ if( - m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && + m->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && ( (strcmp(m->data.picture.mime_type, "image/png") && strcmp(m->data.picture.mime_type, "-->")) || m->data.picture.width != 32 || @@ -865,6 +872,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( encoder->private_->real_signal_mid_side_unaligned[i] = encoder->private_->real_signal_mid_side[i] = 0; #endif } + encoder->private_->integer_signal_33bit_side_unaligned = encoder->private_->integer_signal_33bit_side = 0; #ifndef FLAC__INTEGER_ONLY_LIBRARY for(i = 0; i < encoder->protected_->num_apodizations; i++) encoder->private_->window_unaligned[i] = encoder->private_->window[i] = 0; @@ -883,15 +891,15 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( encoder->private_->abs_residual_partition_sums_unaligned = encoder->private_->abs_residual_partition_sums = 0; encoder->private_->raw_bits_per_partition_unaligned = encoder->private_->raw_bits_per_partition = 0; #ifndef FLAC__INTEGER_ONLY_LIBRARY - encoder->private_->loose_mid_side_stereo_frames = (unsigned)((FLAC__double)encoder->protected_->sample_rate * 0.4 / (FLAC__double)encoder->protected_->blocksize + 0.5); + encoder->private_->loose_mid_side_stereo_frames = (uint32_t)((double)encoder->protected_->sample_rate * 0.4 / (double)encoder->protected_->blocksize + 0.5); #else /* 26214 is the approximate fixed-point equivalent to 0.4 (0.4 * 2^16) */ - /* sample rate can be up to 655350 Hz, and thus use 20 bits, so we do the multiply÷ by hand */ - FLAC__ASSERT(FLAC__MAX_SAMPLE_RATE <= 655350); + /* sample rate can be up to 1048575 Hz, and thus use 20 bits, so we do the multiply÷ by hand */ + FLAC__ASSERT(FLAC__MAX_SAMPLE_RATE <= 1048575); FLAC__ASSERT(FLAC__MAX_BLOCK_SIZE <= 65535); - FLAC__ASSERT(encoder->protected_->sample_rate <= 655350); + FLAC__ASSERT(encoder->protected_->sample_rate <= 1048575); FLAC__ASSERT(encoder->protected_->blocksize <= 65535); - encoder->private_->loose_mid_side_stereo_frames = (unsigned)FLAC__fixedpoint_trunc((((FLAC__uint64)(encoder->protected_->sample_rate) * (FLAC__uint64)(26214)) << 16) / (encoder->protected_->blocksize<<16) + FLAC__FP_ONE_HALF); + encoder->private_->loose_mid_side_stereo_frames = (uint32_t)FLAC__fixedpoint_trunc((((FLAC__uint64)(encoder->protected_->sample_rate) * (FLAC__uint64)(26214)) << 16) / (encoder->protected_->blocksize<<16) + FLAC__FP_ONE_HALF); #endif if(encoder->private_->loose_mid_side_stereo_frames == 0) encoder->private_->loose_mid_side_stereo_frames = 1; @@ -899,19 +907,34 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( encoder->private_->current_sample_number = 0; encoder->private_->current_frame_number = 0; - encoder->private_->use_wide_by_block = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(encoder->protected_->blocksize)+1 > 30); - encoder->private_->use_wide_by_order = (encoder->protected_->bits_per_sample + FLAC__bitmath_ilog2(max(encoder->protected_->max_lpc_order, FLAC__MAX_FIXED_ORDER))+1 > 30); /*@@@ need to use this? */ - encoder->private_->use_wide_by_partition = (false); /*@@@ need to set this */ - /* * get the CPU info and set the function pointers */ FLAC__cpu_info(&encoder->private_->cpuinfo); + /* remove cpu info as requested by + * FLAC__stream_encoder_disable_instruction_set */ + if(encoder->private_->disable_mmx) + encoder->private_->cpuinfo.x86.mmx = false; + if(encoder->private_->disable_sse2) + encoder->private_->cpuinfo.x86.sse2 = false; + if(encoder->private_->disable_ssse3) + encoder->private_->cpuinfo.x86.ssse3 = false; + if(encoder->private_->disable_sse41) + encoder->private_->cpuinfo.x86.sse41 = false; + if(encoder->private_->disable_sse42) + encoder->private_->cpuinfo.x86.sse42 = false; + if(encoder->private_->disable_avx2) + encoder->private_->cpuinfo.x86.avx2 = false; + if(encoder->private_->disable_fma) + encoder->private_->cpuinfo.x86.fma = false; /* first default to the non-asm routines */ #ifndef FLAC__INTEGER_ONLY_LIBRARY encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation; #endif + encoder->private_->local_precompute_partition_info_sums = precompute_partition_info_sums_; encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor; + encoder->private_->local_fixed_compute_best_predictor_wide = FLAC__fixed_compute_best_predictor_wide; + encoder->private_->local_fixed_compute_best_predictor_limit_residual = FLAC__fixed_compute_best_predictor_limit_residual; #ifndef FLAC__INTEGER_ONLY_LIBRARY encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients; encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit = FLAC__lpc_compute_residual_from_qlp_coefficients_wide; @@ -920,43 +943,159 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( /* now override with asm where appropriate */ #ifndef FLAC__INTEGER_ONLY_LIBRARY # ifndef FLAC__NO_ASM +#if defined FLAC__CPU_ARM64 && FLAC__HAS_NEONINTRIN +#if FLAC__HAS_A64NEONINTRIN + if(encoder->protected_->max_lpc_order < 8) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_neon_lag_8; + else if(encoder->protected_->max_lpc_order < 10) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_neon_lag_10; + else if(encoder->protected_->max_lpc_order < 14) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_neon_lag_14; + else + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation; +#endif + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_neon; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_neon; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit = FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_neon; +#endif /* defined FLAC__CPU_ARM64 && FLAC__HAS_NEONINTRIN */ + if(encoder->private_->cpuinfo.use_asm) { # ifdef FLAC__CPU_IA32 FLAC__ASSERT(encoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_IA32); -# ifdef FLAC__HAS_NASM - if(encoder->private_->cpuinfo.data.ia32.sse) { - if(encoder->protected_->max_lpc_order < 4) - encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4; - else if(encoder->protected_->max_lpc_order < 8) - encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8; +# if FLAC__HAS_X86INTRIN +# ifdef FLAC__SSE2_SUPPORTED + if (encoder->private_->cpuinfo.x86.sse2) { + if(encoder->protected_->max_lpc_order < 8) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_8; + else if(encoder->protected_->max_lpc_order < 10) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_10; + else if(encoder->protected_->max_lpc_order < 14) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_14; + + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse2; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2; + } +# endif +# ifdef FLAC__SSE4_1_SUPPORTED + if (encoder->private_->cpuinfo.x86.sse41) { + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit = FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_sse41; + } +# endif +# ifdef FLAC__AVX2_SUPPORTED + if (encoder->private_->cpuinfo.x86.avx2) { + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit = FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2; + } +# endif + +# ifdef FLAC__SSE2_SUPPORTED + if (encoder->private_->cpuinfo.x86.sse2) { + encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_intrin_sse2; + } +# endif +# ifdef FLAC__SSSE3_SUPPORTED + if (encoder->private_->cpuinfo.x86.ssse3) { + encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_intrin_ssse3; + } +# endif +# ifdef FLAC__SSE4_2_SUPPORTED + if (encoder->private_->cpuinfo.x86.sse42) { + encoder->private_->local_fixed_compute_best_predictor_limit_residual = FLAC__fixed_compute_best_predictor_limit_residual_intrin_sse42; + } +# endif +# ifdef FLAC__AVX2_SUPPORTED + if (encoder->private_->cpuinfo.x86.avx2) { + encoder->private_->local_fixed_compute_best_predictor_wide = FLAC__fixed_compute_best_predictor_wide_intrin_avx2; + encoder->private_->local_fixed_compute_best_predictor_limit_residual = FLAC__fixed_compute_best_predictor_limit_residual_intrin_avx2; + } +# endif +# endif /* FLAC__HAS_X86INTRIN */ +# elif defined FLAC__CPU_X86_64 + FLAC__ASSERT(encoder->private_->cpuinfo.type == FLAC__CPUINFO_TYPE_X86_64); +# if FLAC__HAS_X86INTRIN +# ifdef FLAC__SSE2_SUPPORTED + if(encoder->private_->cpuinfo.x86.sse2) { /* For fuzzing */ + if(encoder->protected_->max_lpc_order < 8) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_8; + else if(encoder->protected_->max_lpc_order < 10) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_10; + else if(encoder->protected_->max_lpc_order < 14) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_sse2_lag_14; + + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_sse2; + } +# endif +# ifdef FLAC__SSE4_1_SUPPORTED + if(encoder->private_->cpuinfo.x86.sse41) { + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_sse41; + } +# endif +# ifdef FLAC__AVX2_SUPPORTED + if(encoder->private_->cpuinfo.x86.avx2) { + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_16_intrin_avx2; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_intrin_avx2; + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit = FLAC__lpc_compute_residual_from_qlp_coefficients_wide_intrin_avx2; + } +# endif +# ifdef FLAC__FMA_SUPPORTED + if(encoder->private_->cpuinfo.x86.fma) { + if(encoder->protected_->max_lpc_order < 8) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_fma_lag_8; else if(encoder->protected_->max_lpc_order < 12) - encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12; - else - encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32; + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_fma_lag_12; + else if(encoder->protected_->max_lpc_order < 16) + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_intrin_fma_lag_16; } - else if(encoder->private_->cpuinfo.data.ia32._3dnow) - encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow; - else - encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation_asm_ia32; - if(encoder->private_->cpuinfo.data.ia32.mmx) { - encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32; - encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx; +# endif + + +# ifdef FLAC__SSE2_SUPPORTED + if(encoder->private_->cpuinfo.x86.sse2) { /* For fuzzing */ + encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_intrin_sse2; } - else { - encoder->private_->local_lpc_compute_residual_from_qlp_coefficients = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32; - encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit = FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32; +# endif +# ifdef FLAC__SSSE3_SUPPORTED + if (encoder->private_->cpuinfo.x86.ssse3) { + encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_intrin_ssse3; + } +# endif +# ifdef FLAC__SSE4_2_SUPPORTED + if (encoder->private_->cpuinfo.x86.sse42) { + encoder->private_->local_fixed_compute_best_predictor_limit_residual = FLAC__fixed_compute_best_predictor_limit_residual_intrin_sse42; + } +# endif +# ifdef FLAC__AVX2_SUPPORTED + if (encoder->private_->cpuinfo.x86.avx2) { + encoder->private_->local_fixed_compute_best_predictor_wide = FLAC__fixed_compute_best_predictor_wide_intrin_avx2; + encoder->private_->local_fixed_compute_best_predictor_limit_residual = FLAC__fixed_compute_best_predictor_limit_residual_intrin_avx2; } - if(encoder->private_->cpuinfo.data.ia32.mmx && encoder->private_->cpuinfo.data.ia32.cmov) - encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov; -# endif /* FLAC__HAS_NASM */ -# endif /* FLAC__CPU_IA32 */ +# endif +# endif /* FLAC__HAS_X86INTRIN */ +# endif /* FLAC__CPU_... */ } # endif /* !FLAC__NO_ASM */ + #endif /* !FLAC__INTEGER_ONLY_LIBRARY */ - /* finally override based on wide-ness if necessary */ - if(encoder->private_->use_wide_by_block) { - encoder->private_->local_fixed_compute_best_predictor = FLAC__fixed_compute_best_predictor_wide; +#if !defined FLAC__NO_ASM && FLAC__HAS_X86INTRIN + if(encoder->private_->cpuinfo.use_asm) { +# if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) +# ifdef FLAC__SSE2_SUPPORTED + if (encoder->private_->cpuinfo.x86.sse2) + encoder->private_->local_precompute_partition_info_sums = FLAC__precompute_partition_info_sums_intrin_sse2; +# endif +# ifdef FLAC__SSSE3_SUPPORTED + if (encoder->private_->cpuinfo.x86.ssse3) + encoder->private_->local_precompute_partition_info_sums = FLAC__precompute_partition_info_sums_intrin_ssse3; +# endif +# ifdef FLAC__AVX2_SUPPORTED + if (encoder->private_->cpuinfo.x86.avx2) + encoder->private_->local_precompute_partition_info_sums = FLAC__precompute_partition_info_sums_intrin_avx2; +# endif +# endif /* FLAC__CPU_... */ } +#endif /* !FLAC__NO_ASM && FLAC__HAS_X86INTRIN */ /* set state to OK; from here on, errors are fatal and we'll override the state then */ encoder->protected_->state = FLAC__STREAM_ENCODER_OK; @@ -996,7 +1135,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( */ encoder->private_->verify.input_fifo.size = encoder->protected_->blocksize+OVERREAD_; for(i = 0; i < encoder->protected_->channels; i++) { - if(0 == (encoder->private_->verify.input_fifo.data[i] = (FLAC__int32*)safe_malloc_mul_2op_(sizeof(FLAC__int32), /*times*/encoder->private_->verify.input_fifo.size))) { + if(0 == (encoder->private_->verify.input_fifo.data[i] = safe_malloc_mul_2op_p(sizeof(FLAC__int32), /*times*/encoder->private_->verify.input_fifo.size))) { encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; } @@ -1006,10 +1145,12 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( /* * Now set up a stream decoder for verification */ - encoder->private_->verify.decoder = FLAC__stream_decoder_new(); if(0 == encoder->private_->verify.decoder) { - encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR; - return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; + encoder->private_->verify.decoder = FLAC__stream_decoder_new(); + if(0 == encoder->private_->verify.decoder) { + encoder->protected_->state = FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR; + return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; + } } if(FLAC__stream_decoder_init_stream(encoder->private_->verify.decoder, verify_read_callback_, /*seek_callback=*/0, /*tell_callback=*/0, /*length_callback=*/0, /*eof_callback=*/0, verify_write_callback_, verify_metadata_callback_, verify_error_callback_, /*client_data=*/encoder) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { @@ -1067,7 +1208,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( memset(encoder->private_->streaminfo.data.stream_info.md5sum, 0, 16); /* we don't know this yet; have to fill it in later */ if(encoder->protected_->do_md5) FLAC__MD5Init(&encoder->private_->md5context); - if(!FLAC__add_metadata_block(&encoder->private_->streaminfo, encoder->private_->frame)) { + if(!FLAC__add_metadata_block(&encoder->private_->streaminfo, encoder->private_->frame, true)) { encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; } @@ -1103,7 +1244,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( vorbis_comment.data.vorbis_comment.vendor_string.entry = 0; vorbis_comment.data.vorbis_comment.num_comments = 0; vorbis_comment.data.vorbis_comment.comments = 0; - if(!FLAC__add_metadata_block(&vorbis_comment, encoder->private_->frame)) { + if(!FLAC__add_metadata_block(&vorbis_comment, encoder->private_->frame, true)) { encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; } @@ -1118,7 +1259,7 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( */ for(i = 0; i < encoder->protected_->num_metadata_blocks; i++) { encoder->protected_->metadata[i]->is_last = (i == encoder->protected_->num_metadata_blocks - 1); - if(!FLAC__add_metadata_block(encoder->protected_->metadata[i], encoder->private_->frame)) { + if(!FLAC__add_metadata_block(encoder->protected_->metadata[i], encoder->private_->frame, true)) { encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR; return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; } @@ -1182,7 +1323,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_stream( /*is_ogg=*/true ); } - + static FLAC__StreamEncoderInitStatus init_FILE_internal_( FLAC__StreamEncoder *encoder, FILE *file, @@ -1213,6 +1354,14 @@ static FLAC__StreamEncoderInitStatus init_FILE_internal_( if(file == stdout) file = get_binary_stdout_(); /* just to be safe */ +#ifdef _WIN32 + /* + * Windows can suffer quite badly from disk fragmentation. This can be + * reduced significantly by setting the output buffer size to be 10MB. + */ + if(GetFileType((HANDLE)_get_osfhandle(_fileno(file))) == FILE_TYPE_DISK) + setvbuf(file, NULL, _IOFBF, 10*1024*1024); +#endif encoder->private_->file = file; encoder->private_->progress_callback = progress_callback; @@ -1236,15 +1385,15 @@ static FLAC__StreamEncoderInitStatus init_FILE_internal_( } { - unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder); + uint32_t blocksize = FLAC__stream_encoder_get_blocksize(encoder); FLAC__ASSERT(blocksize != 0); - encoder->private_->total_frames_estimate = (unsigned)((FLAC__stream_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize); + encoder->private_->total_frames_estimate = (uint32_t)((FLAC__stream_encoder_get_total_samples_estimate(encoder) + blocksize - 1) / blocksize); } return init_status; } - + FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE( FLAC__StreamEncoder *encoder, FILE *file, @@ -1254,7 +1403,7 @@ FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_FILE( { return init_FILE_internal_(encoder, file, progress_callback, client_data, /*is_ogg=*/false); } - + FLAC_API FLAC__StreamEncoderInitStatus FLAC__stream_encoder_init_ogg_FILE( FLAC__StreamEncoder *encoder, FILE *file, @@ -1285,7 +1434,7 @@ static FLAC__StreamEncoderInitStatus init_file_internal_( if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED; - file = filename? fopen(filename, "w+b") : stdout; + file = filename? flac_fopen(filename, "w+b") : stdout; if(file == 0) { encoder->protected_->state = FLAC__STREAM_ENCODER_IO_ERROR; @@ -1319,18 +1468,34 @@ FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder) { FLAC__bool error = false; - FLAC__ASSERT(0 != encoder); + if (encoder == NULL) + return false; + FLAC__ASSERT(0 != encoder->private_); FLAC__ASSERT(0 != encoder->protected_); - if(encoder->protected_->state == FLAC__STREAM_ENCODER_UNINITIALIZED) + if(encoder->protected_->state == FLAC__STREAM_ENCODER_UNINITIALIZED){ + if(encoder->protected_->metadata){ // True in case FLAC__stream_encoder_set_metadata was used but init failed + free(encoder->protected_->metadata); + encoder->protected_->metadata = 0; + encoder->protected_->num_metadata_blocks = 0; + } + if(0 != encoder->private_->file) { + if(encoder->private_->file != stdout) + fclose(encoder->private_->file); + encoder->private_->file = 0; + } return true; + } if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK && !encoder->private_->is_being_deleted) { if(encoder->private_->current_sample_number != 0) { - const FLAC__bool is_fractional_block = encoder->protected_->blocksize != encoder->private_->current_sample_number; encoder->protected_->blocksize = encoder->private_->current_sample_number; - if(!process_frame_(encoder, is_fractional_block, /*is_last_block=*/true)) + if(!resize_buffers_(encoder, encoder->protected_->blocksize)) { + /* the above function sets the state for us in case of an error */ + return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR; + } + if(!process_frame_(encoder, /*is_last_block=*/true)) error = true; } } @@ -1424,6 +1589,14 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncod return true; } +/* + * The following routine was intended as debug routine and is not in the + * public headers, but SHOULD NOT CHANGE! It is known is is used in + * some non-audio projects needing every last bit of performance. + * See https://github.com/xiph/flac/issues/547 for details. These projects + * provide their own prototype, so changing the signature of this function + * would break building. + */ FLAC_API FLAC__bool FLAC__stream_encoder_set_do_md5(FLAC__StreamEncoder *encoder, FLAC__bool value) { FLAC__ASSERT(0 != encoder); @@ -1435,7 +1608,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_do_md5(FLAC__StreamEncoder *encoder return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1446,7 +1619,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_channels(FLAC__StreamEncoder *encod return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1457,7 +1630,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_bits_per_sample(FLAC__StreamEncoder return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1468,7 +1641,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *en return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__bool ok = true; FLAC__ASSERT(0 != encoder); @@ -1481,11 +1654,10 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncod ok &= FLAC__stream_encoder_set_do_mid_side_stereo (encoder, compression_levels_[value].do_mid_side_stereo); ok &= FLAC__stream_encoder_set_loose_mid_side_stereo (encoder, compression_levels_[value].loose_mid_side_stereo); #ifndef FLAC__INTEGER_ONLY_LIBRARY -#if 0 - /* was: */ +#if 1 ok &= FLAC__stream_encoder_set_apodization (encoder, compression_levels_[value].apodization); - /* but it's too hard to specify the string in a locale-specific way */ #else + /* equivalent to -A tukey(0.5) */ encoder->protected_->num_apodizations = 1; encoder->protected_->apodizations[0].type = FLAC__APODIZATION_TUKEY; encoder->protected_->apodizations[0].parameters.tukey.p = 0.5; @@ -1502,7 +1674,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncod return ok; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1589,6 +1761,62 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *en encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TUKEY; } } + else if(n>15 && 0 == strncmp("partial_tukey(", specification, 14)) { + FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+14, 0); + const char *si_1 = strchr(specification, '/'); + FLAC__real overlap = si_1?flac_min((FLAC__real)strtod(si_1+1, 0),0.99f):0.1f; + FLAC__real overlap_units = 1.0f/(1.0f - overlap) - 1.0f; + const char *si_2 = strchr((si_1?(si_1+1):specification), '/'); + FLAC__real tukey_p = si_2?(FLAC__real)strtod(si_2+1, 0):0.2f; + + if (tukey_parts <= 1) { + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.tukey.p = tukey_p; + encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TUKEY; + }else if (encoder->protected_->num_apodizations + tukey_parts < 32){ + FLAC__int32 m; + for(m = 0; m < tukey_parts; m++){ + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.multiple_tukey.p = tukey_p; + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.multiple_tukey.start = m/(tukey_parts+overlap_units); + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.multiple_tukey.end = (m+1+overlap_units)/(tukey_parts+overlap_units); + encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_PARTIAL_TUKEY; + } + } + } + else if(n>16 && 0 == strncmp("punchout_tukey(", specification, 15)) { + FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+15, 0); + const char *si_1 = strchr(specification, '/'); + FLAC__real overlap = si_1?flac_min((FLAC__real)strtod(si_1+1, 0),0.99f):0.2f; + FLAC__real overlap_units = 1.0f/(1.0f - overlap) - 1.0f; + const char *si_2 = strchr((si_1?(si_1+1):specification), '/'); + FLAC__real tukey_p = si_2?(FLAC__real)strtod(si_2+1, 0):0.2f; + + if (tukey_parts <= 1) { + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.tukey.p = tukey_p; + encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_TUKEY; + }else if (encoder->protected_->num_apodizations + tukey_parts < 32){ + FLAC__int32 m; + for(m = 0; m < tukey_parts; m++){ + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.multiple_tukey.p = tukey_p; + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.multiple_tukey.start = m/(tukey_parts+overlap_units); + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.multiple_tukey.end = (m+1+overlap_units)/(tukey_parts+overlap_units); + encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_PUNCHOUT_TUKEY; + } + } + } + else if(n>17 && 0 == strncmp("subdivide_tukey(", specification, 16)){ + FLAC__int32 parts = (FLAC__int32)strtod(specification+16, 0); + if(parts > 1){ + const char *si_1 = strchr(specification, '/'); + FLAC__real p = si_1?(FLAC__real)strtod(si_1+1, 0):5e-1; + if(p > 1) + p = 1; + else if(p < 0) + p = 0; + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.subdivide_tukey.parts = parts; + encoder->protected_->apodizations[encoder->protected_->num_apodizations].parameters.subdivide_tukey.p = p/parts; + encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_SUBDIVIDE_TUKEY; + } + } else if(n==5 && 0 == strncmp("welch" , specification, n)) encoder->protected_->apodizations[encoder->protected_->num_apodizations++].type = FLAC__APODIZATION_WELCH; if (encoder->protected_->num_apodizations == 32) @@ -1607,7 +1835,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *en return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1618,7 +1846,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_max_lpc_order(FLAC__StreamEncoder * return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_qlp_coeff_precision(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1647,8 +1875,10 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_do_escape_coding(FLAC__StreamEncode FLAC__ASSERT(0 != encoder->protected_); if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) return false; -#if 0 - /*@@@ deprecated: */ +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* was deprecated since FLAC 1.0.4 (24-Sep-2002), but is needed for + * full spec coverage, so this should be reenabled at some point. + * For now only enable while fuzzing */ encoder->protected_->do_escape_coding = value; #else (void)value; @@ -1667,7 +1897,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_do_exhaustive_model_search(FLAC__St return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1678,7 +1908,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_min_residual_partition_order(FLAC__ return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1689,7 +1919,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_max_residual_partition_order(FLAC__ return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, unsigned value) +FLAC_API FLAC__bool FLAC__stream_encoder_set_rice_parameter_search_dist(FLAC__StreamEncoder *encoder, uint32_t value) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1712,11 +1942,12 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_total_samples_estimate(FLAC__Stream FLAC__ASSERT(0 != encoder->protected_); if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) return false; + value = flac_min(value, (FLAC__U64L(1) << FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN) - 1); encoder->protected_->total_samples_estimate = value; return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, unsigned num_blocks) +FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encoder, FLAC__StreamMetadata **metadata, uint32_t num_blocks) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1735,7 +1966,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encod } if(num_blocks) { FLAC__StreamMetadata **m; - if(0 == (m = (FLAC__StreamMetadata**)safe_malloc_mul_2op_(sizeof(m[0]), /*times*/num_blocks))) + if(0 == (m = safe_malloc_mul_2op_p(sizeof(m[0]), /*times*/num_blocks))) return false; memcpy(m, metadata, sizeof(m[0]) * num_blocks); encoder->protected_->metadata = m; @@ -1748,10 +1979,38 @@ FLAC_API FLAC__bool FLAC__stream_encoder_set_metadata(FLAC__StreamEncoder *encod return true; } +FLAC_API FLAC__bool FLAC__stream_encoder_set_limit_min_bitrate(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->protected_->limit_min_bitrate = value; + return true; +} + /* - * These three functions are not static, but not publically exposed in - * include/FLAC/ either. They are used by the test suite. + * These four functions are not static, but not publicly exposed in + * include/FLAC/ either. They are used by the test suite and in fuzzing */ +FLAC_API FLAC__bool FLAC__stream_encoder_disable_instruction_set(FLAC__StreamEncoder *encoder, FLAC__bool value) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) + return false; + encoder->private_->disable_mmx = value & 1; + encoder->private_->disable_sse2 = value & 2; + encoder->private_->disable_ssse3 = value & 4; + encoder->private_->disable_sse41 = value & 8; + encoder->private_->disable_avx2 = value & 16; + encoder->private_->disable_fma = value & 32; + encoder->private_->disable_sse42 = value & 64; + return true; +} + FLAC_API FLAC__bool FLAC__stream_encoder_disable_constant_subframes(FLAC__StreamEncoder *encoder, FLAC__bool value) { FLAC__ASSERT(0 != encoder); @@ -1815,7 +2074,7 @@ FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__ return FLAC__stream_decoder_get_resolved_state_string(encoder->private_->verify.decoder); } -FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got) +FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, uint32_t *frame_number, uint32_t *channel, uint32_t *sample, FLAC__int32 *expected, FLAC__int32 *got) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1858,7 +2117,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_get_do_md5(const FLAC__StreamEncoder *e return encoder->protected_->do_md5; } -FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder) +FLAC_API uint32_t FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1866,7 +2125,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_channels(const FLAC__StreamEncoder *e return encoder->protected_->channels; } -FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder) +FLAC_API uint32_t FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1874,7 +2133,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_bits_per_sample(const FLAC__StreamEnc return encoder->protected_->bits_per_sample; } -FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder) +FLAC_API uint32_t FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1882,7 +2141,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_sample_rate(const FLAC__StreamEncoder return encoder->protected_->sample_rate; } -FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder) +FLAC_API uint32_t FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1906,7 +2165,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__S return encoder->protected_->loose_mid_side_stereo; } -FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder) +FLAC_API uint32_t FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1914,7 +2173,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_max_lpc_order(const FLAC__StreamEncod return encoder->protected_->max_lpc_order; } -FLAC_API unsigned FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder) +FLAC_API uint32_t FLAC__stream_encoder_get_qlp_coeff_precision(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1946,7 +2205,7 @@ FLAC_API FLAC__bool FLAC__stream_encoder_get_do_exhaustive_model_search(const FL return encoder->protected_->do_exhaustive_model_search; } -FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder) +FLAC_API uint32_t FLAC__stream_encoder_get_min_residual_partition_order(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1954,7 +2213,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_min_residual_partition_order(const FL return encoder->protected_->min_residual_partition_order; } -FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder) +FLAC_API uint32_t FLAC__stream_encoder_get_max_residual_partition_order(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1962,7 +2221,7 @@ FLAC_API unsigned FLAC__stream_encoder_get_max_residual_partition_order(const FL return encoder->protected_->max_residual_partition_order; } -FLAC_API unsigned FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder) +FLAC_API uint32_t FLAC__stream_encoder_get_rice_parameter_search_dist(const FLAC__StreamEncoder *encoder) { FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); @@ -1978,51 +2237,58 @@ FLAC_API FLAC__uint64 FLAC__stream_encoder_get_total_samples_estimate(const FLAC return encoder->protected_->total_samples_estimate; } -FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], unsigned samples) +FLAC_API FLAC__bool FLAC__stream_encoder_get_limit_min_bitrate(const FLAC__StreamEncoder *encoder) +{ + FLAC__ASSERT(0 != encoder); + FLAC__ASSERT(0 != encoder->private_); + FLAC__ASSERT(0 != encoder->protected_); + return encoder->protected_->limit_min_bitrate; +} + +FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, const FLAC__int32 * const buffer[], uint32_t samples) { - unsigned i, j = 0, channel; - const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize; + uint32_t i, j = 0, k = 0, channel; + const uint32_t channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize; + const FLAC__int32 sample_max = INT32_MAX >> (32 - encoder->protected_->bits_per_sample); + const FLAC__int32 sample_min = INT32_MIN >> (32 - encoder->protected_->bits_per_sample); FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); FLAC__ASSERT(0 != encoder->protected_); - FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); + + if(encoder->protected_->state != FLAC__STREAM_ENCODER_OK) + return false; do { - const unsigned n = min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j); + const uint32_t n = flac_min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j); if(encoder->protected_->verify) append_to_verify_fifo_(&encoder->private_->verify.input_fifo, buffer, j, channels, n); - for(channel = 0; channel < channels; channel++) - memcpy(&encoder->private_->integer_signal[channel][encoder->private_->current_sample_number], &buffer[channel][j], sizeof(buffer[channel][0]) * n); - - if(encoder->protected_->do_mid_side_stereo) { - FLAC__ASSERT(channels == 2); - /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */ - for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++) { - encoder->private_->integer_signal_mid_side[1][i] = buffer[0][j] - buffer[1][j]; - encoder->private_->integer_signal_mid_side[0][i] = (buffer[0][j] + buffer[1][j]) >> 1; /* NOTE: not the same as 'mid = (buffer[0][j] + buffer[1][j]) / 2' ! */ + for(channel = 0; channel < channels; channel++) { + if (buffer[channel] == NULL) { + return false; } + for(i = encoder->private_->current_sample_number, k = j; i <= blocksize && k < samples; i++, k++) { + if(buffer[channel][k] < sample_min || buffer[channel][k] > sample_max){ + encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; + return false; + } + } + memcpy(&encoder->private_->integer_signal[channel][encoder->private_->current_sample_number], &buffer[channel][j], sizeof(buffer[channel][0]) * n); } - else - j += n; - + j += n; encoder->private_->current_sample_number += n; /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */ if(encoder->private_->current_sample_number > blocksize) { FLAC__ASSERT(encoder->private_->current_sample_number == blocksize+OVERREAD_); FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */ - if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false)) + if(!process_frame_(encoder, /*is_last_block=*/false)) return false; /* move unprocessed overread samples to beginnings of arrays */ for(channel = 0; channel < channels; channel++) encoder->private_->integer_signal[channel][0] = encoder->private_->integer_signal[channel][blocksize]; - if(encoder->protected_->do_mid_side_stereo) { - encoder->private_->integer_signal_mid_side[0][0] = encoder->private_->integer_signal_mid_side[0][blocksize]; - encoder->private_->integer_signal_mid_side[1][0] = encoder->private_->integer_signal_mid_side[1][blocksize]; - } encoder->private_->current_sample_number = 1; } } while(j < samples); @@ -2030,84 +2296,48 @@ FLAC_API FLAC__bool FLAC__stream_encoder_process(FLAC__StreamEncoder *encoder, c return true; } -FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], unsigned samples) +FLAC_API FLAC__bool FLAC__stream_encoder_process_interleaved(FLAC__StreamEncoder *encoder, const FLAC__int32 buffer[], uint32_t samples) { - unsigned i, j, k, channel; - FLAC__int32 x, mid, side; - const unsigned channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize; + uint32_t i, j, k, channel; + const uint32_t channels = encoder->protected_->channels, blocksize = encoder->protected_->blocksize; + const FLAC__int32 sample_max = INT32_MAX >> (32 - encoder->protected_->bits_per_sample); + const FLAC__int32 sample_min = INT32_MIN >> (32 - encoder->protected_->bits_per_sample); FLAC__ASSERT(0 != encoder); FLAC__ASSERT(0 != encoder->private_); FLAC__ASSERT(0 != encoder->protected_); - FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); - j = k = 0; - /* - * we have several flavors of the same basic loop, optimized for - * different conditions: - */ - if(encoder->protected_->do_mid_side_stereo && channels == 2) { - /* - * stereo coding: unroll channel loop - */ - do { - if(encoder->protected_->verify) - append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j)); + if(encoder->protected_->state != FLAC__STREAM_ENCODER_OK) + return false; - /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */ - for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++) { - encoder->private_->integer_signal[0][i] = mid = side = buffer[k++]; - x = buffer[k++]; - encoder->private_->integer_signal[1][i] = x; - mid += x; - side -= x; - mid >>= 1; /* NOTE: not the same as 'mid = (left + right) / 2' ! */ - encoder->private_->integer_signal_mid_side[1][i] = side; - encoder->private_->integer_signal_mid_side[0][i] = mid; - } - encoder->private_->current_sample_number = i; - /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */ - if(i > blocksize) { - if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false)) - return false; - /* move unprocessed overread samples to beginnings of arrays */ - FLAC__ASSERT(i == blocksize+OVERREAD_); - FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */ - encoder->private_->integer_signal[0][0] = encoder->private_->integer_signal[0][blocksize]; - encoder->private_->integer_signal[1][0] = encoder->private_->integer_signal[1][blocksize]; - encoder->private_->integer_signal_mid_side[0][0] = encoder->private_->integer_signal_mid_side[0][blocksize]; - encoder->private_->integer_signal_mid_side[1][0] = encoder->private_->integer_signal_mid_side[1][blocksize]; - encoder->private_->current_sample_number = 1; - } - } while(j < samples); - } - else { - /* - * independent channel coding: buffer each channel in inner loop - */ - do { - if(encoder->protected_->verify) - append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j)); + j = k = 0; + do { + if(encoder->protected_->verify) + append_to_verify_fifo_interleaved_(&encoder->private_->verify.input_fifo, buffer, j, channels, flac_min(blocksize+OVERREAD_-encoder->private_->current_sample_number, samples-j)); /* "i <= blocksize" to overread 1 sample; see comment in OVERREAD_ decl */ - for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++) { - for(channel = 0; channel < channels; channel++) - encoder->private_->integer_signal[channel][i] = buffer[k++]; - } - encoder->private_->current_sample_number = i; - /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */ - if(i > blocksize) { - if(!process_frame_(encoder, /*is_fractional_block=*/false, /*is_last_block=*/false)) + for(i = encoder->private_->current_sample_number; i <= blocksize && j < samples; i++, j++) { + for(channel = 0; channel < channels; channel++){ + if(buffer[k] < sample_min || buffer[k] > sample_max){ + encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; return false; - /* move unprocessed overread samples to beginnings of arrays */ - FLAC__ASSERT(i == blocksize+OVERREAD_); - FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */ - for(channel = 0; channel < channels; channel++) - encoder->private_->integer_signal[channel][0] = encoder->private_->integer_signal[channel][blocksize]; - encoder->private_->current_sample_number = 1; + } + encoder->private_->integer_signal[channel][i] = buffer[k++]; } - } while(j < samples); - } + } + encoder->private_->current_sample_number = i; + /* we only process if we have a full block + 1 extra sample; final block is always handled by FLAC__stream_encoder_finish() */ + if(i > blocksize) { + if(!process_frame_(encoder, /*is_last_block=*/false)) + return false; + /* move unprocessed overread samples to beginnings of arrays */ + FLAC__ASSERT(i == blocksize+OVERREAD_); + FLAC__ASSERT(OVERREAD_ == 1); /* assert we only overread 1 sample which simplifies the rest of the code below */ + for(channel = 0; channel < channels; channel++) + encoder->private_->integer_signal[channel][0] = encoder->private_->integer_signal[channel][blocksize]; + encoder->private_->current_sample_number = 1; + } + } while(j < samples); return true; } @@ -2149,16 +2379,21 @@ void set_defaults_(FLAC__StreamEncoder *encoder) encoder->protected_->max_residual_partition_order = 0; encoder->protected_->rice_parameter_search_dist = 0; encoder->protected_->total_samples_estimate = 0; + encoder->protected_->limit_min_bitrate = false; encoder->protected_->metadata = 0; encoder->protected_->num_metadata_blocks = 0; encoder->private_->seek_table = 0; + encoder->private_->disable_mmx = false; + encoder->private_->disable_sse2 = false; + encoder->private_->disable_ssse3 = false; + encoder->private_->disable_sse41 = false; + encoder->private_->disable_sse42 = false; + encoder->private_->disable_avx2 = false; encoder->private_->disable_constant_subframes = false; encoder->private_->disable_fixed_subframes = false; encoder->private_->disable_verbatim_subframes = false; -#if FLAC__HAS_OGG encoder->private_->is_ogg = false; -#endif encoder->private_->read_callback = 0; encoder->private_->write_callback = 0; encoder->private_->seek_callback = 0; @@ -2170,11 +2405,13 @@ void set_defaults_(FLAC__StreamEncoder *encoder) #if FLAC__HAS_OGG FLAC__ogg_encoder_aspect_set_defaults(&encoder->protected_->ogg_encoder_aspect); #endif + + FLAC__stream_encoder_set_compression_level(encoder, 5); } void free_(FLAC__StreamEncoder *encoder) { - unsigned i, channel; + uint32_t i, channel; FLAC__ASSERT(0 != encoder); if(encoder->protected_->metadata) { @@ -2206,6 +2443,10 @@ void free_(FLAC__StreamEncoder *encoder) } #endif } + if(0 != encoder->private_->integer_signal_33bit_side_unaligned){ + free(encoder->private_->integer_signal_33bit_side_unaligned); + encoder->private_->integer_signal_33bit_side_unaligned = 0; + } #ifndef FLAC__INTEGER_ONLY_LIBRARY for(i = 0; i < encoder->protected_->num_apodizations; i++) { if(0 != encoder->private_->window_unaligned[i]) { @@ -2253,76 +2494,96 @@ void free_(FLAC__StreamEncoder *encoder) FLAC__bitwriter_free(encoder->private_->frame); } -FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize) +FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, uint32_t new_blocksize) { FLAC__bool ok; - unsigned i, channel; + uint32_t i, channel; FLAC__ASSERT(new_blocksize > 0); FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); - FLAC__ASSERT(encoder->private_->current_sample_number == 0); - - /* To avoid excessive malloc'ing, we only grow the buffer; no shrinking. */ - if(new_blocksize <= encoder->private_->input_capacity) - return true; ok = true; - /* WATCHOUT: FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx() - * requires that the input arrays (in our case the integer signals) - * have a buffer of up to 3 zeroes in front (at negative indices) for - * alignment purposes; we use 4 in front to keep the data well-aligned. - */ + /* To avoid excessive malloc'ing, we only grow the buffer; no shrinking. */ + if(new_blocksize > encoder->private_->input_capacity) { - for(i = 0; ok && i < encoder->protected_->channels; i++) { - ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize+4+OVERREAD_, &encoder->private_->integer_signal_unaligned[i], &encoder->private_->integer_signal[i]); - memset(encoder->private_->integer_signal[i], 0, sizeof(FLAC__int32)*4); - encoder->private_->integer_signal[i] += 4; -#ifndef FLAC__INTEGER_ONLY_LIBRARY -#if 0 /* @@@ currently unused */ - if(encoder->protected_->max_lpc_order > 0) - ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize+OVERREAD_, &encoder->private_->real_signal_unaligned[i], &encoder->private_->real_signal[i]); -#endif -#endif - } - for(i = 0; ok && i < 2; i++) { - ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize+4+OVERREAD_, &encoder->private_->integer_signal_mid_side_unaligned[i], &encoder->private_->integer_signal_mid_side[i]); - memset(encoder->private_->integer_signal_mid_side[i], 0, sizeof(FLAC__int32)*4); - encoder->private_->integer_signal_mid_side[i] += 4; -#ifndef FLAC__INTEGER_ONLY_LIBRARY -#if 0 /* @@@ currently unused */ - if(encoder->protected_->max_lpc_order > 0) - ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize+OVERREAD_, &encoder->private_->real_signal_mid_side_unaligned[i], &encoder->private_->real_signal_mid_side[i]); -#endif -#endif - } + /* WATCHOUT: FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx() and ..._intrin_sse2() + * require that the input arrays (in our case the integer signals) + * have a buffer of up to 3 zeroes in front (at negative indices) for + * alignment purposes; we use 4 in front to keep the data well-aligned. + */ + + for(i = 0; ok && i < encoder->protected_->channels; i++) { + ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize+4+OVERREAD_, &encoder->private_->integer_signal_unaligned[i], &encoder->private_->integer_signal[i]); + if(ok) { + memset(encoder->private_->integer_signal[i], 0, sizeof(FLAC__int32)*4); + encoder->private_->integer_signal[i] += 4; + } + } + for(i = 0; ok && i < 2; i++) { + ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize+4+OVERREAD_, &encoder->private_->integer_signal_mid_side_unaligned[i], &encoder->private_->integer_signal_mid_side[i]); + if(ok) { + memset(encoder->private_->integer_signal_mid_side[i], 0, sizeof(FLAC__int32)*4); + encoder->private_->integer_signal_mid_side[i] += 4; + } + } + ok = ok && FLAC__memory_alloc_aligned_int64_array(new_blocksize+4+OVERREAD_, &encoder->private_->integer_signal_33bit_side_unaligned, &encoder->private_->integer_signal_33bit_side); #ifndef FLAC__INTEGER_ONLY_LIBRARY - if(ok && encoder->protected_->max_lpc_order > 0) { - for(i = 0; ok && i < encoder->protected_->num_apodizations; i++) - ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->window_unaligned[i], &encoder->private_->window[i]); - ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->windowed_signal_unaligned, &encoder->private_->windowed_signal); - } + if(ok && encoder->protected_->max_lpc_order > 0) { + for(i = 0; ok && i < encoder->protected_->num_apodizations; i++) + ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->window_unaligned[i], &encoder->private_->window[i]); + ok = ok && FLAC__memory_alloc_aligned_real_array(new_blocksize, &encoder->private_->windowed_signal_unaligned, &encoder->private_->windowed_signal); + } #endif - for(channel = 0; ok && channel < encoder->protected_->channels; channel++) { - for(i = 0; ok && i < 2; i++) { - ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize, &encoder->private_->residual_workspace_unaligned[channel][i], &encoder->private_->residual_workspace[channel][i]); + for(channel = 0; ok && channel < encoder->protected_->channels; channel++) { + for(i = 0; ok && i < 2; i++) { + ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize, &encoder->private_->residual_workspace_unaligned[channel][i], &encoder->private_->residual_workspace[channel][i]); + } } - } - for(channel = 0; ok && channel < 2; channel++) { + + + for(channel = 0; ok && channel < encoder->protected_->channels; channel++) { + for(i = 0; ok && i < 2; i++) { + ok = ok && FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(&encoder->private_->partitioned_rice_contents_workspace[channel][i], encoder->protected_->max_residual_partition_order); + ok = ok && FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(&encoder->private_->partitioned_rice_contents_workspace[channel][i], encoder->protected_->max_residual_partition_order); + } + } + + for(channel = 0; ok && channel < 2; channel++) { + for(i = 0; ok && i < 2; i++) { + ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize, &encoder->private_->residual_workspace_mid_side_unaligned[channel][i], &encoder->private_->residual_workspace_mid_side[channel][i]); + } + } + + for(channel = 0; ok && channel < 2; channel++) { + for(i = 0; ok && i < 2; i++) { + ok = ok && FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(&encoder->private_->partitioned_rice_contents_workspace_mid_side[channel][i], encoder->protected_->max_residual_partition_order); + } + } + for(i = 0; ok && i < 2; i++) { - ok = ok && FLAC__memory_alloc_aligned_int32_array(new_blocksize, &encoder->private_->residual_workspace_mid_side_unaligned[channel][i], &encoder->private_->residual_workspace_mid_side[channel][i]); + ok = ok && FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(&encoder->private_->partitioned_rice_contents_extra[i], encoder->protected_->max_residual_partition_order); } + + + /* the *2 is an approximation to the series 1 + 1/2 + 1/4 + ... that sums tree occupies in a flat array */ + /*@@@ new_blocksize*2 is too pessimistic, but to fix, we need smarter logic because a smaller new_blocksize can actually increase the # of partitions; would require moving this out into a separate function, then checking its capacity against the need of the current blocksize&min/max_partition_order (and maybe predictor order) */ + ok = ok && FLAC__memory_alloc_aligned_uint64_array(new_blocksize * 2, &encoder->private_->abs_residual_partition_sums_unaligned, &encoder->private_->abs_residual_partition_sums); + if(encoder->protected_->do_escape_coding) + ok = ok && FLAC__memory_alloc_aligned_uint32_array(new_blocksize * 2, &encoder->private_->raw_bits_per_partition_unaligned, &encoder->private_->raw_bits_per_partition); +} + if(ok) + encoder->private_->input_capacity = new_blocksize; + else { + encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; + return ok; } - /* the *2 is an approximation to the series 1 + 1/2 + 1/4 + ... that sums tree occupies in a flat array */ - /*@@@ new_blocksize*2 is too pessimistic, but to fix, we need smarter logic because a smaller new_blocksize can actually increase the # of partitions; would require moving this out into a separate function, then checking its capacity against the need of the current blocksize&min/max_partition_order (and maybe predictor order) */ - ok = ok && FLAC__memory_alloc_aligned_uint64_array(new_blocksize * 2, &encoder->private_->abs_residual_partition_sums_unaligned, &encoder->private_->abs_residual_partition_sums); - if(encoder->protected_->do_escape_coding) - ok = ok && FLAC__memory_alloc_aligned_unsigned_array(new_blocksize * 2, &encoder->private_->raw_bits_per_partition_unaligned, &encoder->private_->raw_bits_per_partition); + /* now adjust the windows if the blocksize has changed */ #ifndef FLAC__INTEGER_ONLY_LIBRARY - if(ok && new_blocksize != encoder->private_->input_capacity && encoder->protected_->max_lpc_order > 0) { - for(i = 0; ok && i < encoder->protected_->num_apodizations; i++) { + if(encoder->protected_->max_lpc_order > 0 && new_blocksize > 1) { + for(i = 0; i < encoder->protected_->num_apodizations; i++) { switch(encoder->protected_->apodizations[i].type) { case FLAC__APODIZATION_BARTLETT: FLAC__window_bartlett(encoder->private_->window[i], new_blocksize); @@ -2366,6 +2627,15 @@ FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize) case FLAC__APODIZATION_TUKEY: FLAC__window_tukey(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.tukey.p); break; + case FLAC__APODIZATION_PARTIAL_TUKEY: + FLAC__window_partial_tukey(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.multiple_tukey.p, encoder->protected_->apodizations[i].parameters.multiple_tukey.start, encoder->protected_->apodizations[i].parameters.multiple_tukey.end); + break; + case FLAC__APODIZATION_PUNCHOUT_TUKEY: + FLAC__window_punchout_tukey(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.multiple_tukey.p, encoder->protected_->apodizations[i].parameters.multiple_tukey.start, encoder->protected_->apodizations[i].parameters.multiple_tukey.end); + break; + case FLAC__APODIZATION_SUBDIVIDE_TUKEY: + FLAC__window_tukey(encoder->private_->window[i], new_blocksize, encoder->protected_->apodizations[i].parameters.tukey.p); + break; case FLAC__APODIZATION_WELCH: FLAC__window_welch(encoder->private_->window[i], new_blocksize); break; @@ -2377,17 +2647,17 @@ FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_blocksize) } } } + if (new_blocksize <= FLAC__MAX_LPC_ORDER) { + /* intrinsics autocorrelation routines do not all handle cases in which lag might be + * larger than data_len. Lag is one larger than the LPC order */ + encoder->private_->local_lpc_compute_autocorrelation = FLAC__lpc_compute_autocorrelation; + } #endif - if(ok) - encoder->private_->input_capacity = new_blocksize; - else - encoder->protected_->state = FLAC__STREAM_ENCODER_MEMORY_ALLOCATION_ERROR; - - return ok; + return true; } -FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC__bool is_last_block) +FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, uint32_t samples, FLAC__bool is_last_block) { const FLAC__byte *buffer; size_t bytes; @@ -2406,7 +2676,10 @@ FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC encoder->private_->verify.needs_magic_hack = true; } else { - if(!FLAC__stream_decoder_process_single(encoder->private_->verify.decoder)) { + if(!FLAC__stream_decoder_process_single(encoder->private_->verify.decoder) + || (!is_last_block + && (FLAC__stream_encoder_get_verify_decoder_state(encoder) == FLAC__STREAM_DECODER_END_OF_STREAM)) + || encoder->protected_->state == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR /* Happens when error callback was used */) { FLAC__bitwriter_release_buffer(encoder->private_->frame); FLAC__bitwriter_clear(encoder->private_->frame); if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_MISMATCH_IN_AUDIO_DATA) @@ -2427,18 +2700,22 @@ FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples, FLAC FLAC__bitwriter_clear(encoder->private_->frame); if(samples > 0) { - encoder->private_->streaminfo.data.stream_info.min_framesize = min(bytes, encoder->private_->streaminfo.data.stream_info.min_framesize); - encoder->private_->streaminfo.data.stream_info.max_framesize = max(bytes, encoder->private_->streaminfo.data.stream_info.max_framesize); + encoder->private_->streaminfo.data.stream_info.min_framesize = flac_min(bytes, encoder->private_->streaminfo.data.stream_info.min_framesize); + encoder->private_->streaminfo.data.stream_info.max_framesize = flac_max(bytes, encoder->private_->streaminfo.data.stream_info.max_framesize); } return true; } -FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, FLAC__bool is_last_block) +FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, FLAC__bool is_last_block) { FLAC__StreamEncoderWriteStatus status; FLAC__uint64 output_position = 0; +#if FLAC__HAS_OGG == 0 + (void)is_last_block; +#endif + /* FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED just means we didn't get the offset; no error */ if(encoder->private_->tell_callback && encoder->private_->tell_callback(encoder, &output_position, encoder->private_->client_data) == FLAC__STREAM_ENCODER_TELL_STATUS_ERROR) { encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; @@ -2462,11 +2739,11 @@ FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const * frame yet) */ if(0 != encoder->private_->seek_table && encoder->protected_->audio_offset > 0 && encoder->private_->seek_table->num_points > 0) { - const unsigned blocksize = FLAC__stream_encoder_get_blocksize(encoder); + const uint32_t blocksize = FLAC__stream_encoder_get_blocksize(encoder); const FLAC__uint64 frame_first_sample = encoder->private_->samples_written; const FLAC__uint64 frame_last_sample = frame_first_sample + (FLAC__uint64)blocksize - 1; FLAC__uint64 test_sample; - unsigned i; + uint32_t i; for(i = encoder->private_->first_seekpoint_to_check; i < encoder->private_->seek_table->num_points; i++) { test_sample = encoder->private_->seek_table->points[i].sample_number; if(test_sample > frame_last_sample) { @@ -2515,7 +2792,7 @@ FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const * when the encoder goes back to write metadata, 'current_frame' * will drop back to 0. */ - encoder->private_->frames_written = max(encoder->private_->frames_written, encoder->private_->current_frame_number+1); + encoder->private_->frames_written = flac_max(encoder->private_->frames_written, encoder->private_->current_frame_number+1); } else encoder->protected_->state = FLAC__STREAM_ENCODER_CLIENT_ERROR; @@ -2526,12 +2803,12 @@ FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const /* Gets called when the encoding process has finished so that we can update the STREAMINFO and SEEKTABLE blocks. */ void update_metadata_(const FLAC__StreamEncoder *encoder) { - FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)]; + FLAC__byte b[flac_max(6u, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)]; const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo; - const FLAC__uint64 samples = metadata->data.stream_info.total_samples; - const unsigned min_framesize = metadata->data.stream_info.min_framesize; - const unsigned max_framesize = metadata->data.stream_info.max_framesize; - const unsigned bps = metadata->data.stream_info.bits_per_sample; + FLAC__uint64 samples = metadata->data.stream_info.total_samples; + const uint32_t min_framesize = metadata->data.stream_info.min_framesize; + const uint32_t max_framesize = metadata->data.stream_info.max_framesize; + const uint32_t bps = metadata->data.stream_info.bits_per_sample; FLAC__StreamEncoderSeekStatus seek_status; FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO); @@ -2545,7 +2822,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder) * Write MD5 signature */ { - const unsigned md5_offset = + const uint32_t md5_offset = FLAC__STREAM_METADATA_HEADER_LENGTH + ( FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN + @@ -2573,7 +2850,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder) * Write total samples */ { - const unsigned total_samples_byte_offset = + const uint32_t total_samples_byte_offset = FLAC__STREAM_METADATA_HEADER_LENGTH + ( FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN + @@ -2585,6 +2862,8 @@ void update_metadata_(const FLAC__StreamEncoder *encoder) FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN - 4 ) / 8; + if(samples > (FLAC__U64L(1) << FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) + samples = 0; b[0] = ((FLAC__byte)(bps-1) << 4) | (FLAC__byte)((samples >> 32) & 0x0F); b[1] = (FLAC__byte)((samples >> 24) & 0xFF); @@ -2606,7 +2885,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder) * Write min/max framesize */ { - const unsigned min_framesize_offset = + const uint32_t min_framesize_offset = FLAC__STREAM_METADATA_HEADER_LENGTH + ( FLAC__STREAM_METADATA_STREAMINFO_MIN_BLOCK_SIZE_LEN + @@ -2634,7 +2913,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder) * Write seektable */ if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) { - unsigned i; + uint32_t i; FLAC__format_seektable_sort(encoder->private_->seek_table); @@ -2648,7 +2927,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder) for(i = 0; i < encoder->private_->seek_table->num_points; i++) { FLAC__uint64 xx; - unsigned x; + uint32_t x; xx = encoder->private_->seek_table->points[i].sample_number; b[7] = (FLAC__byte)xx; xx >>= 8; b[6] = (FLAC__byte)xx; xx >>= 8; @@ -2683,7 +2962,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder) void update_ogg_metadata_(FLAC__StreamEncoder *encoder) { /* the # of bytes in the 1st packet that precede the STREAMINFO */ - static const unsigned FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH = + static const uint32_t FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH = FLAC__OGG_MAPPING_PACKET_TYPE_LENGTH + FLAC__OGG_MAPPING_MAGIC_LENGTH + FLAC__OGG_MAPPING_VERSION_MAJOR_LENGTH + @@ -2691,11 +2970,11 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder) FLAC__OGG_MAPPING_NUM_HEADERS_LENGTH + FLAC__STREAM_SYNC_LENGTH ; - FLAC__byte b[max(6, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)]; + FLAC__byte b[flac_max(6u, FLAC__STREAM_METADATA_SEEKPOINT_LENGTH)]; const FLAC__StreamMetadata *metadata = &encoder->private_->streaminfo; const FLAC__uint64 samples = metadata->data.stream_info.total_samples; - const unsigned min_framesize = metadata->data.stream_info.min_framesize; - const unsigned max_framesize = metadata->data.stream_info.max_framesize; + const uint32_t min_framesize = metadata->data.stream_info.min_framesize; + const uint32_t max_framesize = metadata->data.stream_info.max_framesize; ogg_page page; FLAC__ASSERT(metadata->type == FLAC__METADATA_TYPE_STREAMINFO); @@ -2725,7 +3004,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder) * Write MD5 signature */ { - const unsigned md5_offset = + const uint32_t md5_offset = FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH + FLAC__STREAM_METADATA_HEADER_LENGTH + ( @@ -2739,7 +3018,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder) FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN ) / 8; - if(md5_offset + 16 > (unsigned)page.body_len) { + if(md5_offset + 16 > (uint32_t)page.body_len) { encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR; simple_ogg_page__clear(&page); return; @@ -2751,7 +3030,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder) * Write total samples */ { - const unsigned total_samples_byte_offset = + const uint32_t total_samples_byte_offset = FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH + FLAC__STREAM_METADATA_HEADER_LENGTH + ( @@ -2765,7 +3044,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder) - 4 ) / 8; - if(total_samples_byte_offset + 5 > (unsigned)page.body_len) { + if(total_samples_byte_offset + 5 > (uint32_t)page.body_len) { encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR; simple_ogg_page__clear(&page); return; @@ -2783,7 +3062,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder) * Write min/max framesize */ { - const unsigned min_framesize_offset = + const uint32_t min_framesize_offset = FIRST_OGG_PACKET_STREAMINFO_PREFIX_LENGTH + FLAC__STREAM_METADATA_HEADER_LENGTH + ( @@ -2791,7 +3070,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder) FLAC__STREAM_METADATA_STREAMINFO_MAX_BLOCK_SIZE_LEN ) / 8; - if(min_framesize_offset + 6 > (unsigned)page.body_len) { + if(min_framesize_offset + 6 > (uint32_t)page.body_len) { encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR; simple_ogg_page__clear(&page); return; @@ -2809,67 +3088,10 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder) return; /* state already set */ } simple_ogg_page__clear(&page); - - /* - * Write seektable - */ - if(0 != encoder->private_->seek_table && encoder->private_->seek_table->num_points > 0 && encoder->protected_->seektable_offset > 0) { - unsigned i; - FLAC__byte *p; - - FLAC__format_seektable_sort(encoder->private_->seek_table); - - FLAC__ASSERT(FLAC__format_seektable_is_legal(encoder->private_->seek_table)); - - simple_ogg_page__init(&page); - if(!simple_ogg_page__get_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->read_callback, encoder->private_->client_data)) { - simple_ogg_page__clear(&page); - return; /* state already set */ - } - - if((FLAC__STREAM_METADATA_HEADER_LENGTH + 18*encoder->private_->seek_table->num_points) != (unsigned)page.body_len) { - encoder->protected_->state = FLAC__STREAM_ENCODER_OGG_ERROR; - simple_ogg_page__clear(&page); - return; - } - - for(i = 0, p = page.body + FLAC__STREAM_METADATA_HEADER_LENGTH; i < encoder->private_->seek_table->num_points; i++, p += 18) { - FLAC__uint64 xx; - unsigned x; - xx = encoder->private_->seek_table->points[i].sample_number; - b[7] = (FLAC__byte)xx; xx >>= 8; - b[6] = (FLAC__byte)xx; xx >>= 8; - b[5] = (FLAC__byte)xx; xx >>= 8; - b[4] = (FLAC__byte)xx; xx >>= 8; - b[3] = (FLAC__byte)xx; xx >>= 8; - b[2] = (FLAC__byte)xx; xx >>= 8; - b[1] = (FLAC__byte)xx; xx >>= 8; - b[0] = (FLAC__byte)xx; xx >>= 8; - xx = encoder->private_->seek_table->points[i].stream_offset; - b[15] = (FLAC__byte)xx; xx >>= 8; - b[14] = (FLAC__byte)xx; xx >>= 8; - b[13] = (FLAC__byte)xx; xx >>= 8; - b[12] = (FLAC__byte)xx; xx >>= 8; - b[11] = (FLAC__byte)xx; xx >>= 8; - b[10] = (FLAC__byte)xx; xx >>= 8; - b[9] = (FLAC__byte)xx; xx >>= 8; - b[8] = (FLAC__byte)xx; xx >>= 8; - x = encoder->private_->seek_table->points[i].frame_samples; - b[17] = (FLAC__byte)x; x >>= 8; - b[16] = (FLAC__byte)x; x >>= 8; - memcpy(p, b, 18); - } - - if(!simple_ogg_page__set_at(encoder, encoder->protected_->seektable_offset, &page, encoder->private_->seek_callback, encoder->private_->write_callback, encoder->private_->client_data)) { - simple_ogg_page__clear(&page); - return; /* state already set */ - } - simple_ogg_page__clear(&page); - } } #endif -FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block, FLAC__bool is_last_block) +FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_last_block) { FLAC__uint16 crc; FLAC__ASSERT(encoder->protected_->state == FLAC__STREAM_ENCODER_OK); @@ -2885,7 +3107,7 @@ FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional /* * Process the frame header and subframes into the frame bitbuffer */ - if(!process_subframes_(encoder, is_fractional_block)) { + if(!process_subframes_(encoder)) { /* the above function sets the state for us in case of an error */ return false; } @@ -2928,23 +3150,19 @@ FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional return true; } -FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fractional_block) +FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder) { FLAC__FrameHeader frame_header; - unsigned channel, min_partition_order = encoder->protected_->min_residual_partition_order, max_partition_order; - FLAC__bool do_independent, do_mid_side; + uint32_t channel, min_partition_order = encoder->protected_->min_residual_partition_order, max_partition_order; + FLAC__bool do_independent, do_mid_side, backup_disable_constant_subframes = encoder->private_->disable_constant_subframes, all_subframes_constant = true; /* * Calculate the min,max Rice partition orders */ - if(is_fractional_block) { - max_partition_order = 0; - } - else { - max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize(encoder->protected_->blocksize); - max_partition_order = min(max_partition_order, encoder->protected_->max_residual_partition_order); - } - min_partition_order = min(min_partition_order, max_partition_order); + + max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize(encoder->protected_->blocksize); + max_partition_order = flac_min(max_partition_order, encoder->protected_->max_residual_partition_order); + min_partition_order = flac_min(min_partition_order, max_partition_order); /* * Setup the frame @@ -2984,11 +3202,33 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti FLAC__ASSERT(do_independent || do_mid_side); /* + * Prepare mid-side signals if applicable + */ + if(do_mid_side) { + uint32_t i; + FLAC__ASSERT(encoder->protected_->channels == 2); + if(encoder->protected_->bits_per_sample < 32) + for(i = 0; i < encoder->protected_->blocksize; i++) { + encoder->private_->integer_signal_mid_side[1][i] = encoder->private_->integer_signal[0][i] - encoder->private_->integer_signal[1][i]; + encoder->private_->integer_signal_mid_side[0][i] = (encoder->private_->integer_signal[0][i] + encoder->private_->integer_signal[1][i]) >> 1; /* NOTE: not the same as 'mid = (signal[0][j] + signal[1][j]) / 2' ! */ + } + else + for(i = 0; i <= encoder->protected_->blocksize; i++) { + encoder->private_->integer_signal_33bit_side[i] = (FLAC__int64)encoder->private_->integer_signal[0][i] - (FLAC__int64)encoder->private_->integer_signal[1][i]; + encoder->private_->integer_signal_mid_side[0][i] = ((FLAC__int64)encoder->private_->integer_signal[0][i] + (FLAC__int64)encoder->private_->integer_signal[1][i]) >> 1; /* NOTE: not the same as 'mid = (signal[0][j] + signal[1][j]) / 2' ! */ + } + } + + + /* * Check for wasted bits; set effective bps for each subframe */ if(do_independent) { for(channel = 0; channel < encoder->protected_->channels; channel++) { - const unsigned w = get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize); + uint32_t w = get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize); + if (w > encoder->protected_->bits_per_sample) { + w = encoder->protected_->bits_per_sample; + } encoder->private_->subframe_workspace[channel][0].wasted_bits = encoder->private_->subframe_workspace[channel][1].wasted_bits = w; encoder->private_->subframe_bps[channel] = encoder->protected_->bits_per_sample - w; } @@ -2996,7 +3236,15 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti if(do_mid_side) { FLAC__ASSERT(encoder->protected_->channels == 2); for(channel = 0; channel < 2; channel++) { - const unsigned w = get_wasted_bits_(encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize); + uint32_t w; + if(encoder->protected_->bits_per_sample < 32 || channel == 0) + w = get_wasted_bits_(encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize); + else + w = get_wasted_bits_wide_(encoder->private_->integer_signal_33bit_side, encoder->private_->integer_signal_mid_side[channel], encoder->protected_->blocksize); + + if (w > encoder->protected_->bits_per_sample) { + w = encoder->protected_->bits_per_sample; + } encoder->private_->subframe_workspace_mid_side[channel][0].wasted_bits = encoder->private_->subframe_workspace_mid_side[channel][1].wasted_bits = w; encoder->private_->subframe_bps_mid_side[channel] = encoder->protected_->bits_per_sample - w + (channel==0? 0:1); } @@ -3007,6 +3255,12 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti */ if(do_independent) { for(channel = 0; channel < encoder->protected_->channels; channel++) { + if(encoder->protected_->limit_min_bitrate && all_subframes_constant && (channel + 1) == encoder->protected_->channels){ + /* This frame contains only constant subframes at this point. + * To prevent the frame from becoming too small, make sure + * the last subframe isn't constant */ + encoder->private_->disable_constant_subframes = true; + } if(! process_subframe_( encoder, @@ -3023,6 +3277,8 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti ) ) return false; + if(encoder->private_->subframe_workspace[channel][encoder->private_->best_subframe[channel]].type != FLAC__SUBFRAME_TYPE_CONSTANT) + all_subframes_constant = false; } } @@ -3033,6 +3289,11 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti FLAC__ASSERT(encoder->protected_->channels == 2); for(channel = 0; channel < 2; channel++) { + void *integer_signal_; + if(encoder->private_->subframe_bps_mid_side[channel] <= 32) + integer_signal_ = encoder->private_->integer_signal_mid_side[channel]; + else + integer_signal_ = encoder->private_->integer_signal_33bit_side; if(! process_subframe_( encoder, @@ -3040,7 +3301,7 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti max_partition_order, &frame_header, encoder->private_->subframe_bps_mid_side[channel], - encoder->private_->integer_signal_mid_side[channel], + integer_signal_, encoder->private_->subframe_workspace_ptr_mid_side[channel], encoder->private_->partitioned_rice_contents_workspace_ptr_mid_side[channel], encoder->private_->residual_workspace_mid_side[channel], @@ -3056,7 +3317,7 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti * Compose the frame bitbuffer */ if(do_mid_side) { - unsigned left_bps = 0, right_bps = 0; /* initialized only to prevent superfluous compiler warning */ + uint32_t left_bps = 0, right_bps = 0; /* initialized only to prevent superfluous compiler warning */ FLAC__Subframe *left_subframe = 0, *right_subframe = 0; /* initialized only to prevent superfluous compiler warning */ FLAC__ChannelAssignment channel_assignment; @@ -3066,8 +3327,8 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti channel_assignment = (encoder->private_->last_channel_assignment == FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT? FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT : FLAC__CHANNEL_ASSIGNMENT_MID_SIDE); } else { - unsigned bits[4]; /* WATCHOUT - indexed by FLAC__ChannelAssignment */ - unsigned min_bits; + uint32_t bits[4]; /* WATCHOUT - indexed by FLAC__ChannelAssignment */ + uint32_t min_bits; int ca; FLAC__ASSERT(FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT == 0); @@ -3084,7 +3345,11 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti channel_assignment = FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT; min_bits = bits[channel_assignment]; - for(ca = 1; ca <= 3; ca++) { + + /* When doing loose mid-side stereo, ignore left-side + * and right-side options */ + ca = encoder->protected_->loose_mid_side_stereo ? 3 : 1; + for( ; ca <= 3; ca++) { if(bits[ca] < min_bits) { min_bits = bits[ca]; channel_assignment = (FLAC__ChannelAssignment)ca; @@ -3168,55 +3433,75 @@ FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_fracti } encoder->private_->last_channel_assignment = frame_header.channel_assignment; + encoder->private_->disable_constant_subframes = backup_disable_constant_subframes; return true; } FLAC__bool process_subframe_( FLAC__StreamEncoder *encoder, - unsigned min_partition_order, - unsigned max_partition_order, + uint32_t min_partition_order, + uint32_t max_partition_order, const FLAC__FrameHeader *frame_header, - unsigned subframe_bps, - const FLAC__int32 integer_signal[], + uint32_t subframe_bps, + const void *integer_signal, FLAC__Subframe *subframe[2], FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents[2], FLAC__int32 *residual[2], - unsigned *best_subframe, - unsigned *best_bits + uint32_t *best_subframe, + uint32_t *best_bits ) { #ifndef FLAC__INTEGER_ONLY_LIBRARY - FLAC__float fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]; + float fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]; #else FLAC__fixedpoint fixed_residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]; #endif #ifndef FLAC__INTEGER_ONLY_LIBRARY - FLAC__double lpc_residual_bits_per_sample; - FLAC__real autoc[FLAC__MAX_LPC_ORDER+1]; /* WATCHOUT: the size is important even though encoder->protected_->max_lpc_order might be less; some asm routines need all the space */ - FLAC__double lpc_error[FLAC__MAX_LPC_ORDER]; - unsigned min_lpc_order, max_lpc_order, lpc_order; - unsigned min_qlp_coeff_precision, max_qlp_coeff_precision, qlp_coeff_precision; + double lpc_residual_bits_per_sample; + apply_apodization_state_struct apply_apodization_state; + double lpc_error[FLAC__MAX_LPC_ORDER]; + uint32_t min_lpc_order, max_lpc_order, lpc_order, guess_lpc_order; + uint32_t min_qlp_coeff_precision, max_qlp_coeff_precision, qlp_coeff_precision; #endif - unsigned min_fixed_order, max_fixed_order, guess_fixed_order, fixed_order; - unsigned rice_parameter; - unsigned _candidate_bits, _best_bits; - unsigned _best_subframe; + uint32_t min_fixed_order, max_fixed_order, guess_fixed_order, fixed_order; + uint32_t _candidate_bits, _best_bits; + uint32_t _best_subframe; /* only use RICE2 partitions if stream bps > 16 */ - const unsigned rice_parameter_limit = FLAC__stream_encoder_get_bits_per_sample(encoder) > 16? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; + const uint32_t rice_parameter_limit = FLAC__stream_encoder_get_bits_per_sample(encoder) > 16? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; FLAC__ASSERT(frame_header->blocksize > 0); /* verbatim subframe is the baseline against which we measure other compressed subframes */ _best_subframe = 0; if(encoder->private_->disable_verbatim_subframes && frame_header->blocksize >= FLAC__MAX_FIXED_ORDER) - _best_bits = UINT_MAX; + _best_bits = UINT32_MAX; else _best_bits = evaluate_verbatim_subframe_(encoder, integer_signal, frame_header->blocksize, subframe_bps, subframe[_best_subframe]); + *best_bits = _best_bits; + + if(frame_header->blocksize > FLAC__MAX_FIXED_ORDER) { + uint32_t signal_is_constant = false; + /* The next formula determines when to use a 64-bit accumulator + * for the error of a fixed predictor, and when a 32-bit one. As + * the error of a 4th order predictor for a given sample is the + * sum of 17 sample values (1+4+6+4+1) and there are blocksize - + * order error values to be summed, the maximum total error is + * maximum_sample_value * (blocksize - order) * 17. As ilog2(x) + * calculates floor(2log(x)), the result must be 31 or lower + */ + if(subframe_bps < 28){ + if(subframe_bps + FLAC__bitmath_ilog2((frame_header->blocksize-FLAC__MAX_FIXED_ORDER)*17) < 32) + guess_fixed_order = encoder->private_->local_fixed_compute_best_predictor(((FLAC__int32 *)integer_signal)+FLAC__MAX_FIXED_ORDER, frame_header->blocksize-FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample); + else + guess_fixed_order = encoder->private_->local_fixed_compute_best_predictor_wide(((FLAC__int32 *)integer_signal)+FLAC__MAX_FIXED_ORDER, frame_header->blocksize-FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample); + } + else + if(subframe_bps <= 32) + guess_fixed_order = encoder->private_->local_fixed_compute_best_predictor_limit_residual(((FLAC__int32 *)integer_signal+FLAC__MAX_FIXED_ORDER),frame_header->blocksize-FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample); + else + guess_fixed_order = FLAC__fixed_compute_best_predictor_limit_residual_33bit(((FLAC__int64 *)integer_signal+FLAC__MAX_FIXED_ORDER),frame_header->blocksize-FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample); - if(frame_header->blocksize >= FLAC__MAX_FIXED_ORDER) { - unsigned signal_is_constant = false; - guess_fixed_order = encoder->private_->local_fixed_compute_best_predictor(integer_signal+FLAC__MAX_FIXED_ORDER, frame_header->blocksize-FLAC__MAX_FIXED_ORDER, fixed_residual_bits_per_sample); /* check for constant subframe */ if( !encoder->private_->disable_constant_subframes && @@ -3227,17 +3512,33 @@ FLAC__bool process_subframe_( #endif ) { /* the above means it's possible all samples are the same value; now double-check it: */ - unsigned i; + uint32_t i; signal_is_constant = true; - for(i = 1; i < frame_header->blocksize; i++) { - if(integer_signal[0] != integer_signal[i]) { - signal_is_constant = false; - break; + if(subframe_bps <= 32){ + const FLAC__int32 *integer_signal_ = integer_signal; + for(i = 1; i < frame_header->blocksize; i++) { + if(integer_signal_[0] != integer_signal_[i]) { + signal_is_constant = false; + break; + } + } + } + else { + const FLAC__int64 *integer_signal_ = integer_signal; + for(i = 1; i < frame_header->blocksize; i++) { + if(integer_signal_[0] != integer_signal_[i]) { + signal_is_constant = false; + break; + } } } } if(signal_is_constant) { - _candidate_bits = evaluate_constant_subframe_(encoder, integer_signal[0], frame_header->blocksize, subframe_bps, subframe[!_best_subframe]); + if(subframe_bps <= 32) + _candidate_bits = evaluate_constant_subframe_(encoder, ((FLAC__int32 *)integer_signal)[0], frame_header->blocksize, subframe_bps, subframe[!_best_subframe]); + else + _candidate_bits = evaluate_constant_subframe_(encoder, ((FLAC__int64 *)integer_signal)[0], frame_header->blocksize, subframe_bps, subframe[!_best_subframe]); + if(_candidate_bits < _best_bits) { _best_subframe = !_best_subframe; _best_bits = _candidate_bits; @@ -3257,21 +3558,12 @@ FLAC__bool process_subframe_( max_fixed_order = frame_header->blocksize - 1; for(fixed_order = min_fixed_order; fixed_order <= max_fixed_order; fixed_order++) { #ifndef FLAC__INTEGER_ONLY_LIBRARY - if(fixed_residual_bits_per_sample[fixed_order] >= (FLAC__float)subframe_bps) + if(fixed_residual_bits_per_sample[fixed_order] >= (float)subframe_bps) continue; /* don't even try */ - rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > 0.0)? (unsigned)(fixed_residual_bits_per_sample[fixed_order]+0.5) : 0; /* 0.5 is for rounding */ #else if(FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]) >= (int)subframe_bps) continue; /* don't even try */ - rice_parameter = (fixed_residual_bits_per_sample[fixed_order] > FLAC__FP_ZERO)? (unsigned)FLAC__fixedpoint_trunc(fixed_residual_bits_per_sample[fixed_order]+FLAC__FP_ONE_HALF) : 0; /* 0.5 is for rounding */ -#endif - rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */ - if(rice_parameter >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @0\n", rice_parameter, rice_parameter_limit - 1); #endif - rice_parameter = rice_parameter_limit - 1; - } _candidate_bits = evaluate_fixed_subframe_( encoder, @@ -3282,7 +3574,6 @@ FLAC__bool process_subframe_( frame_header->blocksize, subframe_bps, fixed_order, - rice_parameter, rice_parameter_limit, min_partition_order, max_partition_order, @@ -3306,84 +3597,68 @@ FLAC__bool process_subframe_( else max_lpc_order = encoder->protected_->max_lpc_order; if(max_lpc_order > 0) { - unsigned a; - for (a = 0; a < encoder->protected_->num_apodizations; a++) { - FLAC__lpc_window_data(integer_signal, encoder->private_->window[a], encoder->private_->windowed_signal, frame_header->blocksize); - encoder->private_->local_lpc_compute_autocorrelation(encoder->private_->windowed_signal, frame_header->blocksize, max_lpc_order+1, autoc); - /* if autoc[0] == 0.0, the signal is constant and we usually won't get here, but it can happen */ - if(autoc[0] != 0.0) { - FLAC__lpc_compute_lp_coefficients(autoc, &max_lpc_order, encoder->private_->lp_coeff, lpc_error); - if(encoder->protected_->do_exhaustive_model_search) { - min_lpc_order = 1; + apply_apodization_state.a = 0; + apply_apodization_state.b = 1; + apply_apodization_state.c = 0; + while (apply_apodization_state.a < encoder->protected_->num_apodizations) { + uint32_t max_lpc_order_this_apodization = max_lpc_order; + + if(!apply_apodization_(encoder, &apply_apodization_state, + frame_header->blocksize, lpc_error, + &max_lpc_order_this_apodization, + subframe_bps, integer_signal, + &guess_lpc_order)) + /* If apply_apodization_ fails, try next apodization */ + continue; + + if(encoder->protected_->do_exhaustive_model_search) { + min_lpc_order = 1; + } + else { + min_lpc_order = max_lpc_order_this_apodization = guess_lpc_order; + } + for(lpc_order = min_lpc_order; lpc_order <= max_lpc_order_this_apodization; lpc_order++) { + lpc_residual_bits_per_sample = FLAC__lpc_compute_expected_bits_per_residual_sample(lpc_error[lpc_order-1], frame_header->blocksize-lpc_order); + if(lpc_residual_bits_per_sample >= (double)subframe_bps) + continue; /* don't even try */ + if(encoder->protected_->do_qlp_coeff_prec_search) { + min_qlp_coeff_precision = FLAC__MIN_QLP_COEFF_PRECISION; + /* try to keep qlp coeff precision such that only 32-bit math is required for decode of <=16bps(+1bps for side channel) streams */ + if(subframe_bps <= 17) { + max_qlp_coeff_precision = flac_min(32 - subframe_bps - FLAC__bitmath_ilog2(lpc_order), FLAC__MAX_QLP_COEFF_PRECISION); + max_qlp_coeff_precision = flac_max(max_qlp_coeff_precision, min_qlp_coeff_precision); + } + else + max_qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION; } else { - const unsigned guess_lpc_order = - FLAC__lpc_compute_best_order( - lpc_error, - max_lpc_order, + min_qlp_coeff_precision = max_qlp_coeff_precision = encoder->protected_->qlp_coeff_precision; + } + for(qlp_coeff_precision = min_qlp_coeff_precision; qlp_coeff_precision <= max_qlp_coeff_precision; qlp_coeff_precision++) { + _candidate_bits = + evaluate_lpc_subframe_( + encoder, + integer_signal, + residual[!_best_subframe], + encoder->private_->abs_residual_partition_sums, + encoder->private_->raw_bits_per_partition, + encoder->private_->lp_coeff[lpc_order-1], frame_header->blocksize, - subframe_bps + ( - encoder->protected_->do_qlp_coeff_prec_search? - FLAC__MIN_QLP_COEFF_PRECISION : /* have to guess; use the min possible size to avoid accidentally favoring lower orders */ - encoder->protected_->qlp_coeff_precision - ) + subframe_bps, + lpc_order, + qlp_coeff_precision, + rice_parameter_limit, + min_partition_order, + max_partition_order, + encoder->protected_->do_escape_coding, + encoder->protected_->rice_parameter_search_dist, + subframe[!_best_subframe], + partitioned_rice_contents[!_best_subframe] ); - min_lpc_order = max_lpc_order = guess_lpc_order; - } - if(max_lpc_order >= frame_header->blocksize) - max_lpc_order = frame_header->blocksize - 1; - for(lpc_order = min_lpc_order; lpc_order <= max_lpc_order; lpc_order++) { - lpc_residual_bits_per_sample = FLAC__lpc_compute_expected_bits_per_residual_sample(lpc_error[lpc_order-1], frame_header->blocksize-lpc_order); - if(lpc_residual_bits_per_sample >= (FLAC__double)subframe_bps) - continue; /* don't even try */ - rice_parameter = (lpc_residual_bits_per_sample > 0.0)? (unsigned)(lpc_residual_bits_per_sample+0.5) : 0; /* 0.5 is for rounding */ - rice_parameter++; /* to account for the signed->unsigned conversion during rice coding */ - if(rice_parameter >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @1\n", rice_parameter, rice_parameter_limit - 1); -#endif - rice_parameter = rice_parameter_limit - 1; - } - if(encoder->protected_->do_qlp_coeff_prec_search) { - min_qlp_coeff_precision = FLAC__MIN_QLP_COEFF_PRECISION; - /* try to ensure a 32-bit datapath throughout for 16bps(+1bps for side channel) or less */ - if(subframe_bps <= 17) { - max_qlp_coeff_precision = min(32 - subframe_bps - lpc_order, FLAC__MAX_QLP_COEFF_PRECISION); - max_qlp_coeff_precision = max(max_qlp_coeff_precision, min_qlp_coeff_precision); - } - else - max_qlp_coeff_precision = FLAC__MAX_QLP_COEFF_PRECISION; - } - else { - min_qlp_coeff_precision = max_qlp_coeff_precision = encoder->protected_->qlp_coeff_precision; - } - for(qlp_coeff_precision = min_qlp_coeff_precision; qlp_coeff_precision <= max_qlp_coeff_precision; qlp_coeff_precision++) { - _candidate_bits = - evaluate_lpc_subframe_( - encoder, - integer_signal, - residual[!_best_subframe], - encoder->private_->abs_residual_partition_sums, - encoder->private_->raw_bits_per_partition, - encoder->private_->lp_coeff[lpc_order-1], - frame_header->blocksize, - subframe_bps, - lpc_order, - qlp_coeff_precision, - rice_parameter, - rice_parameter_limit, - min_partition_order, - max_partition_order, - encoder->protected_->do_escape_coding, - encoder->protected_->rice_parameter_search_dist, - subframe[!_best_subframe], - partitioned_rice_contents[!_best_subframe] - ); - if(_candidate_bits > 0) { /* if == 0, there was a problem quantizing the lpcoeffs */ - if(_candidate_bits < _best_bits) { - _best_subframe = !_best_subframe; - _best_bits = _candidate_bits; - } + if(_candidate_bits > 0) { /* if == 0, there was a problem quantizing the lpcoeffs */ + if(_candidate_bits < _best_bits) { + _best_subframe = !_best_subframe; + _best_bits = _candidate_bits; } } } @@ -3396,7 +3671,7 @@ FLAC__bool process_subframe_( } /* under rare circumstances this can happen when all but lpc subframe types are disabled: */ - if(_best_bits == UINT_MAX) { + if(_best_bits == UINT32_MAX) { FLAC__ASSERT(_best_subframe == 0); _best_bits = evaluate_verbatim_subframe_(encoder, integer_signal, frame_header->blocksize, subframe_bps, subframe[_best_subframe]); } @@ -3407,10 +3682,112 @@ FLAC__bool process_subframe_( return true; } +#ifndef FLAC__INTEGER_ONLY_LIBRARY +static inline void set_next_subdivide_tukey(FLAC__int32 parts, uint32_t * apodizations, uint32_t * current_depth, uint32_t * current_part){ + // current_part is interleaved: even are partial, odd are punchout + if(*current_depth == 2){ + // For depth 2, we only do partial, no punchout as that is almost redundant + if(*current_part == 0){ + *current_part = 2; + }else{ /* *current_path == 2 */ + *current_part = 0; + (*current_depth)++; + } + }else if((*current_part) < (2*(*current_depth)-1)){ + (*current_part)++; + }else{ /* (*current_part) >= (2*(*current_depth)-1) */ + *current_part = 0; + (*current_depth)++; + } + + /* Now check if we are done with this SUBDIVIDE_TUKEY apodization */ + if(*current_depth > (uint32_t) parts){ + (*apodizations)++; + *current_depth = 1; + *current_part = 0; + } +} + +FLAC__bool apply_apodization_(FLAC__StreamEncoder *encoder, + apply_apodization_state_struct *apply_apodization_state, + uint32_t blocksize, + double *lpc_error, + uint32_t *max_lpc_order_this_apodization, + uint32_t subframe_bps, + const void *integer_signal, + uint32_t *guess_lpc_order) +{ + apply_apodization_state->current_apodization = &encoder->protected_->apodizations[apply_apodization_state->a]; + + if(apply_apodization_state->b == 1) { + /* window full subblock */ + if(subframe_bps <= 32) + FLAC__lpc_window_data(integer_signal, encoder->private_->window[apply_apodization_state->a], encoder->private_->windowed_signal, blocksize); + else + FLAC__lpc_window_data_wide(integer_signal, encoder->private_->window[apply_apodization_state->a], encoder->private_->windowed_signal, blocksize); + encoder->private_->local_lpc_compute_autocorrelation(encoder->private_->windowed_signal, blocksize, (*max_lpc_order_this_apodization)+1, apply_apodization_state->autoc); + if(apply_apodization_state->current_apodization->type == FLAC__APODIZATION_SUBDIVIDE_TUKEY){ + uint32_t i; + for(i = 0; i < *max_lpc_order_this_apodization; i++) + memcpy(apply_apodization_state->autoc_root, apply_apodization_state->autoc, *max_lpc_order_this_apodization*sizeof(apply_apodization_state->autoc[0])); + + (apply_apodization_state->b)++; + }else{ + (apply_apodization_state->a)++; + } + } + else { + /* window part of subblock */ + if(blocksize/apply_apodization_state->b <= FLAC__MAX_LPC_ORDER) { + /* intrinsics autocorrelation routines do not all handle cases in which lag might be + * larger than data_len, and some routines round lag up to the nearest multiple of 4 + * As little gain is expected from using LPC on part of a signal as small as 32 samples + * and to enable widening this rounding up to larger values in the future, windowing + * parts smaller than or equal to FLAC__MAX_LPC_ORDER (which is 32) samples is not supported */ + set_next_subdivide_tukey(apply_apodization_state->current_apodization->parameters.subdivide_tukey.parts, &apply_apodization_state->a, &apply_apodization_state->b, &apply_apodization_state->c); + return false; + } + if(!(apply_apodization_state->c % 2)) { + /* on even c, evaluate the (c/2)th partial window of size blocksize/b */ + if(subframe_bps <= 32) + FLAC__lpc_window_data_partial(integer_signal, encoder->private_->window[apply_apodization_state->a], encoder->private_->windowed_signal, blocksize, blocksize/apply_apodization_state->b/2, (apply_apodization_state->c/2*blocksize)/apply_apodization_state->b); + else + FLAC__lpc_window_data_partial_wide(integer_signal, encoder->private_->window[apply_apodization_state->a], encoder->private_->windowed_signal, blocksize, blocksize/apply_apodization_state->b/2, (apply_apodization_state->c/2*blocksize)/apply_apodization_state->b); + encoder->private_->local_lpc_compute_autocorrelation(encoder->private_->windowed_signal, blocksize/apply_apodization_state->b, (*max_lpc_order_this_apodization)+1, apply_apodization_state->autoc); + } + else { + /* on uneven c, evaluate the root window (over the whole block) minus the previous partial window + * similar to tukey_punchout apodization but more efficient */ + uint32_t i; + for(i = 0; i < *max_lpc_order_this_apodization; i++) + apply_apodization_state->autoc[i] = apply_apodization_state->autoc_root[i] - apply_apodization_state->autoc[i]; + } + /* Next function sets a, b and c appropriate for next iteration */ + set_next_subdivide_tukey(apply_apodization_state->current_apodization->parameters.subdivide_tukey.parts, &apply_apodization_state->a, &apply_apodization_state->b, &apply_apodization_state->c); + } + + if(apply_apodization_state->autoc[0] == 0.0) /* Signal seems to be constant, so we can't do lp. Constant detection is probably disabled */ + return false; + FLAC__lpc_compute_lp_coefficients(apply_apodization_state->autoc, max_lpc_order_this_apodization, encoder->private_->lp_coeff, lpc_error); + *guess_lpc_order = + FLAC__lpc_compute_best_order( + lpc_error, + *max_lpc_order_this_apodization, + blocksize, + subframe_bps + ( + encoder->protected_->do_qlp_coeff_prec_search? + FLAC__MIN_QLP_COEFF_PRECISION : /* have to guess; use the min possible size to avoid accidentally favoring lower orders */ + encoder->protected_->qlp_coeff_precision + ) + ); + return true; +} +#endif + FLAC__bool add_subframe_( FLAC__StreamEncoder *encoder, - unsigned blocksize, - unsigned subframe_bps, + uint32_t blocksize, + uint32_t subframe_bps, const FLAC__Subframe *subframe, FLAC__BitWriter *frame ) @@ -3451,10 +3828,10 @@ FLAC__bool add_subframe_( #if SPOTCHECK_ESTIMATE static void spotcheck_subframe_estimate_( FLAC__StreamEncoder *encoder, - unsigned blocksize, - unsigned subframe_bps, + uint32_t blocksize, + uint32_t subframe_bps, const FLAC__Subframe *subframe, - unsigned estimate + uint32_t estimate ) { FLAC__bool ret; @@ -3470,7 +3847,7 @@ static void spotcheck_subframe_estimate_( ret = add_subframe_(encoder, blocksize, subframe_bps, subframe, frame); FLAC__ASSERT(ret); { - const unsigned actual = FLAC__bitwriter_get_input_bits_unconsumed(frame); + const uint32_t actual = FLAC__bitwriter_get_input_bits_unconsumed(frame); if(estimate != actual) fprintf(stderr, "EST: bad, frame#%u sub#%%d type=%8s est=%u, actual=%u, delta=%d\n", encoder->private_->current_frame_number, FLAC__SubframeTypeString[subframe->type], estimate, actual, (int)actual-(int)estimate); } @@ -3478,15 +3855,15 @@ static void spotcheck_subframe_estimate_( } #endif -unsigned evaluate_constant_subframe_( +uint32_t evaluate_constant_subframe_( FLAC__StreamEncoder *encoder, - const FLAC__int32 signal, - unsigned blocksize, - unsigned subframe_bps, + const FLAC__int64 signal, + uint32_t blocksize, + uint32_t subframe_bps, FLAC__Subframe *subframe ) { - unsigned estimate; + uint32_t estimate; subframe->type = FLAC__SUBFRAME_TYPE_CONSTANT; subframe->data.constant.value = signal; @@ -3501,29 +3878,33 @@ unsigned evaluate_constant_subframe_( return estimate; } -unsigned evaluate_fixed_subframe_( +uint32_t evaluate_fixed_subframe_( FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], + const void *signal, FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], - unsigned blocksize, - unsigned subframe_bps, - unsigned order, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, + uint32_t raw_bits_per_partition[], + uint32_t blocksize, + uint32_t subframe_bps, + uint32_t order, + uint32_t rice_parameter_limit, + uint32_t min_partition_order, + uint32_t max_partition_order, FLAC__bool do_escape_coding, - unsigned rice_parameter_search_dist, + uint32_t rice_parameter_search_dist, FLAC__Subframe *subframe, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents ) { - unsigned i, residual_bits, estimate; - const unsigned residual_samples = blocksize - order; + uint32_t i, residual_bits, estimate; + const uint32_t residual_samples = blocksize - order; - FLAC__fixed_compute_residual(signal+order, residual_samples, order, residual); + if((subframe_bps + order) <= 32) + FLAC__fixed_compute_residual(((FLAC__int32 *)signal)+order, residual_samples, order, residual); + else if(subframe_bps <= 32) + FLAC__fixed_compute_residual_wide(((FLAC__int32 *)signal)+order, residual_samples, order, residual); + else + FLAC__fixed_compute_residual_wide_33bit(((FLAC__int64 *)signal)+order, residual_samples, order, residual); subframe->type = FLAC__SUBFRAME_TYPE_FIXED; @@ -3539,7 +3920,6 @@ unsigned evaluate_fixed_subframe_( raw_bits_per_partition, residual_samples, order, - rice_parameter, rice_parameter_limit, min_partition_order, max_partition_order, @@ -3550,10 +3930,18 @@ unsigned evaluate_fixed_subframe_( ); subframe->data.fixed.order = order; - for(i = 0; i < order; i++) - subframe->data.fixed.warmup[i] = signal[i]; + if(subframe_bps <= 32) + for(i = 0; i < order; i++) + subframe->data.fixed.warmup[i] = ((FLAC__int32 *)signal)[i]; + else + for(i = 0; i < order; i++) + subframe->data.fixed.warmup[i] = ((FLAC__int64 *)signal)[i]; - estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + (order * subframe_bps) + residual_bits; + estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + (order * subframe_bps); + if(residual_bits < UINT32_MAX - estimate) // To make sure estimate doesn't overflow + estimate += residual_bits; + else + estimate = UINT32_MAX; #if SPOTCHECK_ESTIMATE spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate); @@ -3563,50 +3951,59 @@ unsigned evaluate_fixed_subframe_( } #ifndef FLAC__INTEGER_ONLY_LIBRARY -unsigned evaluate_lpc_subframe_( +uint32_t evaluate_lpc_subframe_( FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], + const void *signal, FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], + uint32_t raw_bits_per_partition[], const FLAC__real lp_coeff[], - unsigned blocksize, - unsigned subframe_bps, - unsigned order, - unsigned qlp_coeff_precision, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, + uint32_t blocksize, + uint32_t subframe_bps, + uint32_t order, + uint32_t qlp_coeff_precision, + uint32_t rice_parameter_limit, + uint32_t min_partition_order, + uint32_t max_partition_order, FLAC__bool do_escape_coding, - unsigned rice_parameter_search_dist, + uint32_t rice_parameter_search_dist, FLAC__Subframe *subframe, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents ) { - FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER]; - unsigned i, residual_bits, estimate; + FLAC__int32 qlp_coeff[FLAC__MAX_LPC_ORDER]; /* WATCHOUT: the size is important; some x86 intrinsic routines need more than lpc order elements */ + uint32_t i, residual_bits, estimate; int quantization, ret; - const unsigned residual_samples = blocksize - order; + const uint32_t residual_samples = blocksize - order; - /* try to keep qlp coeff precision such that only 32-bit math is required for decode of <=16bps streams */ - if(subframe_bps <= 16) { + /* try to keep qlp coeff precision such that only 32-bit math is required for decode of <=16bps(+1bps for side channel) streams */ + if(subframe_bps <= 17) { FLAC__ASSERT(order > 0); FLAC__ASSERT(order <= FLAC__MAX_LPC_ORDER); - qlp_coeff_precision = min(qlp_coeff_precision, 32 - subframe_bps - FLAC__bitmath_ilog2(order)); + qlp_coeff_precision = flac_min(qlp_coeff_precision, 32 - subframe_bps - FLAC__bitmath_ilog2(order)); } ret = FLAC__lpc_quantize_coefficients(lp_coeff, order, qlp_coeff_precision, qlp_coeff, &quantization); if(ret != 0) return 0; /* this is a hack to indicate to the caller that we can't do lp at this order on this subframe */ - if(subframe_bps + qlp_coeff_precision + FLAC__bitmath_ilog2(order) <= 32) - if(subframe_bps <= 16 && qlp_coeff_precision <= 16) - encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit(signal+order, residual_samples, qlp_coeff, order, quantization, residual); + if(FLAC__lpc_max_residual_bps(subframe_bps, qlp_coeff, order, quantization) > 32) { + if(subframe_bps <= 32){ + if(!FLAC__lpc_compute_residual_from_qlp_coefficients_limit_residual(((FLAC__int32 *)signal)+order, residual_samples, qlp_coeff, order, quantization, residual)) + return 0; + } else - encoder->private_->local_lpc_compute_residual_from_qlp_coefficients(signal+order, residual_samples, qlp_coeff, order, quantization, residual); + if(!FLAC__lpc_compute_residual_from_qlp_coefficients_limit_residual_33bit(((FLAC__int64 *)signal)+order, residual_samples, qlp_coeff, order, quantization, residual)) + return 0; + } else - encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit(signal+order, residual_samples, qlp_coeff, order, quantization, residual); + if(FLAC__lpc_max_prediction_before_shift_bps(subframe_bps, qlp_coeff, order) <= 32) + if(subframe_bps <= 16 && qlp_coeff_precision <= 16) + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_16bit(((FLAC__int32 *)signal)+order, residual_samples, qlp_coeff, order, quantization, residual); + else + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients(((FLAC__int32 *)signal)+order, residual_samples, qlp_coeff, order, quantization, residual); + else + encoder->private_->local_lpc_compute_residual_from_qlp_coefficients_64bit(((FLAC__int32 *)signal)+order, residual_samples, qlp_coeff, order, quantization, residual); subframe->type = FLAC__SUBFRAME_TYPE_LPC; @@ -3622,7 +4019,6 @@ unsigned evaluate_lpc_subframe_( raw_bits_per_partition, residual_samples, order, - rice_parameter, rice_parameter_limit, min_partition_order, max_partition_order, @@ -3636,10 +4032,19 @@ unsigned evaluate_lpc_subframe_( subframe->data.lpc.qlp_coeff_precision = qlp_coeff_precision; subframe->data.lpc.quantization_level = quantization; memcpy(subframe->data.lpc.qlp_coeff, qlp_coeff, sizeof(FLAC__int32)*FLAC__MAX_LPC_ORDER); - for(i = 0; i < order; i++) - subframe->data.lpc.warmup[i] = signal[i]; + if(subframe_bps <= 32) + for(i = 0; i < order; i++) + subframe->data.lpc.warmup[i] = ((FLAC__int32 *)signal)[i]; + else + for(i = 0; i < order; i++) + subframe->data.lpc.warmup[i] = ((FLAC__int64 *)signal)[i]; + - estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN + FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN + (order * (qlp_coeff_precision + subframe_bps)) + residual_bits; + estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN + FLAC__SUBFRAME_LPC_QLP_SHIFT_LEN + (order * (qlp_coeff_precision + subframe_bps)); + if(residual_bits < UINT32_MAX - estimate) // To make sure estimate doesn't overflow + estimate += residual_bits; + else + estimate = UINT32_MAX; #if SPOTCHECK_ESTIMATE spotcheck_subframe_estimate_(encoder, blocksize, subframe_bps, subframe, estimate); @@ -3649,19 +4054,26 @@ unsigned evaluate_lpc_subframe_( } #endif -unsigned evaluate_verbatim_subframe_( +uint32_t evaluate_verbatim_subframe_( FLAC__StreamEncoder *encoder, - const FLAC__int32 signal[], - unsigned blocksize, - unsigned subframe_bps, + const void *signal, + uint32_t blocksize, + uint32_t subframe_bps, FLAC__Subframe *subframe ) { - unsigned estimate; + uint32_t estimate; subframe->type = FLAC__SUBFRAME_TYPE_VERBATIM; - subframe->data.verbatim.data = signal; + if(subframe_bps <= 32){ + subframe->data.verbatim.data_type = FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT32; + subframe->data.verbatim.data.int32 = signal; + } + else { + subframe->data.verbatim.data_type = FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT64; + subframe->data.verbatim.data.int64 = signal; + } estimate = FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN + subframe->wasted_bits + (blocksize * subframe_bps); @@ -3674,39 +4086,38 @@ unsigned evaluate_verbatim_subframe_( return estimate; } -unsigned find_best_partition_order_( +uint32_t find_best_partition_order_( FLAC__StreamEncoderPrivate *private_, const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], - unsigned raw_bits_per_partition[], - unsigned residual_samples, - unsigned predictor_order, - unsigned rice_parameter, - unsigned rice_parameter_limit, - unsigned min_partition_order, - unsigned max_partition_order, - unsigned bps, + uint32_t raw_bits_per_partition[], + uint32_t residual_samples, + uint32_t predictor_order, + uint32_t rice_parameter_limit, + uint32_t min_partition_order, + uint32_t max_partition_order, + uint32_t bps, FLAC__bool do_escape_coding, - unsigned rice_parameter_search_dist, + uint32_t rice_parameter_search_dist, FLAC__EntropyCodingMethod *best_ecm ) { - unsigned residual_bits, best_residual_bits = 0; - unsigned best_parameters_index = 0; - unsigned best_partition_order = 0; - const unsigned blocksize = residual_samples + predictor_order; + uint32_t residual_bits, best_residual_bits = 0; + uint32_t best_parameters_index = 0; + uint32_t best_partition_order = 0; + const uint32_t blocksize = residual_samples + predictor_order; max_partition_order = FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(max_partition_order, blocksize, predictor_order); - min_partition_order = min(min_partition_order, max_partition_order); + min_partition_order = flac_min(min_partition_order, max_partition_order); - precompute_partition_info_sums_(residual, abs_residual_partition_sums, residual_samples, predictor_order, min_partition_order, max_partition_order, bps); + private_->local_precompute_partition_info_sums(residual, abs_residual_partition_sums, residual_samples, predictor_order, min_partition_order, max_partition_order, bps); if(do_escape_coding) precompute_partition_info_escapes_(residual, raw_bits_per_partition, residual_samples, predictor_order, min_partition_order, max_partition_order); { int partition_order; - unsigned sum; + uint32_t sum; for(partition_order = (int)max_partition_order, sum = 0; partition_order >= (int)min_partition_order; partition_order--) { if(! @@ -3718,10 +4129,9 @@ unsigned find_best_partition_order_( raw_bits_per_partition+sum, residual_samples, predictor_order, - rice_parameter, rice_parameter_limit, rice_parameter_search_dist, - (unsigned)partition_order, + (uint32_t)partition_order, do_escape_coding, &private_->partitioned_rice_contents_extra[!best_parameters_index], &residual_bits @@ -3748,13 +4158,12 @@ unsigned find_best_partition_order_( * knowledge; it is const to the outside world. */ FLAC__EntropyCodingMethod_PartitionedRiceContents* prc = (FLAC__EntropyCodingMethod_PartitionedRiceContents*)best_ecm->data.partitioned_rice.contents; - unsigned partition; + uint32_t partition; /* save best parameters and raw_bits */ - FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(prc, max(6, best_partition_order)); - memcpy(prc->parameters, private_->partitioned_rice_contents_extra[best_parameters_index].parameters, sizeof(unsigned)*((unsigned long long)1<<(best_partition_order))); + memcpy(prc->parameters, private_->partitioned_rice_contents_extra[best_parameters_index].parameters, (uint32_t)sizeof(uint32_t)*(1<<(best_partition_order))); if(do_escape_coding) - memcpy(prc->raw_bits, private_->partitioned_rice_contents_extra[best_parameters_index].raw_bits, sizeof(unsigned)*((unsigned long long)1<<(best_partition_order))); + memcpy(prc->raw_bits, private_->partitioned_rice_contents_extra[best_parameters_index].raw_bits, (uint32_t)sizeof(uint32_t)*(1<<(best_partition_order))); /* * Now need to check if the type should be changed to * FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2 based on the @@ -3771,76 +4180,52 @@ unsigned find_best_partition_order_( return best_residual_bits; } -#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM -extern void precompute_partition_info_sums_32bit_asm_ia32_( - const FLAC__int32 residual[], - FLAC__uint64 abs_residual_partition_sums[], - unsigned blocksize, - unsigned predictor_order, - unsigned min_partition_order, - unsigned max_partition_order -); -#endif - void precompute_partition_info_sums_( const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], - unsigned residual_samples, - unsigned predictor_order, - unsigned min_partition_order, - unsigned max_partition_order, - unsigned bps + uint32_t residual_samples, + uint32_t predictor_order, + uint32_t min_partition_order, + uint32_t max_partition_order, + uint32_t bps ) { - const unsigned default_partition_samples = (residual_samples + predictor_order) >> max_partition_order; - unsigned partitions = 1u << max_partition_order; + const uint32_t default_partition_samples = (residual_samples + predictor_order) >> max_partition_order; + uint32_t partitions = 1u << max_partition_order; FLAC__ASSERT(default_partition_samples > predictor_order); -#if defined(FLAC__CPU_IA32) && !defined FLAC__NO_ASM && defined FLAC__HAS_NASM - /* slightly pessimistic but still catches all common cases */ - /* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */ - if(FLAC__bitmath_ilog2(default_partition_samples) + bps < 32) { - precompute_partition_info_sums_32bit_asm_ia32_(residual, abs_residual_partition_sums, residual_samples + predictor_order, predictor_order, min_partition_order, max_partition_order); - return; - } -#endif - /* first do max_partition_order */ { - unsigned partition, residual_sample, end = (unsigned)(-(int)predictor_order); - /* slightly pessimistic but still catches all common cases */ - /* WATCHOUT: "+ bps" is an assumption that the average residual magnitude will not be more than "bps" bits */ - if(FLAC__bitmath_ilog2(default_partition_samples) + bps < 32) { - FLAC__uint32 abs_residual_partition_sum; - + const uint32_t threshold = 32 - FLAC__bitmath_ilog2(default_partition_samples); + uint32_t partition, residual_sample, end = (uint32_t)(-(int)predictor_order); + /* WATCHOUT: "bps + FLAC__MAX_EXTRA_RESIDUAL_BPS" is the maximum assumed size of the average residual magnitude */ + if(bps + FLAC__MAX_EXTRA_RESIDUAL_BPS < threshold) { for(partition = residual_sample = 0; partition < partitions; partition++) { + FLAC__uint32 abs_residual_partition_sum = 0; end += default_partition_samples; - abs_residual_partition_sum = 0; for( ; residual_sample < end; residual_sample++) abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */ abs_residual_partition_sums[partition] = abs_residual_partition_sum; } } else { /* have to pessimistically use 64 bits for accumulator */ - FLAC__uint64 abs_residual_partition_sum; - for(partition = residual_sample = 0; partition < partitions; partition++) { + FLAC__uint64 abs_residual_partition_sum64 = 0; end += default_partition_samples; - abs_residual_partition_sum = 0; for( ; residual_sample < end; residual_sample++) - abs_residual_partition_sum += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */ - abs_residual_partition_sums[partition] = abs_residual_partition_sum; + abs_residual_partition_sum64 += abs(residual[residual_sample]); /* abs(INT_MIN) is undefined, but if the residual is INT_MIN we have bigger problems */ + abs_residual_partition_sums[partition] = abs_residual_partition_sum64; } } } /* now merge partitions for lower orders */ { - unsigned from_partition = 0, to_partition = partitions; + uint32_t from_partition = 0, to_partition = partitions; int partition_order; for(partition_order = (int)max_partition_order - 1; partition_order >= (int)min_partition_order; partition_order--) { - unsigned i; + uint32_t i; partitions >>= 1; for(i = 0; i < partitions; i++) { abs_residual_partition_sums[to_partition++] = @@ -3854,24 +4239,24 @@ void precompute_partition_info_sums_( void precompute_partition_info_escapes_( const FLAC__int32 residual[], - unsigned raw_bits_per_partition[], - unsigned residual_samples, - unsigned predictor_order, - unsigned min_partition_order, - unsigned max_partition_order + uint32_t raw_bits_per_partition[], + uint32_t residual_samples, + uint32_t predictor_order, + uint32_t min_partition_order, + uint32_t max_partition_order ) { int partition_order; - unsigned from_partition, to_partition = 0; - const unsigned blocksize = residual_samples + predictor_order; + uint32_t from_partition, to_partition = 0; + const uint32_t blocksize = residual_samples + predictor_order; /* first do max_partition_order */ for(partition_order = (int)max_partition_order; partition_order >= 0; partition_order--) { FLAC__int32 r; FLAC__uint32 rmax; - unsigned partition, partition_sample, partition_samples, residual_sample; - const unsigned partitions = 1u << partition_order; - const unsigned default_partition_samples = blocksize >> partition_order; + uint32_t partition, partition_sample, partition_samples, residual_sample; + const uint32_t partitions = 1u << partition_order; + const uint32_t default_partition_samples = blocksize >> partition_order; FLAC__ASSERT(default_partition_samples > predictor_order); @@ -3897,13 +4282,13 @@ void precompute_partition_info_escapes_( /* now merge partitions for lower orders */ for(from_partition = 0, --partition_order; partition_order >= (int)min_partition_order; partition_order--) { - unsigned m; - unsigned i; - const unsigned partitions = 1u << partition_order; + uint32_t m; + uint32_t i; + const uint32_t partitions = 1u << partition_order; for(i = 0; i < partitions; i++) { m = raw_bits_per_partition[from_partition]; from_partition++; - raw_bits_per_partition[to_partition] = max(m, raw_bits_per_partition[from_partition]); + raw_bits_per_partition[to_partition] = flac_max(m, raw_bits_per_partition[from_partition]); from_partition++; to_partition++; } @@ -3911,36 +4296,37 @@ void precompute_partition_info_escapes_( } #ifdef EXACT_RICE_BITS_CALCULATION -static FLaC__INLINE unsigned count_rice_bits_in_partition_( - const unsigned rice_parameter, - const unsigned partition_samples, +static inline uint32_t count_rice_bits_in_partition_( + const uint32_t rice_parameter, + const uint32_t partition_samples, const FLAC__int32 *residual ) { - unsigned i, partition_bits = + uint32_t i; + uint64_t partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + /* actually could end up being FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN but err on side of 16bps */ (1+rice_parameter) * partition_samples /* 1 for unary stop bit + rice_parameter for the binary portion */ ; for(i = 0; i < partition_samples; i++) partition_bits += ( (FLAC__uint32)((residual[i]<<1)^(residual[i]>>31)) >> rice_parameter ); - return partition_bits; + return (uint32_t)(flac_min(partition_bits,UINT32_MAX)); // To make sure the return value doesn't overflow } #else -static FLaC__INLINE unsigned count_rice_bits_in_partition_( - const unsigned rice_parameter, - const unsigned partition_samples, +static inline uint32_t count_rice_bits_in_partition_( + const uint32_t rice_parameter, + const uint32_t partition_samples, const FLAC__uint64 abs_residual_partition_sum ) { - return + return (uint32_t)(flac_min( // To make sure the return value doesn't overflow FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN + /* actually could end up being FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN but err on side of 16bps */ (1+rice_parameter) * partition_samples + /* 1 for unary stop bit + rice_parameter for the binary portion */ ( rice_parameter? - (unsigned)(abs_residual_partition_sum >> (rice_parameter-1)) /* rice_parameter-1 because the real coder sign-folds instead of using a sign bit */ - : (unsigned)(abs_residual_partition_sum << 1) /* can't shift by negative number, so reverse */ + (abs_residual_partition_sum >> (rice_parameter-1)) /* rice_parameter-1 because the real coder sign-folds instead of using a sign bit */ + : (abs_residual_partition_sum << 1) /* can't shift by negative number, so reverse */ ) - - (partition_samples >> 1) + - (partition_samples >> 1),UINT32_MAX)); /* -(partition_samples>>1) to subtract out extra contributions to the abs_residual_partition_sum. * The actual number of bits used is closer to the sum(for all i in the partition) of abs(residual[i])>>(rice_parameter-1) * By using the abs_residual_partition sum, we also add in bits in the LSBs that would normally be shifted out. @@ -3956,62 +4342,100 @@ FLAC__bool set_partitioned_rice_( const FLAC__int32 residual[], #endif const FLAC__uint64 abs_residual_partition_sums[], - const unsigned raw_bits_per_partition[], - const unsigned residual_samples, - const unsigned predictor_order, - const unsigned suggested_rice_parameter, - const unsigned rice_parameter_limit, - const unsigned rice_parameter_search_dist, - const unsigned partition_order, + const uint32_t raw_bits_per_partition[], + const uint32_t residual_samples, + const uint32_t predictor_order, + const uint32_t rice_parameter_limit, + const uint32_t rice_parameter_search_dist, + const uint32_t partition_order, const FLAC__bool search_for_escapes, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, - unsigned *bits + uint32_t *bits ) { - unsigned rice_parameter, partition_bits; - unsigned best_partition_bits, best_rice_parameter = 0; - unsigned bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; - unsigned *parameters, *raw_bits; + uint32_t rice_parameter, partition_bits; + uint32_t best_partition_bits, best_rice_parameter = 0; + uint32_t bits_ = FLAC__ENTROPY_CODING_METHOD_TYPE_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ORDER_LEN; + uint32_t *parameters, *raw_bits; + uint32_t partition, residual_sample; + uint32_t partition_samples, partition_samples_base; + uint32_t partition_samples_fixed_point_divisor, partition_samples_fixed_point_divisor_base; + const uint32_t partitions = 1u << partition_order; + FLAC__uint64 mean; #ifdef ENABLE_RICE_PARAMETER_SEARCH - unsigned min_rice_parameter, max_rice_parameter; + uint32_t min_rice_parameter, max_rice_parameter; #else (void)rice_parameter_search_dist; #endif - FLAC__ASSERT(suggested_rice_parameter < FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER); FLAC__ASSERT(rice_parameter_limit <= FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER); - FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(partitioned_rice_contents, max(6, partition_order)); parameters = partitioned_rice_contents->parameters; raw_bits = partitioned_rice_contents->raw_bits; - if(partition_order == 0) { - best_partition_bits = (unsigned)(-1); + partition_samples_base = (residual_samples+predictor_order) >> partition_order; + + /* Integer division is slow. To speed up things, precalculate a fixed point + * divisor, as all partitions except the first are the same size. 18 bits + * are taken because maximum block size is 65535, max partition size for + * partitions other than 0 is 32767 (15 bit), max abs residual is 2^31, + * which leaves 18 bit */ + partition_samples_fixed_point_divisor_base = 0x40000 / partition_samples_base; + + for(partition = residual_sample = 0; partition < partitions; partition++) { + partition_samples = partition_samples_base; + if(partition > 0) { + partition_samples_fixed_point_divisor = partition_samples_fixed_point_divisor_base; + } + else { + if(partition_samples <= predictor_order) + return false; + else + partition_samples -= predictor_order; + partition_samples_fixed_point_divisor = 0x40000 / partition_samples; + } + mean = abs_residual_partition_sums[partition]; + /* 'mean' is not a good name for the variable, it is + * actually the sum of magnitudes of all residual values + * in the partition, so the actual mean is + * mean/partition_samples + */ + if(mean < 2 || (((mean - 1)*partition_samples_fixed_point_divisor)>>18) == 0) + rice_parameter = 0; + else + rice_parameter = FLAC__bitmath_ilog2_wide(((mean - 1)*partition_samples_fixed_point_divisor)>>18) + 1; + + if(rice_parameter >= rice_parameter_limit) { +#ifndef NDEBUG + fprintf(stderr, "clipping rice_parameter (%u -> %u) @6\n", rice_parameter, rice_parameter_limit - 1); +#endif + rice_parameter = rice_parameter_limit - 1; + } + + best_partition_bits = UINT32_MAX; #ifdef ENABLE_RICE_PARAMETER_SEARCH if(rice_parameter_search_dist) { - if(suggested_rice_parameter < rice_parameter_search_dist) + if(rice_parameter < rice_parameter_search_dist) min_rice_parameter = 0; else - min_rice_parameter = suggested_rice_parameter - rice_parameter_search_dist; - max_rice_parameter = suggested_rice_parameter + rice_parameter_search_dist; + min_rice_parameter = rice_parameter - rice_parameter_search_dist; + max_rice_parameter = rice_parameter + rice_parameter_search_dist; if(max_rice_parameter >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @5\n", max_rice_parameter, rice_parameter_limit - 1); +#ifndef NDEBUG + fprintf(stderr, "clipping rice_parameter (%u -> %u) @7\n", max_rice_parameter, rice_parameter_limit - 1); #endif max_rice_parameter = rice_parameter_limit - 1; } } else - min_rice_parameter = max_rice_parameter = suggested_rice_parameter; + min_rice_parameter = max_rice_parameter = rice_parameter; for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) { -#else - rice_parameter = suggested_rice_parameter; #endif #ifdef EXACT_RICE_BITS_CALCULATION - partition_bits = count_rice_bits_in_partition_(rice_parameter, residual_samples, residual); + partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, residual+residual_sample); #else - partition_bits = count_rice_bits_in_partition_(rice_parameter, residual_samples, abs_residual_partition_sums[0]); + partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, abs_residual_partition_sums[partition]); #endif if(partition_bits < best_partition_bits) { best_rice_parameter = rice_parameter; @@ -4021,104 +4445,30 @@ FLAC__bool set_partitioned_rice_( } #endif if(search_for_escapes) { - partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[0] * residual_samples; - if(partition_bits <= best_partition_bits) { - raw_bits[0] = raw_bits_per_partition[0]; + partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[partition] * partition_samples; + if(partition_bits <= best_partition_bits && raw_bits_per_partition[partition] < 32) { + raw_bits[partition] = raw_bits_per_partition[partition]; best_rice_parameter = 0; /* will be converted to appropriate escape parameter later */ best_partition_bits = partition_bits; } else - raw_bits[0] = 0; + raw_bits[partition] = 0; } - parameters[0] = best_rice_parameter; - bits_ += best_partition_bits; - } - else { - unsigned partition, residual_sample; - unsigned partition_samples; - FLAC__uint64 mean, k; - const unsigned partitions = 1u << partition_order; - for(partition = residual_sample = 0; partition < partitions; partition++) { - partition_samples = (residual_samples+predictor_order) >> partition_order; - if(partition == 0) { - if(partition_samples <= predictor_order) - return false; - else - partition_samples -= predictor_order; - } - mean = abs_residual_partition_sums[partition]; - /* we are basically calculating the size in bits of the - * average residual magnitude in the partition: - * rice_parameter = floor(log2(mean/partition_samples)) - * 'mean' is not a good name for the variable, it is - * actually the sum of magnitudes of all residual values - * in the partition, so the actual mean is - * mean/partition_samples - */ - for(rice_parameter = 0, k = partition_samples; k < mean; rice_parameter++, k <<= 1) - ; - if(rice_parameter >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @6\n", rice_parameter, rice_parameter_limit - 1); -#endif - rice_parameter = rice_parameter_limit - 1; - } - - best_partition_bits = (unsigned)(-1); -#ifdef ENABLE_RICE_PARAMETER_SEARCH - if(rice_parameter_search_dist) { - if(rice_parameter < rice_parameter_search_dist) - min_rice_parameter = 0; - else - min_rice_parameter = rice_parameter - rice_parameter_search_dist; - max_rice_parameter = rice_parameter + rice_parameter_search_dist; - if(max_rice_parameter >= rice_parameter_limit) { -#ifdef DEBUG_VERBOSE - fprintf(stderr, "clipping rice_parameter (%u -> %u) @7\n", max_rice_parameter, rice_parameter_limit - 1); -#endif - max_rice_parameter = rice_parameter_limit - 1; - } - } - else - min_rice_parameter = max_rice_parameter = rice_parameter; - - for(rice_parameter = min_rice_parameter; rice_parameter <= max_rice_parameter; rice_parameter++) { -#endif -#ifdef EXACT_RICE_BITS_CALCULATION - partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, residual+residual_sample); -#else - partition_bits = count_rice_bits_in_partition_(rice_parameter, partition_samples, abs_residual_partition_sums[partition]); -#endif - if(partition_bits < best_partition_bits) { - best_rice_parameter = rice_parameter; - best_partition_bits = partition_bits; - } -#ifdef ENABLE_RICE_PARAMETER_SEARCH - } -#endif - if(search_for_escapes) { - partition_bits = FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN + FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_RAW_LEN + raw_bits_per_partition[partition] * partition_samples; - if(partition_bits <= best_partition_bits) { - raw_bits[partition] = raw_bits_per_partition[partition]; - best_rice_parameter = 0; /* will be converted to appropriate escape parameter later */ - best_partition_bits = partition_bits; - } - else - raw_bits[partition] = 0; - } - parameters[partition] = best_rice_parameter; + parameters[partition] = best_rice_parameter; + if(best_partition_bits < UINT32_MAX - bits_) // To make sure _bits doesn't overflow bits_ += best_partition_bits; - residual_sample += partition_samples; - } + else + bits_ = UINT32_MAX; + residual_sample += partition_samples; } *bits = bits_; return true; } -unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples) +uint32_t get_wasted_bits_(FLAC__int32 signal[], uint32_t samples) { - unsigned i, shift; + uint32_t i, shift; FLAC__int32 x = 0; for(i = 0; i < samples && !(x&1); i++) @@ -4140,9 +4490,34 @@ unsigned get_wasted_bits_(FLAC__int32 signal[], unsigned samples) return shift; } -void append_to_verify_fifo_(verify_input_fifo *fifo, const FLAC__int32 * const input[], unsigned input_offset, unsigned channels, unsigned wide_samples) +uint32_t get_wasted_bits_wide_(FLAC__int64 signal_wide[], FLAC__int32 signal[], uint32_t samples) { - unsigned channel; + uint32_t i, shift; + FLAC__int64 x = 0; + + for(i = 0; i < samples && !(x&1); i++) + x |= signal_wide[i]; + + if(x == 0) { + shift = 1; + } + else { + for(shift = 0; !(x&1); shift++) + x >>= 1; + } + + if(shift > 0) { + for(i = 0; i < samples; i++) + signal[i] = (FLAC__int32)(signal_wide[i] >> shift); + } + + return shift; +} + + +void append_to_verify_fifo_(verify_input_fifo *fifo, const FLAC__int32 * const input[], uint32_t input_offset, uint32_t channels, uint32_t wide_samples) +{ + uint32_t channel; for(channel = 0; channel < channels; channel++) memcpy(&fifo->data[channel][fifo->tail], &input[channel][input_offset], sizeof(FLAC__int32) * wide_samples); @@ -4152,11 +4527,11 @@ void append_to_verify_fifo_(verify_input_fifo *fifo, const FLAC__int32 * const i FLAC__ASSERT(fifo->tail <= fifo->size); } -void append_to_verify_fifo_interleaved_(verify_input_fifo *fifo, const FLAC__int32 input[], unsigned input_offset, unsigned channels, unsigned wide_samples) +void append_to_verify_fifo_interleaved_(verify_input_fifo *fifo, const FLAC__int32 input[], uint32_t input_offset, uint32_t channels, uint32_t wide_samples) { - unsigned channel; - unsigned sample, wide_sample; - unsigned tail = fifo->tail; + uint32_t channel; + uint32_t sample, wide_sample; + uint32_t tail = fifo->tail; sample = input_offset * channels; for(wide_sample = 0; wide_sample < wide_samples; wide_sample++) { @@ -4203,16 +4578,21 @@ FLAC__StreamDecoderReadStatus verify_read_callback_(const FLAC__StreamDecoder *d FLAC__StreamDecoderWriteStatus verify_write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[], void *client_data) { FLAC__StreamEncoder *encoder = (FLAC__StreamEncoder *)client_data; - unsigned channel; - const unsigned channels = frame->header.channels; - const unsigned blocksize = frame->header.blocksize; - const unsigned bytes_per_block = sizeof(FLAC__int32) * blocksize; + uint32_t channel; + const uint32_t channels = frame->header.channels; + const uint32_t blocksize = frame->header.blocksize; + const uint32_t bytes_per_block = sizeof(FLAC__int32) * blocksize; (void)decoder; + if(encoder->protected_->state == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { + /* This is set when verify_error_callback_ was called */ + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } + for(channel = 0; channel < channels; channel++) { if(0 != memcmp(buffer[channel], encoder->private_->verify.input_fifo.data[channel], bytes_per_block)) { - unsigned i, sample = 0; + uint32_t i, sample = 0; FLAC__int32 expect = 0, got = 0; for(i = 0; i < blocksize; i++) { @@ -4226,7 +4606,7 @@ FLAC__StreamDecoderWriteStatus verify_write_callback_(const FLAC__StreamDecoder FLAC__ASSERT(i < blocksize); FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); encoder->private_->verify.error_stats.absolute_sample = frame->header.number.sample_number + sample; - encoder->private_->verify.error_stats.frame_number = (unsigned)(frame->header.number.sample_number / blocksize); + encoder->private_->verify.error_stats.frame_number = (uint32_t)(frame->header.number.sample_number / blocksize); encoder->private_->verify.error_stats.channel = channel; encoder->private_->verify.error_stats.sample = sample; encoder->private_->verify.error_stats.expected = expect; @@ -4273,7 +4653,7 @@ FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *enc { (void)client_data; - if(fseeko(encoder->private_->file, (off_t)absolute_byte_offset, SEEK_SET) < 0) + if(fseeko(encoder->private_->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; @@ -4281,7 +4661,7 @@ FLAC__StreamEncoderSeekStatus file_seek_callback_(const FLAC__StreamEncoder *enc FLAC__StreamEncoderTellStatus file_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) { - off_t offset; + FLAC__off_t offset; (void)client_data; @@ -4308,7 +4688,7 @@ static size_t local__fwrite(const void *ptr, size_t size, size_t nmemb, FILE *st #define local__fwrite fwrite #endif -FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) +FLAC__StreamEncoderWriteStatus file_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data) { (void)client_data, (void)current_frame; @@ -4350,9 +4730,6 @@ FILE *get_binary_stdout_(void) */ #if defined _MSC_VER || defined __MINGW32__ _setmode(_fileno(stdout), _O_BINARY); -#elif defined __CYGWIN__ - /* almost certainly not needed for any modern Cygwin, but let's be safe... */ - setmode(_fileno(stdout), _O_BINARY); #elif defined __EMX__ setmode(fileno(stdout), O_BINARY); #endif diff --git a/3rdparty/libflac/src/libFLAC/stream_encoder_framing.c b/3rdparty/libflac/src/libFLAC/stream_encoder_framing.c index 621b34c8228..0e07a317650 100644 --- a/3rdparty/libflac/src/libFLAC/stream_encoder_framing.c +++ b/3rdparty/libflac/src/libFLAC/stream_encoder_framing.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,19 +39,18 @@ #include "private/stream_encoder_framing.h" #include "private/crc.h" #include "FLAC/assert.h" - -#ifdef max -#undef max -#endif -#define max(x,y) ((x)>(y)?(x):(y)) +#include "share/compat.h" static FLAC__bool add_entropy_coding_method_(FLAC__BitWriter *bw, const FLAC__EntropyCodingMethod *method); -static FLAC__bool add_residual_partitioned_rice_(FLAC__BitWriter *bw, const FLAC__int32 residual[], const unsigned residual_samples, const unsigned predictor_order, const unsigned rice_parameters[], const unsigned raw_bits[], const unsigned partition_order, const FLAC__bool is_extended); +static FLAC__bool add_residual_partitioned_rice_(FLAC__BitWriter *bw, const FLAC__int32 residual[], const uint32_t residual_samples, const uint32_t predictor_order, const uint32_t rice_parameters[], const uint32_t raw_bits[], const uint32_t partition_order, const FLAC__bool is_extended); -FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw) +FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw, FLAC__bool update_vendor_string) { - unsigned i, j; - const unsigned vendor_string_length = (unsigned)strlen(FLAC__VENDOR_STRING); + uint32_t i, j, metadata_length; + const uint32_t vendor_string_length = (uint32_t)strlen(FLAC__VENDOR_STRING); + const uint32_t start_bits = FLAC__bitwriter_get_input_bits_unconsumed(bw); + + FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(bw)); if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->is_last, FLAC__STREAM_METADATA_IS_LAST_LEN)) return false; @@ -61,14 +61,17 @@ FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__ /* * First, for VORBIS_COMMENTs, adjust the length to reflect our vendor string */ - i = metadata->length; - if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { + metadata_length = metadata->length; + if(metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT && update_vendor_string) { FLAC__ASSERT(metadata->data.vorbis_comment.vendor_string.length == 0 || 0 != metadata->data.vorbis_comment.vendor_string.entry); - i -= metadata->data.vorbis_comment.vendor_string.length; - i += vendor_string_length; + metadata_length -= metadata->data.vorbis_comment.vendor_string.length; + metadata_length += vendor_string_length; } - FLAC__ASSERT(i < (1u << FLAC__STREAM_METADATA_LENGTH_LEN)); - if(!FLAC__bitwriter_write_raw_uint32(bw, i, FLAC__STREAM_METADATA_LENGTH_LEN)) + FLAC__ASSERT(metadata_length < (1u << FLAC__STREAM_METADATA_LENGTH_LEN)); + /* double protection */ + if(metadata_length >= (1u << FLAC__STREAM_METADATA_LENGTH_LEN)) + return false; + if(!FLAC__bitwriter_write_raw_uint32(bw, metadata_length, FLAC__STREAM_METADATA_LENGTH_LEN)) return false; switch(metadata->type) { @@ -96,8 +99,13 @@ FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__ FLAC__ASSERT(metadata->data.stream_info.bits_per_sample <= (1u << FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN)); if(!FLAC__bitwriter_write_raw_uint32(bw, metadata->data.stream_info.bits_per_sample-1, FLAC__STREAM_METADATA_STREAMINFO_BITS_PER_SAMPLE_LEN)) return false; - if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) - return false; + if(metadata->data.stream_info.total_samples >= (FLAC__U64L(1) << FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)){ + if(!FLAC__bitwriter_write_raw_uint64(bw, 0, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) + return false; + }else{ + if(!FLAC__bitwriter_write_raw_uint64(bw, metadata->data.stream_info.total_samples, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) + return false; + } if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.stream_info.md5sum, 16)) return false; break; @@ -122,10 +130,18 @@ FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__ } break; case FLAC__METADATA_TYPE_VORBIS_COMMENT: - if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, vendor_string_length)) - return false; - if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)FLAC__VENDOR_STRING, vendor_string_length)) - return false; + if(update_vendor_string) { + if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, vendor_string_length)) + return false; + if(!FLAC__bitwriter_write_byte_block(bw, (const FLAC__byte*)FLAC__VENDOR_STRING, vendor_string_length)) + return false; + } + else { + if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, metadata->data.vorbis_comment.vendor_string.length)) + return false; + if(!FLAC__bitwriter_write_byte_block(bw, metadata->data.vorbis_comment.vendor_string.entry, metadata->data.vorbis_comment.vendor_string.length)) + return false; + } if(!FLAC__bitwriter_write_raw_uint32_little_endian(bw, metadata->data.vorbis_comment.num_comments)) return false; for(i = 0; i < metadata->data.vorbis_comment.num_comments; i++) { @@ -166,11 +182,11 @@ FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__ if(!FLAC__bitwriter_write_raw_uint32(bw, track->num_indices, FLAC__STREAM_METADATA_CUESHEET_TRACK_NUM_INDICES_LEN)) return false; for(j = 0; j < track->num_indices; j++) { - const FLAC__StreamMetadata_CueSheet_Index *index = track->indices + j; + const FLAC__StreamMetadata_CueSheet_Index *indx = track->indices + j; - if(!FLAC__bitwriter_write_raw_uint64(bw, index->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN)) + if(!FLAC__bitwriter_write_raw_uint64(bw, indx->offset, FLAC__STREAM_METADATA_CUESHEET_INDEX_OFFSET_LEN)) return false; - if(!FLAC__bitwriter_write_raw_uint32(bw, index->number, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN)) + if(!FLAC__bitwriter_write_raw_uint32(bw, indx->number, FLAC__STREAM_METADATA_CUESHEET_INDEX_NUMBER_LEN)) return false; if(!FLAC__bitwriter_write_zeroes(bw, FLAC__STREAM_METADATA_CUESHEET_INDEX_RESERVED_LEN)) return false; @@ -212,13 +228,23 @@ FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__ break; } + /* Now check whether metadata block length was correct */ + { + uint32_t length_in_bits = FLAC__bitwriter_get_input_bits_unconsumed(bw); + if(length_in_bits < start_bits) + return false; + length_in_bits -= start_bits; + if(length_in_bits % 8 != 0 || length_in_bits != (metadata_length*8+32)) + return false; + } + FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(bw)); return true; } FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWriter *bw) { - unsigned u, blocksize_hint, sample_rate_hint; + uint32_t u, blocksize_hint, sample_rate_hint; FLAC__byte crc; FLAC__ASSERT(FLAC__bitwriter_is_byte_aligned(bw)); @@ -277,7 +303,7 @@ FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWrit default: if(header->sample_rate <= 255000 && header->sample_rate % 1000 == 0) sample_rate_hint = u = 12; - else if(header->sample_rate % 10 == 0) + else if(header->sample_rate <= 655350 && header->sample_rate % 10 == 0) sample_rate_hint = u = 14; else if(header->sample_rate <= 0xffff) sample_rate_hint = u = 13; @@ -318,6 +344,7 @@ FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWrit case 16: u = 4; break; case 20: u = 5; break; case 24: u = 6; break; + case 32: u = 7; break; default: u = 0; break; } if(!FLAC__bitwriter_write_raw_uint32(bw, u, FLAC__FRAME_HEADER_BITS_PER_SAMPLE_LEN)) @@ -363,22 +390,22 @@ FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWrit return true; } -FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw) +FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw) { FLAC__bool ok; ok = FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_CONSTANT_BYTE_ALIGNED_MASK | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN) && (wasted_bits? FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits-1) : true) && - FLAC__bitwriter_write_raw_int32(bw, subframe->value, subframe_bps) + FLAC__bitwriter_write_raw_int64(bw, subframe->value, subframe_bps) ; return ok; } -FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw) +FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, uint32_t residual_samples, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw) { - unsigned i; + uint32_t i; if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_FIXED_BYTE_ALIGNED_MASK | (subframe->order<<1) | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN)) return false; @@ -387,7 +414,7 @@ FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsign return false; for(i = 0; i < subframe->order; i++) - if(!FLAC__bitwriter_write_raw_int32(bw, subframe->warmup[i], subframe_bps)) + if(!FLAC__bitwriter_write_raw_int64(bw, subframe->warmup[i], subframe_bps)) return false; if(!add_entropy_coding_method_(bw, &subframe->entropy_coding_method)) @@ -414,9 +441,9 @@ FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsign return true; } -FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw) +FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, uint32_t residual_samples, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw) { - unsigned i; + uint32_t i; if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_LPC_BYTE_ALIGNED_MASK | ((subframe->order-1)<<1) | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN)) return false; @@ -425,7 +452,7 @@ FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned r return false; for(i = 0; i < subframe->order; i++) - if(!FLAC__bitwriter_write_raw_int32(bw, subframe->warmup[i], subframe_bps)) + if(!FLAC__bitwriter_write_raw_int64(bw, subframe->warmup[i], subframe_bps)) return false; if(!FLAC__bitwriter_write_raw_uint32(bw, subframe->qlp_coeff_precision-1, FLAC__SUBFRAME_LPC_QLP_COEFF_PRECISION_LEN)) @@ -460,10 +487,9 @@ FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned r return true; } -FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw) +FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, uint32_t samples, uint32_t subframe_bps, uint32_t wasted_bits, FLAC__BitWriter *bw) { - unsigned i; - const FLAC__int32 *signal = subframe->data; + uint32_t i; if(!FLAC__bitwriter_write_raw_uint32(bw, FLAC__SUBFRAME_TYPE_VERBATIM_BYTE_ALIGNED_MASK | (wasted_bits? 1:0), FLAC__SUBFRAME_ZERO_PAD_LEN + FLAC__SUBFRAME_TYPE_LEN + FLAC__SUBFRAME_WASTED_BITS_FLAG_LEN)) return false; @@ -471,9 +497,24 @@ FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, if(!FLAC__bitwriter_write_unary_unsigned(bw, wasted_bits-1)) return false; - for(i = 0; i < samples; i++) - if(!FLAC__bitwriter_write_raw_int32(bw, signal[i], subframe_bps)) - return false; + if(subframe->data_type == FLAC__VERBATIM_SUBFRAME_DATA_TYPE_INT32) { + const FLAC__int32 *signal = subframe->data.int32; + + FLAC__ASSERT(subframe_bps < 33); + + for(i = 0; i < samples; i++) + if(!FLAC__bitwriter_write_raw_int32(bw, signal[i], subframe_bps)) + return false; + } + else { + const FLAC__int64 *signal = subframe->data.int64; + + FLAC__ASSERT(subframe_bps == 33); + + for(i = 0; i < samples; i++) + if(!FLAC__bitwriter_write_raw_int64(bw, (FLAC__int64)signal[i], subframe_bps)) + return false; + } return true; } @@ -494,13 +535,13 @@ FLAC__bool add_entropy_coding_method_(FLAC__BitWriter *bw, const FLAC__EntropyCo return true; } -FLAC__bool add_residual_partitioned_rice_(FLAC__BitWriter *bw, const FLAC__int32 residual[], const unsigned residual_samples, const unsigned predictor_order, const unsigned rice_parameters[], const unsigned raw_bits[], const unsigned partition_order, const FLAC__bool is_extended) +FLAC__bool add_residual_partitioned_rice_(FLAC__BitWriter *bw, const FLAC__int32 residual[], const uint32_t residual_samples, const uint32_t predictor_order, const uint32_t rice_parameters[], const uint32_t raw_bits[], const uint32_t partition_order, const FLAC__bool is_extended) { - const unsigned plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; - const unsigned pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; + const uint32_t plen = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_PARAMETER_LEN : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_PARAMETER_LEN; + const uint32_t pesc = is_extended? FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE2_ESCAPE_PARAMETER : FLAC__ENTROPY_CODING_METHOD_PARTITIONED_RICE_ESCAPE_PARAMETER; if(partition_order == 0) { - unsigned i; + uint32_t i; if(raw_bits[0] == 0) { if(!FLAC__bitwriter_write_raw_uint32(bw, rice_parameters[0], plen)) @@ -522,9 +563,9 @@ FLAC__bool add_residual_partitioned_rice_(FLAC__BitWriter *bw, const FLAC__int32 return true; } else { - unsigned i, j, k = 0, k_last = 0; - unsigned partition_samples; - const unsigned default_partition_samples = (residual_samples+predictor_order) >> partition_order; + uint32_t i, j, k = 0, k_last = 0; + uint32_t partition_samples; + const uint32_t default_partition_samples = (residual_samples+predictor_order) >> partition_order; for(i = 0; i < (1u<<partition_order); i++) { partition_samples = default_partition_samples; if(i == 0) diff --git a/3rdparty/libflac/src/libFLAC/stream_encoder_intrin_avx2.c b/3rdparty/libflac/src/libFLAC/stream_encoder_intrin_avx2.c new file mode 100644 index 00000000000..b37efb388f9 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/stream_encoder_intrin_avx2.c @@ -0,0 +1,146 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +#include "private/stream_encoder.h" +#include "private/bitmath.h" +#ifdef FLAC__AVX2_SUPPORTED + +#include <stdlib.h> /* for abs() */ +#include <immintrin.h> /* AVX2 */ +#include "FLAC/assert.h" + +FLAC__SSE_TARGET("avx2") +void FLAC__precompute_partition_info_sums_intrin_avx2(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], + uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps) +{ + const uint32_t default_partition_samples = (residual_samples + predictor_order) >> max_partition_order; + uint32_t partitions = 1u << max_partition_order; + + FLAC__ASSERT(default_partition_samples > predictor_order); + + /* first do max_partition_order */ + { + const uint32_t threshold = 32 - FLAC__bitmath_ilog2(default_partition_samples); + uint32_t partition, residual_sample, end = (uint32_t)(-(int32_t)predictor_order); + + if(bps + FLAC__MAX_EXTRA_RESIDUAL_BPS < threshold) { + for(partition = residual_sample = 0; partition < partitions; partition++) { + __m256i sum256 = _mm256_setzero_si256(); + __m128i sum128; + end += default_partition_samples; + + for( ; (int)residual_sample < (int)end-7; residual_sample+=8) { + __m256i res256 = _mm256_abs_epi32(_mm256_loadu_si256((const __m256i*)(const void*)(residual+residual_sample))); + sum256 = _mm256_add_epi32(sum256, res256); + } + + sum128 = _mm_add_epi32(_mm256_extracti128_si256(sum256, 1), _mm256_castsi256_si128(sum256)); + + for( ; (int)residual_sample < (int)end-3; residual_sample+=4) { + __m128i res128 = _mm_abs_epi32(_mm_loadu_si128((const __m128i*)(const void*)(residual+residual_sample))); + sum128 = _mm_add_epi32(sum128, res128); + } + + for( ; residual_sample < end; residual_sample++) { + __m128i res128 = _mm_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); + sum128 = _mm_add_epi32(sum128, res128); + } + + sum128 = _mm_add_epi32(sum128, _mm_shuffle_epi32(sum128, _MM_SHUFFLE(1,0,3,2))); + sum128 = _mm_add_epi32(sum128, _mm_shufflelo_epi16(sum128, _MM_SHUFFLE(1,0,3,2))); + abs_residual_partition_sums[partition] = (FLAC__uint32)_mm_cvtsi128_si32(sum128); +/* workaround for MSVC bugs (at least versions 2015 and 2017 are affected) */ +#if (defined _MSC_VER) && (defined FLAC__CPU_X86_64) + abs_residual_partition_sums[partition] &= 0xFFFFFFFF; /**/ +#endif + } + } + else { /* have to pessimistically use 64 bits for accumulator */ + for(partition = residual_sample = 0; partition < partitions; partition++) { + __m256i sum256 = _mm256_setzero_si256(); + __m128i sum128; + end += default_partition_samples; + + for( ; (int)residual_sample < (int)end-3; residual_sample+=4) { + __m128i res128 = _mm_abs_epi32(_mm_loadu_si128((const __m128i*)(const void*)(residual+residual_sample))); + __m256i res256 = _mm256_cvtepu32_epi64(res128); + sum256 = _mm256_add_epi64(sum256, res256); + } + + sum128 = _mm_add_epi64(_mm256_extracti128_si256(sum256, 1), _mm256_castsi256_si128(sum256)); + + for( ; (int)residual_sample < (int)end-1; residual_sample+=2) { + __m128i res128 = _mm_abs_epi32(_mm_loadl_epi64((const __m128i*)(const void*)(residual+residual_sample))); + res128 = _mm_cvtepu32_epi64(res128); + sum128 = _mm_add_epi64(sum128, res128); + } + + for( ; residual_sample < end; residual_sample++) { + __m128i res128 = _mm_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); + sum128 = _mm_add_epi64(sum128, res128); + } + + sum128 = _mm_add_epi64(sum128, _mm_srli_si128(sum128, 8)); + _mm_storel_epi64((__m128i*)(void*)(abs_residual_partition_sums+partition), sum128); + } + } + } + + /* now merge partitions for lower orders */ + { + uint32_t from_partition = 0, to_partition = partitions; + int partition_order; + for(partition_order = (int)max_partition_order - 1; partition_order >= (int)min_partition_order; partition_order--) { + uint32_t i; + partitions >>= 1; + for(i = 0; i < partitions; i++) { + abs_residual_partition_sums[to_partition++] = + abs_residual_partition_sums[from_partition ] + + abs_residual_partition_sums[from_partition+1]; + from_partition += 2; + } + } + } + _mm256_zeroupper(); +} + +#endif /* FLAC__AVX2_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ diff --git a/3rdparty/libflac/src/libFLAC/stream_encoder_intrin_sse2.c b/3rdparty/libflac/src/libFLAC/stream_encoder_intrin_sse2.c new file mode 100644 index 00000000000..dd25fa65bc5 --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/stream_encoder_intrin_sse2.c @@ -0,0 +1,159 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +#include "private/stream_encoder.h" +#include "private/bitmath.h" +#ifdef FLAC__SSE2_SUPPORTED + +#include <stdlib.h> /* for abs() */ +#include <emmintrin.h> /* SSE2 */ +#include "FLAC/assert.h" +#include "share/compat.h" + +FLAC__SSE_TARGET("sse2") +static inline __m128i local_abs_epi32(__m128i val) +{ + __m128i mask = _mm_srai_epi32(val, 31); + val = _mm_xor_si128(val, mask); + val = _mm_sub_epi32(val, mask); + return val; +} + + +FLAC__SSE_TARGET("sse2") +void FLAC__precompute_partition_info_sums_intrin_sse2(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], + uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps) +{ + const uint32_t default_partition_samples = (residual_samples + predictor_order) >> max_partition_order; + uint32_t partitions = 1u << max_partition_order; + + FLAC__ASSERT(default_partition_samples > predictor_order); + + /* first do max_partition_order */ + { + const uint32_t threshold = 32 - FLAC__bitmath_ilog2(default_partition_samples); + uint32_t partition, residual_sample, end = (uint32_t)(-(int32_t)predictor_order); + + if(bps + FLAC__MAX_EXTRA_RESIDUAL_BPS < threshold) { + for(partition = residual_sample = 0; partition < partitions; partition++) { + __m128i mm_sum = _mm_setzero_si128(); + uint32_t e1, e3; + end += default_partition_samples; + + e1 = (residual_sample + 3) & ~3; e3 = end & ~3; + if(e1 > end) + e1 = end; /* try flac -l 1 -b 16 and you'll be here */ + + /* assumption: residual[] is properly aligned so (residual + e1) is properly aligned too and _mm_loadu_si128() is fast */ + for( ; residual_sample < e1; residual_sample++) { + __m128i mm_res = local_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); + mm_sum = _mm_add_epi32(mm_sum, mm_res); + } + + for( ; residual_sample < e3; residual_sample+=4) { + __m128i mm_res = local_abs_epi32(_mm_loadu_si128((const __m128i*)(const void*)(residual+residual_sample))); + mm_sum = _mm_add_epi32(mm_sum, mm_res); + } + + for( ; residual_sample < end; residual_sample++) { + __m128i mm_res = local_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); + mm_sum = _mm_add_epi32(mm_sum, mm_res); + } + + mm_sum = _mm_add_epi32(mm_sum, _mm_shuffle_epi32(mm_sum, _MM_SHUFFLE(1,0,3,2))); + mm_sum = _mm_add_epi32(mm_sum, _mm_shufflelo_epi16(mm_sum, _MM_SHUFFLE(1,0,3,2))); + abs_residual_partition_sums[partition] = (FLAC__uint32)_mm_cvtsi128_si32(mm_sum); +/* workaround for MSVC bugs (at least versions 2015 and 2017 are affected) */ +#if (defined _MSC_VER) && (defined FLAC__CPU_X86_64) + abs_residual_partition_sums[partition] &= 0xFFFFFFFF; +#endif + } + } + else { /* have to pessimistically use 64 bits for accumulator */ + for(partition = residual_sample = 0; partition < partitions; partition++) { + __m128i mm_sum = _mm_setzero_si128(); + uint32_t e1, e3; + end += default_partition_samples; + + e1 = (residual_sample + 1) & ~1; e3 = end & ~1; + FLAC__ASSERT(e1 <= end); + + for( ; residual_sample < e1; residual_sample++) { + __m128i mm_res = local_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); /* 0 0 0 |r0| == 00 |r0_64| */ + mm_sum = _mm_add_epi64(mm_sum, mm_res); + } + + for( ; residual_sample < e3; residual_sample+=2) { + __m128i mm_res = local_abs_epi32(_mm_loadl_epi64((const __m128i*)(const void*)(residual+residual_sample))); /* 0 0 |r1| |r0| */ + mm_res = _mm_shuffle_epi32(mm_res, _MM_SHUFFLE(3,1,2,0)); /* 0 |r1| 0 |r0| == |r1_64| |r0_64| */ + mm_sum = _mm_add_epi64(mm_sum, mm_res); + } + + for( ; residual_sample < end; residual_sample++) { + __m128i mm_res = local_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); + mm_sum = _mm_add_epi64(mm_sum, mm_res); + } + + mm_sum = _mm_add_epi64(mm_sum, _mm_srli_si128(mm_sum, 8)); + _mm_storel_epi64((__m128i*)(void*)(abs_residual_partition_sums+partition), mm_sum); + } + } + } + + /* now merge partitions for lower orders */ + { + uint32_t from_partition = 0, to_partition = partitions; + int partition_order; + for(partition_order = (int)max_partition_order - 1; partition_order >= (int)min_partition_order; partition_order--) { + uint32_t i; + partitions >>= 1; + for(i = 0; i < partitions; i++) { + abs_residual_partition_sums[to_partition++] = + abs_residual_partition_sums[from_partition ] + + abs_residual_partition_sums[from_partition+1]; + from_partition += 2; + } + } + } +} + +#endif /* FLAC__SSE2_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ diff --git a/3rdparty/libflac/src/libFLAC/stream_encoder_intrin_ssse3.c b/3rdparty/libflac/src/libFLAC/stream_encoder_intrin_ssse3.c new file mode 100644 index 00000000000..241f723a6ba --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/stream_encoder_intrin_ssse3.c @@ -0,0 +1,148 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "private/cpu.h" + +#ifndef FLAC__NO_ASM +#if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN +#include "private/stream_encoder.h" +#include "private/bitmath.h" +#ifdef FLAC__SSSE3_SUPPORTED + +#include <stdlib.h> /* for abs() */ +#include <tmmintrin.h> /* SSSE3 */ +#include "FLAC/assert.h" + +FLAC__SSE_TARGET("ssse3") +void FLAC__precompute_partition_info_sums_intrin_ssse3(const FLAC__int32 residual[], FLAC__uint64 abs_residual_partition_sums[], + uint32_t residual_samples, uint32_t predictor_order, uint32_t min_partition_order, uint32_t max_partition_order, uint32_t bps) +{ + const uint32_t default_partition_samples = (residual_samples + predictor_order) >> max_partition_order; + uint32_t partitions = 1u << max_partition_order; + + FLAC__ASSERT(default_partition_samples > predictor_order); + + /* first do max_partition_order */ + { + const uint32_t threshold = 32 - FLAC__bitmath_ilog2(default_partition_samples); + uint32_t partition, residual_sample, end = (uint32_t)(-(int32_t)predictor_order); + + if(bps + FLAC__MAX_EXTRA_RESIDUAL_BPS < threshold) { + for(partition = residual_sample = 0; partition < partitions; partition++) { + __m128i mm_sum = _mm_setzero_si128(); + uint32_t e1, e3; + end += default_partition_samples; + + e1 = (residual_sample + 3) & ~3; e3 = end & ~3; + if(e1 > end) + e1 = end; /* try flac -l 1 -b 16 and you'll be here */ + + /* assumption: residual[] is properly aligned so (residual + e1) is properly aligned too and _mm_loadu_si128() is fast */ + for( ; residual_sample < e1; residual_sample++) { + __m128i mm_res = _mm_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); + mm_sum = _mm_add_epi32(mm_sum, mm_res); + } + + for( ; residual_sample < e3; residual_sample+=4) { + __m128i mm_res = _mm_abs_epi32(_mm_loadu_si128((const __m128i*)(const void*)(residual+residual_sample))); + mm_sum = _mm_add_epi32(mm_sum, mm_res); + } + + for( ; residual_sample < end; residual_sample++) { + __m128i mm_res = _mm_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); + mm_sum = _mm_add_epi32(mm_sum, mm_res); + } + + mm_sum = _mm_add_epi32(mm_sum, _mm_shuffle_epi32(mm_sum, _MM_SHUFFLE(1,0,3,2))); + mm_sum = _mm_add_epi32(mm_sum, _mm_shufflelo_epi16(mm_sum, _MM_SHUFFLE(1,0,3,2))); + abs_residual_partition_sums[partition] = (FLAC__uint32)_mm_cvtsi128_si32(mm_sum); +/* workaround for MSVC bugs (at least versions 2015 and 2017 are affected) */ +#if (defined _MSC_VER) && (defined FLAC__CPU_X86_64) + abs_residual_partition_sums[partition] &= 0xFFFFFFFF; +#endif + } + } + else { /* have to pessimistically use 64 bits for accumulator */ + for(partition = residual_sample = 0; partition < partitions; partition++) { + __m128i mm_sum = _mm_setzero_si128(); + uint32_t e1, e3; + end += default_partition_samples; + + e1 = (residual_sample + 1) & ~1; e3 = end & ~1; + FLAC__ASSERT(e1 <= end); + + for( ; residual_sample < e1; residual_sample++) { + __m128i mm_res = _mm_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); /* 0 0 0 |r0| == 00 |r0_64| */ + mm_sum = _mm_add_epi64(mm_sum, mm_res); + } + + for( ; residual_sample < e3; residual_sample+=2) { + __m128i mm_res = _mm_abs_epi32(_mm_loadl_epi64((const __m128i*)(const void*)(residual+residual_sample))); /* 0 0 |r1| |r0| */ + mm_res = _mm_shuffle_epi32(mm_res, _MM_SHUFFLE(3,1,2,0)); /* 0 |r1| 0 |r0| == |r1_64| |r0_64| */ + mm_sum = _mm_add_epi64(mm_sum, mm_res); + } + + for( ; residual_sample < end; residual_sample++) { + __m128i mm_res = _mm_abs_epi32(_mm_cvtsi32_si128(residual[residual_sample])); + mm_sum = _mm_add_epi64(mm_sum, mm_res); + } + + mm_sum = _mm_add_epi64(mm_sum, _mm_srli_si128(mm_sum, 8)); + _mm_storel_epi64((__m128i*)(void*)(abs_residual_partition_sums+partition), mm_sum); + } + } + } + + /* now merge partitions for lower orders */ + { + uint32_t from_partition = 0, to_partition = partitions; + int partition_order; + for(partition_order = (int)max_partition_order - 1; partition_order >= (int)min_partition_order; partition_order--) { + uint32_t i; + partitions >>= 1; + for(i = 0; i < partitions; i++) { + abs_residual_partition_sums[to_partition++] = + abs_residual_partition_sums[from_partition ] + + abs_residual_partition_sums[from_partition+1]; + from_partition += 2; + } + } + } +} + +#endif /* FLAC__SSSE3_SUPPORTED */ +#endif /* (FLAC__CPU_IA32 || FLAC__CPU_X86_64) && FLAC__HAS_X86INTRIN */ +#endif /* FLAC__NO_ASM */ diff --git a/3rdparty/libflac/src/libFLAC/version.rc b/3rdparty/libflac/src/libFLAC/version.rc new file mode 100644 index 00000000000..019da1dd25e --- /dev/null +++ b/3rdparty/libflac/src/libFLAC/version.rc @@ -0,0 +1,40 @@ +#include <winver.h> +#include "config.h" +#include "FLAC/export.h" + +#if (defined GIT_COMMIT_HASH && defined GIT_COMMIT_DATE) +# ifdef GIT_COMMIT_TAG +# define VERSIONSTRING GIT_COMMIT_TAG +# else +# define VERSIONSTRING "git-" GIT_COMMIT_HASH +# endif +#else +# define VERSIONSTRING PACKAGE_VERSION +#endif + +#define xstr(s) str(s) +#define str(s) #s + +VS_VERSION_INFO VERSIONINFO +FILEVERSION FLAC_API_VERSION_CURRENT,FLAC_API_VERSION_REVISION,0,0 +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0 +FILEOS VOS__WINDOWS32 +FILETYPE VFT_DLL +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "libFLAC for Windows" + VALUE "ProductName", "Free Lossless Audio Codec" + VALUE "ProductVersion", VERSIONSTRING + VALUE "CompanyName", "Xiph.Org" + VALUE "LegalCopyright", "2000-2009 Josh Coalson, 2011-2023 Xiph.Org Foundation" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/3rdparty/libflac/src/libFLAC/window.c b/3rdparty/libflac/src/libFLAC/window.c index b35c72efeac..69d5464afef 100644 --- a/3rdparty/libflac/src/libFLAC/window.c +++ b/3rdparty/libflac/src/libFLAC/window.c @@ -1,5 +1,6 @@ /* libFLAC - Free Lossless Audio Codec library - * Copyright (C) 2006,2007 Josh Coalson + * Copyright (C) 2006-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,18 +35,18 @@ #endif #include <math.h> +#include "share/compat.h" #include "FLAC/assert.h" #include "FLAC/format.h" #include "private/window.h" #ifndef FLAC__INTEGER_ONLY_LIBRARY -#ifndef M_PI -/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */ -#define M_PI 3.14159265358979323846 +#if defined(_MSC_VER) +// silence 25 MSVC warnings 'conversion from 'double' to 'float', possible loss of data' +#pragma warning ( disable : 4244 ) #endif - void FLAC__window_bartlett(FLAC__real *window, const FLAC__int32 L) { const FLAC__int32 N = L - 1; @@ -61,7 +62,7 @@ void FLAC__window_bartlett(FLAC__real *window, const FLAC__int32 L) for (n = 0; n <= L/2-1; n++) window[n] = 2.0f * n / (float)N; for (; n <= N; n++) - window[n] = 2.0f - 2.0f * (N-n) / (float)N; + window[n] = 2.0f - 2.0f * n / (float)N; } } @@ -71,7 +72,7 @@ void FLAC__window_bartlett_hann(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.62f - 0.48f * fabs((float)n/(float)N+0.5f) + 0.38f * cos(2.0f * M_PI * ((float)n/(float)N+0.5f))); + window[n] = (FLAC__real)(0.62f - 0.48f * fabsf((float)n/(float)N-0.5f) - 0.38f * cosf(2.0f * M_PI * ((float)n/(float)N))); } void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L) @@ -80,7 +81,7 @@ void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.42f - 0.5f * cos(2.0f * M_PI * n / N) + 0.08f * cos(4.0f * M_PI * n / N)); + window[n] = (FLAC__real)(0.42f - 0.5f * cosf(2.0f * M_PI * n / N) + 0.08f * cosf(4.0f * M_PI * n / N)); } /* 4-term -92dB side-lobe */ @@ -90,7 +91,7 @@ void FLAC__window_blackman_harris_4term_92db_sidelobe(FLAC__real *window, const FLAC__int32 n; for (n = 0; n <= N; n++) - window[n] = (FLAC__real)(0.35875f - 0.48829f * cos(2.0f * M_PI * n / N) + 0.14128f * cos(4.0f * M_PI * n / N) - 0.01168f * cos(6.0f * M_PI * n / N)); + window[n] = (FLAC__real)(0.35875f - 0.48829f * cosf(2.0f * M_PI * n / N) + 0.14128f * cosf(4.0f * M_PI * n / N) - 0.01168f * cosf(6.0f * M_PI * n / N)); } void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L) @@ -112,7 +113,7 @@ void FLAC__window_flattop(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = (FLAC__real)(1.0f - 1.93f * cos(2.0f * M_PI * n / N) + 1.29f * cos(4.0f * M_PI * n / N) - 0.388f * cos(6.0f * M_PI * n / N) + 0.0322f * cos(8.0f * M_PI * n / N)); + window[n] = (FLAC__real)(0.21557895f - 0.41663158f * cosf(2.0f * M_PI * n / N) + 0.277263158f * cosf(4.0f * M_PI * n / N) - 0.083578947f * cosf(6.0f * M_PI * n / N) + 0.006947368f * cosf(8.0f * M_PI * n / N)); } void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__real stddev) @@ -121,9 +122,15 @@ void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__rea const double N2 = (double)N / 2.; FLAC__int32 n; - for (n = 0; n <= N; n++) { - const double k = ((double)n - N2) / (stddev * N2); - window[n] = (FLAC__real)exp(-0.5f * k * k); + if(!(stddev > 0.0f && stddev <= 0.5f)) + /* stddev is not between 0 and 0.5, might be NaN. + * Default to 0.5 */ + FLAC__window_gauss(window, L, 0.25f); + else { + for (n = 0; n <= N; n++) { + const double k = ((double)n - N2) / (stddev * N2); + window[n] = (FLAC__real)exp(-0.5f * k * k); + } } } @@ -133,7 +140,7 @@ void FLAC__window_hamming(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.54f - 0.46f * cos(2.0f * M_PI * n / N)); + window[n] = (FLAC__real)(0.54f - 0.46f * cosf(2.0f * M_PI * n / N)); } void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L) @@ -142,7 +149,7 @@ void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.5f - 0.5f * cos(2.0f * M_PI * n / N)); + window[n] = (FLAC__real)(0.5f - 0.5f * cosf(2.0f * M_PI * n / N)); } void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L) @@ -151,7 +158,7 @@ void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.402f - 0.498f * cos(2.0f * M_PI * n / N) + 0.098f * cos(4.0f * M_PI * n / N) - 0.001f * cos(6.0f * M_PI * n / N)); + window[n] = (FLAC__real)(0.402f - 0.498f * cosf(2.0f * M_PI * n / N) + 0.098f * cosf(4.0f * M_PI * n / N) - 0.001f * cosf(6.0f * M_PI * n / N)); } void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L) @@ -160,7 +167,7 @@ void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; for (n = 0; n < L; n++) - window[n] = (FLAC__real)(0.3635819f - 0.4891775f*cos(2.0f*M_PI*n/N) + 0.1365995f*cos(4.0f*M_PI*n/N) - 0.0106411f*cos(6.0f*M_PI*n/N)); + window[n] = (FLAC__real)(0.3635819f - 0.4891775f*cosf(2.0f*M_PI*n/N) + 0.1365995f*cosf(4.0f*M_PI*n/N) - 0.0106411f*cosf(6.0f*M_PI*n/N)); } void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L) @@ -176,16 +183,16 @@ void FLAC__window_triangle(FLAC__real *window, const FLAC__int32 L) FLAC__int32 n; if (L & 1) { - for (n = 1; n <= L+1/2; n++) + for (n = 1; n <= (L+1)/2; n++) window[n-1] = 2.0f * n / ((float)L + 1.0f); for (; n <= L; n++) - window[n-1] = - (float)(2 * (L - n + 1)) / ((float)L + 1.0f); + window[n-1] = (float)(2 * (L - n + 1)) / ((float)L + 1.0f); } else { for (n = 1; n <= L/2; n++) - window[n-1] = 2.0f * n / (float)L; + window[n-1] = 2.0f * n / ((float)L + 1.0f); for (; n <= L; n++) - window[n-1] = ((float)(2 * (L - n)) + 1.0f) / (float)L; + window[n-1] = (float)(2 * (L - n + 1)) / ((float)L + 1.0f); } } @@ -195,6 +202,10 @@ void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__rea FLAC__window_rectangle(window, L); else if (p >= 1.0) FLAC__window_hann(window, L); + else if (!(p > 0.0f && p < 1.0f)) + /* p is not between 0 and 1, probably NaN. + * Default to 0.5 */ + FLAC__window_tukey(window, L, 0.5f); else { const FLAC__int32 Np = (FLAC__int32)(p / 2.0f * L) - 1; FLAC__int32 n; @@ -203,13 +214,81 @@ void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__rea /* ...replace ends with hann */ if (Np > 0) { for (n = 0; n <= Np; n++) { - window[n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * n / Np)); - window[L-Np-1+n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * (n+Np) / Np)); + window[n] = (FLAC__real)(0.5f - 0.5f * cosf(M_PI * n / Np)); + window[L-Np-1+n] = (FLAC__real)(0.5f - 0.5f * cosf(M_PI * (n+Np) / Np)); } } } } +void FLAC__window_partial_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p, const FLAC__real start, const FLAC__real end) +{ + const FLAC__int32 start_n = (FLAC__int32)(start * L); + const FLAC__int32 end_n = (FLAC__int32)(end * L); + const FLAC__int32 N = end_n - start_n; + FLAC__int32 Np, n, i; + + if (p <= 0.0f) + FLAC__window_partial_tukey(window, L, 0.05f, start, end); + else if (p >= 1.0f) + FLAC__window_partial_tukey(window, L, 0.95f, start, end); + else if (!(p > 0.0f && p < 1.0f)) + /* p is not between 0 and 1, probably NaN. + * Default to 0.5 */ + FLAC__window_partial_tukey(window, L, 0.5f, start, end); + else { + + Np = (FLAC__int32)(p / 2.0f * N); + + for (n = 0; n < start_n && n < L; n++) + window[n] = 0.0f; + for (i = 1; n < (start_n+Np) && n < L; n++, i++) + window[n] = (FLAC__real)(0.5f - 0.5f * cosf(M_PI * i / Np)); + for (; n < (end_n-Np) && n < L; n++) + window[n] = 1.0f; + for (i = Np; n < end_n && n < L; n++, i--) + window[n] = (FLAC__real)(0.5f - 0.5f * cosf(M_PI * i / Np)); + for (; n < L; n++) + window[n] = 0.0f; + } +} + +void FLAC__window_punchout_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p, const FLAC__real start, const FLAC__real end) +{ + const FLAC__int32 start_n = (FLAC__int32)(start * L); + const FLAC__int32 end_n = (FLAC__int32)(end * L); + FLAC__int32 Ns, Ne, n, i; + + if (p <= 0.0f) + FLAC__window_punchout_tukey(window, L, 0.05f, start, end); + else if (p >= 1.0f) + FLAC__window_punchout_tukey(window, L, 0.95f, start, end); + else if (!(p > 0.0f && p < 1.0f)) + /* p is not between 0 and 1, probably NaN. + * Default to 0.5 */ + FLAC__window_punchout_tukey(window, L, 0.5f, start, end); + else { + + Ns = (FLAC__int32)(p / 2.0f * start_n); + Ne = (FLAC__int32)(p / 2.0f * (L - end_n)); + + for (n = 0, i = 1; n < Ns && n < L; n++, i++) + window[n] = (FLAC__real)(0.5f - 0.5f * cosf(M_PI * i / Ns)); + for (; n < start_n-Ns && n < L; n++) + window[n] = 1.0f; + for (i = Ns; n < start_n && n < L; n++, i--) + window[n] = (FLAC__real)(0.5f - 0.5f * cosf(M_PI * i / Ns)); + for (; n < end_n && n < L; n++) + window[n] = 0.0f; + for (i = 1; n < end_n+Ne && n < L; n++, i++) + window[n] = (FLAC__real)(0.5f - 0.5f * cosf(M_PI * i / Ne)); + for (; n < L - (Ne) && n < L; n++) + window[n] = 1.0f; + for (i = Ne; n < L; n++, i--) + window[n] = (FLAC__real)(0.5f - 0.5f * cosf(M_PI * i / Ne)); + } +} + void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L) { const FLAC__int32 N = L - 1; @@ -222,4 +301,8 @@ void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L) } } +#if defined(_MSC_VER) +#pragma warning ( default : 4244 ) +#endif + #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ diff --git a/3rdparty/libflac/src/metaflac/CMakeLists.txt b/3rdparty/libflac/src/metaflac/CMakeLists.txt new file mode 100644 index 00000000000..b8af705831d --- /dev/null +++ b/3rdparty/libflac/src/metaflac/CMakeLists.txt @@ -0,0 +1,18 @@ +add_executable(metaflac + main.c + operations.c + operations_shorthand_cuesheet.c + operations_shorthand_picture.c + operations_shorthand_seektable.c + operations_shorthand_streaminfo.c + operations_shorthand_vorbiscomment.c + options.c + usage.c + utils.c + version.rc + $<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h> + $<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>) +target_link_libraries(metaflac FLAC getopt utf8) + +install(TARGETS metaflac EXPORT targets + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") diff --git a/3rdparty/libflac/src/metaflac/Makefile.am b/3rdparty/libflac/src/metaflac/Makefile.am index 92aa50bf467..8c212ff40e2 100644 --- a/3rdparty/libflac/src/metaflac/Makefile.am +++ b/3rdparty/libflac/src/metaflac/Makefile.am @@ -1,5 +1,6 @@ # metaflac - Command-line FLAC metadata editor -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,18 +12,25 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 OS_IS_WINDOWS +win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la +if HAVE_WINDRES +metaflac_DEPENDENCIES = version.o +windows_resource_link = -Wl,version.o +endif +endif bin_PROGRAMS = metaflac AM_CFLAGS = @OGG_CFLAGS@ - +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include EXTRA_DIST = \ - Makefile.lite \ - metaflac.dsp \ - metaflac.vcproj + CMakeLists.txt \ + version.rc metaflac_SOURCES = \ main.c \ @@ -40,15 +48,18 @@ metaflac_SOURCES = \ options.h \ usage.h \ utils.h -metaflac_LDFLAGS = +metaflac_LDFLAGS = $(AM_LDFLAGS) $(windows_resource_link) metaflac_LDADD = \ $(top_builddir)/src/share/grabbag/libgrabbag.la \ $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/share/getopt/libgetopt.a \ + $(top_builddir)/src/share/getopt/libgetopt.la \ $(top_builddir)/src/share/utf8/libutf8.la \ $(top_builddir)/src/libFLAC/libFLAC.la \ - @OGG_LIBS@ \ - @LIBICONV@ \ - @MINGW_WINSOCK_LIBS@ \ - -lm + $(win_utf8_lib) \ + @LTLIBICONV@ + +CLEANFILES = metaflac.exe + +.rc.o: + $(RC) $(AM_CPPFLAGS) $< $@ diff --git a/3rdparty/libflac/src/metaflac/Makefile.in b/3rdparty/libflac/src/metaflac/Makefile.in index 4f6872ed4c9..dae2fae5351 100644 --- a/3rdparty/libflac/src/metaflac/Makefile.in +++ b/3rdparty/libflac/src/metaflac/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # metaflac - Command-line FLAC metadata editor -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,20 +28,71 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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. -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +104,132 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +@HAVE_WINDRES_FALSE@metaflac_DEPENDENCIES = $(top_builddir)/src/share/grabbag/libgrabbag.la \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/share/getopt/libgetopt.la \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/share/utf8/libutf8.la \ +@HAVE_WINDRES_FALSE@ $(top_builddir)/src/libFLAC/libFLAC.la \ +@HAVE_WINDRES_FALSE@ $(win_utf8_lib) +@OS_IS_WINDOWS_FALSE@metaflac_DEPENDENCIES = $(top_builddir)/src/share/grabbag/libgrabbag.la \ +@OS_IS_WINDOWS_FALSE@ $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ +@OS_IS_WINDOWS_FALSE@ $(top_builddir)/src/share/getopt/libgetopt.la \ +@OS_IS_WINDOWS_FALSE@ $(top_builddir)/src/share/utf8/libutf8.la \ +@OS_IS_WINDOWS_FALSE@ $(top_builddir)/src/libFLAC/libFLAC.la \ +@OS_IS_WINDOWS_FALSE@ $(win_utf8_lib) +bin_PROGRAMS = metaflac$(EXEEXT) +subdir = src/metaflac +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_metaflac_OBJECTS = main.$(OBJEXT) operations.$(OBJEXT) \ + operations_shorthand_cuesheet.$(OBJEXT) \ + operations_shorthand_picture.$(OBJEXT) \ + operations_shorthand_seektable.$(OBJEXT) \ + operations_shorthand_streaminfo.$(OBJEXT) \ + operations_shorthand_vorbiscomment.$(OBJEXT) options.$(OBJEXT) \ + usage.$(OBJEXT) utils.$(OBJEXT) +metaflac_OBJECTS = $(am_metaflac_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +metaflac_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(metaflac_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/main.Po ./$(DEPDIR)/operations.Po \ + ./$(DEPDIR)/operations_shorthand_cuesheet.Po \ + ./$(DEPDIR)/operations_shorthand_picture.Po \ + ./$(DEPDIR)/operations_shorthand_seektable.Po \ + ./$(DEPDIR)/operations_shorthand_streaminfo.Po \ + ./$(DEPDIR)/operations_shorthand_vorbiscomment.Po \ + ./$(DEPDIR)/options.Po ./$(DEPDIR)/usage.Po \ + ./$(DEPDIR)/utils.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(metaflac_SOURCES) +DIST_SOURCES = $(metaflac_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,168 +238,151 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - -bin_PROGRAMS = metaflac - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +@OS_IS_WINDOWS_TRUE@win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la +@HAVE_WINDRES_TRUE@@OS_IS_WINDOWS_TRUE@metaflac_DEPENDENCIES = version.o +@HAVE_WINDRES_TRUE@@OS_IS_WINDOWS_TRUE@windows_resource_link = -Wl,version.o AM_CFLAGS = @OGG_CFLAGS@ - +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include EXTRA_DIST = \ - Makefile.lite \ - metaflac.dsp \ - metaflac.vcproj - + CMakeLists.txt \ + version.rc metaflac_SOURCES = \ main.c \ @@ -246,154 +401,150 @@ metaflac_SOURCES = \ usage.h \ utils.h -metaflac_LDFLAGS = - +metaflac_LDFLAGS = $(AM_LDFLAGS) $(windows_resource_link) metaflac_LDADD = \ $(top_builddir)/src/share/grabbag/libgrabbag.la \ $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/share/getopt/libgetopt.a \ + $(top_builddir)/src/share/getopt/libgetopt.la \ $(top_builddir)/src/share/utf8/libutf8.la \ $(top_builddir)/src/libFLAC/libFLAC.la \ - @OGG_LIBS@ \ - @LIBICONV@ \ - @MINGW_WINSOCK_LIBS@ \ - -lm - -subdir = src/metaflac -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -bin_PROGRAMS = metaflac$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am_metaflac_OBJECTS = main.$(OBJEXT) operations.$(OBJEXT) \ - operations_shorthand_cuesheet.$(OBJEXT) \ - operations_shorthand_picture.$(OBJEXT) \ - operations_shorthand_seektable.$(OBJEXT) \ - operations_shorthand_streaminfo.$(OBJEXT) \ - operations_shorthand_vorbiscomment.$(OBJEXT) options.$(OBJEXT) \ - usage.$(OBJEXT) utils.$(OBJEXT) -metaflac_OBJECTS = $(am_metaflac_OBJECTS) -metaflac_DEPENDENCIES = $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/share/getopt/libgetopt.a \ - $(top_builddir)/src/share/utf8/libutf8.la \ - $(top_builddir)/src/libFLAC/libFLAC.la - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/main.Po ./$(DEPDIR)/operations.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/operations_shorthand_cuesheet.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/operations_shorthand_picture.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/operations_shorthand_seektable.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/operations_shorthand_streaminfo.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/operations_shorthand_vorbiscomment.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/options.Po ./$(DEPDIR)/usage.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/utils.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(metaflac_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(metaflac_SOURCES) + $(win_utf8_lib) \ + @LTLIBICONV@ +CLEANFILES = metaflac.exe all: all-am .SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/metaflac/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +.SUFFIXES: .c .lo .o .obj .rc +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/metaflac/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/metaflac/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \ - else :; fi; \ - done + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p \ + || test -f $$p1 \ + ; then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' \ + -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ - done + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' \ + `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -metaflac$(EXEEXT): $(metaflac_OBJECTS) $(metaflac_DEPENDENCIES) + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +metaflac$(EXEEXT): $(metaflac_OBJECTS) $(metaflac_DEPENDENCIES) $(EXTRA_metaflac_DEPENDENCIES) @rm -f metaflac$(EXEEXT) - $(LINK) $(metaflac_LDFLAGS) $(metaflac_OBJECTS) $(metaflac_LDADD) $(LIBS) + $(AM_V_CCLD)$(metaflac_LINK) $(metaflac_OBJECTS) $(metaflac_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_cuesheet.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_picture.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_seektable.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_streaminfo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_vorbiscomment.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usage.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_cuesheet.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_picture.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_seektable.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_streaminfo.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/operations_shorthand_vorbiscomment.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usage.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -401,101 +552,97 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -506,16 +653,23 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -525,31 +679,71 @@ clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/operations.Po + -rm -f ./$(DEPDIR)/operations_shorthand_cuesheet.Po + -rm -f ./$(DEPDIR)/operations_shorthand_picture.Po + -rm -f ./$(DEPDIR)/operations_shorthand_seektable.Po + -rm -f ./$(DEPDIR)/operations_shorthand_streaminfo.Po + -rm -f ./$(DEPDIR)/operations_shorthand_vorbiscomment.Po + -rm -f ./$(DEPDIR)/options.Po + -rm -f ./$(DEPDIR)/usage.Po + -rm -f ./$(DEPDIR)/utils.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: install-binPROGRAMS +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/operations.Po + -rm -f ./$(DEPDIR)/operations_shorthand_cuesheet.Po + -rm -f ./$(DEPDIR)/operations_shorthand_picture.Po + -rm -f ./$(DEPDIR)/operations_shorthand_seektable.Po + -rm -f ./$(DEPDIR)/operations_shorthand_streaminfo.Po + -rm -f ./$(DEPDIR)/operations_shorthand_vorbiscomment.Po + -rm -f ./$(DEPDIR)/options.Po + -rm -f ./$(DEPDIR)/usage.Po + -rm -f ./$(DEPDIR)/utils.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -566,19 +760,29 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binPROGRAMS uninstall-info-am +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-info-am + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS + +.PRECIOUS: Makefile + + +.rc.o: + $(RC) $(AM_CPPFLAGS) $< $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/metaflac/Makefile.lite b/3rdparty/libflac/src/metaflac/Makefile.lite deleted file mode 100644 index 56dba51859b..00000000000 --- a/3rdparty/libflac/src/metaflac/Makefile.lite +++ /dev/null @@ -1,49 +0,0 @@ -# metaflac - Command-line FLAC metadata editor -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -PROGRAM_NAME = metaflac - -INCLUDES = -I./include -I$(topdir)/include -I$(OGG_INCLUDE_DIR) - -ifeq ($(DARWIN_BUILD),yes) -EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libFLAC.a $(libdir)/libreplaygain_analysis.a $(libdir)/libgetopt.a $(libdir)/libutf8.a $(OGG_LIB_DIR)/libogg.a -liconv -lm -else -LIBS = -lgrabbag -lFLAC -lreplaygain_analysis -lgetopt -lutf8 -L$(OGG_LIB_DIR) -logg -lm -endif - -SRCS_C = \ - main.c \ - operations.c \ - operations_shorthand_cuesheet.c \ - operations_shorthand_picture.c \ - operations_shorthand_seektable.c \ - operations_shorthand_streaminfo.c \ - operations_shorthand_vorbiscomment.c \ - options.c \ - usage.c \ - utils.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/metaflac/main.c b/3rdparty/libflac/src/metaflac/main.c index d2b8145e26e..bb6629358c9 100644 --- a/3rdparty/libflac/src/metaflac/main.c +++ b/3rdparty/libflac/src/metaflac/main.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,20 +12,27 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include "operations.h" #include "options.h" #include <locale.h> +#include <stdlib.h> +#include <string.h> +#include "share/compat.h" +#ifndef FUZZ_TOOL_METAFLAC int main(int argc, char *argv[]) +#else +static int main_to_fuzz(int argc, char *argv[]) +#endif { CommandLineOptions options; int ret = 0; @@ -33,11 +41,30 @@ int main(int argc, char *argv[]) _response(&argc, &argv); _wildcard(&argc, &argv); #endif +#ifdef _WIN32 + if (get_utf8_argv(&argc, &argv) != 0) { + fputs("ERROR: failed to convert command line parameters to UTF-8\n", stderr); + return 1; + } +#endif +#ifdef _WIN32 + { + const char *var; + var = getenv("LC_ALL"); + if (!var) + var = getenv("LC_NUMERIC"); + if (!var) + var = getenv("LANG"); + if (!var || strcmp(var, "C") != 0) + setlocale(LC_ALL, ""); + } +#else setlocale(LC_ALL, ""); +#endif init_options(&options); - if(parse_options(argc, argv, &options)) + if ((ret = parse_options(argc, argv, &options)) == 0) ret = !do_operations(&options); else ret = 1; diff --git a/3rdparty/libflac/src/metaflac/metaflac.dsp b/3rdparty/libflac/src/metaflac/metaflac.dsp deleted file mode 100644 index aa1fbadd2b6..00000000000 --- a/3rdparty/libflac/src/metaflac/metaflac.dsp +++ /dev/null @@ -1,152 +0,0 @@ -# Microsoft Developer Studio Project File - Name="metaflac" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=metaflac - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "metaflac.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "metaflac.mak" CFG="metaflac - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "metaflac - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "metaflac - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "metaflac - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "." /I "..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\getopt_static.lib ..\..\obj\release\lib\utf8_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "metaflac - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "." /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\getopt_static.lib ..\..\obj\debug\lib\utf8_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "metaflac - Win32 Release" -# Name "metaflac - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\main.c -# End Source File -# Begin Source File - -SOURCE=.\operations.c -# End Source File -# Begin Source File - -SOURCE=.\operations_shorthand_cuesheet.c -# End Source File -# Begin Source File - -SOURCE=.\operations_shorthand_picture.c -# End Source File -# Begin Source File - -SOURCE=.\operations_shorthand_seektable.c -# End Source File -# Begin Source File - -SOURCE=.\operations_shorthand_streaminfo.c -# End Source File -# Begin Source File - -SOURCE=.\operations_shorthand_vorbiscomment.c -# End Source File -# Begin Source File - -SOURCE=.\options.c -# End Source File -# Begin Source File - -SOURCE=.\usage.c -# End Source File -# Begin Source File - -SOURCE=.\utils.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\operations.h -# End Source File -# Begin Source File - -SOURCE=.\options.h -# End Source File -# Begin Source File - -SOURCE=.\usage.h -# End Source File -# Begin Source File - -SOURCE=.\utils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/metaflac/metaflac.vcproj b/3rdparty/libflac/src/metaflac/metaflac.vcproj deleted file mode 100644 index 6da60fe6dc9..00000000000 --- a/3rdparty/libflac/src/metaflac/metaflac.vcproj +++ /dev/null @@ -1,256 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="metaflac" - ProjectGUID="{4cefbc87-c215-11db-8314-0800200c9a66}" - RootNamespace="metaflac" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\operations.h" - > - </File> - <File - RelativePath=".\options.h" - > - </File> - <File - RelativePath=".\usage.h" - > - </File> - <File - RelativePath=".\utils.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\main.c" - > - </File> - <File - RelativePath=".\operations.c" - > - </File> - <File - RelativePath=".\operations_shorthand_cuesheet.c" - > - </File> - <File - RelativePath=".\operations_shorthand_picture.c" - > - </File> - <File - RelativePath=".\operations_shorthand_seektable.c" - > - </File> - <File - RelativePath=".\operations_shorthand_streaminfo.c" - > - </File> - <File - RelativePath=".\operations_shorthand_vorbiscomment.c" - > - </File> - <File - RelativePath=".\options.c" - > - </File> - <File - RelativePath=".\usage.c" - > - </File> - <File - RelativePath=".\utils.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/metaflac/operations.c b/3rdparty/libflac/src/metaflac/operations.c index 54774bf69b0..d81d87a79d5 100644 --- a/3rdparty/libflac/src/metaflac/operations.c +++ b/3rdparty/libflac/src/metaflac/operations.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -27,6 +28,7 @@ #include "FLAC/metadata.h" #include "share/alloc.h" #include "share/grabbag.h" +#include "share/compat.h" #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -42,11 +44,12 @@ static FLAC__bool do_major_operation__remove_all(FLAC__Metadata_Chain *chain, co static FLAC__bool do_shorthand_operations(const CommandLineOptions *options); static FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLineOptions *options); static FLAC__bool do_shorthand_operation(const char *filename, FLAC__bool prefix_with_filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write, FLAC__bool utf8_convert); -static FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned num_files, FLAC__bool preserve_modtime); +static FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned num_files, FLAC__bool preserve_modtime, FLAC__bool scan); static FLAC__bool do_shorthand_operation__add_padding(const char *filename, FLAC__Metadata_Chain *chain, unsigned length, FLAC__bool *needs_write); static FLAC__bool passes_filter(const CommandLineOptions *options, const FLAC__StreamMetadata *block, unsigned block_number); static void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned block_number, FLAC__bool raw, FLAC__bool hexdump_application); +static void write_metadata_binary(FLAC__StreamMetadata *block, FLAC__byte *block_raw, FLAC__bool headerless); /* from operations_shorthand_seektable.c */ extern FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Metadata_Chain *chain, const char *specification, FLAC__bool *needs_write); @@ -186,9 +189,21 @@ FLAC__bool do_major_operation__list(const char *filename, FLAC__Metadata_Chain * block = FLAC__metadata_iterator_get_block(iterator); ok &= (0 != block); if(!ok) - fprintf(stderr, "%s: ERROR: couldn't get block from chain\n", filename); - else if(passes_filter(options, FLAC__metadata_iterator_get_block(iterator), block_number)) - write_metadata(filename, block, block_number, !options->utf8_convert, options->application_data_format_is_hexdump); + flac_fprintf(stderr, "%s: ERROR: couldn't get block from chain\n", filename); + else if(passes_filter(options, FLAC__metadata_iterator_get_block(iterator), block_number)) { + if(!options->data_format_is_binary && !options->data_format_is_binary_headerless) + write_metadata(filename, block, block_number, !options->utf8_convert, options->application_data_format_is_hexdump); + else { + FLAC__byte * block_raw = FLAC__metadata_object_get_raw(block); + if(block_raw == 0) { + flac_fprintf(stderr, "%s: ERROR: couldn't get block in raw form\n", filename); + FLAC__metadata_iterator_delete(iterator); + return false; + } + write_metadata_binary(block, block_raw, options->data_format_is_binary_headerless); + free(block_raw); + } + } block_number++; } while(ok && FLAC__metadata_iterator_next(iterator)); @@ -199,9 +214,124 @@ FLAC__bool do_major_operation__list(const char *filename, FLAC__Metadata_Chain * FLAC__bool do_major_operation__append(FLAC__Metadata_Chain *chain, const CommandLineOptions *options) { - (void) chain, (void) options; - fprintf(stderr, "ERROR: --append not implemented yet\n"); - return false; + FLAC__byte header[FLAC__STREAM_METADATA_HEADER_LENGTH]; + FLAC__byte *buffer; + FLAC__uint32 buffer_size, num_objects = 0, i, append_after = UINT32_MAX; + FLAC__StreamMetadata *object; + FLAC__Metadata_Iterator *iterator = 0; + FLAC__bool has_vorbiscomment = false; + + /* First, find out after which block appending should take place */ + for(i = 0; i < options->args.num_arguments; i++) { + if(options->args.arguments[i].type == ARG__BLOCK_NUMBER) { + if(append_after != UINT32_MAX || options->args.arguments[i].value.block_number.num_entries > 1) { + flac_fprintf(stderr, "ERROR: more than one block number specified with --append\n"); + return false; + } + append_after = options->args.arguments[i].value.block_number.entries[0]; + } + } + + iterator = FLAC__metadata_iterator_new(); + + if(0 == iterator) + die("out of memory allocating iterator"); + + FLAC__metadata_iterator_init(iterator, chain); + + /* Find out whether there is already a vorbis comment block present */ + do { + FLAC__MetadataType type = FLAC__metadata_iterator_get_block_type(iterator); + if(type == FLAC__METADATA_TYPE_VORBIS_COMMENT) + has_vorbiscomment = true; + } + while(FLAC__metadata_iterator_next(iterator)); + + /* Reset iterator */ + FLAC__metadata_iterator_init(iterator, chain); + + /* Go to requested block */ + for(i = 0; i < append_after; i++) { + if(!FLAC__metadata_iterator_next(iterator)) + break; + } + +#ifdef _WIN32 + _setmode(fileno(stdin),_O_BINARY); +#endif + + /* Read header from stdin */ + while(fread(header, 1, FLAC__STREAM_METADATA_HEADER_LENGTH, stdin) == FLAC__STREAM_METADATA_HEADER_LENGTH) { + + buffer_size = ((FLAC__uint32)(header[1]) << 16) + ((FLAC__uint32)(header[2]) << 8) + header[3]; + buffer = safe_malloc_(buffer_size + FLAC__STREAM_METADATA_HEADER_LENGTH); + if(0 == buffer) + die("out of memory allocating read buffer"); + memcpy(buffer, header, FLAC__STREAM_METADATA_HEADER_LENGTH); + + num_objects++; + + if(fread(buffer+FLAC__STREAM_METADATA_HEADER_LENGTH, 1, buffer_size, stdin) < buffer_size) { + flac_fprintf(stderr, "ERROR: couldn't read metadata block #%u from stdin\n",(num_objects)); + free(buffer); + FLAC__metadata_iterator_delete(iterator); + return false; + } + + if((object = FLAC__metadata_object_set_raw(buffer, buffer_size + FLAC__STREAM_METADATA_HEADER_LENGTH)) == NULL) { + flac_fprintf(stderr, "ERROR: couldn't parse supplied metadata block #%u\n",(num_objects)); + free(buffer); + FLAC__metadata_iterator_delete(iterator); + return false; + } + free(buffer); + + if(has_vorbiscomment && object->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { + flac_fprintf(stderr, "ERROR: can't add another vorbis comment block to file, it already has one\n"); + FLAC__metadata_object_delete(object); + FLAC__metadata_iterator_delete(iterator); + return false; + } + + + if(object->type == FLAC__METADATA_TYPE_STREAMINFO) { + flac_fprintf(stderr, "ERROR: can't add streaminfo to file\n"); + FLAC__metadata_object_delete(object); + FLAC__metadata_iterator_delete(iterator); + return false; + } + + if(object->type == FLAC__METADATA_TYPE_SEEKTABLE) { + flac_fprintf(stderr, "ERROR: can't add seektable to file, please use --add-seekpoint instead\n"); + FLAC__metadata_object_delete(object); + FLAC__metadata_iterator_delete(iterator); + return false; + } + + if(!FLAC__metadata_iterator_insert_block_after(iterator, object)) { + flac_fprintf(stderr, "ERROR: couldn't add supplied metadata block #%u to file\n",(num_objects)); + FLAC__metadata_object_delete(object); + FLAC__metadata_iterator_delete(iterator); + return false; + } + /* Now check whether what type of block was added */ + { + FLAC__MetadataType type = FLAC__metadata_iterator_get_block_type(iterator); + if(type == FLAC__METADATA_TYPE_VORBIS_COMMENT) + has_vorbiscomment = true; + } + } + +#ifdef _WIN32 + _setmode(fileno(stdin),_O_TEXT); +#endif + + if(num_objects == 0) + flac_fprintf(stderr, "ERROR: unable to find a metadata block in the supplied input\n"); + + FLAC__metadata_iterator_delete(iterator); + + return true; } FLAC__bool do_major_operation__remove(FLAC__Metadata_Chain *chain, const CommandLineOptions *options) @@ -264,7 +394,9 @@ FLAC__bool do_shorthand_operations(const CommandLineOptions *options) if(ok && options->num_files > 0) { for(i = 0; i < options->ops.num_operations; i++) { if(options->ops.operations[i].type == OP__ADD_REPLAY_GAIN) - ok = do_shorthand_operation__add_replay_gain(options->filenames, options->num_files, options->preserve_modtime); + ok = do_shorthand_operation__add_replay_gain(options->filenames, options->num_files, options->preserve_modtime, false); + else if(options->ops.operations[i].type == OP__SCAN_REPLAY_GAIN) + ok = do_shorthand_operation__add_replay_gain(options->filenames, options->num_files, options->preserve_modtime, true); } } @@ -282,7 +414,8 @@ FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLi if(!FLAC__metadata_chain_read(chain, filename)) { print_error_with_chain_status(chain, "%s: ERROR: reading metadata", filename); - return false; + ok = false; + goto cleanup; } for(i = 0; i < options->ops.num_operations && ok; i++) { @@ -321,6 +454,7 @@ FLAC__bool do_shorthand_operations_on_file(const char *filename, const CommandLi print_error_with_chain_status(chain, "%s: ERROR: writing FLAC file", filename); } + cleanup : FLAC__metadata_chain_delete(chain); return ok; @@ -354,6 +488,7 @@ FLAC__bool do_shorthand_operation(const char *filename, FLAC__bool prefix_with_f case OP__SHOW_VC_VENDOR: case OP__SHOW_VC_FIELD: case OP__REMOVE_VC_ALL: + case OP__REMOVE_VC_ALL_EXCEPT: case OP__REMOVE_VC_FIELD: case OP__REMOVE_VC_FIRSTFIELD: case OP__SET_VC_FIELD: @@ -373,7 +508,8 @@ FLAC__bool do_shorthand_operation(const char *filename, FLAC__bool prefix_with_f ok = do_shorthand_operation__add_seekpoints(filename, chain, operation->argument.add_seekpoint.specification, needs_write); break; case OP__ADD_REPLAY_GAIN: - /* this command is always executed last */ + case OP__SCAN_REPLAY_GAIN: + /* these commands are always executed last */ ok = true; break; case OP__ADD_PADDING: @@ -388,7 +524,7 @@ FLAC__bool do_shorthand_operation(const char *filename, FLAC__bool prefix_with_f return ok; } -FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned num_files, FLAC__bool preserve_modtime) +FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned num_files, FLAC__bool preserve_modtime, FLAC__bool scan) { FLAC__StreamMetadata streaminfo; float *title_gains = 0, *title_peaks = 0; @@ -405,7 +541,7 @@ FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned nu for(i = 0; i < num_files; i++) { FLAC__ASSERT(0 != filenames[i]); if(!FLAC__metadata_get_streaminfo(filenames[i], &streaminfo)) { - fprintf(stderr, "%s: ERROR: can't open file or get STREAMINFO block\n", filenames[i]); + flac_fprintf(stderr, "%s: ERROR: can't open file or get STREAMINFO block\n", filenames[i]); return false; } if(first) { @@ -416,45 +552,48 @@ FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned nu } else { if(sample_rate != streaminfo.data.stream_info.sample_rate) { - fprintf(stderr, "%s: ERROR: sample rate of %u Hz does not match previous files' %u Hz\n", filenames[i], streaminfo.data.stream_info.sample_rate, sample_rate); + flac_fprintf(stderr, "%s: ERROR: sample rate of %u Hz does not match previous files' %u Hz\n", filenames[i], streaminfo.data.stream_info.sample_rate, sample_rate); return false; } if(bits_per_sample != streaminfo.data.stream_info.bits_per_sample) { - fprintf(stderr, "%s: ERROR: resolution of %u bps does not match previous files' %u bps\n", filenames[i], streaminfo.data.stream_info.bits_per_sample, bits_per_sample); + flac_fprintf(stderr, "%s: ERROR: resolution of %u bps does not match previous files' %u bps\n", filenames[i], streaminfo.data.stream_info.bits_per_sample, bits_per_sample); return false; } if(channels != streaminfo.data.stream_info.channels) { - fprintf(stderr, "%s: ERROR: # channels (%u) does not match previous files' (%u)\n", filenames[i], streaminfo.data.stream_info.channels, channels); + flac_fprintf(stderr, "%s: ERROR: # channels (%u) does not match previous files' (%u)\n", filenames[i], streaminfo.data.stream_info.channels, channels); return false; } } if(!grabbag__replaygain_is_valid_sample_frequency(sample_rate)) { - fprintf(stderr, "%s: ERROR: sample rate of %u Hz is not supported\n", filenames[i], sample_rate); + flac_fprintf(stderr, "%s: ERROR: sample rate of %u Hz is not supported\n", filenames[i], sample_rate); return false; } if(channels != 1 && channels != 2) { - fprintf(stderr, "%s: ERROR: # of channels (%u) is not supported, must be 1 or 2\n", filenames[i], channels); + flac_fprintf(stderr, "%s: ERROR: # of channels (%u) is not supported, must be 1 or 2\n", filenames[i], channels); + return false; + } + if(bits_per_sample < FLAC__MIN_BITS_PER_SAMPLE || bits_per_sample > FLAC__MAX_BITS_PER_SAMPLE) { + flac_fprintf(stderr, "%s: ERROR: resolution (%u) is not supported, must be between %u and %u\n", filenames[i], bits_per_sample, FLAC__MIN_BITS_PER_SAMPLE, FLAC__MAX_BITS_PER_SAMPLE); return false; } } - FLAC__ASSERT(bits_per_sample >= FLAC__MIN_BITS_PER_SAMPLE && bits_per_sample <= FLAC__MAX_BITS_PER_SAMPLE); if(!grabbag__replaygain_init(sample_rate)) { FLAC__ASSERT(0); /* double protection */ - fprintf(stderr, "internal error\n"); + flac_fprintf(stderr, "internal error\n"); return false; } if( - 0 == (title_gains = (float*)safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) || - 0 == (title_peaks = (float*)safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) + 0 == (title_gains = safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) || + 0 == (title_peaks = safe_malloc_mul_2op_(sizeof(float), /*times*/num_files)) ) die("out of memory allocating space for title gains/peaks"); for(i = 0; i < num_files; i++) { if(0 != (error = grabbag__replaygain_analyze_file(filenames[i], title_gains+i, title_peaks+i))) { - fprintf(stderr, "%s: ERROR: during analysis (%s)\n", filenames[i], error); + flac_fprintf(stderr, "%s: ERROR: during analysis (%s)\n", filenames[i], error); free(title_gains); free(title_peaks); return false; @@ -463,11 +602,15 @@ FLAC__bool do_shorthand_operation__add_replay_gain(char **filenames, unsigned nu grabbag__replaygain_get_album(&album_gain, &album_peak); for(i = 0; i < num_files; i++) { - if(0 != (error = grabbag__replaygain_store_to_file(filenames[i], album_gain, album_peak, title_gains[i], title_peaks[i], preserve_modtime))) { - fprintf(stderr, "%s: ERROR: writing tags (%s)\n", filenames[i], error); - free(title_gains); - free(title_peaks); - return false; + if(!scan) { + if(0 != (error = grabbag__replaygain_store_to_file(filenames[i], album_gain, album_peak, title_gains[i], title_peaks[i], preserve_modtime))) { + flac_fprintf(stderr, "%s: ERROR: writing tags (%s)\n", filenames[i], error); + free(title_gains); + free(title_peaks); + return false; + } + } else { + flac_fprintf(stdout, "%s: %f %f %f %f\n", filenames[i], album_gain, album_peak, title_gains[i], title_peaks[i]); } } @@ -550,7 +693,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned unsigned i, j; /*@@@ yuck, should do this with a varargs function or something: */ -#define PPR if(filename)printf("%s:",filename); +#define PPR if(filename) { if(raw) printf("%s:",filename); else flac_printf("%s:",filename); } PPR; printf("METADATA block #%u\n", block_number); PPR; printf(" type: %u (%s)\n", (unsigned)block->type, block->type < FLAC__METADATA_TYPE_UNDEFINED? FLAC__MetadataTypeString[block->type] : "UNKNOWN"); PPR; printf(" is last: %s\n", block->is_last? "true":"false"); @@ -565,11 +708,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned PPR; printf(" sample_rate: %u Hz\n", block->data.stream_info.sample_rate); PPR; printf(" channels: %u\n", block->data.stream_info.channels); PPR; printf(" bits-per-sample: %u\n", block->data.stream_info.bits_per_sample); -#ifdef _MSC_VER - PPR; printf(" total samples: %I64u\n", block->data.stream_info.total_samples); -#else - PPR; printf(" total samples: %llu\n", (unsigned long long)block->data.stream_info.total_samples); -#endif + PPR; printf(" total samples: %" PRIu64 "\n", block->data.stream_info.total_samples); PPR; printf(" MD5 signature: "); for(i = 0; i < 16; i++) { printf("%02x", (unsigned)block->data.stream_info.md5sum[i]); @@ -596,11 +735,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned PPR; printf(" seek points: %u\n", block->data.seek_table.num_points); for(i = 0; i < block->data.seek_table.num_points; i++) { if(block->data.seek_table.points[i].sample_number != FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER) { -#ifdef _MSC_VER - PPR; printf(" point %u: sample_number=%I64u, stream_offset=%I64u, frame_samples=%u\n", i, block->data.seek_table.points[i].sample_number, block->data.seek_table.points[i].stream_offset, block->data.seek_table.points[i].frame_samples); -#else - PPR; printf(" point %u: sample_number=%llu, stream_offset=%llu, frame_samples=%u\n", i, (unsigned long long)block->data.seek_table.points[i].sample_number, (unsigned long long)block->data.seek_table.points[i].stream_offset, block->data.seek_table.points[i].frame_samples); -#endif + PPR; printf(" point %u: sample_number=%" PRIu64 ", stream_offset=%" PRIu64 ", frame_samples=%u\n", i, block->data.seek_table.points[i].sample_number, block->data.seek_table.points[i].stream_offset, block->data.seek_table.points[i].frame_samples); } else { PPR; printf(" point %u: PLACEHOLDER\n", i); @@ -618,11 +753,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned break; case FLAC__METADATA_TYPE_CUESHEET: PPR; printf(" media catalog number: %s\n", block->data.cue_sheet.media_catalog_number); -#ifdef _MSC_VER - PPR; printf(" lead-in: %I64u\n", block->data.cue_sheet.lead_in); -#else - PPR; printf(" lead-in: %llu\n", (unsigned long long)block->data.cue_sheet.lead_in); -#endif + PPR; printf(" lead-in: %" PRIu64 "\n", block->data.cue_sheet.lead_in); PPR; printf(" is CD: %s\n", block->data.cue_sheet.is_cd? "true":"false"); PPR; printf(" number of tracks: %u\n", block->data.cue_sheet.num_tracks); for(i = 0; i < block->data.cue_sheet.num_tracks; i++) { @@ -630,11 +761,7 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned const FLAC__bool is_last = (i == block->data.cue_sheet.num_tracks-1); const FLAC__bool is_leadout = is_last && track->num_indices == 0; PPR; printf(" track[%u]\n", i); -#ifdef _MSC_VER - PPR; printf(" offset: %I64u\n", track->offset); -#else - PPR; printf(" offset: %llu\n", (unsigned long long)track->offset); -#endif + PPR; printf(" offset: %" PRIu64 "\n", track->offset); if(is_last) { PPR; printf(" number: %u (%s)\n", (unsigned)track->number, is_leadout? "LEAD-OUT" : "INVALID"); } @@ -647,14 +774,10 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned PPR; printf(" pre-emphasis: %s\n", track->pre_emphasis? "true":"false"); PPR; printf(" number of index points: %u\n", track->num_indices); for(j = 0; j < track->num_indices; j++) { - const FLAC__StreamMetadata_CueSheet_Index *index = track->indices+j; + const FLAC__StreamMetadata_CueSheet_Index *indx = track->indices+j; PPR; printf(" index[%u]\n", j); -#ifdef _MSC_VER - PPR; printf(" offset: %I64u\n", index->offset); -#else - PPR; printf(" offset: %llu\n", (unsigned long long)index->offset); -#endif - PPR; printf(" number: %u\n", (unsigned)index->number); + PPR; printf(" offset: %" PRIu64 "\n", indx->offset); + PPR; printf(" number: %u\n", (unsigned)indx->number); } } } @@ -680,3 +803,21 @@ void write_metadata(const char *filename, FLAC__StreamMetadata *block, unsigned } #undef PPR } + +void write_metadata_binary(FLAC__StreamMetadata *block, FLAC__byte *block_raw, FLAC__bool headerless) +{ +#ifdef _WIN32 + fflush(stdout); + _setmode(fileno(stdout),_O_BINARY); +#endif + if(!headerless) + local_fwrite(block_raw, 1, block->length+FLAC__STREAM_METADATA_HEADER_LENGTH, stdout); + else if(block->type == FLAC__METADATA_TYPE_APPLICATION && block->length > 3) + local_fwrite(block_raw+FLAC__STREAM_METADATA_HEADER_LENGTH+4, 1, block->length-4, stdout); + else + local_fwrite(block_raw+FLAC__STREAM_METADATA_HEADER_LENGTH, 1, block->length, stdout); +#ifdef _WIN32 + fflush(stdout); + _setmode(fileno(stdout),_O_TEXT); +#endif +} diff --git a/3rdparty/libflac/src/metaflac/operations.h b/3rdparty/libflac/src/metaflac/operations.h index b5144a36be5..79e1c3ba794 100644 --- a/3rdparty/libflac/src/metaflac/operations.h +++ b/3rdparty/libflac/src/metaflac/operations.h @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 metaflac__operations_h diff --git a/3rdparty/libflac/src/metaflac/operations_shorthand.h b/3rdparty/libflac/src/metaflac/operations_shorthand.h index 112c079b0a6..1877c26858b 100644 --- a/3rdparty/libflac/src/metaflac/operations_shorthand.h +++ b/3rdparty/libflac/src/metaflac/operations_shorthand.h @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 "options.h" diff --git a/3rdparty/libflac/src/metaflac/operations_shorthand_cuesheet.c b/3rdparty/libflac/src/metaflac/operations_shorthand_cuesheet.c index 14912c11931..13c4dedb413 100644 --- a/3rdparty/libflac/src/metaflac/operations_shorthand_cuesheet.c +++ b/3rdparty/libflac/src/metaflac/operations_shorthand_cuesheet.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,25 +12,25 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include <errno.h> -#include <stdio.h> /* for snprintf() */ #include <string.h> #include "options.h" #include "utils.h" #include "FLAC/assert.h" #include "share/grabbag.h" +#include "share/compat.h" #include "operations_shorthand.h" -static FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, const char *cs_filename, FLAC__bool *needs_write, FLAC__uint64 lead_out_offset, FLAC__bool is_cdda, Argument_AddSeekpoint *add_seekpoint_link); +static FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, const char *cs_filename, FLAC__bool *needs_write, FLAC__uint64 lead_out_offset, unsigned sample_rate, FLAC__bool is_cdda, Argument_AddSeekpoint *add_seekpoint_link); static FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cuesheet, const char *cs_filename); FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata_Chain *chain, const Operation *operation, FLAC__bool *needs_write) @@ -39,6 +40,7 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata FLAC__Metadata_Iterator *iterator = FLAC__metadata_iterator_new(); FLAC__uint64 lead_out_offset = 0; FLAC__bool is_cdda = false; + unsigned sample_rate = 0; if(0 == iterator) die("out of memory allocating iterator"); @@ -50,18 +52,25 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata if(block->type == FLAC__METADATA_TYPE_STREAMINFO) { lead_out_offset = block->data.stream_info.total_samples; if(lead_out_offset == 0) { - fprintf(stderr, "%s: ERROR: FLAC file must have total_samples set in STREAMINFO in order to import/export cuesheet\n", filename); + flac_fprintf(stderr, "%s: ERROR: FLAC file must have total_samples set in STREAMINFO in order to import/export cuesheet\n", filename); FLAC__metadata_iterator_delete(iterator); return false; } - is_cdda = (block->data.stream_info.channels == 1 || block->data.stream_info.channels == 2) && (block->data.stream_info.bits_per_sample == 16) && (block->data.stream_info.sample_rate == 44100); + sample_rate = block->data.stream_info.sample_rate; + is_cdda = (block->data.stream_info.channels == 1 || block->data.stream_info.channels == 2) && (block->data.stream_info.bits_per_sample == 16) && (sample_rate == 44100); } else if(block->type == FLAC__METADATA_TYPE_CUESHEET) cuesheet = block; } while(FLAC__metadata_iterator_next(iterator)); if(lead_out_offset == 0) { - fprintf(stderr, "%s: ERROR: FLAC stream has no STREAMINFO block\n", filename); + flac_fprintf(stderr, "%s: ERROR: FLAC stream has no STREAMINFO block\n", filename); + FLAC__metadata_iterator_delete(iterator); + return false; + } + + if(sample_rate == 0) { + flac_fprintf(stderr, "%s: ERROR: cannot parse cuesheet when sample rate is unknown\n", filename); FLAC__metadata_iterator_delete(iterator); return false; } @@ -69,11 +78,11 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata switch(operation->type) { case OP__IMPORT_CUESHEET_FROM: if(0 != cuesheet) { - fprintf(stderr, "%s: ERROR: FLAC file already has CUESHEET block\n", filename); + flac_fprintf(stderr, "%s: ERROR: FLAC file already has CUESHEET block\n", filename); ok = false; } else { - ok = import_cs_from(filename, &cuesheet, operation->argument.import_cuesheet_from.filename, needs_write, lead_out_offset, is_cdda, operation->argument.import_cuesheet_from.add_seekpoint_link); + ok = import_cs_from(filename, &cuesheet, operation->argument.import_cuesheet_from.filename, needs_write, lead_out_offset, sample_rate, is_cdda, operation->argument.import_cuesheet_from.add_seekpoint_link); if(ok) { /* append CUESHEET block */ while(FLAC__metadata_iterator_next(iterator)) @@ -88,7 +97,7 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata break; case OP__EXPORT_CUESHEET_TO: if(0 == cuesheet) { - fprintf(stderr, "%s: ERROR: FLAC file has no CUESHEET block\n", filename); + flac_fprintf(stderr, "%s: ERROR: FLAC file has no CUESHEET block\n", filename); ok = false; } else @@ -108,7 +117,7 @@ FLAC__bool do_shorthand_operation__cuesheet(const char *filename, FLAC__Metadata * local routines */ -FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, const char *cs_filename, FLAC__bool *needs_write, FLAC__uint64 lead_out_offset, FLAC__bool is_cdda, Argument_AddSeekpoint *add_seekpoint_link) +FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, const char *cs_filename, FLAC__bool *needs_write, FLAC__uint64 lead_out_offset, unsigned sample_rate, FLAC__bool is_cdda, Argument_AddSeekpoint *add_seekpoint_link) { FILE *f; const char *error_message; @@ -116,55 +125,52 @@ FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet, unsigned last_line_read; if(0 == cs_filename || strlen(cs_filename) == 0) { - fprintf(stderr, "%s: ERROR: empty import file name\n", filename); + flac_fprintf(stderr, "%s: ERROR: empty import file name\n", filename); return false; } if(0 == strcmp(cs_filename, "-")) f = stdin; else - f = fopen(cs_filename, "r"); + f = flac_fopen(cs_filename, "r"); if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, cs_filename, strerror(errno)); + flac_fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, cs_filename, strerror(errno)); return false; } - *cuesheet = grabbag__cuesheet_parse(f, &error_message, &last_line_read, is_cdda, lead_out_offset); + *cuesheet = grabbag__cuesheet_parse(f, &error_message, &last_line_read, sample_rate, is_cdda, lead_out_offset); if(f != stdin) fclose(f); if(0 == *cuesheet) { - fprintf(stderr, "%s: ERROR: while parsing cuesheet \"%s\" on line %u: %s\n", filename, cs_filename, last_line_read, error_message); + flac_fprintf(stderr, "%s: ERROR: while parsing cuesheet \"%s\" on line %u: %s\n", filename, cs_filename, last_line_read, error_message); return false; } if(!FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/false, &error_message)) { - fprintf(stderr, "%s: ERROR parsing cuesheet \"%s\": %s\n", filename, cs_filename, error_message); + flac_fprintf(stderr, "%s: ERROR parsing cuesheet \"%s\": %s\n", filename, cs_filename, error_message); + FLAC__metadata_object_delete(*cuesheet); return false; } /* if we're expecting CDDA, warn about non-compliance */ if(is_cdda && !FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/true, &error_message)) { - fprintf(stderr, "%s: WARNING cuesheet \"%s\" is not audio CD compliant: %s\n", filename, cs_filename, error_message); + flac_fprintf(stderr, "%s: WARNING cuesheet \"%s\" is not audio CD compliant: %s\n", filename, cs_filename, error_message); (*cuesheet)->data.cue_sheet.is_cd = false; } /* add seekpoints for each index point if required */ if(0 != seekpoint_specification) { char spec[128]; - unsigned track, index; + unsigned track, indx; const FLAC__StreamMetadata_CueSheet *cs = &(*cuesheet)->data.cue_sheet; if(0 == *seekpoint_specification) *seekpoint_specification = local_strdup(""); for(track = 0; track < cs->num_tracks; track++) { const FLAC__StreamMetadata_CueSheet_Track *tr = cs->tracks+track; - for(index = 0; index < tr->num_indices; index++) { -#ifdef _MSC_VER - sprintf(spec, "%I64u;", tr->offset + tr->indices[index].offset); -#else - sprintf(spec, "%llu;", (unsigned long long)(tr->offset + tr->indices[index].offset)); -#endif + for(indx = 0; indx < tr->num_indices; indx++) { + flac_snprintf(spec, sizeof (spec), "%" PRIu64 ";", (tr->offset + tr->indices[indx].offset)); local_strcat(seekpoint_specification, spec); } } @@ -181,30 +187,28 @@ FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cueshe size_t reflen; if(0 == cs_filename || strlen(cs_filename) == 0) { - fprintf(stderr, "%s: ERROR: empty export file name\n", filename); + flac_fprintf(stderr, "%s: ERROR: empty export file name\n", filename); return false; } if(0 == strcmp(cs_filename, "-")) f = stdout; else - f = fopen(cs_filename, "w"); + f = flac_fopen(cs_filename, "w"); if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, cs_filename, strerror(errno)); + flac_fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, cs_filename, strerror(errno)); return false; } reflen = strlen(filename) + 7 + 1; if(0 == (ref = malloc(reflen))) { - fprintf(stderr, "%s: ERROR: allocating memory\n", filename); + flac_fprintf(stderr, "%s: ERROR: allocating memory\n", filename); + if(f != stdout) + fclose(f); return false; } -#if defined _MSC_VER || defined __MINGW32__ - _snprintf(ref, reflen, "\"%s\" FLAC", filename); -#else - snprintf(ref, reflen, "\"%s\" FLAC", filename); -#endif + flac_snprintf(ref, reflen, "\"%s\" FLAC", filename); grabbag__cuesheet_emit(f, cuesheet, ref); @@ -212,6 +216,11 @@ FLAC__bool export_cs_to(const char *filename, const FLAC__StreamMetadata *cueshe if(f != stdout) fclose(f); +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* Delete output file when fuzzing */ + if(f != stdout) + flac_unlink(cs_filename); +#endif return true; } diff --git a/3rdparty/libflac/src/metaflac/operations_shorthand_picture.c b/3rdparty/libflac/src/metaflac/operations_shorthand_picture.c index 9045aaeb6cf..6bb459baa30 100644 --- a/3rdparty/libflac/src/metaflac/operations_shorthand_picture.c +++ b/3rdparty/libflac/src/metaflac/operations_shorthand_picture.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -94,9 +95,9 @@ FLAC__bool do_shorthand_operation__picture(const char *filename, FLAC__Metadata_ } while(FLAC__metadata_iterator_next(iterator) && 0 == picture); if(0 == picture) { if(block_number < 0) - fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block\n", filename); + flac_fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block\n", filename); else - fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block at block #%d\n", filename, block_number); + flac_fprintf(stderr, "%s: ERROR: FLAC file has no PICTURE block at block #%d\n", filename, block_number); ok = false; } else @@ -122,19 +123,21 @@ FLAC__bool import_pic_from(const char *filename, FLAC__StreamMetadata **picture, const char *error_message; if(0 == specification || strlen(specification) == 0) { - fprintf(stderr, "%s: ERROR: empty picture specification\n", filename); + flac_fprintf(stderr, "%s: ERROR: empty picture specification\n", filename); return false; } *picture = grabbag__picture_parse_specification(specification, &error_message); if(0 == *picture) { - fprintf(stderr, "%s: ERROR: while parsing picture specification \"%s\": %s\n", filename, specification, error_message); + flac_fprintf(stderr, "%s: ERROR: while parsing picture specification \"%s\": %s\n", filename, specification, error_message); return false; } if(!FLAC__format_picture_is_legal(&(*picture)->data.picture, &error_message)) { - fprintf(stderr, "%s: ERROR: new PICTURE block for \"%s\" is illegal: %s\n", filename, specification, error_message); + flac_fprintf(stderr, "%s: ERROR: new PICTURE block for \"%s\" is illegal: %s\n", filename, specification, error_message); + FLAC__metadata_object_delete(*picture); + *picture = 0; return false; } @@ -148,26 +151,34 @@ FLAC__bool export_pic_to(const char *filename, const FLAC__StreamMetadata *pictu const FLAC__uint32 len = picture->data.picture.data_length; if(0 == pic_filename || strlen(pic_filename) == 0) { - fprintf(stderr, "%s: ERROR: empty export file name\n", filename); + flac_fprintf(stderr, "%s: ERROR: empty export file name\n", filename); return false; } if(0 == strcmp(pic_filename, "-")) f = grabbag__file_get_binary_stdout(); else - f = fopen(pic_filename, "wb"); + f = flac_fopen(pic_filename, "wb"); if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, pic_filename, strerror(errno)); + flac_fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, pic_filename, strerror(errno)); return false; } if(fwrite(picture->data.picture.data, 1, len, f) != len) { - fprintf(stderr, "%s: ERROR: writing PICTURE data to file\n", filename); + flac_fprintf(stderr, "%s: ERROR: writing PICTURE data to file\n", filename); + if(f != stdout) + fclose(f); return false; } if(f != stdout) fclose(f); +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* Delete output file when fuzzing */ + if(f != stdout) + flac_unlink(pic_filename); +#endif + return true; } diff --git a/3rdparty/libflac/src/metaflac/operations_shorthand_seektable.c b/3rdparty/libflac/src/metaflac/operations_shorthand_seektable.c index 4f4fb5d9f64..c9175b36862 100644 --- a/3rdparty/libflac/src/metaflac/operations_shorthand_seektable.c +++ b/3rdparty/libflac/src/metaflac/operations_shorthand_seektable.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -53,7 +54,8 @@ FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Me } while(!found_seektable_block && FLAC__metadata_iterator_next(iterator)); if(total_samples == 0) { - fprintf(stderr, "%s: ERROR: cannot add seekpoints because STREAMINFO block does not specify total_samples\n", filename); + flac_fprintf(stderr, "%s: ERROR: cannot add seekpoints because STREAMINFO block does not specify total_samples\n", filename); + FLAC__metadata_iterator_delete(iterator); return false; } @@ -67,6 +69,7 @@ FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Me if(!FLAC__metadata_iterator_insert_block_after(iterator, block)) { print_error_with_chain_status(chain, "%s: ERROR: adding new SEEKTABLE block to metadata", filename); FLAC__metadata_object_delete(block); + FLAC__metadata_iterator_delete(iterator); return false; } /* iterator is left pointing to new block */ @@ -79,7 +82,7 @@ FLAC__bool do_shorthand_operation__add_seekpoints(const char *filename, FLAC__Me FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_SEEKTABLE); if(!grabbag__seektable_convert_specification_to_template(specification, /*only_explicit_placeholders=*/false, total_samples, sample_rate, block, /*spec_has_real_points=*/0)) { - fprintf(stderr, "%s: ERROR (internal) preparing seektable with seekpoints\n", filename); + flac_fprintf(stderr, "%s: ERROR (internal) preparing seektable with seekpoints\n", filename); return false; } @@ -178,7 +181,7 @@ FLAC__bool populate_seekpoint_values(const char *filename, FLAC__StreamMetadata decoder = FLAC__stream_decoder_new(); if(0 == decoder) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) creating the decoder instance\n", filename); + flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) creating the decoder instance\n", filename); return false; } @@ -186,28 +189,28 @@ FLAC__bool populate_seekpoint_values(const char *filename, FLAC__StreamMetadata FLAC__stream_decoder_set_metadata_ignore_all(decoder); if(FLAC__stream_decoder_init_file(decoder, filename, write_callback_, /*metadata_callback=*/0, error_callback_, &client_data) != FLAC__STREAM_DECODER_INIT_STATUS_OK) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) initializing the decoder instance (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder)); + flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) initializing the decoder instance (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder)); ok = false; } if(ok && !FLAC__stream_decoder_process_until_end_of_metadata(decoder)) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder)); + flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder)); ok = false; } if(ok && !FLAC__stream_decoder_get_decode_position(decoder, &client_data.audio_offset)) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file\n", filename); + flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file\n", filename); ok = false; } client_data.last_offset = client_data.audio_offset; if(ok && !FLAC__stream_decoder_process_until_end_of_stream(decoder)) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder)); + flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%s)\n", filename, FLAC__stream_decoder_get_resolved_state_string(decoder)); ok = false; } if(ok && client_data.error_occurred) { - fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%u:%s)\n", filename, (unsigned)client_data.error_status, FLAC__StreamDecoderErrorStatusString[client_data.error_status]); + flac_fprintf(stderr, "%s: ERROR (--add-seekpoint) decoding file (%u:%s)\n", filename, (unsigned)client_data.error_status, FLAC__StreamDecoderErrorStatusString[client_data.error_status]); ok = false; } diff --git a/3rdparty/libflac/src/metaflac/operations_shorthand_streaminfo.c b/3rdparty/libflac/src/metaflac/operations_shorthand_streaminfo.c index b4593f50e24..32198416901 100644 --- a/3rdparty/libflac/src/metaflac/operations_shorthand_streaminfo.c +++ b/3rdparty/libflac/src/metaflac/operations_shorthand_streaminfo.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -24,6 +25,7 @@ #include "utils.h" #include "FLAC/assert.h" #include "FLAC/metadata.h" +#include "share/compat.h" #include <string.h> #include "operations_shorthand.h" @@ -45,7 +47,7 @@ FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool p FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_STREAMINFO); if(prefix_with_filename) - printf("%s:", filename); + flac_printf("%s:", filename); switch(operation->type) { case OP__SHOW_MD5SUM: @@ -75,11 +77,7 @@ FLAC__bool do_shorthand_operation__streaminfo(const char *filename, FLAC__bool p printf("%u\n", block->data.stream_info.bits_per_sample); break; case OP__SHOW_TOTAL_SAMPLES: -#ifdef _MSC_VER - printf("%I64u\n", block->data.stream_info.total_samples); -#else - printf("%llu\n", (unsigned long long)block->data.stream_info.total_samples); -#endif + printf("%" PRIu64 "\n", block->data.stream_info.total_samples); break; case OP__SET_MD5SUM: memcpy(block->data.stream_info.md5sum, operation->argument.streaminfo_md5.value, 16); diff --git a/3rdparty/libflac/src/metaflac/operations_shorthand_vorbiscomment.c b/3rdparty/libflac/src/metaflac/operations_shorthand_vorbiscomment.c index ba00859b502..27c9e4c87a3 100644 --- a/3rdparty/libflac/src/metaflac/operations_shorthand_vorbiscomment.c +++ b/3rdparty/libflac/src/metaflac/operations_shorthand_vorbiscomment.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -29,8 +30,10 @@ #include <stdlib.h> #include <string.h> #include "operations_shorthand.h" +#include "share/compat.h" static FLAC__bool remove_vc_all(const char *filename, FLAC__StreamMetadata *block, FLAC__bool *needs_write); +static FLAC__bool remove_vc_all_except(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write); static FLAC__bool remove_vc_field(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write); static FLAC__bool remove_vc_firstfield(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write); static FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const Argument_VcField *field, FLAC__bool *needs_write, FLAC__bool raw); @@ -88,6 +91,9 @@ FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__bo case OP__REMOVE_VC_ALL: ok = remove_vc_all(filename, block, needs_write); break; + case OP__REMOVE_VC_ALL_EXCEPT: + ok = remove_vc_all_except(filename, block, operation->argument.vc_field_name.value, needs_write); + break; case OP__REMOVE_VC_FIELD: ok = remove_vc_field(filename, block, operation->argument.vc_field_name.value, needs_write); break; @@ -95,7 +101,11 @@ FLAC__bool do_shorthand_operation__vorbis_comment(const char *filename, FLAC__bo ok = remove_vc_firstfield(filename, block, operation->argument.vc_field_name.value, needs_write); break; case OP__SET_VC_FIELD: +#ifdef _WIN32 /* do not convert anything or things will break */ + ok = set_vc_field(filename, block, &operation->argument.vc_field, needs_write, true); +#else ok = set_vc_field(filename, block, &operation->argument.vc_field, needs_write, raw); +#endif break; case OP__IMPORT_VC_FROM: ok = import_vc_from(filename, block, &operation->argument.filename, needs_write, raw); @@ -126,7 +136,7 @@ FLAC__bool remove_vc_all(const char *filename, FLAC__StreamMetadata *block, FLAC if(0 != block->data.vorbis_comment.comments) { FLAC__ASSERT(block->data.vorbis_comment.num_comments > 0); if(!FLAC__metadata_object_vorbiscomment_resize_comments(block, 0)) { - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); + flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); return false; } *needs_write = true; @@ -138,6 +148,51 @@ FLAC__bool remove_vc_all(const char *filename, FLAC__StreamMetadata *block, FLAC return true; } +FLAC__bool remove_vc_all_except(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write) +{ + char * field_names[200]; + uint32_t field_name_length, i; + int j, num_field_names; + + FLAC__ASSERT(0 != block); + FLAC__ASSERT(block->type == FLAC__METADATA_TYPE_VORBIS_COMMENT); + FLAC__ASSERT(0 != needs_write); + + field_name_length = strlen(field_name); + field_names[0] = (void *)field_name; + + for(num_field_names = 1; num_field_names < 200; num_field_names++) { + char * separator = strchr(field_names[num_field_names-1], '='); + if(separator == 0 || separator >= field_name + field_name_length) + break; + field_names[num_field_names] = separator+1; + } + + if(num_field_names > 200) { + flac_fprintf(stderr, "%s: ERROR: too many field names\n", filename); + return false; + } + + for(i = 0; i < block->data.vorbis_comment.num_comments; ) { + int field_name_found = false; + for(j = 0; j < num_field_names; j++) { + const uint32_t length = (j == (num_field_names - 1))?(uint32_t)strlen(field_names[j]):(uint32_t)(strchr(field_names[j],'=')-field_names[j]); + if(FLAC__metadata_object_vorbiscomment_entry_matches(block->data.vorbis_comment.comments[i], field_names[j], length)) { + field_name_found = true; + break; + } + } + if(!field_name_found) { + FLAC__metadata_object_vorbiscomment_delete_comment(block, i); + *needs_write = true; + } + else + i++; + } + + return true; +} + FLAC__bool remove_vc_field(const char *filename, FLAC__StreamMetadata *block, const char *field_name, FLAC__bool *needs_write) { int n; @@ -147,7 +202,7 @@ FLAC__bool remove_vc_field(const char *filename, FLAC__StreamMetadata *block, co n = FLAC__metadata_object_vorbiscomment_remove_entries_matching(block, field_name); if(n < 0) { - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); + flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); return false; } else if(n > 0) @@ -165,7 +220,7 @@ FLAC__bool remove_vc_firstfield(const char *filename, FLAC__StreamMetadata *bloc n = FLAC__metadata_object_vorbiscomment_remove_entry_matching(block, field_name); if(n < 0) { - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); + flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); return false; } else if(n > 0) @@ -188,20 +243,20 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const /* read the file into 'data' */ FILE *f = 0; char *data = 0; - const off_t size = grabbag__file_get_filesize(field->field_value); + const FLAC__off_t size = grabbag__file_get_filesize(field->field_value); if(size < 0) { - fprintf(stderr, "%s: ERROR: can't open file '%s' for '%s' tag value\n", filename, field->field_value, field->field_name); + flac_fprintf(stderr, "%s: ERROR: can't open file '%s' for '%s' tag value\n", filename, field->field_value, field->field_name); return false; } if(size >= 0x100000) { /* magic arbitrary limit, actual format limit is near 16MB */ - fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is too large\n", filename, field->field_value, field->field_name); + flac_fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is too large\n", filename, field->field_value, field->field_name); return false; } if(0 == (data = malloc(size+1))) die("out of memory allocating tag value"); data[size] = '\0'; - if(0 == (f = fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) { - fprintf(stderr, "%s: ERROR: while reading file '%s' for '%s' tag value: %s\n", filename, field->field_value, field->field_name, strerror(errno)); + if(0 == (f = flac_fopen(field->field_value, "rb")) || fread(data, 1, size, f) != (size_t)size) { + flac_fprintf(stderr, "%s: ERROR: while reading file '%s' for '%s' tag value: %s\n", filename, field->field_value, field->field_name, strerror(errno)); free(data); if(f) fclose(f); @@ -210,7 +265,7 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const fclose(f); if(strlen(data) != (size_t)size) { free(data); - fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value has embedded NULs\n", filename, field->field_value, field->field_name); + flac_fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value has embedded NULs\n", filename, field->field_value, field->field_name); return false; } @@ -223,19 +278,19 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const } else { free(data); - fprintf(stderr, "%s: ERROR: converting file '%s' contents to UTF-8 for tag value\n", filename, field->field_value); + flac_fprintf(stderr, "%s: ERROR: converting file '%s' contents to UTF-8 for tag value\n", filename, field->field_value); return false; } /* create and entry and append it */ if(!FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, field->field_name, converted)) { free(converted); - fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is not valid UTF-8\n", filename, field->field_value, field->field_name); + flac_fprintf(stderr, "%s: ERROR: file '%s' for '%s' tag value is not valid UTF-8\n", filename, field->field_value, field->field_name); return false; } free(converted); if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/false)) { - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); + flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); return false; } @@ -244,6 +299,7 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const } else { FLAC__bool needs_free = false; + entry.entry = (FLAC__byte *)field->field; if(raw) { entry.entry = (FLAC__byte *)field->field; } @@ -252,7 +308,7 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const needs_free = true; } else { - fprintf(stderr, "%s: ERROR: converting comment '%s' to UTF-8\n", filename, field->field); + flac_fprintf(stderr, "%s: ERROR: converting comment '%s' to UTF-8\n", filename, field->field); return false; } entry.length = strlen((const char *)entry.entry); @@ -263,14 +319,14 @@ FLAC__bool set_vc_field(const char *filename, FLAC__StreamMetadata *block, const * our previous parsing has already established that the field * name is OK, so it must be the field value */ - fprintf(stderr, "%s: ERROR: tag value for '%s' is not valid UTF-8\n", filename, field->field_name); + flac_fprintf(stderr, "%s: ERROR: tag value for '%s' is not valid UTF-8\n", filename, field->field_name); return false; } if(!FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true)) { if(needs_free) free(converted); - fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); + flac_fprintf(stderr, "%s: ERROR: memory allocation failure\n", filename); return false; } @@ -288,26 +344,25 @@ FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, con FLAC__bool ret; if(0 == vc_filename->value || strlen(vc_filename->value) == 0) { - fprintf(stderr, "%s: ERROR: empty import file name\n", filename); + flac_fprintf(stderr, "%s: ERROR: empty import file name\n", filename); return false; } if(0 == strcmp(vc_filename->value, "-")) f = stdin; else - f = fopen(vc_filename->value, "r"); + f = flac_fopen(vc_filename->value, "r"); if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, vc_filename->value, strerror(errno)); + flac_fprintf(stderr, "%s: ERROR: can't open import file %s: %s\n", filename, vc_filename->value, strerror(errno)); return false; } ret = true; - while(ret && !feof(f)) { - fgets(line, sizeof(line), f); + while(ret && !feof(f) && fgets(line, sizeof(line), f) != NULL) { if(!feof(f)) { char *p = strchr(line, '\n'); if(0 == p) { - fprintf(stderr, "%s: ERROR: line too long, aborting\n", vc_filename->value); + flac_fprintf(stderr, "%s: ERROR: line too long, aborting\n", vc_filename->value); ret = false; } else { @@ -318,7 +373,7 @@ FLAC__bool import_vc_from(const char *filename, FLAC__StreamMetadata *block, con field.field_value_from_file = false; if(!parse_vorbis_comment_field(line, &field.field, &field.field_name, &field.field_value, &field.field_value_length, &violation)) { FLAC__ASSERT(0 != violation); - fprintf(stderr, "%s: ERROR: malformed vorbis comment field \"%s\",\n %s\n", vc_filename->value, line, violation); + flac_fprintf(stderr, "%s: ERROR: malformed vorbis comment field \"%s\",\n %s\n", vc_filename->value, line, violation); ret = false; } else { @@ -345,16 +400,16 @@ FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const FLAC__bool ret; if(0 == vc_filename->value || strlen(vc_filename->value) == 0) { - fprintf(stderr, "%s: ERROR: empty export file name\n", filename); + flac_fprintf(stderr, "%s: ERROR: empty export file name\n", filename); return false; } if(0 == strcmp(vc_filename->value, "-")) f = stdout; else - f = fopen(vc_filename->value, "w"); + f = flac_fopen(vc_filename->value, "w"); if(0 == f) { - fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, vc_filename->value, strerror(errno)); + flac_fprintf(stderr, "%s: ERROR: can't open export file %s: %s\n", filename, vc_filename->value, strerror(errno)); return false; } @@ -364,5 +419,12 @@ FLAC__bool export_vc_to(const char *filename, FLAC__StreamMetadata *block, const if(f != stdout) fclose(f); + +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* Delete output file when fuzzing */ + if(f != stdout) + flac_unlink(vc_filename->value); +#endif + return ret; } diff --git a/3rdparty/libflac/src/metaflac/options.c b/3rdparty/libflac/src/metaflac/options.c index 56c441691f5..1b4b6f624b2 100644 --- a/3rdparty/libflac/src/metaflac/options.c +++ b/3rdparty/libflac/src/metaflac/options.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -25,6 +26,7 @@ #include "utils.h" #include "FLAC/assert.h" #include "share/alloc.h" +#include "share/compat.h" #include "share/grabbag/replaygain.h" #include <ctype.h> #include <stdio.h> @@ -62,21 +64,24 @@ struct share__option long_options_[] = { { "set-channels", 1, 0, 0 }, /* undocumented */ { "set-bps", 1, 0, 0 }, /* undocumented */ { "set-total-samples", 1, 0, 0 }, /* undocumented */ /* WATCHOUT: used by test/test_flac.sh on windows */ - { "show-vendor-tag", 0, 0, 0 }, - { "show-tag", 1, 0, 0 }, - { "remove-all-tags", 0, 0, 0 }, - { "remove-tag", 1, 0, 0 }, - { "remove-first-tag", 1, 0, 0 }, - { "set-tag", 1, 0, 0 }, - { "set-tag-from-file", 1, 0, 0 }, - { "import-tags-from", 1, 0, 0 }, - { "export-tags-to", 1, 0, 0 }, + { "show-vendor-tag", 0, 0, 0 }, + { "show-all-tags", 0, 0, 0 }, + { "show-tag", 1, 0, 0 }, + { "remove-all-tags", 0, 0, 0 }, + { "remove-all-tags-except", 1, 0, 0 }, + { "remove-tag", 1, 0, 0 }, + { "remove-first-tag", 1, 0, 0 }, + { "set-tag", 1, 0, 0 }, + { "set-tag-from-file", 1, 0, 0 }, + { "import-tags-from", 1, 0, 0 }, + { "export-tags-to", 1, 0, 0 }, { "import-cuesheet-from", 1, 0, 0 }, { "export-cuesheet-to", 1, 0, 0 }, { "import-picture-from", 1, 0, 0 }, { "export-picture-to", 1, 0, 0 }, { "add-seekpoint", 1, 0, 0 }, { "add-replay-gain", 0, 0, 0 }, + { "scan-replay-gain", 0, 0, 0 }, { "remove-replay-gain", 0, 0, 0 }, { "add-padding", 1, 0, 0 }, /* major operations */ @@ -111,6 +116,7 @@ static FLAC__bool parse_uint32(const char *src, FLAC__uint32 *dest); static FLAC__bool parse_uint64(const char *src, FLAC__uint64 *dest); static FLAC__bool parse_string(const char *src, char **dest); static FLAC__bool parse_vorbis_comment_field_name(const char *field_ref, char **name, const char **violation); +static FLAC__bool parse_vorbis_comment_field_names(const char *field_ref, char **names, const char **violation); static FLAC__bool parse_add_seekpoint(const char *in, char **out, const char **violation); static FLAC__bool parse_add_padding(const char *in, unsigned *out); static FLAC__bool parse_block_number(const char *in, Argument_BlockNumber *out); @@ -133,6 +139,8 @@ void init_options(CommandLineOptions *options) options->cued_seekpoints = true; options->show_long_help = false; options->show_version = false; + options->data_format_is_binary = false; + options->data_format_is_binary_headerless = false; options->application_data_format_is_hexdump = false; options->ops.operations = 0; @@ -177,8 +185,8 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options) options->prefix_with_filename = (argc - share__optind > 1); if(share__optind >= argc && !options->show_long_help && !options->show_version) { - fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n"); - fprintf(stderr," metaflac cannot be used as a pipe\n"); + flac_fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n"); + flac_fprintf(stderr," metaflac cannot be used as a pipe\n"); had_error = true; } @@ -186,7 +194,7 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options) if(options->num_files > 0) { unsigned i = 0; - if(0 == (options->filenames = (char**)safe_malloc_mul_2op_(sizeof(char*), /*times*/options->num_files))) + if(0 == (options->filenames = safe_malloc_mul_2op_(sizeof(char*), /*times*/options->num_files))) die("out of memory allocating space for file names list"); while(share__optind < argc) options->filenames[i++] = local_strdup(argv[share__optind++]); @@ -194,40 +202,40 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options) if(options->args.checks.num_major_ops > 0) { if(options->args.checks.num_major_ops > 1) { - fprintf(stderr, "ERROR: you may only specify one major operation at a time\n"); + flac_fprintf(stderr, "ERROR: you may only specify one major operation at a time\n"); had_error = true; } else if(options->args.checks.num_shorthand_ops > 0) { - fprintf(stderr, "ERROR: you may not mix shorthand and major operations\n"); + flac_fprintf(stderr, "ERROR: you may not mix shorthand and major operations\n"); had_error = true; } } /* check for only one FLAC file used with certain options */ - if(options->num_files > 1) { + if(!had_error && options->num_files > 1) { if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) { - fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-cuesheet-from'\n"); + flac_fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-cuesheet-from'\n"); had_error = true; } if(0 != find_shorthand_operation(options, OP__EXPORT_CUESHEET_TO)) { - fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-cuesheet-to'\n"); + flac_fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-cuesheet-to'\n"); had_error = true; } if(0 != find_shorthand_operation(options, OP__EXPORT_PICTURE_TO)) { - fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-picture-to'\n"); + flac_fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--export-picture-to'\n"); had_error = true; } if( 0 != find_shorthand_operation(options, OP__IMPORT_VC_FROM) && 0 == strcmp(find_shorthand_operation(options, OP__IMPORT_VC_FROM)->argument.filename.value, "-") ) { - fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-tags-from=-'\n"); + flac_fprintf(stderr, "ERROR: you may only specify one FLAC file when using '--import-tags-from=-'\n"); had_error = true; } } if(options->args.checks.has_block_type && options->args.checks.has_except_block_type) { - fprintf(stderr, "ERROR: you may not specify both '--block-type' and '--except-block-type'\n"); + flac_fprintf(stderr, "ERROR: you may not specify both '--block-type' and '--except-block-type'\n"); had_error = true; } @@ -249,7 +257,7 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options) } } - return !had_error; + return had_error; } void free_options(CommandLineOptions *options) @@ -266,6 +274,7 @@ void free_options(CommandLineOptions *options) case OP__SHOW_VC_FIELD: case OP__REMOVE_VC_FIELD: case OP__REMOVE_VC_FIRSTFIELD: + case OP__REMOVE_VC_ALL_EXCEPT: if(0 != op->argument.vc_field_name.value) free(op->argument.vc_field_name.value); break; @@ -399,7 +408,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi op = append_shorthand_operation(options, OP__SET_MD5SUM); FLAC__ASSERT(0 != option_argument); if(!parse_md5(option_argument, op->argument.streaminfo_md5.value)) { - fprintf(stderr, "ERROR (--%s): bad MD5 sum\n", opt); + flac_fprintf(stderr, "ERROR (--%s): bad MD5 sum\n", opt); ok = false; } else @@ -408,7 +417,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else if(0 == strcmp(opt, "set-min-blocksize")) { op = append_shorthand_operation(options, OP__SET_MIN_BLOCKSIZE); if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BLOCK_SIZE || op->argument.streaminfo_uint32.value > FLAC__MAX_BLOCK_SIZE) { - fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); + flac_fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); ok = false; } else @@ -417,7 +426,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else if(0 == strcmp(opt, "set-max-blocksize")) { op = append_shorthand_operation(options, OP__SET_MAX_BLOCKSIZE); if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BLOCK_SIZE || op->argument.streaminfo_uint32.value > FLAC__MAX_BLOCK_SIZE) { - fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); + flac_fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE); ok = false; } else @@ -426,7 +435,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else if(0 == strcmp(opt, "set-min-framesize")) { op = append_shorthand_operation(options, OP__SET_MIN_FRAMESIZE); if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value >= (1u<<FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN)) { - fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN); + flac_fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_MIN_FRAME_SIZE_LEN); ok = false; } else @@ -435,7 +444,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else if(0 == strcmp(opt, "set-max-framesize")) { op = append_shorthand_operation(options, OP__SET_MAX_FRAMESIZE); if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value >= (1u<<FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN)) { - fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN); + flac_fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_MAX_FRAME_SIZE_LEN); ok = false; } else @@ -444,7 +453,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else if(0 == strcmp(opt, "set-sample-rate")) { op = append_shorthand_operation(options, OP__SET_SAMPLE_RATE); if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || !FLAC__format_sample_rate_is_valid(op->argument.streaminfo_uint32.value)) { - fprintf(stderr, "ERROR (--%s): invalid sample rate\n", opt); + flac_fprintf(stderr, "ERROR (--%s): invalid sample rate\n", opt); ok = false; } else @@ -453,7 +462,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else if(0 == strcmp(opt, "set-channels")) { op = append_shorthand_operation(options, OP__SET_CHANNELS); if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value > FLAC__MAX_CHANNELS) { - fprintf(stderr, "ERROR (--%s): value must be > 0 and <= %u\n", opt, FLAC__MAX_CHANNELS); + flac_fprintf(stderr, "ERROR (--%s): value must be > 0 and <= %u\n", opt, FLAC__MAX_CHANNELS); ok = false; } else @@ -462,7 +471,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else if(0 == strcmp(opt, "set-bps")) { op = append_shorthand_operation(options, OP__SET_BPS); if(!parse_uint32(option_argument, &(op->argument.streaminfo_uint32.value)) || op->argument.streaminfo_uint32.value < FLAC__MIN_BITS_PER_SAMPLE || op->argument.streaminfo_uint32.value > FLAC__MAX_BITS_PER_SAMPLE) { - fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BITS_PER_SAMPLE, FLAC__MAX_BITS_PER_SAMPLE); + flac_fprintf(stderr, "ERROR (--%s): value must be >= %u and <= %u\n", opt, FLAC__MIN_BITS_PER_SAMPLE, FLAC__MAX_BITS_PER_SAMPLE); ok = false; } else @@ -471,7 +480,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else if(0 == strcmp(opt, "set-total-samples")) { op = append_shorthand_operation(options, OP__SET_TOTAL_SAMPLES); if(!parse_uint64(option_argument, &(op->argument.streaminfo_uint64.value)) || op->argument.streaminfo_uint64.value >= (((FLAC__uint64)1)<<FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN)) { - fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN); + flac_fprintf(stderr, "ERROR (--%s): value must be a %u-bit unsigned integer\n", opt, FLAC__STREAM_METADATA_STREAMINFO_TOTAL_SAMPLES_LEN); ok = false; } else @@ -486,20 +495,34 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi FLAC__ASSERT(0 != option_argument); if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) { FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); + flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); ok = false; } } + else if(0 == strcmp(opt, "show-all-tags")) { + op = append_shorthand_operation(options, OP__EXPORT_VC_TO); + parse_string("-",&op->argument.filename.value); + } else if(0 == strcmp(opt, "remove-all-tags")) { (void) append_shorthand_operation(options, OP__REMOVE_VC_ALL); } + else if(0 == strcmp(opt, "remove-all-tags-except")) { + const char *violation; + op = append_shorthand_operation(options, OP__REMOVE_VC_ALL_EXCEPT); + FLAC__ASSERT(0 != option_argument); + if(!parse_vorbis_comment_field_names(option_argument, &(op->argument.vc_field_name.value), &violation)) { + FLAC__ASSERT(0 != violation); + flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); + ok = false; + } + } else if(0 == strcmp(opt, "remove-tag")) { const char *violation; op = append_shorthand_operation(options, OP__REMOVE_VC_FIELD); FLAC__ASSERT(0 != option_argument); if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) { FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); + flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); ok = false; } } @@ -509,7 +532,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi FLAC__ASSERT(0 != option_argument); if(!parse_vorbis_comment_field_name(option_argument, &(op->argument.vc_field_name.value), &violation)) { FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); + flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field name \"%s\",\n %s\n", opt, option_argument, violation); ok = false; } } @@ -520,7 +543,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi op->argument.vc_field.field_value_from_file = false; if(!parse_vorbis_comment_field(option_argument, &(op->argument.vc_field.field), &(op->argument.vc_field.field_name), &(op->argument.vc_field.field_value), &(op->argument.vc_field.field_value_length), &violation)) { FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation); + flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation); ok = false; } } @@ -531,7 +554,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi op->argument.vc_field.field_value_from_file = true; if(!parse_vorbis_comment_field(option_argument, &(op->argument.vc_field.field), &(op->argument.vc_field.field_name), &(op->argument.vc_field.field_value), &(op->argument.vc_field.field_value_length), &violation)) { FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation); + flac_fprintf(stderr, "ERROR (--%s): malformed vorbis comment field \"%s\",\n %s\n", opt, option_argument, violation); ok = false; } } @@ -539,7 +562,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi op = append_shorthand_operation(options, OP__IMPORT_VC_FROM); FLAC__ASSERT(0 != option_argument); if(!parse_string(option_argument, &(op->argument.filename.value))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); + flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt); ok = false; } } @@ -547,19 +570,19 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi op = append_shorthand_operation(options, OP__EXPORT_VC_TO); FLAC__ASSERT(0 != option_argument); if(!parse_string(option_argument, &(op->argument.filename.value))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); + flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt); ok = false; } } else if(0 == strcmp(opt, "import-cuesheet-from")) { if(0 != find_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM)) { - fprintf(stderr, "ERROR (--%s): may be specified only once\n", opt); + flac_fprintf(stderr, "ERROR (--%s): may be specified only once\n", opt); ok = false; } op = append_shorthand_operation(options, OP__IMPORT_CUESHEET_FROM); FLAC__ASSERT(0 != option_argument); if(!parse_string(option_argument, &(op->argument.import_cuesheet_from.filename))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); + flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt); ok = false; } } @@ -567,7 +590,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi op = append_shorthand_operation(options, OP__EXPORT_CUESHEET_TO); FLAC__ASSERT(0 != option_argument); if(!parse_string(option_argument, &(op->argument.filename.value))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); + flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt); ok = false; } } @@ -575,16 +598,16 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi op = append_shorthand_operation(options, OP__IMPORT_PICTURE_FROM); FLAC__ASSERT(0 != option_argument); if(!parse_string(option_argument, &(op->argument.specification.value))) { - fprintf(stderr, "ERROR (--%s): missing specification\n", opt); + flac_fprintf(stderr, "ERROR (--%s): missing specification\n", opt); ok = false; } } else if(0 == strcmp(opt, "export-picture-to")) { - const Argument *arg = find_argument(options, ARG__BLOCK_NUMBER); + arg = find_argument(options, ARG__BLOCK_NUMBER); op = append_shorthand_operation(options, OP__EXPORT_PICTURE_TO); FLAC__ASSERT(0 != option_argument); if(!parse_string(option_argument, &(op->argument.export_picture_to.filename))) { - fprintf(stderr, "ERROR (--%s): missing filename\n", opt); + flac_fprintf(stderr, "ERROR (--%s): missing filename\n", opt); ok = false; } op->argument.export_picture_to.block_number_link = arg? &(arg->value.block_number) : 0; @@ -595,7 +618,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi FLAC__ASSERT(0 != option_argument); if(!parse_add_seekpoint(option_argument, &spec, &violation)) { FLAC__ASSERT(0 != violation); - fprintf(stderr, "ERROR (--%s): malformed seekpoint specification \"%s\",\n %s\n", opt, option_argument, violation); + flac_fprintf(stderr, "ERROR (--%s): malformed seekpoint specification \"%s\",\n %s\n", opt, option_argument, violation); ok = false; } else { @@ -610,6 +633,9 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi else if(0 == strcmp(opt, "add-replay-gain")) { (void) append_shorthand_operation(options, OP__ADD_REPLAY_GAIN); } + else if(0 == strcmp(opt, "scan-replay-gain")) { + (void) append_shorthand_operation(options, OP__SCAN_REPLAY_GAIN); + } else if(0 == strcmp(opt, "remove-replay-gain")) { const FLAC__byte * const tags[5] = { GRABBAG__REPLAYGAIN_TAG_REFERENCE_LOUDNESS, @@ -628,7 +654,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi op = append_shorthand_operation(options, OP__ADD_PADDING); FLAC__ASSERT(0 != option_argument); if(!parse_add_padding(option_argument, &(op->argument.add_padding.length))) { - fprintf(stderr, "ERROR (--%s): illegal length \"%s\", length must be >= 0 and < 2^%u\n", opt, option_argument, FLAC__STREAM_METADATA_LENGTH_LEN); + flac_fprintf(stderr, "ERROR (--%s): illegal length \"%s\", length must be >= 0 and < 2^%u\n", opt, option_argument, FLAC__STREAM_METADATA_LENGTH_LEN); ok = false; } } @@ -660,7 +686,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi arg = append_argument(options, ARG__BLOCK_NUMBER); FLAC__ASSERT(0 != option_argument); if(!parse_block_number(option_argument, &(arg->value.block_number))) { - fprintf(stderr, "ERROR: malformed block number specification \"%s\"\n", option_argument); + flac_fprintf(stderr, "ERROR: malformed block number specification \"%s\"\n", option_argument); ok = false; } } @@ -668,7 +694,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi arg = append_argument(options, ARG__BLOCK_TYPE); FLAC__ASSERT(0 != option_argument); if(!parse_block_type(option_argument, &(arg->value.block_type))) { - fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument); + flac_fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument); ok = false; } options->args.checks.has_block_type = true; @@ -677,7 +703,7 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi arg = append_argument(options, ARG__EXCEPT_BLOCK_TYPE); FLAC__ASSERT(0 != option_argument); if(!parse_block_type(option_argument, &(arg->value.block_type))) { - fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument); + flac_fprintf(stderr, "ERROR (--%s): malformed block type specification \"%s\"\n", opt, option_argument); ok = false; } options->args.checks.has_except_block_type = true; @@ -686,14 +712,16 @@ FLAC__bool parse_option(int option_index, const char *option_argument, CommandLi arg = append_argument(options, ARG__DATA_FORMAT); FLAC__ASSERT(0 != option_argument); if(!parse_data_format(option_argument, &(arg->value.data_format))) { - fprintf(stderr, "ERROR (--%s): illegal data format \"%s\"\n", opt, option_argument); + flac_fprintf(stderr, "ERROR (--%s): illegal data format \"%s\"\n", opt, option_argument); ok = false; } + options->data_format_is_binary = arg->value.data_format.is_binary; + options->data_format_is_binary_headerless = arg->value.data_format.is_headerless; } else if(0 == strcmp(opt, "application-data-format")) { FLAC__ASSERT(0 != option_argument); if(!parse_application_data_format(option_argument, &(options->application_data_format_is_hexdump))) { - fprintf(stderr, "ERROR (--%s): illegal application data format \"%s\"\n", opt, option_argument); + flac_fprintf(stderr, "ERROR (--%s): illegal application data format \"%s\"\n", opt, option_argument); ok = false; } } @@ -713,16 +741,16 @@ void append_new_operation(CommandLineOptions *options, Operation operation) { if(options->ops.capacity == 0) { options->ops.capacity = 50; - if(0 == (options->ops.operations = (Operation*)malloc(sizeof(Operation) * options->ops.capacity))) + if(0 == (options->ops.operations = malloc(sizeof(Operation) * options->ops.capacity))) die("out of memory allocating space for option list"); memset(options->ops.operations, 0, sizeof(Operation) * options->ops.capacity); } if(options->ops.capacity <= options->ops.num_operations) { unsigned original_capacity = options->ops.capacity; - if(options->ops.capacity > SIZE_MAX / 2) /* overflow check */ + if(options->ops.capacity > UINT32_MAX / 2) /* overflow check */ die("out of memory allocating space for option list"); options->ops.capacity *= 2; - if(0 == (options->ops.operations = (Operation*)safe_realloc_mul_2op_(options->ops.operations, sizeof(Operation), /*times*/options->ops.capacity))) + if(0 == (options->ops.operations = safe_realloc_mul_2op_(options->ops.operations, sizeof(Operation), /*times*/options->ops.capacity))) die("out of memory allocating space for option list"); memset(options->ops.operations + original_capacity, 0, sizeof(Operation) * (options->ops.capacity - original_capacity)); } @@ -734,16 +762,16 @@ void append_new_argument(CommandLineOptions *options, Argument argument) { if(options->args.capacity == 0) { options->args.capacity = 50; - if(0 == (options->args.arguments = (Argument*)malloc(sizeof(Argument) * options->args.capacity))) + if(0 == (options->args.arguments = malloc(sizeof(Argument) * options->args.capacity))) die("out of memory allocating space for option list"); memset(options->args.arguments, 0, sizeof(Argument) * options->args.capacity); } if(options->args.capacity <= options->args.num_arguments) { unsigned original_capacity = options->args.capacity; - if(options->args.capacity > SIZE_MAX / 2) /* overflow check */ + if(options->args.capacity > UINT32_MAX / 2) /* overflow check */ die("out of memory allocating space for option list"); options->args.capacity *= 2; - if(0 == (options->args.arguments = (Argument*)safe_realloc_mul_2op_(options->args.arguments, sizeof(Argument), /*times*/options->args.capacity))) + if(0 == (options->args.arguments = safe_realloc_mul_2op_(options->args.arguments, sizeof(Argument), /*times*/options->args.capacity))) die("out of memory allocating space for option list"); memset(options->args.arguments + original_capacity, 0, sizeof(Argument) * (options->args.capacity - original_capacity)); } @@ -840,34 +868,12 @@ FLAC__bool parse_uint32(const char *src, FLAC__uint32 *dest) return true; } -#ifdef _MSC_VER -/* There's no strtoull() in MSVC6 so we just write a specialized one */ -static FLAC__uint64 local__strtoull(const char *src) -{ - FLAC__uint64 ret = 0; - int c; - FLAC__ASSERT(0 != src); - while(0 != (c = *src++)) { - c -= '0'; - if(c >= 0 && c <= 9) - ret = (ret * 10) + c; - else - break; - } - return ret; -} -#endif - FLAC__bool parse_uint64(const char *src, FLAC__uint64 *dest) { FLAC__ASSERT(0 != src); if(strlen(src) == 0 || strspn(src, "0123456789") != strlen(src)) return false; -#ifdef _MSC_VER - *dest = local__strtoull(src); -#else *dest = strtoull(src, 0, 10); -#endif return true; } @@ -902,6 +908,29 @@ FLAC__bool parse_vorbis_comment_field_name(const char *field_ref, char **name, c return true; } +FLAC__bool parse_vorbis_comment_field_names(const char *field_ref, char **names, const char **violation) +{ + static const char * const violations[] = { + "field name contains invalid character" + }; + + char *q, *s; + + s = local_strdup(field_ref); + + for(q = s; *q; q++) { + if(*q < 0x20 || *q > 0x7d) { + free(s); + *violation = violations[0]; + return false; + } + } + + *names = s; + + return true; +} + FLAC__bool parse_add_seekpoint(const char *in, char **out, const char **violation) { static const char *garbled_ = "garbled specification"; @@ -974,7 +1003,7 @@ FLAC__bool parse_block_number(const char *in, Argument_BlockNumber *out) /* make space */ FLAC__ASSERT(out->num_entries > 0); - if(0 == (out->entries = (unsigned*)safe_malloc_mul_2op_(sizeof(unsigned), /*times*/out->num_entries))) + if(0 == (out->entries = safe_malloc_mul_2op_(sizeof(unsigned), /*times*/out->num_entries))) die("out of memory allocating space for option list"); /* load 'em up */ @@ -1013,7 +1042,7 @@ FLAC__bool parse_block_type(const char *in, Argument_BlockType *out) /* make space */ FLAC__ASSERT(out->num_entries > 0); - if(0 == (out->entries = (Argument_BlockTypeEntry*)safe_malloc_mul_2op_(sizeof(Argument_BlockTypeEntry), /*times*/out->num_entries))) + if(0 == (out->entries = safe_malloc_mul_2op_(sizeof(Argument_BlockTypeEntry), /*times*/out->num_entries))) die("out of memory allocating space for option list"); /* load 'em up */ @@ -1040,10 +1069,10 @@ FLAC__bool parse_block_type(const char *in, Argument_BlockType *out) out->entries[entry].type = FLAC__METADATA_TYPE_APPLICATION; out->entries[entry].filter_application_by_id = (0 != r); if(0 != r) { - if(strlen(r) == 4) { - strcpy(out->entries[entry].application_id, r); + if(strlen(r) == sizeof (out->entries[entry].application_id)) { + memcpy(out->entries[entry].application_id, r, sizeof (out->entries[entry].application_id)); } - else if(strlen(r) == 10 && strncmp(r, "0x", 2) == 0 && strspn(r+2, "0123456789ABCDEFabcdef") == 8) { + else if(strlen(r) == 10 && FLAC__STRNCASECMP(r, "0x", 2) == 0 && strspn(r+2, "0123456789ABCDEFabcdef") == 8) { FLAC__uint32 x = strtoul(r+2, 0, 16); out->entries[entry].application_id[3] = (FLAC__byte)(x & 0xff); out->entries[entry].application_id[2] = (FLAC__byte)((x>>=8) & 0xff); @@ -1083,10 +1112,18 @@ FLAC__bool parse_block_type(const char *in, Argument_BlockType *out) FLAC__bool parse_data_format(const char *in, Argument_DataFormat *out) { - if(0 == strcmp(in, "binary")) + if(0 == strcmp(in, "binary-headerless")) { + out->is_binary = false; + out->is_headerless = true; + } + else if(0 == strcmp(in, "binary")) { out->is_binary = true; - else if(0 == strcmp(in, "text")) + out->is_headerless = false; + } + else if(0 == strcmp(in, "text")) { out->is_binary = false; + out->is_headerless = false; + } else return false; return true; @@ -1105,5 +1142,5 @@ FLAC__bool parse_application_data_format(const char *in, FLAC__bool *out) void undocumented_warning(const char *opt) { - fprintf(stderr, "WARNING: undocmented option --%s should be used with caution,\n only for repairing a damaged STREAMINFO block\n", opt); + flac_fprintf(stderr, "WARNING: undocumented option --%s should be used with caution,\n only for repairing a damaged STREAMINFO block\n", opt); } diff --git a/3rdparty/libflac/src/metaflac/options.h b/3rdparty/libflac/src/metaflac/options.h index 244a8d01f7b..984f2e11480 100644 --- a/3rdparty/libflac/src/metaflac/options.h +++ b/3rdparty/libflac/src/metaflac/options.h @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 metaflac__options_h @@ -53,6 +54,7 @@ typedef enum { OP__SHOW_VC_VENDOR, OP__SHOW_VC_FIELD, OP__REMOVE_VC_ALL, + OP__REMOVE_VC_ALL_EXCEPT, OP__REMOVE_VC_FIELD, OP__REMOVE_VC_FIRSTFIELD, OP__SET_VC_FIELD, @@ -64,6 +66,7 @@ typedef enum { OP__EXPORT_PICTURE_TO, OP__ADD_SEEKPOINT, OP__ADD_REPLAY_GAIN, + OP__SCAN_REPLAY_GAIN, OP__ADD_PADDING, OP__LIST, OP__APPEND, @@ -128,6 +131,7 @@ typedef struct { typedef struct { FLAC__bool is_binary; + FLAC__bool is_headerless; } Argument_DataFormat; typedef struct { @@ -187,6 +191,8 @@ typedef struct { FLAC__bool cued_seekpoints; FLAC__bool show_long_help; FLAC__bool show_version; + FLAC__bool data_format_is_binary; + FLAC__bool data_format_is_binary_headerless; FLAC__bool application_data_format_is_hexdump; struct { Operation *operations; diff --git a/3rdparty/libflac/src/metaflac/usage.c b/3rdparty/libflac/src/metaflac/usage.c index 02cfaf23e35..58afc0ea047 100644 --- a/3rdparty/libflac/src/metaflac/usage.c +++ b/3rdparty/libflac/src/metaflac/usage.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,25 +12,28 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif +#include "utils.h" #include "usage.h" #include "FLAC/format.h" #include <stdarg.h> #include <stdio.h> +#include "share/compat.h" static void usage_header(FILE *out) { fprintf(out, "==============================================================================\n"); fprintf(out, "metaflac - Command-line FLAC metadata editor version %s\n", FLAC__VERSION_STRING); - fprintf(out, "Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson\n"); + fprintf(out, "Copyright (C) 2001-2009 Josh Coalson\n"); + fprintf(out, "Copyright (C) 2011-2023 Xiph.Org Foundation\n"); fprintf(out, "\n"); fprintf(out, "This program is free software; you can redistribute it and/or\n"); fprintf(out, "modify it under the terms of the GNU General Public License\n"); @@ -41,9 +45,9 @@ static void usage_header(FILE *out) fprintf(out, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"); fprintf(out, "GNU General Public License for more details.\n"); fprintf(out, "\n"); - fprintf(out, "You should have received a copy of the GNU General Public License\n"); - fprintf(out, "along with this program; if not, write to the Free Software\n"); - fprintf(out, "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n"); + fprintf(out, "You should have received a copy of the GNU General Public License along\n"); + fprintf(out, "with this program; if not, write to the Free Software Foundation, Inc.,\n"); + fprintf(out, "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n"); fprintf(out, "==============================================================================\n"); } @@ -58,7 +62,9 @@ static void usage_summary(FILE *out) fprintf(out, "Options:\n"); fprintf(out, "--preserve-modtime Preserve the original modification time in spite of edits\n"); fprintf(out, "--with-filename Prefix each output line with the FLAC file name\n"); - fprintf(out, " (the default if more than one FLAC file is specified)\n"); + fprintf(out, " (the default if more than one FLAC file is specified).\n"); + fprintf(out, " This option has no effect for options exporting to a\n"); + fprintf(out, " file, like --export-tags-to.\n"); fprintf(out, "--no-filename Do not prefix each output line with the FLAC file name\n"); fprintf(out, " (the default if only one FLAC file is specified)\n"); fprintf(out, "--no-utf8-convert Do not convert tags from UTF-8 to local charset,\n"); @@ -83,9 +89,9 @@ int short_usage(const char *message, ...) } usage_header(stderr); - fprintf(stderr, "\n"); - fprintf(stderr, "This is the short help; for full help use 'metaflac --help'\n"); - fprintf(stderr, "\n"); + flac_fprintf(stderr, "\n"); + flac_fprintf(stderr, "This is the short help; for full help use 'metaflac --help'\n"); + flac_fprintf(stderr, "\n"); usage_summary(stderr); return message? 1 : 0; @@ -120,10 +126,14 @@ int long_usage(const char *message, ...) fprintf(out, "--show-total-samples Show the total # of samples from the STREAMINFO block.\n"); fprintf(out, "\n"); fprintf(out, "--show-vendor-tag Show the vendor string from the VORBIS_COMMENT block.\n"); - fprintf(out, "--show-tag=NAME Show all tags where the the field name matches 'NAME'.\n"); + fprintf(out, "--show-tag=NAME Show all tags where the field name matches 'NAME'.\n"); + fprintf(out, "--show-all-tags Show all tags. This is an alias for --export-tags-to=-.\n"); fprintf(out, "--remove-tag=NAME Remove all tags whose field name is 'NAME'.\n"); fprintf(out, "--remove-first-tag=NAME Remove first tag whose field name is 'NAME'.\n"); fprintf(out, "--remove-all-tags Remove all tags, leaving only the vendor string.\n"); + fprintf(out, "--remove-all-tags-except=NAME1[=NAME2[=...]] Remove all tags, except the vendor\n"); + fprintf(out, " string and the tag names specified. Tag names must be\n"); + fprintf(out, " separated by an = character.\n"); fprintf(out, "--set-tag=FIELD Add a tag. The FIELD must comply with the Vorbis comment\n"); fprintf(out, " spec, of the form \"NAME=VALUE\". If there is currently\n"); fprintf(out, " no tag block, one will be created.\n"); @@ -189,7 +199,7 @@ int long_usage(const char *message, ...) fprintf(out, " mean that FILE is actually a URL to an image, though this use is\n"); fprintf(out, " discouraged.\n"); fprintf(out, " DESCRIPTION is optional; the default is an empty string\n"); - fprintf(out, " The next part specfies the resolution and color information. If\n"); + fprintf(out, " The next part specifies the resolution and color information. If\n"); fprintf(out, " the MIME-TYPE is image/jpeg, image/png, or image/gif, you can\n"); fprintf(out, " usually leave this empty and they can be detected from the file.\n"); fprintf(out, " Otherwise, you must specify the width in pixels, height in pixels,\n"); @@ -213,8 +223,13 @@ int long_usage(const char *message, ...) fprintf(out, " executed last, after all other operations have been\n"); fprintf(out, " completed and written to disk. All FLAC files specified\n"); fprintf(out, " must have the same resolution, sample rate, and number\n"); - fprintf(out, " of channels. The sample rate must be one of 8, 11.025,\n"); - fprintf(out, " 12, 16, 22.05, 24, 32, 44.1, or 48 kHz.\n"); + fprintf(out, " of channels. Only mono and stereo files are allowed,\n"); + fprintf(out, " and the sample rate must be 8, 11.025, 12, 16, 18.9,\n"); + fprintf(out, " 22.05, 24, 28, 32, 36, 37.8, 44.1, 48, 56, 64, 72, 75.6,\n"); + fprintf(out, " 88.2, 96, 112, 128, 144, 151.2, 176.4, 192, 224, 256,\n"); + fprintf(out, " 288, 302.4, 352.8, 384, 448, 512, 576, or 604.8 kHz.\n"); + fprintf(out, "--scan-replay-gain Like --add-replay-gain, but only analyzes the files\n"); + fprintf(out, " rather than writing them to tags.\n"); fprintf(out, "--remove-replay-gain Removes the ReplayGain tags.\n"); fprintf(out, "--add-seekpoint={#|X|#x|#s} Add seek points to a SEEKTABLE block\n"); fprintf(out, " # : a specific sample number for a seek point\n"); @@ -262,23 +277,30 @@ int long_usage(const char *message, ...) fprintf(out, " NOTE: if both --block-number and --[except-]block-type are specified,\n"); fprintf(out, " the result is the logical AND of both arguments.\n"); fprintf(out, "\n"); -#if 0 - /*@@@ not implemented yet */ - fprintf(out, " --data-format=binary|text\n"); + fprintf(out, " --data-format=binary|binary-headerless|text\n"); fprintf(out, " By default a human-readable text representation of the data is displayed.\n"); fprintf(out, " You may specify --data-format=binary to dump the raw binary form of each\n"); - fprintf(out, " metadata block. The output can be read in using a subsequent call to\n"); - fprintf(out, " "metaflac --append --from-file=..."\n"); + fprintf(out, " metadata block. Specify --data-format=binary-headerless to omit output of\n"); + fprintf(out, " metadata block headers, including the id of APPLICATION metadata blocks.\n"); + fprintf(out, " The output can be read in using a subsequent call to\n"); + fprintf(out, " \"metaflac --append\"\n"); fprintf(out, "\n"); -#endif fprintf(out, " --application-data-format=hexdump|text\n"); fprintf(out, " If the application block you are displaying contains binary data but your\n"); fprintf(out, " --data-format=text, you can display a hex dump of the application data\n"); fprintf(out, " contents instead using --application-data-format=hexdump\n"); fprintf(out, "\n"); -#if 0 - /*@@@ not implemented yet */ fprintf(out, "--append\n"); + fprintf(out, " Insert a metadata block from a file. This must be a binary block as\n"); + fprintf(out, " exported with --list --data-format=binary. The insertion point is\n"); + fprintf(out, " defined with --block-number=#. The new block will be added after the\n"); + fprintf(out, " given block number. This prevents the illegal insertion of a block\n"); + fprintf(out, " before the first STREAMINFO block. You may not --append another\n"); + fprintf(out, " STREAMINFO block. It is possible to copy a metadata block from one\n"); + fprintf(out, " file to another with this option. For example use\n"); + fprintf(out, " metaflac --list --data-format=binary --block-number=6 file.flac > block\n"); + fprintf(out, " to export the block, and then import it with\n"); + fprintf(out, " metaflac --append anotherfile.flac < block\n"); fprintf(out, " Insert a metadata block from a file. The input file must be in the same\n"); fprintf(out, " format as generated with --list.\n"); fprintf(out, "\n"); @@ -288,6 +310,8 @@ int long_usage(const char *message, ...) fprintf(out, " of a block before the first STREAMINFO block. You may not --append another\n"); fprintf(out, " STREAMINFO block.\n"); fprintf(out, "\n"); +#if 0 + /*@@@ not implemented yet */ fprintf(out, " --from-file=filename\n"); fprintf(out, " Mandatory 'option' to specify the input file containing the block contents.\n"); fprintf(out, "\n"); diff --git a/3rdparty/libflac/src/metaflac/usage.h b/3rdparty/libflac/src/metaflac/usage.h index 8ad091c7120..1366417a7bc 100644 --- a/3rdparty/libflac/src/metaflac/usage.h +++ b/3rdparty/libflac/src/metaflac/usage.h @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 metaflac__usage_h diff --git a/3rdparty/libflac/src/metaflac/utils.c b/3rdparty/libflac/src/metaflac/utils.c index cdd823c2074..045719a7445 100644 --- a/3rdparty/libflac/src/metaflac/utils.c +++ b/3rdparty/libflac/src/metaflac/utils.c @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,29 +12,31 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif -#include "utils.h" -#include "FLAC/assert.h" -#include "share/alloc.h" -#include "share/utf8.h" #include <ctype.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include "utils.h" +#include "FLAC/assert.h" +#include "share/alloc.h" +#include "share/safe_str.h" +#include "share/utf8.h" +#include "share/compat.h" void die(const char *message) { FLAC__ASSERT(0 != message); - fprintf(stderr, "ERROR: %s\n", message); + flac_fprintf(stderr, "ERROR: %s\n", message); exit(1); } @@ -58,21 +61,34 @@ char *local_strdup(const char *source) void local_strcat(char **dest, const char *source) { - size_t ndest, nsource; + size_t ndest, nsource, outlen; FLAC__ASSERT(0 != dest); FLAC__ASSERT(0 != source); - ndest = *dest? strlen(*dest) : 0; + ndest = *dest ? strlen(*dest) : 0; nsource = strlen(source); + outlen = ndest + nsource + 1; if(nsource == 0) return; - *dest = (char*)safe_realloc_add_3op_(*dest, ndest, /*+*/nsource, /*+*/1); - if(0 == *dest) + *dest = safe_realloc_add_3op_(*dest, ndest, /*+*/nsource, /*+*/1); + if(*dest == NULL) die("out of memory growing string"); - strcpy((*dest)+ndest, source); + /* If ndest == 0, strlen in safe_strncat reads + * uninitialized data. To prevent that, set first character + * to zero */ + if(ndest == 0) + *dest[0] = 0; + safe_strncat(*dest, source, outlen); +} + +static inline int local_isprint(int c) +{ + if (c < 32) return 0; + if (c > 127) return 0; + return isprint(c); } void hexdump(const char *filename, const FLAC__byte *buf, unsigned bytes, const char *indent) @@ -81,11 +97,11 @@ void hexdump(const char *filename, const FLAC__byte *buf, unsigned bytes, const const FLAC__byte *b = buf; for(i = 0; i < bytes; i += 16) { - printf("%s%s%s%08X: " + flac_printf("%s%s", filename? filename:"", filename? ":":""); + printf("%s%08X: " "%02X %02X %02X %02X %02X %02X %02X %02X " "%02X %02X %02X %02X %02X %02X %02X %02X " "%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", - filename? filename:"", filename? ":":"", indent, i, left > 0? (unsigned char)b[ 0] : 0, left > 1? (unsigned char)b[ 1] : 0, @@ -103,22 +119,22 @@ void hexdump(const char *filename, const FLAC__byte *buf, unsigned bytes, const left > 13? (unsigned char)b[13] : 0, left > 14? (unsigned char)b[14] : 0, left > 15? (unsigned char)b[15] : 0, - (left > 0) ? (isprint(b[ 0]) ? b[ 0] : '.') : ' ', - (left > 1) ? (isprint(b[ 1]) ? b[ 1] : '.') : ' ', - (left > 2) ? (isprint(b[ 2]) ? b[ 2] : '.') : ' ', - (left > 3) ? (isprint(b[ 3]) ? b[ 3] : '.') : ' ', - (left > 4) ? (isprint(b[ 4]) ? b[ 4] : '.') : ' ', - (left > 5) ? (isprint(b[ 5]) ? b[ 5] : '.') : ' ', - (left > 6) ? (isprint(b[ 6]) ? b[ 6] : '.') : ' ', - (left > 7) ? (isprint(b[ 7]) ? b[ 7] : '.') : ' ', - (left > 8) ? (isprint(b[ 8]) ? b[ 8] : '.') : ' ', - (left > 9) ? (isprint(b[ 9]) ? b[ 9] : '.') : ' ', - (left > 10) ? (isprint(b[10]) ? b[10] : '.') : ' ', - (left > 11) ? (isprint(b[11]) ? b[11] : '.') : ' ', - (left > 12) ? (isprint(b[12]) ? b[12] : '.') : ' ', - (left > 13) ? (isprint(b[13]) ? b[13] : '.') : ' ', - (left > 14) ? (isprint(b[14]) ? b[14] : '.') : ' ', - (left > 15) ? (isprint(b[15]) ? b[15] : '.') : ' ' + (left > 0) ? (local_isprint(b[ 0]) ? b[ 0] : '.') : ' ', + (left > 1) ? (local_isprint(b[ 1]) ? b[ 1] : '.') : ' ', + (left > 2) ? (local_isprint(b[ 2]) ? b[ 2] : '.') : ' ', + (left > 3) ? (local_isprint(b[ 3]) ? b[ 3] : '.') : ' ', + (left > 4) ? (local_isprint(b[ 4]) ? b[ 4] : '.') : ' ', + (left > 5) ? (local_isprint(b[ 5]) ? b[ 5] : '.') : ' ', + (left > 6) ? (local_isprint(b[ 6]) ? b[ 6] : '.') : ' ', + (left > 7) ? (local_isprint(b[ 7]) ? b[ 7] : '.') : ' ', + (left > 8) ? (local_isprint(b[ 8]) ? b[ 8] : '.') : ' ', + (left > 9) ? (local_isprint(b[ 9]) ? b[ 9] : '.') : ' ', + (left > 10) ? (local_isprint(b[10]) ? b[10] : '.') : ' ', + (left > 11) ? (local_isprint(b[11]) ? b[11] : '.') : ' ', + (left > 12) ? (local_isprint(b[12]) ? b[12] : '.') : ' ', + (left > 13) ? (local_isprint(b[13]) ? b[13] : '.') : ' ', + (left > 14) ? (local_isprint(b[14]) ? b[14] : '.') : ' ', + (left > 15) ? (local_isprint(b[15]) ? b[15] : '.') : ' ' ); left -= 16; b += 16; @@ -134,47 +150,47 @@ void print_error_with_chain_status(FLAC__Metadata_Chain *chain, const char *form va_start(args, format); - (void) vfprintf(stderr, format, args); + (void) flac_vfprintf(stderr, format, args); va_end(args); - fprintf(stderr, ", status = \"%s\"\n", FLAC__Metadata_ChainStatusString[status]); + flac_fprintf(stderr, ", status = \"%s\"\n", FLAC__Metadata_ChainStatusString[status]); if(status == FLAC__METADATA_CHAIN_STATUS_ERROR_OPENING_FILE) { - fprintf(stderr, "\n" + flac_fprintf(stderr, "\n" "The FLAC file could not be opened. Most likely the file does not exist\n" "or is not readable.\n" ); } else if(status == FLAC__METADATA_CHAIN_STATUS_NOT_A_FLAC_FILE) { - fprintf(stderr, "\n" + flac_fprintf(stderr, "\n" "The file does not appear to be a FLAC file.\n" ); } else if(status == FLAC__METADATA_CHAIN_STATUS_NOT_WRITABLE) { - fprintf(stderr, "\n" + flac_fprintf(stderr, "\n" "The FLAC file does not have write permissions.\n" ); } else if(status == FLAC__METADATA_CHAIN_STATUS_BAD_METADATA) { - fprintf(stderr, "\n" - "The metadata to be writted does not conform to the FLAC metadata\n" + flac_fprintf(stderr, "\n" + "The metadata to be written does not conform to the FLAC metadata\n" "specifications.\n" ); } else if(status == FLAC__METADATA_CHAIN_STATUS_READ_ERROR) { - fprintf(stderr, "\n" + flac_fprintf(stderr, "\n" "There was an error while reading the FLAC file.\n" ); } else if(status == FLAC__METADATA_CHAIN_STATUS_WRITE_ERROR) { - fprintf(stderr, "\n" + flac_fprintf(stderr, "\n" "There was an error while writing FLAC file; most probably the disk is\n" "full.\n" ); } else if(status == FLAC__METADATA_CHAIN_STATUS_UNLINK_ERROR) { - fprintf(stderr, "\n" + flac_fprintf(stderr, "\n" "There was an error removing the temporary FLAC file.\n" ); } @@ -221,13 +237,18 @@ void write_vc_field(const char *filename, const FLAC__StreamMetadata_VorbisComme { if(0 != entry->entry) { if(filename) - fprintf(f, "%s:", filename); + flac_fprintf(f, "%s:", filename); if(!raw) { /* * WATCHOUT: comments that contain an embedded null will * be truncated by utf_decode(). */ +#ifdef _WIN32 /* if we are outputting to console, we need to use proper print functions to show unicode characters */ + if (f == stdout || f == stderr) { + flac_fprintf(f, "%s", entry->entry); + } else { +#endif char *converted; if(utf8_decode((const char *)entry->entry, &converted) >= 0) { @@ -237,6 +258,9 @@ void write_vc_field(const char *filename, const FLAC__StreamMetadata_VorbisComme else { (void) local_fwrite(entry->entry, 1, entry->length, f); } +#ifdef _WIN32 + } +#endif } else { (void) local_fwrite(entry->entry, 1, entry->length, f); diff --git a/3rdparty/libflac/src/metaflac/utils.h b/3rdparty/libflac/src/metaflac/utils.h index 111d10cccdc..972a4501c9e 100644 --- a/3rdparty/libflac/src/metaflac/utils.h +++ b/3rdparty/libflac/src/metaflac/utils.h @@ -1,5 +1,6 @@ /* metaflac - Command-line FLAC metadata editor - * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2001-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 metaflac__utils_h @@ -22,6 +23,11 @@ #include "FLAC/metadata.h" #include <stdio.h> /* for FILE */ +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION +#undef stderr +#define stderr stdout +#endif + void die(const char *message); #ifdef FLAC__VALGRIND_TESTING size_t local_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); diff --git a/3rdparty/libflac/src/metaflac/version.rc b/3rdparty/libflac/src/metaflac/version.rc new file mode 100644 index 00000000000..51172024752 --- /dev/null +++ b/3rdparty/libflac/src/metaflac/version.rc @@ -0,0 +1,38 @@ +#include <winver.h> +#include "config.h" + +#if (defined GIT_COMMIT_HASH && defined GIT_COMMIT_DATE) +# ifdef GIT_COMMIT_TAG +# define VERSIONSTRING GIT_COMMIT_TAG +# else +# define VERSIONSTRING "git-" GIT_COMMIT_HASH +# endif +#else +# define VERSIONSTRING PACKAGE_VERSION +#endif + +#define xstr(s) str(s) +#define str(s) #s + +VS_VERSION_INFO VERSIONINFO +FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +FILEFLAGS 0 +FILEOS VOS__WINDOWS32 +FILETYPE VFT_DLL +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "metaflac command line tool for Windows" + VALUE "ProductName", "Free Lossless Audio Codec" + VALUE "ProductVersion", VERSIONSTRING + VALUE "CompanyName", "Xiph.Org" + VALUE "LegalCopyright", "2000-2009 Josh Coalson, 2011-2023 Xiph.Org Foundation" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/Makefile.in b/3rdparty/libflac/src/monkeys_audio_utilities/Makefile.in deleted file mode 100644 index 2444f6c3648..00000000000 --- a/3rdparty/libflac/src/monkeys_audio_utilities/Makefile.in +++ /dev/null @@ -1,520 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference 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. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -SUBDIRS = flac_mac flac_ren -subdir = src/monkeys_audio_utilities -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = $(SUBDIRS) -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/monkeys_audio_utilities/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - else \ - include_option=--include; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: - -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/Makefile.in b/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/Makefile.in deleted file mode 100644 index 15621b356b9..00000000000 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/Makefile.in +++ /dev/null @@ -1,375 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# flac_mac - wedge utility to add FLAC support to Monkey's Audio -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -EXTRA_DIST = \ - flac_mac.dsp \ - flac_mac.vcproj \ - main.c - -subdir = src/monkeys_audio_utilities/flac_mac -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/monkeys_audio_utilities/flac_mac/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/flac_mac.dsp b/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/flac_mac.dsp deleted file mode 100644 index 7c5253a97fa..00000000000 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/flac_mac.dsp +++ /dev/null @@ -1,100 +0,0 @@ -# Microsoft Developer Studio Project File - Name="flac_mac" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=flac_mac - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "flac_mac.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "flac_mac.mak" CFG="flac_mac - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "flac_mac - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "flac_mac - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "flac_mac - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "flac_mac - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "flac_mac - Win32 Release" -# Name "flac_mac - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\main.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/flac_mac.vcproj b/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/flac_mac.vcproj deleted file mode 100644 index cc65f83294f..00000000000 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/flac_mac.vcproj +++ /dev/null @@ -1,200 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="flac_mac" - ProjectGUID="{4cefbc7e-c215-11db-8314-0800200c9a66}" - RootNamespace="flac_mac" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\main.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/main.c b/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/main.c deleted file mode 100644 index 8e0410386eb..00000000000 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/main.c +++ /dev/null @@ -1,208 +0,0 @@ -/* flac_mac - wedge utility to add FLAC support to Monkey's Audio - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -/* - * This program can be used to allow FLAC to masquerade as one of the other - * supported lossless codecs in Monkey's Audio. See the documentation for - * how to do this. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include<stdio.h> -#include<stdlib.h> -#include<string.h> -#include<wtypes.h> -#include<process.h> -#include<winbase.h> - -static int execit(char *prog, char *args); -static int forkit(char *prog, char *args); - -int main(int argc, char *argv[]) -{ - int flac_return_val = 0, opt_arg = 1, from_arg = -1, to_arg = -1, flac_level = 5, i; - char prog[MAX_PATH], cmdline[MAX_PATH*2], from[MAX_PATH], to[MAX_PATH], macdir[MAX_PATH], options[256], *p; - enum { WAVPACK, RKAU, SHORTEN } codec; - - /* get the directory where MAC external codecs reside */ - if(0 != (p = strrchr(argv[0],'\\'))) { - strcpy(macdir, argv[0]); - *(strrchr(macdir,'\\')+1) = '\0'; - } - else { - strcpy(macdir, ""); - } - - /* determine which codec we were called as and parse the options */ - if(p == 0) - p = argv[0]; - else - p++; - if(0 == strnicmp(p, "short", 5)) { - codec = SHORTEN; - } - else if(0 == strnicmp(p, "rkau", 4)) { - codec = RKAU; - if(argv[1][0] == '-' && argv[1][1] == 'l') { - opt_arg = 2; - switch(argv[1][2]) { - case '1': flac_level = 1; break; - case '2': flac_level = 5; break; - case '3': flac_level = 8; break; - } - } - } - else if(0 == strnicmp(p, "wavpack", 7)) { - codec = WAVPACK; - if(argv[1][0] == '-') { - opt_arg = 2; - switch(argv[1][1]) { - case 'f': flac_level = 1; break; - case 'h': flac_level = 8; break; - default: opt_arg = 1; - } - } - } - else { - return -5; - } - - /* figure out which arguments are the source and destination files */ - for(i = 1; i < argc; i++) - if(argv[i][0] != '-') { - from_arg = i++; - break; - } - for( ; i < argc; i++) - if(argv[i][0] != '-') { - to_arg = i++; - break; - } - if(to_arg < 0) - return -4; - - /* build the command to call flac with */ - sprintf(prog, "%sflac.exe", macdir); - sprintf(options, "-%d", flac_level); - for(i = opt_arg; i < argc; i++) - if(argv[i][0] == '-') { - strcat(options, " "); - strcat(options, argv[i]); - } - sprintf(cmdline, "\"%s\" %s -o \"%s\" \"%s\"", prog, options, argv[to_arg], argv[from_arg]); - - flac_return_val = execit(prog, cmdline); - - /* - * Now that flac has finished, we need to fork a process that will rename - * the resulting file with the correct extension once MAC has moved it to - * it's final resting place. - */ - if(0 == flac_return_val) { - /* get the destination directory, if any */ - if(0 != (p = strchr(argv[to_arg],'\\'))) { - strcpy(from, argv[to_arg]); - *(strrchr(from,'\\')+1) = '\0'; - } - else { - strcpy(from, ""); - } - - /* for the full 'from' and 'to' paths for the renamer process */ - p = strrchr(argv[from_arg],'\\'); - strcat(from, p? p+1 : argv[from_arg]); - strcpy(to, from); - if(0 == strchr(from,'.')) - return -3; - switch(codec) { - case SHORTEN: strcpy(strrchr(from,'.'), ".shn"); break; - case WAVPACK: strcpy(strrchr(from,'.'), ".wv"); break; - case RKAU: strcpy(strrchr(from,'.'), ".rka"); break; - } - strcpy(strrchr(to,'.'), ".flac"); - - sprintf(prog, "%sflac_ren.exe", macdir); - sprintf(cmdline, "\"%s\" \"%s\" \"%s\"", prog, from, to); - - flac_return_val = forkit(prog, cmdline); - } - - return flac_return_val; -} - -int execit(char *prog, char *args) -{ - BOOL ok; - STARTUPINFO startup_info; - PROCESS_INFORMATION proc_info; - - GetStartupInfo(&startup_info); - - ok = CreateProcess( - prog, - args, - 0, /*process security attributes*/ - 0, /*thread security attributes*/ - FALSE, - 0, /*dwCreationFlags*/ - 0, /*environment*/ - 0, /*lpCurrentDirectory*/ - &startup_info, - &proc_info - ); - if(ok) { - DWORD dw; - dw = WaitForSingleObject(proc_info.hProcess, INFINITE); - ok = (dw != 0xFFFFFFFF); - CloseHandle(proc_info.hThread); - CloseHandle(proc_info.hProcess); - } - - return ok? 0 : -1; -} - -int forkit(char *prog, char *args) -{ - BOOL ok; - STARTUPINFO startup_info; - PROCESS_INFORMATION proc_info; - - GetStartupInfo(&startup_info); - - ok = CreateProcess( - prog, - args, - 0, /*process security attributes*/ - 0, /*thread security attributes*/ - FALSE, - DETACHED_PROCESS, /*dwCreationFlags*/ - 0, /*environment*/ - 0, /*lpCurrentDirectory*/ - &startup_info, - &proc_info - ); - if(ok) { - CloseHandle(proc_info.hThread); - CloseHandle(proc_info.hProcess); - } - - return ok? 0 : -2; -} diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/Makefile.in b/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/Makefile.in deleted file mode 100644 index 01bd04287e8..00000000000 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/Makefile.in +++ /dev/null @@ -1,375 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# flac_ren - renamer part of utility to add FLAC support to Monkey's Audio -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -EXTRA_DIST = \ - flac_ren.dsp \ - flac_ren.vcproj \ - main.c - -subdir = src/monkeys_audio_utilities/flac_ren -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/monkeys_audio_utilities/flac_ren/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/flac_ren.dsp b/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/flac_ren.dsp deleted file mode 100644 index ea9abb42c57..00000000000 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/flac_ren.dsp +++ /dev/null @@ -1,100 +0,0 @@ -# Microsoft Developer Studio Project File - Name="flac_ren" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=flac_ren - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "flac_ren.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "flac_ren.mak" CFG="flac_ren - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "flac_ren - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "flac_ren - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "flac_ren - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "flac_ren - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "flac_ren - Win32 Release" -# Name "flac_ren - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\main.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj b/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj deleted file mode 100644 index e6f274e5966..00000000000 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/flac_ren.vcproj +++ /dev/null @@ -1,200 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="flac_ren" - ProjectGUID="{4cefbc7f-c215-11db-8314-0800200c9a66}" - RootNamespace="flac_ren" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\main.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/main.c b/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/main.c deleted file mode 100644 index 14667b4c65d..00000000000 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/main.c +++ /dev/null @@ -1,39 +0,0 @@ -/* flac_ren - renamer part of utility to add FLAC support to Monkey's Audio - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <io.h> -#include <sys/stat.h> -#include <wtypes.h> -#include <winbase.h> - -int main(int argc, char *argv[]) -{ - struct stat s; - - /* wait till the 'from' file has reached its final destination */ - do { - Sleep(2000); - } while(stat(argv[1], &s) < 0); - - /* now rename it */ - return rename(argv[1], argv[2]); -} diff --git a/3rdparty/libflac/src/plugin_common/Makefile.am b/3rdparty/libflac/src/plugin_common/Makefile.am deleted file mode 100644 index e2915a7c672..00000000000 --- a/3rdparty/libflac/src/plugin_common/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ -# plugin_common - Routines common to several plugins -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -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 = \ - Makefile.lite \ - README \ - plugin_common_static.dsp \ - plugin_common_static.vcproj - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" diff --git a/3rdparty/libflac/src/plugin_common/Makefile.in b/3rdparty/libflac/src/plugin_common/Makefile.in deleted file mode 100644 index 663a3096275..00000000000 --- a/3rdparty/libflac/src/plugin_common/Makefile.in +++ /dev/null @@ -1,539 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# plugin_common - Routines common to several plugins -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -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 = \ - Makefile.lite \ - README \ - plugin_common_static.dsp \ - plugin_common_static.vcproj - -subdir = src/plugin_common -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libplugin_common_la_LDFLAGS = -libplugin_common_la_LIBADD = -am_libplugin_common_la_OBJECTS = charset.lo dither.lo replaygain.lo \ - tags.lo -libplugin_common_la_OBJECTS = $(am_libplugin_common_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/charset.Plo ./$(DEPDIR)/dither.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/replaygain.Plo ./$(DEPDIR)/tags.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libplugin_common_la_SOURCES) -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.in \ - Makefile.am -SOURCES = $(libplugin_common_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/plugin_common/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libplugin_common.la: $(libplugin_common_la_OBJECTS) $(libplugin_common_la_DEPENDENCIES) - $(LINK) $(libplugin_common_la_LDFLAGS) $(libplugin_common_la_OBJECTS) $(libplugin_common_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/charset.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dither.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replaygain.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tags.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am - - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/plugin_common/Makefile.lite b/3rdparty/libflac/src/plugin_common/Makefile.lite deleted file mode 100644 index 987bae8d05d..00000000000 --- a/3rdparty/libflac/src/plugin_common/Makefile.lite +++ /dev/null @@ -1,36 +0,0 @@ -# plugin_common - Routines common to several plugins -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 -DEFINES = - -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/3rdparty/libflac/src/plugin_common/README b/3rdparty/libflac/src/plugin_common/README deleted file mode 100644 index 5a3352614d3..00000000000 --- a/3rdparty/libflac/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/3rdparty/libflac/src/plugin_common/all.h b/3rdparty/libflac/src/plugin_common/all.h deleted file mode 100644 index e987dd088f5..00000000000 --- a/3rdparty/libflac/src/plugin_common/all.h +++ /dev/null @@ -1,26 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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/3rdparty/libflac/src/plugin_common/charset.c b/3rdparty/libflac/src/plugin_common/charset.c deleted file mode 100644 index cc826690876..00000000000 --- a/3rdparty/libflac/src/plugin_common/charset.c +++ /dev/null @@ -1,157 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * Only slightly modified charset.c from: - * EasyTAG - Tag editor for MP3 and OGG files - * Copyright (C) 1999-2001 Håvard Kvålen <havardk@xmms.org> - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#ifdef HAVE_ICONV -#include <iconv.h> -#endif - -#ifdef HAVE_LANGINFO_CODESET -#include <langinfo.h> -#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) - { -#ifdef DEBUG - 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 = (char*)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: -#ifdef DEBUG - 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/3rdparty/libflac/src/plugin_common/charset.h b/3rdparty/libflac/src/plugin_common/charset.h deleted file mode 100644 index 7ea283818fc..00000000000 --- a/3rdparty/libflac/src/plugin_common/charset.h +++ /dev/null @@ -1,39 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 <havardk@xmms.org> - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#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/3rdparty/libflac/src/plugin_common/defs.h b/3rdparty/libflac/src/plugin_common/defs.h deleted file mode 100644 index 0cc9b4b06b5..00000000000 --- a/3rdparty/libflac/src/plugin_common/defs.h +++ /dev/null @@ -1,24 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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/3rdparty/libflac/src/plugin_common/dither.c b/3rdparty/libflac/src/plugin_common/dither.c deleted file mode 100644 index 538a28029e0..00000000000 --- a/3rdparty/libflac/src/plugin_common/dither.c +++ /dev/null @@ -1,262 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#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__INLINE FLAC__int32 linear_dither(unsigned source_bps, unsigned target_bps, FLAC__int32 sample, dither_state *dither, const FLAC__int32 MIN, const FLAC__int32 MAX) -{ - unsigned 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[], unsigned wide_samples, unsigned channels, unsigned source_bps, unsigned target_bps) -{ - static dither_state dither[FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS]; - FLAC__byte * const start = data; - FLAC__int32 sample; - const FLAC__int32 *input_; - unsigned samples, channel; - const unsigned bytes_per_sample = target_bps / 8; - const unsigned 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[], unsigned wide_samples, unsigned channels, unsigned source_bps, unsigned target_bps) -{ - static dither_state dither[FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS]; - FLAC__byte * const start = data; - FLAC__int32 sample; - const FLAC__int32 *input_; - unsigned samples, channel; - const unsigned bytes_per_sample = target_bps / 8; - const unsigned 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/3rdparty/libflac/src/plugin_common/dither.h b/3rdparty/libflac/src/plugin_common/dither.h deleted file mode 100644 index ad94bae194a..00000000000 --- a/3rdparty/libflac/src/plugin_common/dither.h +++ /dev/null @@ -1,29 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 <stdlib.h> /* 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[], unsigned wide_samples, unsigned channels, unsigned source_bps, unsigned target_bps); -size_t FLAC__plugin_common__pack_pcm_signed_little_endian(FLAC__byte *data, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, unsigned source_bps, unsigned target_bps); - -#endif diff --git a/3rdparty/libflac/src/plugin_common/plugin_common_static.dsp b/3rdparty/libflac/src/plugin_common/plugin_common_static.dsp deleted file mode 100644 index ae9b2bce61e..00000000000 --- a/3rdparty/libflac/src/plugin_common/plugin_common_static.dsp +++ /dev/null @@ -1,128 +0,0 @@ -# Microsoft Developer Studio Project File - Name="plugin_common_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=plugin_common_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "plugin_common_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "plugin_common_static.mak" CFG="plugin_common_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "plugin_common_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "plugin_common_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "plugin_common" -# PROP Scc_LocalPath "..\.." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "plugin_common_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /WX /GX /Ox /Og /Oi /Os /Op /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ELSEIF "$(CFG)" == "plugin_common_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "plugin_common_static - Win32 Release" -# Name "plugin_common_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp" -# Begin Source File - -SOURCE=.\charset.c -# End Source File -# Begin Source File - -SOURCE=.\dither.c -# End Source File -# Begin Source File - -SOURCE=.\replaygain.c -# End Source File -# Begin Source File - -SOURCE=.\tags.c -# End Source File -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\all.h -# End Source File -# Begin Source File - -SOURCE=.\charset.h -# End Source File -# Begin Source File - -SOURCE=.\dither.h -# End Source File -# Begin Source File - -SOURCE=.\replaygain.h -# End Source File -# Begin Source File - -SOURCE=.\tags.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/plugin_common/plugin_common_static.vcproj b/3rdparty/libflac/src/plugin_common/plugin_common_static.vcproj deleted file mode 100644 index ee64d2593aa..00000000000 --- a/3rdparty/libflac/src/plugin_common/plugin_common_static.vcproj +++ /dev/null @@ -1,209 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="plugin_common_static" - ProjectGUID="{4cefbc88-c215-11db-8314-0800200c9a66}" - RootNamespace="plugin_common_static" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\lib" - IntermediateDirectory="Debug_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\obj\debug\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\lib" - IntermediateDirectory="Release_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\release\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\all.h" - > - </File> - <File - RelativePath=".\charset.h" - > - </File> - <File - RelativePath=".\defs.h" - > - </File> - <File - RelativePath=".\dither.h" - > - </File> - <File - RelativePath=".\replaygain.h" - > - </File> - <File - RelativePath=".\tags.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\charset.c" - > - </File> - <File - RelativePath=".\dither.c" - > - </File> - <File - RelativePath=".\replaygain.c" - > - </File> - <File - RelativePath=".\tags.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/plugin_common/replaygain.c b/3rdparty/libflac/src/plugin_common/replaygain.c deleted file mode 100644 index 5ad59c8305c..00000000000 --- a/3rdparty/libflac/src/plugin_common/replaygain.c +++ /dev/null @@ -1,64 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#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/3rdparty/libflac/src/plugin_common/replaygain.h b/3rdparty/libflac/src/plugin_common/replaygain.h deleted file mode 100644 index 528312ecc9c..00000000000 --- a/3rdparty/libflac/src/plugin_common/replaygain.h +++ /dev/null @@ -1,32 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/3rdparty/libflac/src/plugin_common/tags.c b/3rdparty/libflac/src/plugin_common/tags.c deleted file mode 100644 index befc8484fd2..00000000000 --- a/3rdparty/libflac/src/plugin_common/tags.c +++ /dev/null @@ -1,358 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#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 FLaC__INLINE 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 FLaC__INLINE 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, unsigned length) -{ - FLAC__uint16 *out; - size_t chars = 0; - - FLAC__ASSERT(0 != src); - - /* calculate length */ - { - const unsigned char *s, *end; - for (s=(const unsigned char *)src, end=s+length; s<end; chars++) { - const unsigned n = local__utf8len(s); - if (n == 0) - return 0; - s += n; - } - FLAC__ASSERT(s == end); - } - - /* allocate */ - out = (FLAC__uint16*)safe_malloc_mul_2op_(chars, /*times*/sizeof(FLAC__uint16)); - if (0 == out) { - FLAC__ASSERT(0); - return 0; - } - - /* convert */ - { - const unsigned char *s = (const unsigned char *)src; - FLAC__uint16 *u = out; - for ( ; chars; chars--) - s += local__utf8_to_ucs2(s, u++); - } - - return out; -} - -static FLaC__INLINE size_t local__ucs2len(FLAC__uint16 ucs2) -{ - if (ucs2 < 0x0080) - return 1; - else if (ucs2 < 0x0800) - return 2; - else - return 3; -} - -static FLaC__INLINE size_t local__ucs2_to_utf8(FLAC__uint16 ucs2, FLAC__byte *utf8) -{ - if (ucs2 < 0x080) { - utf8[0] = (FLAC__byte)ucs2; - return 1; - } - else if (ucs2 < 0x800) { - utf8[0] = 0xc0 | (ucs2 >> 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, unsigned length) -{ - char *out; - size_t len = 0, n; - - FLAC__ASSERT(0 != src); - - /* calculate length */ - { - unsigned i; - for (i = 0; i < length; i++) { - n = local__ucs2len(src[i]); - if(len + n < len) /* overflow check */ - return 0; - len += n; - } - } - - /* allocate */ - out = (char*)safe_malloc_mul_2op_(len, /*times*/sizeof(char)); - if (0 == out) - return 0; - - /* convert */ - { - unsigned char *u = (unsigned char *)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 = (FLAC__byte*)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/3rdparty/libflac/src/plugin_common/tags.h b/3rdparty/libflac/src/plugin_common/tags.h deleted file mode 100644 index 78887674762..00000000000 --- a/3rdparty/libflac/src/plugin_common/tags.h +++ /dev/null @@ -1,74 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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/3rdparty/libflac/src/plugin_winamp2/Makefile.am b/3rdparty/libflac/src/plugin_winamp2/Makefile.am deleted file mode 100644 index 401d4d5f7e6..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# in_flac - Winamp2 FLAC input plugin -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -SUBDIRS = include - -EXTRA_DIST = \ - configure.h \ - configure.c \ - in_flac.c \ - in_flac.dsp \ - in_flac.vcproj \ - infobox.c \ - infobox.h \ - playback.c \ - playback.h \ - resource.h \ - resource.rc \ - tagz.cpp \ - tagz.h diff --git a/3rdparty/libflac/src/plugin_winamp2/Makefile.in b/3rdparty/libflac/src/plugin_winamp2/Makefile.in deleted file mode 100644 index c08f7944c24..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/Makefile.in +++ /dev/null @@ -1,536 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# in_flac - Winamp2 FLAC input plugin -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -SUBDIRS = include - -EXTRA_DIST = \ - configure.h \ - configure.c \ - in_flac.c \ - in_flac.dsp \ - in_flac.vcproj \ - infobox.c \ - infobox.h \ - playback.c \ - playback.h \ - resource.h \ - resource.rc \ - tagz.cpp \ - tagz.h - -subdir = src/plugin_winamp2 -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = $(SUBDIRS) -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/plugin_winamp2/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - else \ - include_option=--include; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: - -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/plugin_winamp2/configure.c b/3rdparty/libflac/src/plugin_winamp2/configure.c deleted file mode 100644 index dee0709bee6..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/configure.c +++ /dev/null @@ -1,428 +0,0 @@ -/* in_flac - Winamp2 FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <windows.h> -#include <commctrl.h> -#include <stdio.h> -#include "configure.h" -#include "tagz.h" -#include "resource.h" -#include "share/alloc.h" - - -static char buffer[256]; -static char ini_name[MAX_PATH]; - -/* - * Read/write config - */ - -#define RI(x, def) (x = GetPrivateProfileInt("FLAC", #x, def, ini_name)) -#define WI(x) WritePrivateProfileString("FLAC", #x, itoa(x, buffer, 10), ini_name) -#define RS(x, n, def) GetPrivateProfileString("FLAC", #x, def, x, n, ini_name) -#define WS(x) WritePrivateProfileString("FLAC", #x, x, ini_name) - -static const char default_format[] = "[%artist% - ]$if2(%title%,%filename%)"; -static const char default_sep[] = ", "; - -static wchar_t *convert_ansi_to_wide_(const char *src) -{ - int len; - wchar_t *dest; - - FLAC__ASSERT(0 != src); - - len = strlen(src) + 1; - /* copy */ - dest = safe_malloc_mul_2op_(len, /*times*/sizeof(wchar_t)); - if (dest) mbstowcs(dest, src, len); - return dest; -} - -void InitConfig() -{ - char *p; - - GetModuleFileName(NULL, ini_name, sizeof(ini_name)); - p = strrchr(ini_name, '.'); - if (!p) p = ini_name + strlen(ini_name); - strcpy(p, ".ini"); - - flac_cfg.title.tag_format_w = NULL; -} - -void ReadConfig() -{ - RS(flac_cfg.title.tag_format, sizeof(flac_cfg.title.tag_format), default_format); - if (flac_cfg.title.tag_format_w) - free(flac_cfg.title.tag_format_w); - flac_cfg.title.tag_format_w = convert_ansi_to_wide_(flac_cfg.title.tag_format); - /* @@@ FIXME: trailing spaces */ - RS(flac_cfg.title.sep, sizeof(flac_cfg.title.sep), default_sep); - RI(flac_cfg.tag.reserve_space, 1); - - RI(flac_cfg.display.show_bps, 1); - RI(flac_cfg.output.misc.stop_err, 0); - RI(flac_cfg.output.replaygain.enable, 1); - RI(flac_cfg.output.replaygain.album_mode, 0); - RI(flac_cfg.output.replaygain.hard_limit, 0); - RI(flac_cfg.output.replaygain.preamp, 0); - RI(flac_cfg.output.resolution.normal.dither_24_to_16, 0); - RI(flac_cfg.output.resolution.replaygain.dither, 0); - RI(flac_cfg.output.resolution.replaygain.noise_shaping, 1); - RI(flac_cfg.output.resolution.replaygain.bps_out, 16); -} - -void WriteConfig() -{ - WS(flac_cfg.title.tag_format); - WI(flac_cfg.tag.reserve_space); - WS(flac_cfg.title.sep); - - WI(flac_cfg.display.show_bps); - WI(flac_cfg.output.misc.stop_err); - WI(flac_cfg.output.replaygain.enable); - WI(flac_cfg.output.replaygain.album_mode); - WI(flac_cfg.output.replaygain.hard_limit); - WI(flac_cfg.output.replaygain.preamp); - WI(flac_cfg.output.resolution.normal.dither_24_to_16); - WI(flac_cfg.output.resolution.replaygain.dither); - WI(flac_cfg.output.resolution.replaygain.noise_shaping); - WI(flac_cfg.output.resolution.replaygain.bps_out); -} - -/* - * Dialog - */ - -#define PREAMP_RANGE 24 - -#define Check(x,y) CheckDlgButton(hwnd, x, y ? BST_CHECKED : BST_UNCHECKED) -#define GetCheck(x) (IsDlgButtonChecked(hwnd, x)==BST_CHECKED) -#define GetSel(x) SendDlgItemMessage(hwnd, x, CB_GETCURSEL, 0, 0) -#define GetPos(x) SendDlgItemMessage(hwnd, x, TBM_GETPOS, 0, 0) -#define Enable(x,y) EnableWindow(GetDlgItem(hwnd, x), y) - -static INT_PTR CALLBACK GeneralProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - /* init */ - case WM_INITDIALOG: - SendDlgItemMessage(hwnd, IDC_TITLE, EM_LIMITTEXT, 255, 0); - SendDlgItemMessage(hwnd, IDC_SEP, EM_LIMITTEXT, 15, 0); - - SetDlgItemText(hwnd, IDC_TITLE, flac_cfg.title.tag_format); - SetDlgItemText(hwnd, IDC_SEP, flac_cfg.title.sep); - Check(IDC_ID3V1, 0); -/*! Check(IDC_RESERVE, flac_cfg.tag.reserve_space); */ - Check(IDC_BPS, flac_cfg.display.show_bps); - Check(IDC_ERRORS, flac_cfg.output.misc.stop_err); - return TRUE; - /* commands */ - case WM_COMMAND: - switch (LOWORD(wParam)) - { - /* ok */ - case IDOK: - GetDlgItemText(hwnd, IDC_TITLE, flac_cfg.title.tag_format, sizeof(flac_cfg.title.tag_format)); - if (flac_cfg.title.tag_format_w) - free(flac_cfg.title.tag_format_w); - GetDlgItemText(hwnd, IDC_SEP, flac_cfg.title.sep, sizeof(flac_cfg.title.sep)); - flac_cfg.title.tag_format_w = convert_ansi_to_wide_(flac_cfg.title.tag_format); - -/*! flac_cfg.tag.reserve_space = GetCheck(IDC_RESERVE); */ - flac_cfg.display.show_bps = GetCheck(IDC_BPS); - flac_cfg.output.misc.stop_err = GetCheck(IDC_ERRORS); - break; - /* reset */ - case IDC_RESET: - Check(IDC_ID3V1, 0); - Check(IDC_RESERVE, 1); - Check(IDC_BPS, 1); - Check(IDC_ERRORS, 0); - /* fall throught */ - /* default */ - case IDC_TAGZ_DEFAULT: - SetDlgItemText(hwnd, IDC_TITLE, default_format); - break; - /* help */ - case IDC_TAGZ_HELP: - MessageBox(hwnd, tagz_manual, "Help", 0); - break; - } - break; - } - - return 0; -} - - -static void UpdatePreamp(HWND hwnd, HWND hamp) -{ - int pos = SendMessage(hamp, TBM_GETPOS, 0, 0) - PREAMP_RANGE; - sprintf(buffer, "%d dB", pos); - SetDlgItemText(hwnd, IDC_PA, buffer); -} - -static void UpdateRG(HWND hwnd) -{ - int on = GetCheck(IDC_ENABLE); - Enable(IDC_ALBUM, on); - Enable(IDC_LIMITER, on); - Enable(IDC_PREAMP, on); - Enable(IDC_PA, on); -} - -static void UpdateDither(HWND hwnd) -{ - int on = GetCheck(IDC_DITHERRG); - Enable(IDC_SHAPE, on); -} - -static INT_PTR CALLBACK OutputProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - /* init */ - case WM_INITDIALOG: - Check(IDC_ENABLE, flac_cfg.output.replaygain.enable); - Check(IDC_ALBUM, flac_cfg.output.replaygain.album_mode); - Check(IDC_LIMITER, flac_cfg.output.replaygain.hard_limit); - Check(IDC_DITHER, flac_cfg.output.resolution.normal.dither_24_to_16); - Check(IDC_DITHERRG, flac_cfg.output.resolution.replaygain.dither); - /* prepare preamp slider */ - { - HWND hamp = GetDlgItem(hwnd, IDC_PREAMP); - SendMessage(hamp, TBM_SETRANGE, 1, MAKELONG(0, PREAMP_RANGE*2)); - SendMessage(hamp, TBM_SETPOS, 1, flac_cfg.output.replaygain.preamp+PREAMP_RANGE); - UpdatePreamp(hwnd, hamp); - } - /* fill comboboxes */ - { - HWND hlist = GetDlgItem(hwnd, IDC_TO); - SendMessage(hlist, CB_ADDSTRING, 0, (LPARAM)"16 bps"); - SendMessage(hlist, CB_ADDSTRING, 0, (LPARAM)"24 bps"); - SendMessage(hlist, CB_SETCURSEL, flac_cfg.output.resolution.replaygain.bps_out/8 - 2, 0); - - hlist = GetDlgItem(hwnd, IDC_SHAPE); - SendMessage(hlist, CB_ADDSTRING, 0, (LPARAM)"None"); - SendMessage(hlist, CB_ADDSTRING, 0, (LPARAM)"Low"); - SendMessage(hlist, CB_ADDSTRING, 0, (LPARAM)"Medium"); - SendMessage(hlist, CB_ADDSTRING, 0, (LPARAM)"High"); - SendMessage(hlist, CB_SETCURSEL, flac_cfg.output.resolution.replaygain.noise_shaping, 0); - } - UpdateRG(hwnd); - UpdateDither(hwnd); - return TRUE; - /* commands */ - case WM_COMMAND: - switch (LOWORD(wParam)) - { - /* ok */ - case IDOK: - flac_cfg.output.replaygain.enable = GetCheck(IDC_ENABLE); - flac_cfg.output.replaygain.album_mode = GetCheck(IDC_ALBUM); - flac_cfg.output.replaygain.hard_limit = GetCheck(IDC_LIMITER); - flac_cfg.output.replaygain.preamp = GetPos(IDC_PREAMP) - PREAMP_RANGE; - flac_cfg.output.resolution.normal.dither_24_to_16 = GetCheck(IDC_DITHER); - flac_cfg.output.resolution.replaygain.dither = GetCheck(IDC_DITHERRG); - flac_cfg.output.resolution.replaygain.noise_shaping = GetSel(IDC_SHAPE); - flac_cfg.output.resolution.replaygain.bps_out = (GetSel(IDC_TO)+2)*8; - break; - /* reset */ - case IDC_RESET: - Check(IDC_ENABLE, 1); - Check(IDC_ALBUM, 0); - Check(IDC_LIMITER, 0); - Check(IDC_DITHER, 0); - Check(IDC_DITHERRG, 0); - - SendDlgItemMessage(hwnd, IDC_PREAMP, TBM_SETPOS, 1, PREAMP_RANGE); - SendDlgItemMessage(hwnd, IDC_TO, CB_SETCURSEL, 0, 0); - SendDlgItemMessage(hwnd, IDC_SHAPE, CB_SETCURSEL, 1, 0); - - UpdatePreamp(hwnd, GetDlgItem(hwnd, IDC_PREAMP)); - UpdateRG(hwnd); - UpdateDither(hwnd); - break; - /* active check-boxes */ - case IDC_ENABLE: - UpdateRG(hwnd); - break; - case IDC_DITHERRG: - UpdateDither(hwnd); - break; - } - break; - /* scroller */ - case WM_HSCROLL: - if (GetDlgCtrlID((HWND)lParam)==IDC_PREAMP) - UpdatePreamp(hwnd, (HWND)lParam); - return 0; - } - - return 0; -} - -#define NUM_PAGES 2 - -typedef struct -{ - HWND htab; - HWND hdlg; - RECT r; - HWND all[NUM_PAGES]; -} LOCALDATA; - -static void ScreenToClientRect(HWND hwnd, RECT *rect) -{ - POINT pt = { rect->left, rect->top }; - ScreenToClient(hwnd, &pt); - rect->left = pt.x; - rect->top = pt.y; - - pt.x = rect->right; - pt.y = rect->bottom; - ScreenToClient(hwnd, &pt); - rect->right = pt.x; - rect->bottom = pt.y; -} - -static void SendCommand(HWND hwnd, int command) -{ - LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA); - SendMessage(data->hdlg, WM_COMMAND, command, 0); -} - -static void BroadcastCommand(HWND hwnd, int command) -{ - LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA); - int i; - - for (i=0; i<NUM_PAGES; i++) - SendMessage(data->all[i], WM_COMMAND, command, 0); -} - -static void OnSelChange(HWND hwnd) -{ - LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA); - int index = TabCtrl_GetCurSel(data->htab); - if (index < 0) return; - /* hide previous */ - if (data->hdlg) - ShowWindow(data->hdlg, SW_HIDE); - /* display */ - data->hdlg = data->all[index]; - SetWindowPos(data->hdlg, HWND_TOP, data->r.left, data->r.top, data->r.right-data->r.left, data->r.bottom-data->r.top, SWP_SHOWWINDOW); - SetFocus(hwnd); -} - -static INT_PTR CALLBACK DialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - static activePage = 0; - - switch (msg) - { - /* init */ - case WM_INITDIALOG: - { - LOCALDATA *data = LocalAlloc(LPTR, sizeof(LOCALDATA)); - HINSTANCE inst = (HINSTANCE)lParam; - TCITEM item; - - /* init */ - SetWindowLong(hwnd, GWL_USERDATA, (LONG)data); - data->htab = GetDlgItem(hwnd, IDC_TABS); - data->hdlg = NULL; - /* add pages */ - item.mask = TCIF_TEXT; - data->all[0] = CreateDialog(inst, MAKEINTRESOURCE(IDD_CONFIG_GENERAL), hwnd, GeneralProc); - item.pszText = "General"; - TabCtrl_InsertItem(data->htab, 0, &item); - - data->all[1] = CreateDialog(inst, MAKEINTRESOURCE(IDD_CONFIG_OUTPUT), hwnd, OutputProc); - item.pszText = "Output"; - TabCtrl_InsertItem(data->htab, 1, &item); - /* get rect (after adding pages) */ - GetWindowRect(data->htab, &data->r); - ScreenToClientRect(hwnd, &data->r); - TabCtrl_AdjustRect(data->htab, 0, &data->r); - /* simulate item change */ - TabCtrl_SetCurSel(data->htab, activePage); - OnSelChange(hwnd); - } - return TRUE; - /* destory */ - case WM_DESTROY: - { - LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA); - int i; - - activePage = TabCtrl_GetCurSel(data->htab); - - for (i=0; i<NUM_PAGES; i++) - DestroyWindow(data->all[i]); - - LocalFree(data); - } - break; - /* commands */ - case WM_COMMAND: - switch (LOWORD(wParam)) - { - /* ok/cancel */ - case IDOK: - BroadcastCommand(hwnd, IDOK); - /* fall through */ - case IDCANCEL: - EndDialog(hwnd, LOWORD(wParam)); - return TRUE; - case IDC_RESET: - SendCommand(hwnd, IDC_RESET); - break; - } - break; - /* notification */ - case WM_NOTIFY: - if (LOWORD(wParam) == IDC_TABS) - { - NMHDR *hdr = (NMHDR*)lParam; - - switch (hdr->code) - { - case TCN_SELCHANGE: - OnSelChange(hwnd); - break; - } - } - break; - } - - return 0; -} - - -int DoConfig(HINSTANCE inst, HWND parent) -{ - return DialogBoxParam(inst, MAKEINTRESOURCE(IDD_CONFIG), parent, DialogProc, (LONG)inst) == IDOK; -} diff --git a/3rdparty/libflac/src/plugin_winamp2/configure.h b/3rdparty/libflac/src/plugin_winamp2/configure.h deleted file mode 100644 index 5c051aff73e..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/configure.h +++ /dev/null @@ -1,49 +0,0 @@ -/* in_flac - Winamp2 FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 - */ - -#include "playback.h" - -/* - * common stuff - */ - -typedef struct { - struct { - char tag_format[256]; - char sep[16]; - WCHAR *tag_format_w; - } title; - struct { - BOOL reserve_space; - } tag; - struct { - FLAC__bool show_bps; - } display; - output_config_t output; -} flac_config_t; - -extern flac_config_t flac_cfg; - -/* - * prototypes - */ - -void InitConfig(); -void ReadConfig(); -void WriteConfig(); -int DoConfig(HINSTANCE inst, HWND parent); diff --git a/3rdparty/libflac/src/plugin_winamp2/in_flac.c b/3rdparty/libflac/src/plugin_winamp2/in_flac.c deleted file mode 100644 index dc3fc5480af..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/in_flac.c +++ /dev/null @@ -1,443 +0,0 @@ -/* in_flac - Winamp2 FLAC input plugin - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <windows.h> -#include <limits.h> /* for INT_MAX */ -#include <stdio.h> - -#include "share/alloc.h" -#include "winamp2/in2.h" -#include "configure.h" -#include "infobox.h" -#include "tagz.h" - -#define PLUGIN_VERSION "1.2.1" - -static In_Module mod_; /* the input module (declared near the bottom of this file) */ -static char lastfn_[MAX_PATH]; /* currently playing file (used for getting info on the current file) */ -flac_config_t flac_cfg; - -static stream_data_struct stream_data_; -static int paused; -static FLAC__StreamDecoder *decoder_; -static char sample_buffer_[SAMPLES_PER_WRITE * FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS * (24/8) * 2]; -/* (24/8) for max bytes per sample, and 2 for DSPs */ - -static HANDLE thread_handle = NULL; /* the handle to the decode thread */ -static DWORD WINAPI DecodeThread(void *b); /* the decode thread procedure */ - -/* - * init/quit - */ - -static void init() -{ - decoder_ = FLAC__stream_decoder_new(); - strcpy(lastfn_, ""); - - InitConfig(); - ReadConfig(); - InitInfobox(); -} - -static void quit() -{ - WriteConfig(); - DeinitInfobox(); - FLAC_plugin__decoder_delete(decoder_); - decoder_ = 0; -} - -/* - * open/close - */ - -static int isourfile(char *fn) { return 0; } - -static int play(char *fn) -{ - LONGLONG filesize; - DWORD thread_id; - int maxlatency; - /* checks */ - if (decoder_ == 0) return 1; - if (!(filesize = FileSize(fn))) return -1; - /* init decoder */ - if (!FLAC_plugin__decoder_init(decoder_, fn, filesize, &stream_data_, &flac_cfg.output)) - return 1; - strcpy(lastfn_, fn); - /* open output */ - maxlatency = mod_.outMod->Open(stream_data_.sample_rate, stream_data_.channels, stream_data_.output_bits_per_sample, -1, -1); - if (maxlatency < 0) - { - FLAC_plugin__decoder_finish(decoder_); - return 1; - } - /* set defaults */ - mod_.outMod->SetVolume(-666); - mod_.outMod->SetPan(0); - /* initialize vis stuff */ - mod_.SAVSAInit(maxlatency, stream_data_.sample_rate); - mod_.VSASetInfo(stream_data_.sample_rate, stream_data_.channels); - /* set info */ - mod_.SetInfo(stream_data_.average_bps, stream_data_.sample_rate/1000, stream_data_.channels, 1); - /* start playing thread */ - paused = 0; - thread_handle = CreateThread(NULL, 0, DecodeThread, NULL, 0, &thread_id); - if (!thread_handle) return 1; - - return 0; -} - -static void stop() -{ - if (thread_handle) - { - stream_data_.is_playing = false; - if (WaitForSingleObject(thread_handle, 2000) == WAIT_TIMEOUT) - { - FLAC_plugin__show_error("Error while stopping decoding thread."); - TerminateThread(thread_handle, 0); - } - CloseHandle(thread_handle); - thread_handle = NULL; - } - - FLAC_plugin__decoder_finish(decoder_); - mod_.outMod->Close(); - mod_.SAVSADeInit(); -} - -/* - * play control - */ - -static void pause() -{ - paused = 1; - mod_.outMod->Pause(1); -} - -static void unpause() -{ - paused = 0; - mod_.outMod->Pause(0); -} - -static int ispaused() -{ - return paused; -} - -static int getlength() -{ - return stream_data_.length_in_msec; -} - -static int getoutputtime() -{ - return mod_.outMod->GetOutputTime(); -} - -static void setoutputtime(int time_in_ms) -{ - stream_data_.seek_to = time_in_ms; -} - -static void setvolume(int volume) -{ - mod_.outMod->SetVolume(volume); -} - -static void setpan(int pan) -{ - mod_.outMod->SetPan(pan); -} - -static void eq_set(int on, char data[10], int preamp) {} - -/* - * playing loop - */ - -static void do_vis(char *data, int nch, int resolution, int position, unsigned samples) -{ - static char vis_buffer[SAMPLES_PER_WRITE * FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS]; - char *ptr; - int size, count; - - /* - * Winamp visuals may have problems accepting sample sizes larger than - * 16 bits, so we reduce the sample size here if necessary. - */ - - switch(resolution) { - case 32: - case 24: - size = resolution / 8; - count = samples * nch; - data += size - 1; - - ptr = vis_buffer; - while(count--) { - *ptr++ = data[0] ^ 0x80; - data += size; - } - - data = vis_buffer; - resolution = 8; - /* fall through */ - case 16: - case 8: - mod_.SAAddPCMData(data, nch, resolution, position); - mod_.VSAAddPCMData(data, nch, resolution, position); - } -} - -static DWORD WINAPI DecodeThread(void *unused) -{ - const unsigned channels = stream_data_.channels; - const unsigned bits_per_sample = stream_data_.bits_per_sample; - const unsigned target_bps = stream_data_.output_bits_per_sample; - const unsigned sample_rate = stream_data_.sample_rate; - const unsigned fact = channels * (target_bps/8); - - while (stream_data_.is_playing) - { - /* seek needed */ - if (stream_data_.seek_to != -1) - { - const int pos = FLAC_plugin__seek(decoder_, &stream_data_); - if (pos != -1) mod_.outMod->Flush(pos); - } - /* stream ended */ - else if (stream_data_.eof) - { - if (!mod_.outMod->IsPlaying()) - { - PostMessage(mod_.hMainWindow, WM_WA_MPEG_EOF, 0, 0); - return 0; - } - Sleep(10); - } - /* decode */ - else - { - /* decode samples */ - int bytes = FLAC_plugin__decode(decoder_, &stream_data_, sample_buffer_); - const int n = bytes / fact; - /* visualization */ - do_vis(sample_buffer_, channels, target_bps, mod_.outMod->GetWrittenTime(), n); - /* dsp */ - if (mod_.dsp_isactive()) - bytes = mod_.dsp_dosamples((short*)sample_buffer_, n, target_bps, channels, sample_rate) * fact; - /* output */ - while (mod_.outMod->CanWrite()<bytes && stream_data_.is_playing && stream_data_.seek_to==-1) - Sleep(20); - if (stream_data_.is_playing && stream_data_.seek_to==-1) - mod_.outMod->Write(sample_buffer_, bytes); - /* show bitrate */ - if (flac_cfg.display.show_bps) - { - const int rate = FLAC_plugin__get_rate(mod_.outMod->GetWrittenTime(), mod_.outMod->GetOutputTime(), &stream_data_); - if (rate) mod_.SetInfo(rate/1000, stream_data_.sample_rate/1000, stream_data_.channels, 1); - } - } - } - - return 0; -} - -/* - * title formatting - */ - -static T_CHAR *get_tag(const T_CHAR *tag, void *param) -{ - FLAC__StreamMetadata *tags = (FLAC__StreamMetadata*)param; - char *tagname, *p; - T_CHAR *val; - - if (!tag) - return 0; - /* Vorbis comment names must be ASCII, so convert 'tag' first */ - tagname = safe_malloc_add_2op_(wcslen(tag), /*+*/1); - for(p=tagname;*tag;) { - if(*tag > 0x7d) { - free(tagname); - return 0; - } - else - *p++ = (char)(*tag++); - } - *p++ = '\0'; - /* now get it */ - val = FLAC_plugin__tags_get_tag_ucs2(tags, tagname); - free(tagname); - /* some "user friendly cheavats" */ - if (!val) - { - if (!wcsicmp(tag, L"ARTIST")) - { - val = FLAC_plugin__tags_get_tag_ucs2(tags, "PERFORMER"); - if (!val) val = FLAC_plugin__tags_get_tag_ucs2(tags, "COMPOSER"); - } - else if (!wcsicmp(tag, L"YEAR") || !wcsicmp(tag, L"DATE")) - { - val = FLAC_plugin__tags_get_tag_ucs2(tags, "YEAR_RECORDED"); - if (!val) val = FLAC_plugin__tags_get_tag_ucs2(tags, "YEAR_PERFORMED"); - } - } - - return val; -} - -static void free_tag(T_CHAR *tag, void *param) -{ - (void)param; - free(tag); -} - -static void format_title(const char *filename, WCHAR *title, unsigned max_size) -{ - FLAC__StreamMetadata *tags; - - ReadTags(filename, &tags, /*forDisplay=*/true); - - tagz_format(flac_cfg.title.tag_format_w, get_tag, free_tag, tags, title, max_size); - - FLAC_plugin__tags_destroy(&tags); -} - -static void getfileinfo(char *filename, char *title, int *length_in_msec) -{ - FLAC__StreamMetadata streaminfo; - - if (!filename || !*filename) { - filename = lastfn_; - if (length_in_msec) { - *length_in_msec = stream_data_.length_in_msec; - length_in_msec = 0; /* force skip in following code */ - } - } - - if (!FLAC__metadata_get_streaminfo(filename, &streaminfo)) { - if (length_in_msec) - *length_in_msec = -1; - return; - } - - if (title) { - static WCHAR buffer[400]; - format_title(filename, buffer, 400); - WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, buffer, -1, title, 400, NULL, NULL); - } - - if (length_in_msec) { - /* with VC++ you have to spoon feed it the casting from uint64->int64->double */ - FLAC__uint64 l = (FLAC__uint64)((double)(FLAC__int64)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; - } -} - -/* - * interface - */ - -void FLAC_plugin__show_error(const char *message,...) -{ - char foo[512]; - va_list args; - va_start(args, message); - vsprintf(foo, message, args); - va_end(args); - MessageBox(mod_.hMainWindow, foo, "FLAC Plug-in Error", MB_ICONSTOP); -} - -static void about(HWND hwndParent) -{ - MessageBox(hwndParent, "Winamp2 FLAC Plugin v"PLUGIN_VERSION"\nby Josh Coalson and X-Fixer\n\nuses libFLAC "VERSION"\nSee http://flac.sourceforge.net/\n", "About FLAC Plugin", MB_ICONINFORMATION); -} - -static void config(HWND hwndParent) -{ - if (DoConfig(mod_.hDllInstance, hwndParent)) - WriteConfig(); -} - -static int infobox(char *fn, HWND hwnd) -{ - DoInfoBox(mod_.hDllInstance, hwnd, fn); - return 0; -} - -/* - * exported stuff - */ - -static In_Module mod_ = -{ - IN_VER, - "FLAC Decoder v" PLUGIN_VERSION, - 0, /* hMainWindow */ - 0, /* hDllInstance */ - "FLAC\0FLAC Audio File (*.FLAC)\0", - 1, /* is_seekable */ - 1, /* uses output */ - config, - about, - init, - quit, - getfileinfo, - infobox, - isourfile, - play, - pause, - unpause, - ispaused, - stop, - - getlength, - getoutputtime, - setoutputtime, - - setvolume, - setpan, - - 0,0,0,0,0,0,0,0,0, /* vis stuff */ - 0,0, /* dsp */ - eq_set, - NULL, /* setinfo */ - 0 /* out_mod */ -}; - -__declspec(dllexport) In_Module *winampGetInModule2() -{ - return &mod_; -} - -BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) -{ - return TRUE; -} diff --git a/3rdparty/libflac/src/plugin_winamp2/in_flac.dsp b/3rdparty/libflac/src/plugin_winamp2/in_flac.dsp deleted file mode 100644 index fa49abb7ef0..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/in_flac.dsp +++ /dev/null @@ -1,154 +0,0 @@ -# Microsoft Developer Studio Project File - Name="in_flac" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=in_flac - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "in_flac.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "in_flac.mak" CFG="in_flac - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "in_flac - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "in_flac - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "$/Studio/in_flac" -# PROP Scc_LocalPath "." -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "in_flac - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "in_flac_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /WX /GX /Ox /Og /Oi /Os /Op /Gf /Gy /I "include" /I ".." /I "..\..\include" /D "NDEBUG" /D VERSION=\"1.2.1\" /D "in_flac_EXPORTS" /D "FLAC__NO_DLL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAGZ_UNICODE" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 plugin_common_static.lib grabbag_static.lib libFLAC_static.lib replaygain_analysis_static.lib replaygain_synthesis_static.lib kernel32.lib user32.lib /nologo /dll /machine:I386 /out:"../../obj/release/bin/in_flac.dll" /libpath:"../../obj/release/lib" ..\..\obj\release\lib\ogg_static.lib /opt:nowin98 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "in_flac - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "in_flac_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "include" /I ".." /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "REAL_STDIO" /D VERSION=\"1.2.1\" /D "in_flac_EXPORTS" /D "FLAC__NO_DLL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TAGZ_UNICODE" /YX /FD /GZ /c -# SUBTRACT CPP /WX -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 plugin_common_static.lib grabbag_static.lib libFLAC_static.lib replaygain_analysis_static.lib replaygain_synthesis_static.lib kernel32.lib user32.lib /nologo /dll /debug /machine:I386 /out:"../../obj/debug/bin/in_flac.dll" /pdbtype:sept /libpath:"../../obj/debug/lib" ..\..\obj\release\lib\ogg_static.lib -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "in_flac - Win32 Release" -# Name "in_flac - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Group "Winamp2 SDK" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\include\winamp2\in2.h -# End Source File -# Begin Source File - -SOURCE=.\include\winamp2\out.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\configure.c -# End Source File -# Begin Source File - -SOURCE=.\configure.h -# End Source File -# Begin Source File - -SOURCE=.\in_flac.c -# End Source File -# Begin Source File - -SOURCE=.\infobox.c -# End Source File -# Begin Source File - -SOURCE=.\infobox.h -# End Source File -# Begin Source File - -SOURCE=.\playback.c -# End Source File -# Begin Source File - -SOURCE=.\playback.h -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\resource.rc -# End Source File -# Begin Source File - -SOURCE=.\tagz.cpp -# End Source File -# Begin Source File - -SOURCE=.\tagz.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/plugin_winamp2/in_flac.vcproj b/3rdparty/libflac/src/plugin_winamp2/in_flac.vcproj deleted file mode 100644 index 553451c7b30..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/in_flac.vcproj +++ /dev/null @@ -1,259 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="in_flac" - ProjectGUID="{4cefbc82-c215-11db-8314-0800200c9a66}" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\lib" - IntermediateDirectory="Debug_dynamic" - ConfigurationType="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;IN_FLAC_EXPORTS;FLAC__NO_DLL;VERSION=\"1.2.0\";TAGZ_UNICODE;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories=""C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include"" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib user32.lib" - LinkIncremental="2" - AdditionalLibraryDirectories="C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\lib" - IntermediateDirectory="Release_dynamic" - ConfigurationType="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IN_FLAC_EXPORTS;FLAC__NO_DLL;VERSION=\"1.2.0\";TAGZ_UNICODE" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - AdditionalIncludeDirectories=""C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include"" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib user32.lib" - LinkIncremental="1" - AdditionalLibraryDirectories="C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\configure.h" - > - </File> - <File - RelativePath=".\include\winamp2\in2.h" - > - </File> - <File - RelativePath=".\infobox.h" - > - </File> - <File - RelativePath=".\include\winamp2\out.h" - > - </File> - <File - RelativePath=".\playback.h" - > - </File> - <File - RelativePath=".\resource.h" - > - </File> - <File - RelativePath=".\tagz.h" - > - </File> - </Filter> - <Filter - Name="Resource Files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - <File - RelativePath=".\resource.rc" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\configure.c" - > - </File> - <File - RelativePath=".\in_flac.c" - > - </File> - <File - RelativePath=".\infobox.c" - > - </File> - <File - RelativePath=".\playback.c" - > - </File> - <File - RelativePath=".\tagz.cpp" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/plugin_winamp2/include/Makefile.am b/3rdparty/libflac/src/plugin_winamp2/include/Makefile.am deleted file mode 100644 index ea96623b482..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/include/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -# in_flac - Winamp2 FLAC input plugin -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -SUBDIRS = winamp2 diff --git a/3rdparty/libflac/src/plugin_winamp2/include/Makefile.in b/3rdparty/libflac/src/plugin_winamp2/include/Makefile.in deleted file mode 100644 index 832ec5257d3..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/include/Makefile.in +++ /dev/null @@ -1,520 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# in_flac - Winamp2 FLAC input plugin -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -SUBDIRS = winamp2 -subdir = src/plugin_winamp2/include -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = $(SUBDIRS) -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/plugin_winamp2/include/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - else \ - include_option=--include; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: - -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/plugin_winamp2/include/winamp2/Makefile.am b/3rdparty/libflac/src/plugin_winamp2/include/winamp2/Makefile.am deleted file mode 100644 index 8153ed8bc81..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/include/winamp2/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -# in_flac - Winamp2 FLAC input plugin -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -EXTRA_DIST = \ - in2.h \ - out.h diff --git a/3rdparty/libflac/src/plugin_winamp2/include/winamp2/Makefile.in b/3rdparty/libflac/src/plugin_winamp2/include/winamp2/Makefile.in deleted file mode 100644 index a9082bde301..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/include/winamp2/Makefile.in +++ /dev/null @@ -1,374 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# in_flac - Winamp2 FLAC input plugin -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -EXTRA_DIST = \ - in2.h \ - out.h - -subdir = src/plugin_winamp2/include/winamp2 -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/plugin_winamp2/include/winamp2/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/plugin_winamp2/include/winamp2/in2.h b/3rdparty/libflac/src/plugin_winamp2/include/winamp2/in2.h deleted file mode 100644 index 130ec496915..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/include/winamp2/in2.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Standard Winamp input-plugin header - */ - -#include "out.h" - -/* post this to the main window at end of file (after playback as stopped) */ -#define WM_WA_MPEG_EOF (WM_USER + 2) - -// note: exported symbol is now winampGetInModule2. - -#define IN_VER 0x100 - -typedef struct -{ - int version; // module type (IN_VER) - char *description; // description of module, with version string - - HWND hMainWindow; // winamp's main window (filled in by winamp) - HINSTANCE hDllInstance; // DLL instance handle (Also filled in by winamp) - - char *FileExtensions; // "mp3\0Layer 3 MPEG\0mp2\0Layer 2 MPEG\0mpg\0Layer 1 MPEG\0" - // May be altered from Config, so the user can select what they want - - int is_seekable; // is this stream seekable? - int UsesOutputPlug; // does this plug-in use the output plug-ins? (musn't ever change, ever :) - - void (*Config)(HWND hwndParent); // configuration dialog - void (*About)(HWND hwndParent); // about dialog - - void (*Init)(); // called at program init - void (*Quit)(); // called at program quit - - void (*GetFileInfo)(char *file, char *title, int *length_in_ms); // if file == NULL, current playing is used - int (*InfoBox)(char *file, HWND hwndParent); - - int (*IsOurFile)(char *fn); // called before extension checks, to allow detection of mms://, etc - // playback stuff - int (*Play)(char *fn); // return zero on success, -1 on file-not-found, some other value on other (stopping winamp) error - void (*Pause)(); // pause stream - void (*UnPause)(); // unpause stream - int (*IsPaused)(); // ispaused? return 1 if paused, 0 if not - void (*Stop)(); // stop (unload) stream - - // time stuff - int (*GetLength)(); // get length in ms - int (*GetOutputTime)(); // returns current output time in ms. (usually returns outMod->GetOutputTime() - void (*SetOutputTime)(int time_in_ms); // seeks to point in stream (in ms). Usually you signal yoru thread to seek, which seeks and calls outMod->Flush().. - - // volume stuff - void (*SetVolume)(int volume); // from 0 to 255.. usually just call outMod->SetVolume - void (*SetPan)(int pan); // from -127 to 127.. usually just call outMod->SetPan - - // in-window builtin vis stuff - - void (*SAVSAInit)(int maxlatency_in_ms, int srate); // call once in Play(). maxlatency_in_ms should be the value returned from outMod->Open() - // call after opening audio device with max latency in ms and samplerate - void (*SAVSADeInit)(); // call in Stop() - - - // simple vis supplying mode - void (*SAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); - // sets the spec data directly from PCM data - // quick and easy way to get vis working :) - // needs at least 576 samples :) - - // advanced vis supplying mode, only use if you're cool. Use SAAddPCMData for most stuff. - int (*SAGetMode)(); // gets csa (the current type (4=ws,2=osc,1=spec)) - // use when calling SAAdd() - void (*SAAdd)(void *data, int timestamp, int csa); // sets the spec data, filled in by winamp - - - // vis stuff (plug-in) - // simple vis supplying mode - void (*VSAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); // sets the vis data directly from PCM data - // quick and easy way to get vis working :) - // needs at least 576 samples :) - - // advanced vis supplying mode, only use if you're cool. Use VSAAddPCMData for most stuff. - int (*VSAGetMode)(int *specNch, int *waveNch); // use to figure out what to give to VSAAdd - void (*VSAAdd)(void *data, int timestamp); // filled in by winamp, called by plug-in - - - // call this in Play() to tell the vis plug-ins the current output params. - void (*VSASetInfo)(int nch, int srate); - - - // dsp plug-in processing: - // (filled in by winamp, called by input plug) - - // returns 1 if active (which means that the number of samples returned by dsp_dosamples - // could be greater than went in.. Use it to estimate if you'll have enough room in the - // output buffer - int (*dsp_isactive)(); - - // returns number of samples to output. This can be as much as twice numsamples. - // be sure to allocate enough buffer for samples, then. - int (*dsp_dosamples)(short int *samples, int numsamples, int bps, int nch, int srate); - - - // eq stuff - void (*EQSet)(int on, char data[10], int preamp); // 0-64 each, 31 is +0, 0 is +12, 63 is -12. Do nothing to ignore. - - // info setting (filled in by winamp) - void (*SetInfo)(int bitrate, int srate, int stereo, int synched); // if -1, changes ignored? :) - - Out_Module *outMod; // filled in by winamp, optionally used :) -} In_Module; diff --git a/3rdparty/libflac/src/plugin_winamp2/include/winamp2/out.h b/3rdparty/libflac/src/plugin_winamp2/include/winamp2/out.h deleted file mode 100644 index e8ad41270a5..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/include/winamp2/out.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Standard Winamp output-plugin header - */ - -#define OUT_VER 0x10 - -typedef struct -{ - int version; // module version (OUT_VER) - char *description; // description of module, with version string - int id; // module id. each input module gets its own. non-nullsoft modules should - // be >= 65536. - - HWND hMainWindow; // winamp's main window (filled in by winamp) - HINSTANCE hDllInstance; // DLL instance handle (filled in by winamp) - - void (*Config)(HWND hwndParent); // configuration dialog - void (*About)(HWND hwndParent); // about dialog - - void (*Init)(); // called when loaded - void (*Quit)(); // called when unloaded - - int (*Open)(int samplerate, int numchannels, int bitspersamp, int bufferlenms, int prebufferms); - // returns >=0 on success, <0 on failure - // NOTENOTENOTE: bufferlenms and prebufferms are ignored in most if not all output plug-ins. - // ... so don't expect the max latency returned to be what you asked for. - // returns max latency in ms (0 for diskwriters, etc) - // bufferlenms and prebufferms must be in ms. 0 to use defaults. - // prebufferms must be <= bufferlenms - - void (*Close)(); // close the ol' output device. - - int (*Write)(char *buf, int len); - // 0 on success. Len == bytes to write (<= 8192 always). buf is straight audio data. - // 1 returns not able to write (yet). Non-blocking, always. - - int (*CanWrite)(); // returns number of bytes possible to write at a given time. - // Never will decrease unless you call Write (or Close, heh) - - int (*IsPlaying)(); // non0 if output is still going or if data in buffers waiting to be - // written (i.e. closing while IsPlaying() returns 1 would truncate the song - - int (*Pause)(int pause); // returns previous pause state - - void (*SetVolume)(int volume); // volume is 0-255 - void (*SetPan)(int pan); // pan is -128 to 128 - - void (*Flush)(int t); // flushes buffers and restarts output at time t (in ms) - // (used for seeking) - - int (*GetOutputTime)(); // returns played time in MS - int (*GetWrittenTime)(); // returns time written in MS (used for synching up vis stuff) - -} Out_Module; - - diff --git a/3rdparty/libflac/src/plugin_winamp2/infobox.c b/3rdparty/libflac/src/plugin_winamp2/infobox.c deleted file mode 100644 index 00dc5e6fa44..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/infobox.c +++ /dev/null @@ -1,459 +0,0 @@ -/* in_flac - Winamp2 FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <windows.h> -#include <stdio.h> -#include "FLAC/all.h" -#include "share/alloc.h" -#include "plugin_common/all.h" -#include "infobox.h" -#include "configure.h" -#include "resource.h" - - -typedef struct -{ - char filename[MAX_PATH]; - FLAC__StreamMetadata *tags; -} LOCALDATA; - -static char buffer[8192]; -static char *genres = NULL; -static DWORD genresSize = 0, genresCount = 0; -static BOOL genresChanged = FALSE, isNT; - -static const char infoTitle[] = "FLAC File Info"; - -/* - * Genres - */ - -/* TODO: write genres in utf-8 ? */ - -static __inline int GetGenresFileName(char *buffer, int size) -{ - char *c; - - if (!GetModuleFileName(NULL, buffer, size)) - return 0; - c = strrchr(buffer, '\\'); - if (!c) return 0; - strcpy(c+1, "genres.txt"); - - return 1; -} - -static void LoadGenres() -{ - HANDLE hFile; - DWORD spam; - char *c; - - FLAC__ASSERT(0 != genres); - - if (!GetGenresFileName(buffer, sizeof(buffer))) return; - /* load file */ - hFile = CreateFile(buffer, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) return; - genresSize = GetFileSize(hFile, 0); - if (genresSize && (genres = (char*)safe_malloc_add_2op_(genresSize, /*+*/2))) - { - if (!ReadFile(hFile, genres, genresSize, &spam, NULL) || spam!=genresSize) - { - free(genres); - genres = NULL; - } - else - { - genres[genresSize] = 0; - genres[genresSize+1] = 0; - /* replace newlines */ - genresChanged = FALSE; - genresCount = 1; - - for (c=genres; *c; c++) - { - if (*c == 10) - { - *c = 0; - if (*(c+1)) - genresCount++; - else genresSize--; - } - } - } - } - - CloseHandle(hFile); -} - -static void SaveGenres(HWND hlist) -{ - HANDLE hFile; - DWORD spam; - int i, count, len; - - if (!GetGenresFileName(buffer, sizeof(buffer))) return; - /* write file */ - hFile = CreateFile(buffer, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile == INVALID_HANDLE_VALUE) return; - - count = SendMessage(hlist, CB_GETCOUNT, 0, 0); - for (i=0; i<count; i++) - { - SendMessage(hlist, CB_GETLBTEXT, i, (LPARAM)buffer); - len = strlen(buffer); - if (i != count-1) - { - buffer[len] = 10; - len++; - } - WriteFile(hFile, buffer, len, &spam, NULL); - } - - CloseHandle(hFile); -} - -static void AddGenre(HWND hwnd, const char *genre) -{ - HWND hgen = GetDlgItem(hwnd, IDC_GENRE); - - if (SendMessage(hgen, CB_FINDSTRINGEXACT, -1, (LPARAM)genre) == CB_ERR) - { - genresChanged = TRUE; - SendMessage(hgen, CB_ADDSTRING, 0, (LPARAM)genre); - } -} - -static void InitGenres(HWND hwnd) -{ - HWND hgen = GetDlgItem(hwnd, IDC_GENRE); - char *c; - - /* set text length limit to 64 chars */ - SendMessage(hgen, CB_LIMITTEXT, 64, 0); - /* try to load genres */ - if (!genres) - LoadGenres(hgen); - /* add the to list */ - if (genres) - { - SendMessage(hgen, CB_INITSTORAGE, genresCount, genresSize); - - for (c = genres; *c; c += strlen(c)+1) - SendMessage(hgen, CB_ADDSTRING, 0, (LPARAM)c); - } -} - -static void DeinitGenres(HWND hwnd, BOOL final) -{ - if (genresChanged && hwnd) - { - SaveGenres(GetDlgItem(hwnd, IDC_GENRE)); - genresChanged = FALSE; - final = TRUE; - } - if (final) - { - free(genres); - genres = 0; - } -} - -static wchar_t *AnsiToWide(const char *src) -{ - int len; - wchar_t *dest; - - FLAC__ASSERT(0 != src); - - len = strlen(src) + 1; - /* copy */ - dest = (wchar_t*)safe_malloc_mul_2op_(len, /*times*/sizeof(wchar_t)); - if (dest) mbstowcs(dest, src, len); - return dest; -} - -/* - * Infobox helpers - */ - -#define SetText(x,y) ucs2 = FLAC_plugin__tags_get_tag_ucs2(data->tags, y); \ - WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, ucs2, -1, buffer, sizeof(buffer), NULL, NULL); \ - if(ucs2) free(ucs2); \ - SetDlgItemText(hwnd, x, buffer) - -#define GetText(x,y) GetDlgItemText(hwnd, x, buffer, sizeof(buffer)); \ - if (*buffer) { ucs2 = AnsiToWide(buffer); FLAC_plugin__tags_set_tag_ucs2(data->tags, y, ucs2, /*replace_all=*/false); free(ucs2); } \ - else FLAC_plugin__tags_delete_tag(data->tags, y) - -#define SetTextW(x,y) ucs2 = FLAC_plugin__tags_get_tag_ucs2(data->tags, y); \ - SetDlgItemTextW(hwnd, x, ucs2); \ - free(ucs2) - -#define GetTextW(x,y) GetDlgItemTextW(hwnd, x, (WCHAR*)buffer, sizeof(buffer)/2); \ - if (*(WCHAR*)buffer) FLAC_plugin__tags_set_tag_ucs2(data->tags, y, (WCHAR*)buffer, /*replace_all=*/false); \ - else FLAC_plugin__tags_delete_tag(data->tags, y) - - -static BOOL InitInfoboxInfo(HWND hwnd, const char *file) -{ - LOCALDATA *data = LocalAlloc(LPTR, sizeof(LOCALDATA)); - wchar_t *ucs2; - FLAC__StreamMetadata streaminfo; - DWORD length, bps, ratio, rg; - LONGLONG filesize; - - SetWindowLong(hwnd, GWL_USERDATA, (LONG)data); - /* file name */ - strncpy(data->filename, file, sizeof(data->filename)); - SetDlgItemText(hwnd, IDC_NAME, file); - /* stream data and vorbis comment */ - filesize = FileSize(file); - if (!filesize) return FALSE; - if (!FLAC__metadata_get_streaminfo(file, &streaminfo)) - return FALSE; - ReadTags(file, &data->tags, false); - - length = (DWORD)(streaminfo.data.stream_info.total_samples / streaminfo.data.stream_info.sample_rate); - bps = (DWORD)(filesize / (125*streaminfo.data.stream_info.total_samples/streaminfo.data.stream_info.sample_rate)); - ratio = bps*1000000 / (streaminfo.data.stream_info.sample_rate*streaminfo.data.stream_info.channels*streaminfo.data.stream_info.bits_per_sample); - rg = FLAC_plugin__tags_get_tag_utf8(data->tags, "REPLAYGAIN_TRACK_GAIN") ? 1 : 0; - rg |= FLAC_plugin__tags_get_tag_utf8(data->tags, "REPLAYGAIN_ALBUM_GAIN") ? 2 : 0; - - sprintf(buffer, "Sample rate: %d Hz\nChannels: %d\nBits per sample: %d\nMin block size: %d\nMax block size: %d\n" - "File size: %I64d bytes\nTotal samples: %I64d\nLength: %d:%02d\nAvg. bitrate: %d\nCompression ratio: %d.%d%%\n" - "ReplayGain: %s\n", - streaminfo.data.stream_info.sample_rate, streaminfo.data.stream_info.channels, streaminfo.data.stream_info.bits_per_sample, - streaminfo.data.stream_info.min_blocksize, streaminfo.data.stream_info.max_blocksize, filesize, streaminfo.data.stream_info.total_samples, - length/60, length%60, bps, ratio/10, ratio%10, - rg==3 ? "track gain\nReplayGain: album gain" : rg==2 ? "album gain" : rg==1 ? "track gain" : "not present"); - - SetDlgItemText(hwnd, IDC_INFO, buffer); - /* tag */ - if (isNT) - { - SetTextW(IDC_TITLE, "TITLE"); - SetTextW(IDC_ARTIST, "ARTIST"); - SetTextW(IDC_ALBUM, "ALBUM"); - SetTextW(IDC_COMMENT, "COMMENT"); - SetTextW(IDC_YEAR, "DATE"); - SetTextW(IDC_TRACK, "TRACKNUMBER"); - SetTextW(IDC_GENRE, "GENRE"); - } - else - { - SetText(IDC_TITLE, "TITLE"); - SetText(IDC_ARTIST, "ARTIST"); - SetText(IDC_ALBUM, "ALBUM"); - SetText(IDC_COMMENT, "COMMENT"); - SetText(IDC_YEAR, "DATE"); - SetText(IDC_TRACK, "TRACKNUMBER"); - SetText(IDC_GENRE, "GENRE"); - } - - return TRUE; -} - -static void __inline SetTag(HWND hwnd, const char *filename, FLAC__StreamMetadata *tags) -{ - strcpy(buffer, infoTitle); - - if (FLAC_plugin__tags_set(filename, tags)) - strcat(buffer, " [Updated]"); - else strcat(buffer, " [Failed]"); - - SetWindowText(hwnd, buffer); -} - -static void UpdateTag(HWND hwnd) -{ - LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA); - wchar_t *ucs2; - - /* get fields */ - if (isNT) - { - GetTextW(IDC_TITLE, "TITLE"); - GetTextW(IDC_ARTIST, "ARTIST"); - GetTextW(IDC_ALBUM, "ALBUM"); - GetTextW(IDC_COMMENT, "COMMENT"); - GetTextW(IDC_YEAR, "DATE"); - GetTextW(IDC_TRACK, "TRACKNUMBER"); - GetTextW(IDC_GENRE, "GENRE"); - - ucs2 = FLAC_plugin__tags_get_tag_ucs2(data->tags, "GENRE"); - WideCharToMultiByte(CP_ACP, WC_COMPOSITECHECK, ucs2, -1, buffer, sizeof(buffer), NULL, NULL); - free(ucs2); - } - else - { - GetText(IDC_TITLE, "TITLE"); - GetText(IDC_ARTIST, "ARTIST"); - GetText(IDC_ALBUM, "ALBUM"); - GetText(IDC_COMMENT, "COMMENT"); - GetText(IDC_YEAR, "DATE"); - GetText(IDC_TRACK, "TRACKNUMBER"); - GetText(IDC_GENRE, "GENRE"); - } - - /* update genres list (buffer should contain genre) */ - if (buffer[0]) AddGenre(hwnd, buffer); - - /* write tag */ - SetTag(hwnd, data->filename, data->tags); -} - -static void RemoveTag(HWND hwnd) -{ - LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA); - FLAC_plugin__tags_delete_all(data->tags); - - SetDlgItemText(hwnd, IDC_TITLE, ""); - SetDlgItemText(hwnd, IDC_ARTIST, ""); - SetDlgItemText(hwnd, IDC_ALBUM, ""); - SetDlgItemText(hwnd, IDC_COMMENT, ""); - SetDlgItemText(hwnd, IDC_YEAR, ""); - SetDlgItemText(hwnd, IDC_TRACK, ""); - SetDlgItemText(hwnd, IDC_GENRE, ""); - - SetTag(hwnd, data->filename, data->tags); -} - - -static INT_PTR CALLBACK InfoProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - /* init */ - case WM_INITDIALOG: - SetWindowText(hwnd, infoTitle); - InitGenres(hwnd); - /* init fields */ - if (!InitInfoboxInfo(hwnd, (const char*)lParam)) - PostMessage(hwnd, WM_CLOSE, 0, 0); - return TRUE; - /* destroy */ - case WM_DESTROY: - { - LOCALDATA *data = (LOCALDATA*)GetWindowLong(hwnd, GWL_USERDATA); - FLAC_plugin__tags_destroy(&data->tags); - LocalFree(data); - DeinitGenres(hwnd, FALSE); - } - break; - /* commands */ - case WM_COMMAND: - switch (LOWORD(wParam)) - { - /* ok/cancel */ - case IDOK: - case IDCANCEL: - EndDialog(hwnd, LOWORD(wParam)); - return TRUE; - /* save */ - case IDC_UPDATE: - UpdateTag(hwnd); - break; - /* remove */ - case IDC_REMOVE: - RemoveTag(hwnd); - break; - } - break; - } - - return 0; -} - -/* - * Helpers - */ - -ULONGLONG FileSize(const char *fileName) -{ - LARGE_INTEGER res; - HANDLE hFile = CreateFile(fileName, 0, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - - if (hFile == INVALID_HANDLE_VALUE) return 0; - res.LowPart = GetFileSize(hFile, &res.HighPart); - CloseHandle(hFile); - return res.QuadPart; -} - -static __inline char *GetFileName(const char *fullname) -{ - const char *c = fullname + strlen(fullname) - 1; - - while (c > fullname) - { - if (*c=='\\' || *c=='/') - { - c++; - break; - } - c--; - } - - return (char*)c; -} - -void ReadTags(const char *fileName, FLAC__StreamMetadata **tags, BOOL forDisplay) -{ - if(FLAC_plugin__tags_get(fileName, tags)) { - - /* add file name */ - if (forDisplay) - { - char *c; - wchar_t *ucs2; - ucs2 = AnsiToWide(fileName); - FLAC_plugin__tags_set_tag_ucs2(*tags, "filepath", ucs2, /*replace_all=*/true); - free(ucs2); - - strcpy(buffer, GetFileName(fileName)); - if (c = strrchr(buffer, '.')) *c = 0; - ucs2 = AnsiToWide(buffer); - FLAC_plugin__tags_set_tag_ucs2(*tags, "filename", ucs2, /*replace_all=*/true); - free(ucs2); - } - } -} - -/* - * Front-end - */ - -void InitInfobox() -{ - isNT = !(GetVersion() & 0x80000000); -} - -void DeinitInfobox() -{ - DeinitGenres(NULL, true); -} - -void DoInfoBox(HINSTANCE inst, HWND hwnd, const char *filename) -{ - DialogBoxParam(inst, MAKEINTRESOURCE(IDD_INFOBOX), hwnd, InfoProc, (LONG)filename); -} diff --git a/3rdparty/libflac/src/plugin_winamp2/infobox.h b/3rdparty/libflac/src/plugin_winamp2/infobox.h deleted file mode 100644 index dc71490ce76..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/infobox.h +++ /dev/null @@ -1,28 +0,0 @@ -/* in_flac - Winamp2 FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 - */ - -/* - * prototypes - */ - -ULONGLONG FileSize(const char *fileName); -void ReadTags(const char *fileName, FLAC__StreamMetadata **tags, BOOL forDisplay); - -void InitInfobox(); -void DeinitInfobox(); -void DoInfoBox(HINSTANCE inst, HWND hwnd, const char *filename); diff --git a/3rdparty/libflac/src/plugin_winamp2/playback.c b/3rdparty/libflac/src/plugin_winamp2/playback.c deleted file mode 100644 index 99de9e63f89..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/playback.c +++ /dev/null @@ -1,307 +0,0 @@ -/* in_flac - Winamp2 FLAC input plugin - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <limits.h> /* for INT_MAX */ -#include <stdlib.h> -#include <string.h> /* for memmove() */ -#include "playback.h" -#include "share/grabbag.h" - - -static FLAC__int32 reservoir_[FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS][FLAC__MAX_BLOCK_SIZE * 2/*for overflow*/]; -static FLAC__int32 *reservoir__[FLAC_PLUGIN__MAX_SUPPORTED_CHANNELS] = { reservoir_[0], reservoir_[1] }; /*@@@ kind of a hard-coded hack */ -static unsigned wide_samples_in_reservoir_; -static output_config_t cfg; /* local copy */ - -static unsigned bh_index_last_w, bh_index_last_o, written_time_last; -static FLAC__int64 decode_position, decode_position_last; - -/* - * callbacks - */ - -static 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 unsigned channels = stream_data->channels, wide_samples = frame->header.blocksize; - unsigned channel; - - (void)decoder; - - if (stream_data->abort_flag) - return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; - - for (channel = 0; channel < channels; channel++) - memcpy(&reservoir_[channel][wide_samples_in_reservoir_], buffer[channel], sizeof(buffer[0][0]) * wide_samples); - - wide_samples_in_reservoir_ += wide_samples; - - return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; -} - -static 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; - - if (stream_data->bits_per_sample!=8 && stream_data->bits_per_sample!=16 && stream_data->bits_per_sample!=24) - { - FLAC_plugin__show_error("This plugin can only handle 8/16/24-bit samples."); - stream_data->abort_flag = true; - return; - } - - { - /* with VC++ you have to spoon feed it the casting from uint64->int64->double */ - FLAC__uint64 l = (FLAC__uint64)((double)(FLAC__int64)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, cfg.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)cfg.replaygain.preamp, !cfg.replaygain.hard_limit); - } - } -} - -static 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 (cfg.misc.stop_err || status!=FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC) - stream_data->abort_flag = true; -} - -/* - * init/delete - */ - -FLAC__bool FLAC_plugin__decoder_init(FLAC__StreamDecoder *decoder, const char *filename, FLAC__int64 filesize, stream_data_struct *stream_data, output_config_t *config) -{ - FLAC__StreamDecoderInitStatus init_status; - - FLAC__ASSERT(decoder); - FLAC_plugin__decoder_finish(decoder); - /* init 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 ((init_status = FLAC__stream_decoder_init_file(decoder, filename, write_callback, metadata_callback, error_callback, /*client_data=*/stream_data)) != FLAC__STREAM_DECODER_INIT_STATUS_OK) - { - FLAC_plugin__show_error("Error while initializing decoder (%s [%s]).", FLAC__StreamDecoderInitStatusString[init_status], FLAC__stream_decoder_get_resolved_state_string(decoder)); - return false; - } - /* process */ - cfg = *config; - wide_samples_in_reservoir_ = 0; - stream_data->is_playing = false; - stream_data->abort_flag = false; - stream_data->has_replaygain = false; - - if (!FLAC__stream_decoder_process_until_end_of_metadata(decoder)) - { - FLAC_plugin__show_error("Error while processing metadata (%s).", FLAC__stream_decoder_get_resolved_state_string(decoder)); - return false; - } - /* check results */ - if (stream_data->abort_flag) return false; /* metadata callback already popped up the error dialog */ - /* init replaygain */ - stream_data->output_bits_per_sample = stream_data->has_replaygain && cfg.replaygain.enable ? - cfg.resolution.replaygain.bps_out : - cfg.resolution.normal.dither_24_to_16 ? min(stream_data->bits_per_sample, 16) : stream_data->bits_per_sample; - - if (stream_data->has_replaygain && cfg.replaygain.enable && cfg.resolution.replaygain.dither) - FLAC__replaygain_synthesis__init_dither_context(&stream_data->dither_context, stream_data->bits_per_sample, cfg.resolution.replaygain.noise_shaping); - /* more inits */ - stream_data->eof = false; - stream_data->seek_to = -1; - stream_data->is_playing = true; - stream_data->average_bps = (unsigned)(filesize / (125.*(double)(FLAC__int64)stream_data->total_samples/(double)stream_data->sample_rate)); - - bh_index_last_w = 0; - bh_index_last_o = BITRATE_HIST_SIZE; - decode_position = 0; - decode_position_last = 0; - written_time_last = 0; - - return true; -} - -void FLAC_plugin__decoder_finish(FLAC__StreamDecoder *decoder) -{ - if (decoder && FLAC__stream_decoder_get_state(decoder) != FLAC__STREAM_DECODER_UNINITIALIZED) - (void)FLAC__stream_decoder_finish(decoder); -} - -void FLAC_plugin__decoder_delete(FLAC__StreamDecoder *decoder) -{ - if (decoder) - { - FLAC_plugin__decoder_finish(decoder); - FLAC__stream_decoder_delete(decoder); - } -} - -/* - * decode - */ - -int FLAC_plugin__seek(FLAC__StreamDecoder *decoder, stream_data_struct *stream_data) -{ - int pos; - FLAC__uint64 target_sample = stream_data->total_samples * stream_data->seek_to / stream_data->length_in_msec; - - if (stream_data->total_samples > 0 && target_sample >= stream_data->total_samples && target_sample > 0) - target_sample = stream_data->total_samples - 1; - - /* even if the seek fails we have to reset these so that we don't repeat the seek */ - stream_data->seek_to = -1; - stream_data->eof = false; - wide_samples_in_reservoir_ = 0; - pos = (int)(target_sample*1000 / stream_data->sample_rate); - - if (!FLAC__stream_decoder_seek_absolute(decoder, target_sample)) { - if(FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_SEEK_ERROR) - FLAC__stream_decoder_flush(decoder); - pos = -1; - } - - bh_index_last_o = bh_index_last_w = (pos/BITRATE_HIST_SEGMENT_MSEC) % BITRATE_HIST_SIZE; - if (!FLAC__stream_decoder_get_decode_position(decoder, &decode_position)) - decode_position = 0; - - return pos; -} - -unsigned FLAC_plugin__decode(FLAC__StreamDecoder *decoder, stream_data_struct *stream_data, char *sample_buffer) -{ - /* fill reservoir */ - while (wide_samples_in_reservoir_ < SAMPLES_PER_WRITE) - { - 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)) - { - FLAC_plugin__show_error("Error while processing frame (%s).", FLAC__stream_decoder_get_resolved_state_string(decoder)); - stream_data->eof = true; - break; - } - if (!FLAC__stream_decoder_get_decode_position(decoder, &decode_position)) - decode_position = 0; - } - /* output samples */ - if (wide_samples_in_reservoir_ > 0) - { - const unsigned n = min(wide_samples_in_reservoir_, SAMPLES_PER_WRITE); - const unsigned channels = stream_data->channels; - unsigned i; - int bytes; - - if (cfg.replaygain.enable && stream_data->has_replaygain) - { - bytes = FLAC__replaygain_synthesis__apply_gain( - sample_buffer, - true, /* little_endian_data_out */ - stream_data->output_bits_per_sample == 8, /* unsigned_data_out */ - reservoir__, - n, - channels, - stream_data->bits_per_sample, - stream_data->output_bits_per_sample, - stream_data->replay_scale, - cfg.replaygain.hard_limit, - cfg.resolution.replaygain.dither, - &stream_data->dither_context - ); - } - else - { - bytes = FLAC__plugin_common__pack_pcm_signed_little_endian( - sample_buffer, - reservoir__, - n, - channels, - stream_data->bits_per_sample, - stream_data->output_bits_per_sample - ); - } - - wide_samples_in_reservoir_ -= n; - for (i = 0; i < channels; i++) - memmove(&reservoir_[i][0], &reservoir_[i][n], sizeof(reservoir_[0][0]) * wide_samples_in_reservoir_); - - return bytes; - } - else - { - stream_data->eof = true; - return 0; - } -} - -int FLAC_plugin__get_rate(unsigned written_time, unsigned output_time, stream_data_struct *stream_data) -{ - static int bitrate_history_[BITRATE_HIST_SIZE]; - unsigned bh_index_w = (written_time/BITRATE_HIST_SEGMENT_MSEC) % BITRATE_HIST_SIZE; - unsigned bh_index_o = (output_time/BITRATE_HIST_SEGMENT_MSEC) % BITRATE_HIST_SIZE; - - /* written bitrate */ - if (bh_index_w != bh_index_last_w) - { - bitrate_history_[(bh_index_w + BITRATE_HIST_SIZE-1)%BITRATE_HIST_SIZE] = - decode_position>decode_position_last && written_time > written_time_last ? - (unsigned)(8000*(decode_position - decode_position_last)/(written_time - written_time_last)) : - stream_data->average_bps; - - bh_index_last_w = bh_index_w; - written_time_last = written_time; - decode_position_last = decode_position; - } - - /* output bitrate */ - if (bh_index_o!=bh_index_last_o && bh_index_o!=bh_index_last_w) - { - bh_index_last_o = bh_index_o; - return bitrate_history_[bh_index_o]; - } - - return 0; -} diff --git a/3rdparty/libflac/src/plugin_winamp2/playback.h b/3rdparty/libflac/src/plugin_winamp2/playback.h deleted file mode 100644 index cf4349cd576..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/playback.h +++ /dev/null @@ -1,92 +0,0 @@ -/* in_flac - Winamp2 FLAC input plugin - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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 - */ - -#include "FLAC/all.h" -#include "share/replaygain_synthesis.h" -#include "plugin_common/all.h" - -/* - * constants - */ - -#define SAMPLES_PER_WRITE 576 - -#define BITRATE_HIST_SEGMENT_MSEC 500 -#define BITRATE_HIST_SIZE 64 - -/* - * common structures - */ - -typedef struct { - volatile FLAC__bool is_playing; - volatile FLAC__bool abort_flag; - volatile FLAC__bool eof; - volatile int seek_to; - FLAC__uint64 total_samples; - unsigned bits_per_sample; - unsigned output_bits_per_sample; - unsigned channels; - unsigned sample_rate; - int length_in_msec; /* int (instead of FLAC__uint64) only because that's what Winamp uses; seeking won't work right if this maxes out */ - unsigned average_bps; - FLAC__bool has_replaygain; - double replay_scale; - DitherContext dither_context; -} stream_data_struct; - - -typedef struct { - struct { - FLAC__bool enable; - FLAC__bool album_mode; - int preamp; - FLAC__bool hard_limit; - } replaygain; - struct { - struct { - FLAC__bool dither_24_to_16; - } normal; - struct { - FLAC__bool dither; - int noise_shaping; /* value must be one of NoiseShaping enum, see plugin_common/replaygain_synthesis.h */ - int bps_out; - } replaygain; - } resolution; - struct { - FLAC__bool stop_err; - } misc; -} output_config_t; - -/* - * protopytes - */ - -FLAC__bool FLAC_plugin__decoder_init(FLAC__StreamDecoder *decoder, const char *filename, FLAC__int64 filesize, stream_data_struct *stream_data, output_config_t *config); -void FLAC_plugin__decoder_finish(FLAC__StreamDecoder *decoder); -void FLAC_plugin__decoder_delete(FLAC__StreamDecoder *decoder); - -int FLAC_plugin__seek(FLAC__StreamDecoder *decoder, stream_data_struct *stream_data); -unsigned FLAC_plugin__decode(FLAC__StreamDecoder *decoder, stream_data_struct *stream_data, char *sample_buffer); -int FLAC_plugin__get_rate(unsigned written_time, unsigned output_time, stream_data_struct *stream_data); - -/* - * these should be defined in plug-in - */ - -extern void FLAC_plugin__show_error(const char *message,...); diff --git a/3rdparty/libflac/src/plugin_winamp2/resource.h b/3rdparty/libflac/src/plugin_winamp2/resource.h deleted file mode 100644 index 7426359c5ac..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/resource.h +++ /dev/null @@ -1,47 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by resource.rc -// -#define IDC_RESET 3 -#define IDD_CONFIG 101 -#define IDD_CONFIG_GENERAL 103 -#define IDD_CONFIG_OUTPUT 104 -#define IDD_INFOBOX 105 -#define IDC_ENABLE 1000 -#define IDC_ALBUM 1001 -#define IDC_LIMITER 1002 -#define IDC_COMMENT 1002 -#define IDC_PREAMP 1003 -#define IDC_YEAR 1003 -#define IDC_PA 1004 -#define IDC_TRACK 1004 -#define IDC_DITHER 1005 -#define IDC_DITHERRG 1006 -#define IDC_TO 1008 -#define IDC_SHAPE 1009 -#define IDC_TABS 1009 -#define IDC_TITLE 1010 -#define IDC_TAGZ_HELP 1011 -#define IDC_ARTIST 1011 -#define IDC_TAGZ_DEFAULT 1012 -#define IDC_SEP 1013 -#define IDC_NAME 1014 -#define IDC_INFO 1015 -#define IDC_GENRE 1017 -#define IDC_REMOVE 1020 -#define IDC_UPDATE 1021 -#define IDC_ID3V1 1030 -#define IDC_RESERVE 1032 -#define IDC_BPS 1036 -#define IDC_ERRORS 1037 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 106 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1037 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/3rdparty/libflac/src/plugin_winamp2/resource.rc b/3rdparty/libflac/src/plugin_winamp2/resource.rc deleted file mode 100644 index d47fd990e73..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/resource.rc +++ /dev/null @@ -1,236 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Russian resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -#ifdef _WIN32 -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_INFOBOX DIALOG DISCARDABLE 0, 0, 292, 148 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -FONT 8, "MS Sans Serif" -BEGIN - EDITTEXT IDC_NAME,3,3,285,12,ES_AUTOHSCROLL | ES_READONLY | NOT - WS_TABSTOP - GROUPBOX " Tag ",IDC_STATIC,3,20,182,104 - RTEXT "&Title",IDC_STATIC,8,32,31,8 - EDITTEXT IDC_TITLE,43,30,137,12,ES_AUTOHSCROLL - RTEXT "&Artist",IDC_STATIC,8,47,31,8 - EDITTEXT IDC_ARTIST,43,45,137,12,ES_AUTOHSCROLL - RTEXT "Albu&m",IDC_STATIC,8,62,31,8 - EDITTEXT IDC_ALBUM,43,60,137,12,ES_AUTOHSCROLL - RTEXT "&Comment",IDC_STATIC,8,77,31,8 - EDITTEXT IDC_COMMENT,43,75,137,12,ES_AUTOHSCROLL - RTEXT "&Date",IDC_STATIC,8,92,31,8 - EDITTEXT IDC_YEAR,43,90,40,12,ES_AUTOHSCROLL - RTEXT "Track &number",IDC_STATIC,90,92,46,8 - EDITTEXT IDC_TRACK,141,90,39,12,ES_AUTOHSCROLL - RTEXT "&Genre",IDC_STATIC,8,107,31,8 - COMBOBOX IDC_GENRE,43,105,137,95,CBS_DROPDOWN | CBS_SORT | - WS_VSCROLL | WS_TABSTOP - GROUPBOX " FLAC Info ",IDC_STATIC,191,20,97,124 - LTEXT "",IDC_INFO,195,30,90,110 - DEFPUSHBUTTON "Close",IDOK,3,130,50,14 - PUSHBUTTON "&Update",IDC_UPDATE,69,130,50,14 - PUSHBUTTON "&Remove",IDC_REMOVE,135,130,50,14 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_INFOBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 285 - TOPMARGIN, 7 - BOTTOMMARGIN, 141 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Russian resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_CONFIG DIALOG DISCARDABLE 0, 0, 237, 212 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "FLAC Configuration" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,75,195,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,195,50,14 - PUSHBUTTON "Reset",IDC_RESET,183,195,50,14 - CONTROL "Tab1",IDC_TABS,"SysTabControl32",WS_TABSTOP,3,3,230,187 -END - -IDD_CONFIG_GENERAL DIALOG DISCARDABLE 0, 0, 226, 171 -STYLE DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX " Title Formatting ",IDC_STATIC,2,2,220,58 - LTEXT "&Title",IDC_STATIC,8,17,14,8 - EDITTEXT IDC_TITLE,27,15,188,12,ES_AUTOHSCROLL - PUSHBUTTON "default",IDC_TAGZ_DEFAULT,156,28,30,10 - PUSHBUTTON "help",IDC_TAGZ_HELP,188,28,27,10 - LTEXT "Separate tag values &with",IDC_STATIC,8,43,79,8 - EDITTEXT IDC_SEP,91,41,27,12,ES_AUTOHSCROLL - CONTROL "Read ID3v&1 tags",IDC_ID3V1,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,147,43,70,10 - GROUPBOX " Tag Editor ",IDC_STATIC,2,63,220,30 - CONTROL "Reserve space for &FLAC tags",IDC_RESERVE,"Button", - BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,8,76,125,10 - GROUPBOX " Miscellaneous ",IDC_STATIC,2,96,220,72 - CONTROL "&Show instantaneous bitrate while playing",IDC_BPS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,108,125,10 - CONTROL "Stop on &all errors",IDC_ERRORS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,8,120,69,10 -END - -IDD_CONFIG_OUTPUT DIALOG DISCARDABLE 0, 0, 224, 171 -STYLE DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX " ReplayGain ",IDC_STATIC,2,2,220,57 - CONTROL "&Enable ReplayGain",IDC_ENABLE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,8,15,77,10 - CONTROL "&Album mode",IDC_ALBUM,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,8,27,55,10 - CONTROL "6dB &hard limiter",IDC_LIMITER,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,123,27,64,10 - LTEXT "&Preamp",IDC_STATIC,8,44,25,8 - CONTROL "Slider1",IDC_PREAMP,"msctls_trackbar32",TBS_NOTICKS | - WS_TABSTOP,36,43,154,12 - RTEXT "",IDC_PA,194,44,21,8 - GROUPBOX " Resolution ",IDC_STATIC,1,62,220,95 - GROUPBOX " Without ReplayGain ",IDC_STATIC,7,71,209,30 - CONTROL "&Dither 24bps to 16bps",IDC_DITHER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,16,84,85,10 - GROUPBOX " With ReplayGain ",IDC_STATIC,7,104,209,47 - LTEXT "&Output bit depth",IDC_STATIC,16,119,52,8 - COMBOBOX IDC_TO,71,116,39,43,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - CONTROL "E&nable dithering",IDC_DITHERRG,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,16,134,67,10 - LTEXT "Noise &shaping",IDC_STATIC,113,135,46,8 - COMBOBOX IDC_SHAPE,164,132,46,48,CBS_DROPDOWNLIST | WS_VSCROLL | - WS_TABSTOP - LTEXT "Note: changes take effect after restarting playback", - IDC_STATIC,2,160,161,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_CONFIG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 230 - TOPMARGIN, 7 - BOTTOMMARGIN, 205 - END - - IDD_CONFIG_GENERAL, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 219 - TOPMARGIN, 7 - BOTTOMMARGIN, 164 - END - - IDD_CONFIG_OUTPUT, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 217 - TOPMARGIN, 7 - BOTTOMMARGIN, 164 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/3rdparty/libflac/src/plugin_winamp2/tagz.cpp b/3rdparty/libflac/src/plugin_winamp2/tagz.cpp deleted file mode 100644 index a2c5a4857e5..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/tagz.cpp +++ /dev/null @@ -1,921 +0,0 @@ -#include <string.h> -#include <stdio.h> -#include <ctype.h> -#include <stdlib.h> -#include "tagz.h" - -#ifdef TAGZ_UNICODE - -#define _TX(X) L##X -#define t_strdup wcsdup -#define t_strlen wcslen -#define t_strnicmp wcsnicmp -#define t_atoi(x) wcstol(x,0,10) -#define t_stricmp wcsicmp -#define t_strstr wcsstr -#define sprintf swprintf - -#else - -#define _TX(X) X -#define t_strdup strdup -#define t_strlen strlen -#define t_strnicmp strnicmp -#define t_atoi atoi -#define t_stricmp stricmp -#define t_strstr strstr - -#endif - -#define TABSIZE(x) (sizeof(x)/sizeof(x[0])) - - -class T_String -{ -private: - T_CHAR * data; - UINT size,used; -public: - T_String() {data=0;size=0;used=0;} - void AddChar(T_CHAR c) - { - if (!data) - { - data=(T_CHAR*)malloc((size=512)*sizeof(T_CHAR)); - used=0; - } - else if (size==used) - { - size<<=1; - data=(T_CHAR*)realloc((char*)data,size*sizeof(T_CHAR)); - } - if (data) data[used++]=c; - } - void AddInt(int i) - { - T_CHAR foo[16]; - sprintf(foo,_TX("%i"),i); - AddString(foo); - } - void AddString(const T_CHAR * z) - { - while(*z) {AddChar(*z);z++;} - } - void AddString(T_String & s) - { - AddString(s.Peek()); - } - ~T_String() - { - if (data) free(data); - } - T_CHAR * GetBuf() - { - if (!data) return ::t_strdup(_TX("")); - T_CHAR * r=(T_CHAR*)realloc(data,(used+1)*sizeof(T_CHAR)); - r[used]=0; - data=0; - return r; - } - T_CHAR operator[](UINT i) - { - if (!data || i>=used) return 0; - else return data[i]; - } - UINT Len() {return data ? used : 0;} - void Reset() - { - if (data) {free(data);data=0;} - } - const T_CHAR * Peek() - { - AddChar(0); - used--; - return data; - } - T_CHAR * strdup() - { - return ::t_strdup(Peek()); - } -}; - - - - -static int separator(T_CHAR x) -{ - if (!x || x==' ') return 1; - if (x=='\'' || x=='_') return 0; -#ifdef TAGZ_UNICODE - return !iswalnum(x); -#else - return !isalnum(x); -#endif -} - -static int sepcmp(T_CHAR* src,T_CHAR* val) -{ - UINT l=t_strlen(val); - return !t_strnicmp(src,val,l) && separator(src[l]); -} - -static char roman_num[]= -{ - 'I','V','X','L','C','D','M' -}; - - -static int is_roman(T_CHAR * ptr)/* could be more smart i think */ -{ - if (ptr[0]==']' && ptr[1]=='[' && separator(ptr[2])) return 1; - while(!separator(*ptr)) - { - UINT n; - bool found=0; - for(n=0;n<TABSIZE(roman_num);n++) - { - if (*ptr==roman_num[n]) {found=1;break;} - } - if (!found) return 0; - ptr++; - } - return 1; -} - -static int need_full(T_CHAR* ptr) -{ - if (is_roman(ptr)) return 1; - if (sepcmp(ptr,_TX("RPG"))) return 1; - while(!separator(*ptr)) - { - if (*ptr<'0' || *ptr>'9') return 0; - ptr++; - } - return 1; -} - -typedef bool (*TEXTFUNC)(UINT n_src,T_CHAR **src,UINT*,T_String &out); - -#define MAKEFUNC(X) static bool X(UINT n_src,T_CHAR ** src,UINT *found_src,T_String &out) - - -MAKEFUNC(If) -{ - if (n_src!=3) return false; - - out.AddString(src[found_src[0] ? 1 : 2]); - return true; -} - -MAKEFUNC(If2) -{ - if (n_src!=2) return false; - - out.AddString(src[found_src[0] ? 0 : 1]); - return true; -} - - -MAKEFUNC(Iflonger) -{ - if (n_src!=4) return false; - - out.AddString(src[(int)t_strlen(src[0])>t_atoi(src[1]) ? 2 : 3]); - return true; -} - -MAKEFUNC(Ifgreater) -{ - if (n_src!=4) return false; - - out.AddString(src[t_atoi(src[0])>t_atoi(src[1]) ? 2 : 3]); - return true; -} - -MAKEFUNC(Upper) -{ - if (n_src!=1) return false; - - T_CHAR * s=src[0]; - - while(*s) - out.AddChar(toupper(*(s++))); - - return true; -} - -MAKEFUNC(Lower) -{ - if (n_src!=1) return false; - - T_CHAR * s=src[0]; - - while(*s) - out.AddChar(tolower(*(s++))); - - return true; -} - -MAKEFUNC(Pad) -{ - if (n_src<2 || n_src>3) return false; - - T_CHAR *fill=_TX(" "); - if (n_src==3 && src[2][0]) - fill = src[2]; - - int num = t_atoi(src[1]); - T_CHAR *p = src[0]; - - while (*p) { out.AddChar(*(p++)); num--; } - - UINT fl = t_strlen(fill); - while (num>0) - out.AddChar(fill[(--num)%fl]); - - return true; -} - -MAKEFUNC(Cut) -{ - if (n_src!=2) return false; - - UINT num = t_atoi(src[1]); - T_CHAR *p = src[0]; - - while (*p && num>0) {out.AddChar(*(p++));num--;} - - return true; -} - -MAKEFUNC(PadCut) -{ - if (n_src<2 || n_src>3) return false; - - T_CHAR *fill = _TX(" "); - if (n_src==3 && src[2][0]) - fill = src[2]; - - int num = t_atoi(src[1]); - T_CHAR *p = src[0]; - - while(*p && num>0) {out.AddChar(*(p++));num--;} - - UINT fl=t_strlen(fill); - while (num>0) - out.AddChar(fill[(--num)%fl]); - - return true; -} - -/* abbr(string) */ -/* abbr(string,len) */ -MAKEFUNC(Abbr) -{ - if (n_src==0 || n_src>2) return false; - - - if (n_src==2 && (int)t_strlen(src[0])<t_atoi(src[1])) - { - out.AddString(src[0]); - return true; - } - - T_CHAR * meta=src[0]; - bool w=0, r=0; - - while(*meta) - { - bool an=!separator(*meta) || *meta==']' || *meta=='['; - - if (w && !an) - w=0; - else if (!w && an) - { - w=1; - r=need_full(meta)?1:0; - out.AddChar(*meta); - } - else if (w && r) - out.AddChar(*meta); - meta++; - } - - return true; -} - - - -MAKEFUNC(Caps) -{ - if (n_src!=1) return false; - - T_CHAR* sp=src[0]; - int sep = 1; - - while(*sp) - { - T_CHAR c=*(sp++); - int s = separator(c); - if (!s && sep) - c=toupper(c); - else if (!sep) c=tolower(c); - sep=s; - out.AddChar(c); - } - - return true; -} - -MAKEFUNC(Caps2) -{ - if (n_src!=1) return false; - - T_CHAR* sp=src[0]; - int sep=1; - - while(*sp) - { - T_CHAR c=*(sp++); - int s = separator(c); - if (!s && sep) - c=toupper(c); - sep=s; - out.AddChar(c); - } - - return true; -} - -MAKEFUNC(Longest) -{ - T_CHAR *ptr=0; - UINT n, m=0; - - for(n=0;n<n_src;n++) - { - UINT l=t_strlen(src[n]); - if (l>m) {m=l;ptr=src[n];} - } - - if (ptr) out.AddString(ptr); - return true; -} - -MAKEFUNC(Shortest) -{ - T_CHAR * ptr=0; - UINT n,m=(UINT)(-1); - - for(n=0;n<n_src;n++) - { - UINT l=t_strlen(src[n]); - if (l<m) {m=l;ptr=src[n];} - } - - if (ptr) out.AddString(ptr); - return true; -} - -MAKEFUNC(Num) -{ - if (n_src!=2) return false; - - T_CHAR tmp[16]; - T_CHAR tmp1[16]; - sprintf(tmp1,_TX("%%0%uu"),t_atoi(src[1])); - sprintf(tmp,tmp1,t_atoi(src[0])); - out.AddString(tmp); - - return true; -} - -MAKEFUNC(Hex) -{ - if (n_src!=2) return false; - - T_CHAR tmp[16]; - T_CHAR tmp1[16]; - sprintf(tmp1,_TX("%%0%ux"),t_atoi(src[1])); - sprintf(tmp,tmp1,t_atoi(src[0])); - out.AddString(tmp); - - return true; -} - -MAKEFUNC(StrChr) -{ - if (n_src!=2) return false; - - T_CHAR * p=src[0]; - T_CHAR s=src[1][0]; - - while (*p && *p!=s) p++; - if (*p==s) - out.AddInt(1+p-src[0]); - else out.AddChar('0'); - - return true; -} - -MAKEFUNC(StrRChr) -{ - if (n_src!=2) return false; - - T_CHAR * p=src[0],*p1=0; - T_CHAR s=src[1][0]; - - while(*p) - { - if (*p==s) p1=p; - p++; - } - - if (p1) - out.AddInt(1+p1-src[0]); - else out.AddChar('0'); - - return true; -} - -MAKEFUNC(StrStr) -{ - if (n_src!=2) return false; - - T_CHAR * p = t_strstr(src[0],src[1]); - - if (p) - out.AddInt(1+p-src[0]); - else out.AddChar('0'); - - return true; -} - -/* substr(string, index) */ -/* substr(string, index, length) */ -MAKEFUNC(SubStr) -{ - if (n_src<2 || n_src>3) return false; - - int n1 = t_atoi(src[1]), n2; - - if (n_src == 3) - n2 = t_atoi(src[2]); - else n2 = n1; - - if (n1 < 1) n1=1; - if (n2 >= n1) - { - n1--; - n2--; - while(n1<=n2 && src[0][n1]) - out.AddChar(src[0][n1++]); - } - - return true; -} - -MAKEFUNC(Len) -{ - if (n_src!=1) return false; - - out.AddInt(t_strlen(src[0])); - return true; -} - -MAKEFUNC(Add) -{ - UINT n; - int s=0; - - for (n=0;n<n_src;n++) - s+=t_atoi(src[n]); - - out.AddInt(s); - - return true; -} - -MAKEFUNC(Sub) -{ - if (n_src==0) return false; - - UINT n; - int s=t_atoi(src[0]); - - for (n=1;n<n_src;n++) - s-=t_atoi(src[n]); - - out.AddInt(s); - - return true; -} - -MAKEFUNC(Mul) -{ - UINT n; - int s=1; - - for(n=0;n<n_src;n++) - s*=t_atoi(src[n]); - - out.AddInt(s); - - return true; -} - -MAKEFUNC(Div) -{ - if (n_src==0) return false; - - UINT n; - int s=t_atoi(src[0]); - - for(n=1;n<n_src;n++) - { - int t=t_atoi(src[n]); - if (t) s/=t; - else t=0; - } - - out.AddInt(s); - - return true; -} - -MAKEFUNC(Mod) -{ - if (n_src==0) return false; - - UINT n; - int s=t_atoi(src[0]); - - for(n=1;n<n_src;n++) - { - int t=t_atoi(src[n]); - if (t) s%=t; - else t=0; - } - - out.AddInt(s); - - return true; -} - -MAKEFUNC(Max) -{ - if (!n_src) return false; - - int m = t_atoi(src[0]); - UINT n; - - for (n=1; n<n_src; n++) - { - int t = t_atoi(src[n]); - if (t > m) m = t; - } - out.AddInt(m); - - return true; -} - -MAKEFUNC(Min) -{ - if (!n_src) return false; - - int m=t_atoi(src[0]); - UINT n; - - for(n=1;n<n_src;n++) - { - int t=t_atoi(src[n]); - if (t<m) m=t; - } - out.AddInt(m); - - return true; -} - -/* replace(string, what_to_replace, replacement) */ -MAKEFUNC(Replace) -{ - if (n_src!=3) return false; - T_CHAR *p = src[0]; - - while (*p) - { - UINT n=0; - - while (src[1][n] && p[n]==src[1][n]) n++; - - if (!src[1][n]) - { - out.AddString(src[2]); - p += n; - } - else out.AddChar(*p++); - } - - return true; -} - -struct -{ - TEXTFUNC func; - const T_CHAR * name; -} -FUNCS[] = -{ - If,_TX("if"), - If2,_TX("if2"), - Upper,_TX("upper"), - Lower,_TX("lower"), - Pad,_TX("pad"), - Cut,_TX("cut"), - PadCut,_TX("padcut"), - Abbr,_TX("abbr"), - Caps,_TX("caps"), - Caps2,_TX("caps2"), - Longest,_TX("longest"), - Shortest,_TX("shortest"), - Iflonger,_TX("iflonger"), - Ifgreater,_TX("ifgreater"), - Num,_TX("num"),Num,_TX("dec"), - Hex,_TX("hex"), - StrChr,_TX("strchr"), - StrChr,_TX("strlchr"), - StrRChr,_TX("strrchr"), - StrStr,_TX("strstr"), - SubStr,_TX("substr"), - Len,_TX("len"), - Add,_TX("add"), - Sub,_TX("sub"), - Mul,_TX("mul"), - Div,_TX("div"), - Mod,_TX("mod"), - Min,_TX("min"), - Max,_TX("max"), - Replace,_TX("replace"), -}; - - -class FMT -{ -private: - T_String str; - T_CHAR * spec; - TAGFUNC f; - TAGFREEFUNC ff; - void * fp; - T_CHAR * org_spec; - int found; - - void Error(T_CHAR *e=0) - { - str.Reset(); - str.AddString(e ? e : _TX("[SYNTAX ERROR IN FORMATTING STRING]")); - found++; /* force displaying */ - } - - T_CHAR * _FMT(T_CHAR * s,UINT *f=0) - { - FMT fmt(this,s); - T_CHAR * c=(T_CHAR*)fmt; - if (f) *f=fmt.found; - found+=fmt.found; - return c; - } - - static bool skipshit(T_CHAR** _p,T_CHAR *bl) - { - T_CHAR * p=*_p; - int bc1=0,bc2=0; - while(*p) - { - if (!bc1 && !bc2 && bl) - { - T_CHAR *z=bl; - while(*z) - { - if (*z==*p) break; - z++; - } - if (*z) break; - } - if (*p=='\'') - { - p++; - while(*p && *p!='\'') p++; - if (!*p) return 0; - } - else if (*p=='(') bc1++; - else if (*p==')') - { - if (--bc1<0) return 0; - } - else if (*p=='[') bc2++; - else if (*p==']') - { - if (--bc2<0) return 0; - } - p++; - } - *_p=p; - return *p && !bc1 && !bc2; - } - - void run() - { - if (!spec) {Error();return;} - while(*spec) - { - if (*spec=='%') - { - spec++; - if (*spec=='%') {str.AddChar('%');spec++;continue;} - T_CHAR* s1=spec+1; - while(*s1 && *s1!='%') s1++; - if (!*s1) {Error();break;} - *s1=0; - T_CHAR * tag=f(spec,fp); - *s1='%'; - /*if (!tag) tag=tag_unknown; */ - if (tag && tag[0]) - { - found++; - str.AddString(tag); - } - else - { - str.AddString(_TX("?")); - } - if (tag && ff) ff(tag,fp); - spec=s1+1; - } - else if (*spec=='$') - { - spec++; - if (*spec=='$') {str.AddChar('$');spec++;continue;} - T_CHAR * s1=spec+1; - while(*s1 && *s1!='(') s1++; - if (!*s1) {Error();break;} - T_CHAR * s2=s1+1; - if (!skipshit(&s2,_TX(")"))) {Error();break;} - if (!*s2) {Error();break;}; - T_CHAR * p=s1+1; - T_CHAR* temp[64]; - UINT temp_f[64]; - UINT nt=0; - T_CHAR * p1=s1+1; - while(p<=s2 && nt<64) - { - if (!skipshit(&p,_TX(",)"))) {Error();return;} - if (p>s2 || (*p!=',' && *p!=')')) {Error(_TX("internal error"));return;} - T_CHAR bk=*p; - *p=0; - temp[nt]=_FMT(p1,&temp_f[nt]); - nt++; - *p=bk;; - p1=p+1; - p++; - } - *s1=0; - UINT n; - - for (n=0; n<TABSIZE(FUNCS); n++) - if (!t_stricmp(spec, FUNCS[n].name)) - break; - - *s1='('; - - if (n != TABSIZE(FUNCS)) - { - if (!FUNCS[n].func(nt, temp, temp_f, str)) - { - Error(_TX("[INVALID $")); - str.AddString(FUNCS[n].name); - str.AddString(_TX(" SYNTAX]")); - return; - } - } - else - { - Error(_TX("[UNKNOWN FUNCTION]")); - return; - } - - for(n=0;n<nt;n++) free(temp[n]); - spec=s2+1; - } - else if (*spec=='\'') - { - spec++; - if (*spec=='\'') {str.AddChar('\'');spec++;continue;} - T_CHAR * s1=spec+1; - while(*s1 && *s1!='\'') s1++; - if (!*s1) {Error();break;} - *s1=0; - str.AddString(spec); - *s1='\''; - spec=s1+1; - } - else if (*spec=='[') - { - spec++; - T_CHAR * s1=spec; - UINT bc=0; - if (!skipshit(&s1,_TX("]"))) {Error();break;} - T_CHAR bk=*s1; - *s1=0; - FMT fmt(this,spec); - fmt.run(); - if (fmt.found) - { - str.AddString(fmt.str); - found+=fmt.found; - } - *s1=bk; - spec=s1+1; - } - else if (*spec == ']') {Error();break;} - else - { - str.AddChar(*spec); - spec++; - } - } - } - - FMT(FMT* base,T_CHAR * _spec) - { - found=0; - org_spec=0; - f=base->f; - ff=base->ff; - fp=base->fp; - spec=_spec; - } -public: - FMT(const T_CHAR * p_spec,TAGFUNC _f,TAGFREEFUNC _ff,void * _fp) - { - found=0; - org_spec=spec=t_strdup(p_spec); - f=_f; - ff=_ff; - fp=_fp; - } - operator T_CHAR*() - { - run(); - return str.GetBuf(); - } - ~FMT() - { - if (org_spec) free(org_spec); - } -}; - -extern "C" -{ - -UINT tagz_format(const T_CHAR * spec,TAGFUNC f,TAGFREEFUNC ff,void *fp,T_CHAR* out,UINT max) -{ - T_CHAR * zz=tagz_format_r(spec,f,ff,fp); - UINT r=0; - while(r<max-1 && zz[r]) - { - out[r]=zz[r]; - r++; - } - out[r]=0; - free(zz); - return r; -} - -T_CHAR * tagz_format_r(const T_CHAR* spec,TAGFUNC f,TAGFREEFUNC ff,void * fp) -{ - return FMT(spec,f,ff,fp); -} - -const char tagz_manual[]="Syntax reference: \n" - "\n" - "* %tagname% - inserts field named <tagname>, eg. \"%artist%\"\n" - "* $abbr(x) - inserts abbreviation of x, eg. \"$abbr(%album%)\" - will convert album name of \"Final Fantasy VI\" to \"FFVI\"\n" - "* $abbr(x,y) - inserts abbreviation of x if x is longer than y characters; otherwise inserts full value of x, eg. \"$abbr(%album%,10)\"\n" - "* $lower(x), $upper(x) - converts x to in lower/uppercase, eg. \"$upper(%title%)\"\n" - "* $num(x,y) - displays x number and pads with zeros up to y characters (useful for track numbers), eg. $num(%tracknumber%,2)\n" - "* $caps(x) - converts first letter in every word of x to uppercase, and all other letters to lowercase, eg. \"blah BLAH\" -> \"Blah Blah\"\n" - "* $caps2(x) - similar to $caps, but leaves uppercase letters as they are, eg. \"blah BLAH\" -> \"Blah BLAH\"\n" - "* $if(A,B,C) - if A contains at least one valid tag, displays B, otherwise displays C; eg. \"$if(%artist%,%artist%,unknown artist)\" will display artist name if present; otherwise will display \"unknown artist\"; note that \"$if(A,A,)\" is equivalent to \"[A]\" (see below)\n" - "* $if2(A,B) - equals to $if(A,A,B)\n" - "* $longest(A,B,C,....) - compares lengths of output strings produced by A,B,C... and displays the longest one, eg. \"$longest(%title%,%comment%)\" will display either title if it's longer than comment; otherwise it will display comment\n" - "* $pad(x,y) - pads x with spaces up to y characters\n" - "* $cut(x,y) - truncates x to y characters\n" - "* $padcut(x,y) - pads x to y characters and truncates to y if longer\n" - "* [ .... ] - displays contents of brackets only if at least one of fields referenced inside has been found, eg. \"%artist% - [%album% / ]%title%\" will hide [] block if album field is not present\n" - "* \' (single quotation mark) - outputs raw text without parsing, eg, \'blah$blah%blah[][]\' will output the contained string and ignore all reserved characters (%,$,[,]) in it; you can use this feature to insert square brackets for an example.\n" - "\n" - "eg. \"[%artist% - ][$abbr(%album%,10)[ %tracknumber%] / ]%title%[ %streamtitle%]\"\n"; - - -} diff --git a/3rdparty/libflac/src/plugin_winamp2/tagz.h b/3rdparty/libflac/src/plugin_winamp2/tagz.h deleted file mode 100644 index f826b7cec8a..00000000000 --- a/3rdparty/libflac/src/plugin_winamp2/tagz.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef UINT -typedef unsigned int UINT; -#endif - -#ifdef TAGZ_UNICODE -#if _MSC_VER <= 1200 -typedef unsigned short T_CHAR; -#else -typedef wchar_t T_CHAR; -#endif -#else -#define T_CHAR char -#endif - -typedef T_CHAR* (*TAGFUNC)(const T_CHAR *tag,void *p); /* return 0 if not found */ -typedef void (*TAGFREEFUNC)(T_CHAR *tag,void *p); - - -UINT tagz_format(const T_CHAR * spec,TAGFUNC f,TAGFREEFUNC ff,void *fp,T_CHAR * out,UINT max); -T_CHAR * tagz_format_r(const T_CHAR * spec,TAGFUNC f,TAGFREEFUNC ff,void * fp); - -extern const char tagz_manual[]; - -#ifdef __cplusplus -} -#endif diff --git a/3rdparty/libflac/src/plugin_xmms/Makefile.am b/3rdparty/libflac/src/plugin_xmms/Makefile.am deleted file mode 100644 index 62ca2abb979..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/Makefile.am +++ /dev/null @@ -1,70 +0,0 @@ -# libxmms-flac - XMMS FLAC input plugin -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -EXTRA_DIST = \ - Makefile.lite - -noinst_HEADERS = \ - charset.h \ - configure.h \ - http.h \ - locale_hack.h \ - plugin.h \ - tag.h - -AM_CFLAGS = @OGG_CFLAGS@ @XMMS_CFLAGS@ - -INCLUDES = -I$(top_srcdir)/src -if FLaC__INSTALL_XMMS_PLUGIN_LOCALLY -xmmsinputplugindir = $(HOME)/.xmms/Plugins -else -xmmsinputplugindir = @XMMS_INPUT_PLUGIN_DIR@ -endif - -# Don't build a static library -LIBTOOL = $(top_builddir)/libtool-disable-static - -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 \ - @OGG_LIBS@ \ - @XMMS_LIBS@ \ - @LIBICONV@ -libxmms_flac_la_LDFLAGS = -module -avoid-version diff --git a/3rdparty/libflac/src/plugin_xmms/Makefile.in b/3rdparty/libflac/src/plugin_xmms/Makefile.in deleted file mode 100644 index bf9eba974dd..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/Makefile.in +++ /dev/null @@ -1,588 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# libxmms-flac - XMMS FLAC input plugin -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ - -# Don't build a static library -LIBTOOL = $(top_builddir)/libtool-disable-static -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -EXTRA_DIST = \ - Makefile.lite - - -noinst_HEADERS = \ - charset.h \ - configure.h \ - http.h \ - locale_hack.h \ - plugin.h \ - tag.h - - -AM_CFLAGS = @OGG_CFLAGS@ @XMMS_CFLAGS@ - -INCLUDES = -I$(top_srcdir)/src -@FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@xmmsinputplugindir = @XMMS_INPUT_PLUGIN_DIR@ -@FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@xmmsinputplugindir = $(HOME)/.xmms/Plugins - -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 \ - @OGG_LIBS@ \ - @XMMS_LIBS@ \ - @LIBICONV@ - -libxmms_flac_la_LDFLAGS = -module -avoid-version -subdir = src/plugin_xmms -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(xmmsinputplugin_LTLIBRARIES) - -libxmms_flac_la_DEPENDENCIES = \ - $(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 -am__objects_1 = charset.lo configure.lo fileinfo.lo http.lo plugin.lo \ - tag.lo -am_libxmms_flac_la_OBJECTS = $(am__objects_1) -libxmms_flac_la_OBJECTS = $(am_libxmms_flac_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/charset.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/configure.Plo ./$(DEPDIR)/fileinfo.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/http.Plo ./$(DEPDIR)/plugin.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/tag.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libxmms_flac_la_SOURCES) -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am -SOURCES = $(libxmms_flac_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/plugin_xmms/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -xmmsinputpluginLTLIBRARIES_INSTALL = $(INSTALL) -install-xmmsinputpluginLTLIBRARIES: $(xmmsinputplugin_LTLIBRARIES) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(xmmsinputplugindir) - @list='$(xmmsinputplugin_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=install $(xmmsinputpluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(xmmsinputplugindir)/$$f"; \ - $(LIBTOOL) --mode=install $(xmmsinputpluginLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(xmmsinputplugindir)/$$f; \ - else :; fi; \ - done - -uninstall-xmmsinputpluginLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(xmmsinputplugin_LTLIBRARIES)'; for p in $$list; do \ - p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(xmmsinputplugindir)/$$p"; \ - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(xmmsinputplugindir)/$$p; \ - done - -clean-xmmsinputpluginLTLIBRARIES: - -test -z "$(xmmsinputplugin_LTLIBRARIES)" || rm -f $(xmmsinputplugin_LTLIBRARIES) - @list='$(xmmsinputplugin_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libxmms-flac.la: $(libxmms_flac_la_OBJECTS) $(libxmms_flac_la_DEPENDENCIES) - $(LINK) -rpath $(xmmsinputplugindir) $(libxmms_flac_la_LDFLAGS) $(libxmms_flac_la_OBJECTS) $(libxmms_flac_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/charset.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/configure.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileinfo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) - -installdirs: - $(mkinstalldirs) $(DESTDIR)$(xmmsinputplugindir) -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-xmmsinputpluginLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: install-xmmsinputpluginLTLIBRARIES - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am uninstall-xmmsinputpluginLTLIBRARIES - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-xmmsinputpluginLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip install-xmmsinputpluginLTLIBRARIES installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am \ - uninstall-xmmsinputpluginLTLIBRARIES - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/plugin_xmms/Makefile.lite b/3rdparty/libflac/src/plugin_xmms/Makefile.lite deleted file mode 100644 index 6addb9da283..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/Makefile.lite +++ /dev/null @@ -1,43 +0,0 @@ -# libxmms-flac - XMMS FLAC input plugin -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../.. - -LIB_NAME = libxmms-flac -INCLUDES = -I./include -I$(topdir)/include -I.. $(shell xmms-config --cflags) -# refer to the static libs explicitly -ifeq ($(DARWIN_BUILD),yes) -LIBS = $(topdir)/obj/$(BUILD)/lib/libFLAC.a $(topdir)/obj/$(BUILD)/lib/libplugin_common.a $(topdir)/obj/$(BUILD)/lib/libgrabbag.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_analysis.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_synthesis.a $(OGG_LIB_DIR)/libogg.a -liconv -lstdc++ -lz -else -LIBS = $(topdir)/obj/$(BUILD)/lib/libFLAC.a $(topdir)/obj/$(BUILD)/lib/libplugin_common.a $(topdir)/obj/$(BUILD)/lib/libgrabbag.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_analysis.a $(topdir)/obj/$(BUILD)/lib/libreplaygain_synthesis.a -L$(OGG_LIB_DIR) -logg -lstdc++ -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/3rdparty/libflac/src/plugin_xmms/charset.c b/3rdparty/libflac/src/plugin_xmms/charset.c deleted file mode 100644 index c79e2eff6a6..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/charset.c +++ /dev/null @@ -1,198 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006 Daisuke Shimamura - * - * Almost from charset.c - * EasyTAG - Tag editor for MP3 and OGG files - * Copyright (C) 1999-2001 Håvard Kvålen <havardk@xmms.org> - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdlib.h> -#include <glib.h> -#include <string.h> -#include <errno.h> - -#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<CHARSET_TRANS_ARRAY_LEN; i++) - list = g_list_append(list,_(charset_trans_array[i].charset_title)); - return list; -} - -GList *Charset_Create_List_UTF8_Only (void) -{ - GList *list = NULL; - - list = g_list_append(list,_(Charset_Get_Title_From_Name("UTF-8"))); - return list; -} - - -/* - * Return charset_name from charset_title - */ -gchar *Charset_Get_Name_From_Title (gchar *charset_title) -{ - guint i; - - if (charset_title) - for (i=0; i<CHARSET_TRANS_ARRAY_LEN; i++) - if ( strcasecmp(_(charset_title),_(charset_trans_array[i].charset_title)) == 0 ) - return charset_trans_array[i].charset_name; - return ""; -} - - -/* - * Return charset_title from charset_name - */ -gchar *Charset_Get_Title_From_Name (gchar *charset_name) -{ - guint i; - - if (charset_name) - for (i=0; i<CHARSET_TRANS_ARRAY_LEN; i++) - if ( strcasecmp(charset_name,charset_trans_array[i].charset_name) == 0 ) - return _(charset_trans_array[i].charset_title); - return ""; -} diff --git a/3rdparty/libflac/src/plugin_xmms/charset.h b/3rdparty/libflac/src/plugin_xmms/charset.h deleted file mode 100644 index 6ed42c7b2c2..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/charset.h +++ /dev/null @@ -1,56 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006 Daisuke Shimamura - * - * Almost from charset.h - 2001/12/04 - * EasyTAG - Tag editor for MP3 and OGG files - * Copyright (C) 1999-2001 H蛆ard Kvè™±en <havardk@xmms.org> - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - - -#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/3rdparty/libflac/src/plugin_xmms/configure.c b/3rdparty/libflac/src/plugin_xmms/configure.c deleted file mode 100644 index f9170e977b2..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/configure.c +++ /dev/null @@ -1,823 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006 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 <j.couderc@ifrance.com> - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <pthread.h> -#include <math.h> - -#include <xmms/configfile.h> -#include <xmms/dirbrowser.h> -#include <xmms/titlestring.h> -#include <xmms/util.h> -#include <xmms/plugin.h> - -#include "share/replaygain_synthesis.h" /* for NOISE_SHAPING_LOW */ -#include "charset.h" -#include "configure.h" -#include "locale_hack.h" - -/* - * Initialize Global Valueable - */ -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://flac.sourceforge.net/"), - _("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/3rdparty/libflac/src/plugin_xmms/configure.h b/3rdparty/libflac/src/plugin_xmms/configure.h deleted file mode 100644 index 88b2e37e194..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/configure.h +++ /dev/null @@ -1,77 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef FLAC__PLUGIN_XMMS__CONFIGURE_H -#define FLAC__PLUGIN_XMMS__CONFIGURE_H - -#include <glib.h> - -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/3rdparty/libflac/src/plugin_xmms/fileinfo.c b/3rdparty/libflac/src/plugin_xmms/fileinfo.c deleted file mode 100644 index 5589e1cba2b..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/fileinfo.c +++ /dev/null @@ -1,496 +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 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> /* for strlen() */ -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <stdarg.h> -#include <gtk/gtk.h> - -#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: %llu\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)) { -#if _FILE_OFFSET_BITS == 64 - label_set_text(flac_filesize, _("Filesize: %lld B"), _stat.st_size); -#else - label_set_text(flac_filesize, _("Filesize: %ld B"), _stat.st_size); -#endif - 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) -{ - unsigned 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/3rdparty/libflac/src/plugin_xmms/http.c b/3rdparty/libflac/src/plugin_xmms/http.c deleted file mode 100644 index af3235fb1f0..00000000000 --- a/3rdparty/libflac/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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -/* modified for FLAC support by Steven Richman (2003) */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/time.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#include <netdb.h> -#include <glib.h> -#include <string.h> -#include <fcntl.h> -#include <unistd.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> - -#include <pthread.h> - -#include <xmms/util.h> -#include <xmms/plugin.h> - -#include "FLAC/format.h" -#include "configure.h" -#include "locale_hack.h" -#include "plugin.h" - -/* on FreeBSD we get socklen_t from <sys/socket.h> */ -#if (!defined HAVE_SOCKLEN_T) && !defined(__FreeBSD__) -typedef unsigned int 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; - -#undef DEBUG_UDP - -/* 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) - sprintf (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: %llu-\r\n", temp, offset); - fprintf (stderr, "%s", temp); - 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)) { -#ifdef DEBUG_UDP - 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); - -#ifdef DEBUG_UDP - 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; - } - -#ifdef DEBUG_UDP - 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'; -#ifdef DEBUG_UDP - 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]; - sprintf(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)); - } -#ifdef DEBUG_UDP - 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/3rdparty/libflac/src/plugin_xmms/locale_hack.h b/3rdparty/libflac/src/plugin_xmms/locale_hack.h deleted file mode 100644 index d04b1b2e90e..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/locale_hack.h +++ /dev/null @@ -1,55 +0,0 @@ -/* plugin_common - Routines common to several plugins - * Copyright (C) 2002,2003,2004,2006,2007 Josh Coalson - * - * 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 <havardk@xmms.org> - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -/* - * Gettext support for EasyTAG - */ - - -#ifndef FLAC__PLUGIN_COMMON__LOCALE_HACK_H -#define FLAC__PLUGIN_COMMON__LOCALE_HACK_H - -#include <locale.h> - -/* - * Standard gettext macros. - */ -#ifdef ENABLE_NLS -# include <libintl.h> -# 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/3rdparty/libflac/src/plugin_xmms/plugin.c b/3rdparty/libflac/src/plugin_xmms/plugin.c deleted file mode 100644 index 24a79b770ef..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/plugin.c +++ /dev/null @@ -1,684 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <limits.h> -#include <pthread.h> -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <glib.h> -#include <pwd.h> -#include <sys/types.h> -#include <unistd.h> - -#include <xmms/plugin.h> -#include <xmms/util.h> -#include <xmms/configfile.h> -#include <xmms/titlestring.h> - -#ifdef HAVE_LANGINFO_CODESET -#include <langinfo.h> -#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; - unsigned bits_per_sample; - unsigned channels; - unsigned 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; - unsigned 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 unsigned 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 unsigned bitrate_history_[BITRATE_HIST_SIZE]; - - -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 %d 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 { - *title = g_malloc(strlen(errtitle) + 1 + strlen(filename) + 1 + 1); - sprintf(*title, "%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) -{ - unsigned 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) { - unsigned 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 unsigned 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; - unsigned 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 */ - unsigned 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 unsigned channels = stream_data->channels, wide_samples = frame->header.blocksize; - const unsigned 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, /* unsigned_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/3rdparty/libflac/src/plugin_xmms/tag.c b/3rdparty/libflac/src/plugin_xmms/tag.c deleted file mode 100644 index c4a7c940874..00000000000 --- a/3rdparty/libflac/src/plugin_xmms/tag.c +++ /dev/null @@ -1,154 +0,0 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson - * Copyright (C) 2002,2003,2004,2005,2006,2007 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <glib.h> -#include <xmms/plugin.h> -#include <xmms/util.h> -#include <xmms/configfile.h> -#include <xmms/titlestring.h> - -#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 extenstion, 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(performer); - if(!input->performer) - input->performer = local__getstr(artist); - 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/3rdparty/libflac/src/share/Makefile.am b/3rdparty/libflac/src/share/Makefile.am index 19d71ee6af0..caf61226b77 100644 --- a/3rdparty/libflac/src/share/Makefile.am +++ b/3rdparty/libflac/src/share/Makefile.am @@ -1,8 +1,9 @@ # FLAC - Free Lossless Audio Codec -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference licenses. The codec libraries +# 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 @@ -15,8 +16,58 @@ # restrictive of those mentioned above. See the file COPYING.Xiph in this # distribution. -SUBDIRS = getopt replaygain_analysis replaygain_synthesis grabbag utf8 +AUTOMAKE_OPTIONS = subdir-objects + +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include EXTRA_DIST = \ - Makefile.lite \ - README + README \ + getopt/CMakeLists.txt \ + grabbag/CMakeLists.txt \ + replaygain_analysis/CMakeLists.txt \ + replaygain_synthesis/CMakeLists.txt \ + utf8/CMakeLists.txt \ + utf8/charmaps.h \ + utf8/makemap.c \ + utf8/charset_test.c + + +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 +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/3rdparty/libflac/src/share/Makefile.in b/3rdparty/libflac/src/share/Makefile.in index a348b495267..a9449984156 100644 --- a/3rdparty/libflac/src/share/Makefile.in +++ b/3rdparty/libflac/src/share/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,10 +15,11 @@ @SET_MAKE@ # FLAC - Free Lossless Audio Codec -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference licenses. The codec libraries +# 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 @@ -31,16 +32,67 @@ # restrictive of those mentioned above. See the file COPYING.Xiph in this # distribution. -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +104,153 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +subdir = src/share +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +getopt_libgetopt_la_LIBADD = +am__dirstamp = $(am__leading_dot)dirstamp +am_getopt_libgetopt_la_OBJECTS = getopt/getopt.lo getopt/getopt1.lo +getopt_libgetopt_la_OBJECTS = $(am_getopt_libgetopt_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +grabbag_libgrabbag_la_LIBADD = +am_grabbag_libgrabbag_la_OBJECTS = grabbag/alloc.lo \ + grabbag/cuesheet.lo grabbag/file.lo grabbag/picture.lo \ + grabbag/replaygain.lo grabbag/seektable.lo grabbag/snprintf.lo +grabbag_libgrabbag_la_OBJECTS = $(am_grabbag_libgrabbag_la_OBJECTS) +replaygain_analysis_libreplaygain_analysis_la_LIBADD = +am_replaygain_analysis_libreplaygain_analysis_la_OBJECTS = \ + replaygain_analysis/replaygain_analysis.lo +replaygain_analysis_libreplaygain_analysis_la_OBJECTS = \ + $(am_replaygain_analysis_libreplaygain_analysis_la_OBJECTS) +replaygain_synthesis_libreplaygain_synthesis_la_LIBADD = +am_replaygain_synthesis_libreplaygain_synthesis_la_OBJECTS = replaygain_synthesis/libreplaygain_synthesis_la-replaygain_synthesis.lo +replaygain_synthesis_libreplaygain_synthesis_la_OBJECTS = \ + $(am_replaygain_synthesis_libreplaygain_synthesis_la_OBJECTS) +replaygain_synthesis_libreplaygain_synthesis_la_LINK = $(LIBTOOL) \ + $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) \ + $(replaygain_synthesis_libreplaygain_synthesis_la_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +utf8_libutf8_la_LIBADD = +am_utf8_libutf8_la_OBJECTS = utf8/charset.lo utf8/iconvert.lo \ + utf8/utf8.lo +utf8_libutf8_la_OBJECTS = $(am_utf8_libutf8_la_OBJECTS) +win_utf8_io_libwin_utf8_io_la_LIBADD = +am__win_utf8_io_libwin_utf8_io_la_SOURCES_DIST = \ + win_utf8_io/win_utf8_io.c +@OS_IS_WINDOWS_TRUE@am_win_utf8_io_libwin_utf8_io_la_OBJECTS = \ +@OS_IS_WINDOWS_TRUE@ win_utf8_io/win_utf8_io.lo +win_utf8_io_libwin_utf8_io_la_OBJECTS = \ + $(am_win_utf8_io_libwin_utf8_io_la_OBJECTS) +@OS_IS_WINDOWS_TRUE@am_win_utf8_io_libwin_utf8_io_la_rpath = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = getopt/$(DEPDIR)/getopt.Plo \ + getopt/$(DEPDIR)/getopt1.Plo grabbag/$(DEPDIR)/alloc.Plo \ + grabbag/$(DEPDIR)/cuesheet.Plo grabbag/$(DEPDIR)/file.Plo \ + grabbag/$(DEPDIR)/picture.Plo grabbag/$(DEPDIR)/replaygain.Plo \ + grabbag/$(DEPDIR)/seektable.Plo grabbag/$(DEPDIR)/snprintf.Plo \ + replaygain_analysis/$(DEPDIR)/replaygain_analysis.Plo \ + replaygain_synthesis/$(DEPDIR)/libreplaygain_synthesis_la-replaygain_synthesis.Plo \ + utf8/$(DEPDIR)/charset.Plo utf8/$(DEPDIR)/iconvert.Plo \ + utf8/$(DEPDIR)/utf8.Plo win_utf8_io/$(DEPDIR)/win_utf8_io.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(getopt_libgetopt_la_SOURCES) \ + $(grabbag_libgrabbag_la_SOURCES) \ + $(replaygain_analysis_libreplaygain_analysis_la_SOURCES) \ + $(replaygain_synthesis_libreplaygain_synthesis_la_SOURCES) \ + $(utf8_libutf8_la_SOURCES) \ + $(win_utf8_io_libwin_utf8_io_la_SOURCES) +DIST_SOURCES = $(getopt_libgetopt_la_SOURCES) \ + $(grabbag_libgrabbag_la_SOURCES) \ + $(replaygain_analysis_libreplaygain_analysis_la_SOURCES) \ + $(replaygain_synthesis_libreplaygain_synthesis_la_SOURCES) \ + $(utf8_libutf8_la_SOURCES) \ + $(am__win_utf8_io_libwin_utf8_io_la_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,459 +259,646 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - -SUBDIRS = getopt replaygain_analysis replaygain_synthesis grabbag utf8 - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = subdir-objects +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include EXTRA_DIST = \ - Makefile.lite \ - README - -subdir = src/share -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = $(SUBDIRS) -all: all-recursive + README \ + getopt/CMakeLists.txt \ + grabbag/CMakeLists.txt \ + replaygain_analysis/CMakeLists.txt \ + replaygain_synthesis/CMakeLists.txt \ + utf8/CMakeLists.txt \ + utf8/charmaps.h \ + utf8/makemap.c \ + utf8/charset_test.c + +noinst_LTLIBRARIES = \ + getopt/libgetopt.la \ + grabbag/libgrabbag.la \ + utf8/libutf8.la \ + $(libwin_utf8_io) \ + replaygain_analysis/libreplaygain_analysis.la \ + replaygain_synthesis/libreplaygain_synthesis.la + +@OS_IS_WINDOWS_FALSE@win_utf8_io_libwin_utf8_io_la_SOURCES = +@OS_IS_WINDOWS_TRUE@win_utf8_io_libwin_utf8_io_la_SOURCES = win_utf8_io/win_utf8_io.c +@OS_IS_WINDOWS_FALSE@libwin_utf8_io = +@OS_IS_WINDOWS_TRUE@libwin_utf8_io = win_utf8_io/libwin_utf8_io.la +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 +all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/share/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/share/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/share/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +getopt/$(am__dirstamp): + @$(MKDIR_P) getopt + @: > getopt/$(am__dirstamp) +getopt/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) getopt/$(DEPDIR) + @: > getopt/$(DEPDIR)/$(am__dirstamp) +getopt/getopt.lo: getopt/$(am__dirstamp) \ + getopt/$(DEPDIR)/$(am__dirstamp) +getopt/getopt1.lo: getopt/$(am__dirstamp) \ + getopt/$(DEPDIR)/$(am__dirstamp) + +getopt/libgetopt.la: $(getopt_libgetopt_la_OBJECTS) $(getopt_libgetopt_la_DEPENDENCIES) $(EXTRA_getopt_libgetopt_la_DEPENDENCIES) getopt/$(am__dirstamp) + $(AM_V_CCLD)$(LINK) $(getopt_libgetopt_la_OBJECTS) $(getopt_libgetopt_la_LIBADD) $(LIBS) +grabbag/$(am__dirstamp): + @$(MKDIR_P) grabbag + @: > grabbag/$(am__dirstamp) +grabbag/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) grabbag/$(DEPDIR) + @: > grabbag/$(DEPDIR)/$(am__dirstamp) +grabbag/alloc.lo: grabbag/$(am__dirstamp) \ + grabbag/$(DEPDIR)/$(am__dirstamp) +grabbag/cuesheet.lo: grabbag/$(am__dirstamp) \ + grabbag/$(DEPDIR)/$(am__dirstamp) +grabbag/file.lo: grabbag/$(am__dirstamp) \ + grabbag/$(DEPDIR)/$(am__dirstamp) +grabbag/picture.lo: grabbag/$(am__dirstamp) \ + grabbag/$(DEPDIR)/$(am__dirstamp) +grabbag/replaygain.lo: grabbag/$(am__dirstamp) \ + grabbag/$(DEPDIR)/$(am__dirstamp) +grabbag/seektable.lo: grabbag/$(am__dirstamp) \ + grabbag/$(DEPDIR)/$(am__dirstamp) +grabbag/snprintf.lo: grabbag/$(am__dirstamp) \ + grabbag/$(DEPDIR)/$(am__dirstamp) + +grabbag/libgrabbag.la: $(grabbag_libgrabbag_la_OBJECTS) $(grabbag_libgrabbag_la_DEPENDENCIES) $(EXTRA_grabbag_libgrabbag_la_DEPENDENCIES) grabbag/$(am__dirstamp) + $(AM_V_CCLD)$(LINK) $(grabbag_libgrabbag_la_OBJECTS) $(grabbag_libgrabbag_la_LIBADD) $(LIBS) +replaygain_analysis/$(am__dirstamp): + @$(MKDIR_P) replaygain_analysis + @: > replaygain_analysis/$(am__dirstamp) +replaygain_analysis/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) replaygain_analysis/$(DEPDIR) + @: > replaygain_analysis/$(DEPDIR)/$(am__dirstamp) +replaygain_analysis/replaygain_analysis.lo: \ + replaygain_analysis/$(am__dirstamp) \ + replaygain_analysis/$(DEPDIR)/$(am__dirstamp) + +replaygain_analysis/libreplaygain_analysis.la: $(replaygain_analysis_libreplaygain_analysis_la_OBJECTS) $(replaygain_analysis_libreplaygain_analysis_la_DEPENDENCIES) $(EXTRA_replaygain_analysis_libreplaygain_analysis_la_DEPENDENCIES) replaygain_analysis/$(am__dirstamp) + $(AM_V_CCLD)$(LINK) $(replaygain_analysis_libreplaygain_analysis_la_OBJECTS) $(replaygain_analysis_libreplaygain_analysis_la_LIBADD) $(LIBS) +replaygain_synthesis/$(am__dirstamp): + @$(MKDIR_P) replaygain_synthesis + @: > replaygain_synthesis/$(am__dirstamp) +replaygain_synthesis/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) replaygain_synthesis/$(DEPDIR) + @: > replaygain_synthesis/$(DEPDIR)/$(am__dirstamp) +replaygain_synthesis/libreplaygain_synthesis_la-replaygain_synthesis.lo: \ + replaygain_synthesis/$(am__dirstamp) \ + replaygain_synthesis/$(DEPDIR)/$(am__dirstamp) + +replaygain_synthesis/libreplaygain_synthesis.la: $(replaygain_synthesis_libreplaygain_synthesis_la_OBJECTS) $(replaygain_synthesis_libreplaygain_synthesis_la_DEPENDENCIES) $(EXTRA_replaygain_synthesis_libreplaygain_synthesis_la_DEPENDENCIES) replaygain_synthesis/$(am__dirstamp) + $(AM_V_CCLD)$(replaygain_synthesis_libreplaygain_synthesis_la_LINK) $(replaygain_synthesis_libreplaygain_synthesis_la_OBJECTS) $(replaygain_synthesis_libreplaygain_synthesis_la_LIBADD) $(LIBS) +utf8/$(am__dirstamp): + @$(MKDIR_P) utf8 + @: > utf8/$(am__dirstamp) +utf8/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) utf8/$(DEPDIR) + @: > utf8/$(DEPDIR)/$(am__dirstamp) +utf8/charset.lo: utf8/$(am__dirstamp) utf8/$(DEPDIR)/$(am__dirstamp) +utf8/iconvert.lo: utf8/$(am__dirstamp) utf8/$(DEPDIR)/$(am__dirstamp) +utf8/utf8.lo: utf8/$(am__dirstamp) utf8/$(DEPDIR)/$(am__dirstamp) + +utf8/libutf8.la: $(utf8_libutf8_la_OBJECTS) $(utf8_libutf8_la_DEPENDENCIES) $(EXTRA_utf8_libutf8_la_DEPENDENCIES) utf8/$(am__dirstamp) + $(AM_V_CCLD)$(LINK) $(utf8_libutf8_la_OBJECTS) $(utf8_libutf8_la_LIBADD) $(LIBS) +win_utf8_io/$(am__dirstamp): + @$(MKDIR_P) win_utf8_io + @: > win_utf8_io/$(am__dirstamp) +win_utf8_io/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) win_utf8_io/$(DEPDIR) + @: > win_utf8_io/$(DEPDIR)/$(am__dirstamp) +win_utf8_io/win_utf8_io.lo: win_utf8_io/$(am__dirstamp) \ + win_utf8_io/$(DEPDIR)/$(am__dirstamp) + +win_utf8_io/libwin_utf8_io.la: $(win_utf8_io_libwin_utf8_io_la_OBJECTS) $(win_utf8_io_libwin_utf8_io_la_DEPENDENCIES) $(EXTRA_win_utf8_io_libwin_utf8_io_la_DEPENDENCIES) win_utf8_io/$(am__dirstamp) + $(AM_V_CCLD)$(LINK) $(am_win_utf8_io_libwin_utf8_io_la_rpath) $(win_utf8_io_libwin_utf8_io_la_OBJECTS) $(win_utf8_io_libwin_utf8_io_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f getopt/*.$(OBJEXT) + -rm -f getopt/*.lo + -rm -f grabbag/*.$(OBJEXT) + -rm -f grabbag/*.lo + -rm -f replaygain_analysis/*.$(OBJEXT) + -rm -f replaygain_analysis/*.lo + -rm -f replaygain_synthesis/*.$(OBJEXT) + -rm -f replaygain_synthesis/*.lo + -rm -f utf8/*.$(OBJEXT) + -rm -f utf8/*.lo + -rm -f win_utf8_io/*.$(OBJEXT) + -rm -f win_utf8_io/*.lo + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@getopt/$(DEPDIR)/getopt.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@getopt/$(DEPDIR)/getopt1.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@grabbag/$(DEPDIR)/alloc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@grabbag/$(DEPDIR)/cuesheet.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@grabbag/$(DEPDIR)/file.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@grabbag/$(DEPDIR)/picture.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@grabbag/$(DEPDIR)/replaygain.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@grabbag/$(DEPDIR)/seektable.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@grabbag/$(DEPDIR)/snprintf.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@replaygain_analysis/$(DEPDIR)/replaygain_analysis.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@replaygain_synthesis/$(DEPDIR)/libreplaygain_synthesis_la-replaygain_synthesis.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@utf8/$(DEPDIR)/charset.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@utf8/$(DEPDIR)/iconvert.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@utf8/$(DEPDIR)/utf8.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@win_utf8_io/$(DEPDIR)/win_utf8_io.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +replaygain_synthesis/libreplaygain_synthesis_la-replaygain_synthesis.lo: replaygain_synthesis/replaygain_synthesis.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(replaygain_synthesis_libreplaygain_synthesis_la_CFLAGS) $(CFLAGS) -MT replaygain_synthesis/libreplaygain_synthesis_la-replaygain_synthesis.lo -MD -MP -MF replaygain_synthesis/$(DEPDIR)/libreplaygain_synthesis_la-replaygain_synthesis.Tpo -c -o replaygain_synthesis/libreplaygain_synthesis_la-replaygain_synthesis.lo `test -f 'replaygain_synthesis/replaygain_synthesis.c' || echo '$(srcdir)/'`replaygain_synthesis/replaygain_synthesis.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) replaygain_synthesis/$(DEPDIR)/libreplaygain_synthesis_la-replaygain_synthesis.Tpo replaygain_synthesis/$(DEPDIR)/libreplaygain_synthesis_la-replaygain_synthesis.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='replaygain_synthesis/replaygain_synthesis.c' object='replaygain_synthesis/libreplaygain_synthesis_la-replaygain_synthesis.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(replaygain_synthesis_libreplaygain_synthesis_la_CFLAGS) $(CFLAGS) -c -o replaygain_synthesis/libreplaygain_synthesis_la-replaygain_synthesis.lo `test -f 'replaygain_synthesis/replaygain_synthesis.c' || echo '$(srcdir)/'`replaygain_synthesis/replaygain_synthesis.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ + -rm -rf getopt/.libs getopt/_libs + -rm -rf grabbag/.libs grabbag/_libs + -rm -rf replaygain_analysis/.libs replaygain_analysis/_libs + -rm -rf replaygain_synthesis/.libs replaygain_synthesis/_libs + -rm -rf utf8/.libs utf8/_libs + -rm -rf win_utf8_io/.libs win_utf8_io/_libs + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ else \ - local_target="$$target"; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique + fi +ctags: ctags-am -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - else \ - include_option=--include; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ fi; \ done check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: - -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-recursive +installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f getopt/$(DEPDIR)/$(am__dirstamp) + -rm -f getopt/$(am__dirstamp) + -rm -f grabbag/$(DEPDIR)/$(am__dirstamp) + -rm -f grabbag/$(am__dirstamp) + -rm -f replaygain_analysis/$(DEPDIR)/$(am__dirstamp) + -rm -f replaygain_analysis/$(am__dirstamp) + -rm -f replaygain_synthesis/$(DEPDIR)/$(am__dirstamp) + -rm -f replaygain_synthesis/$(am__dirstamp) + -rm -f utf8/$(DEPDIR)/$(am__dirstamp) + -rm -f utf8/$(am__dirstamp) + -rm -f win_utf8_io/$(DEPDIR)/$(am__dirstamp) + -rm -f win_utf8_io/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -f getopt/$(DEPDIR)/getopt.Plo + -rm -f getopt/$(DEPDIR)/getopt1.Plo + -rm -f grabbag/$(DEPDIR)/alloc.Plo + -rm -f grabbag/$(DEPDIR)/cuesheet.Plo + -rm -f grabbag/$(DEPDIR)/file.Plo + -rm -f grabbag/$(DEPDIR)/picture.Plo + -rm -f grabbag/$(DEPDIR)/replaygain.Plo + -rm -f grabbag/$(DEPDIR)/seektable.Plo + -rm -f grabbag/$(DEPDIR)/snprintf.Plo + -rm -f replaygain_analysis/$(DEPDIR)/replaygain_analysis.Plo + -rm -f replaygain_synthesis/$(DEPDIR)/libreplaygain_synthesis_la-replaygain_synthesis.Plo + -rm -f utf8/$(DEPDIR)/charset.Plo + -rm -f utf8/$(DEPDIR)/iconvert.Plo + -rm -f utf8/$(DEPDIR)/utf8.Plo + -rm -f win_utf8_io/$(DEPDIR)/win_utf8_io.Plo -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ +distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags -dvi: dvi-recursive +dvi: dvi-am dvi-am: -info: info-recursive +html: html-am + +html-am: + +info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: -install-info: install-info-recursive +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: -maintainer-clean: maintainer-clean-recursive +maintainer-clean: maintainer-clean-am + -rm -f getopt/$(DEPDIR)/getopt.Plo + -rm -f getopt/$(DEPDIR)/getopt1.Plo + -rm -f grabbag/$(DEPDIR)/alloc.Plo + -rm -f grabbag/$(DEPDIR)/cuesheet.Plo + -rm -f grabbag/$(DEPDIR)/file.Plo + -rm -f grabbag/$(DEPDIR)/picture.Plo + -rm -f grabbag/$(DEPDIR)/replaygain.Plo + -rm -f grabbag/$(DEPDIR)/seektable.Plo + -rm -f grabbag/$(DEPDIR)/snprintf.Plo + -rm -f replaygain_analysis/$(DEPDIR)/replaygain_analysis.Plo + -rm -f replaygain_synthesis/$(DEPDIR)/libreplaygain_synthesis_la-replaygain_synthesis.Plo + -rm -f utf8/$(DEPDIR)/charset.Plo + -rm -f utf8/$(DEPDIR)/iconvert.Plo + -rm -f utf8/$(DEPDIR)/utf8.Plo + -rm -f win_utf8_io/$(DEPDIR)/win_utf8_io.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-recursive +mostlyclean: mostlyclean-am -mostlyclean-am: mostlyclean-generic mostlyclean-libtool +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool -pdf: pdf-recursive +pdf: pdf-am pdf-am: -ps: ps-recursive +ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/share/Makefile.lite b/3rdparty/libflac/src/share/Makefile.lite deleted file mode 100644 index 9ed2198eb21..00000000000 --- a/3rdparty/libflac/src/share/Makefile.lite +++ /dev/null @@ -1,53 +0,0 @@ -# FLAC - Free Lossless Audio Codec -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference 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 grabbag replaygain_analysis 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)) - -grabbag: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -replaygain_analysis: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -replaygain_synthesis: - (cd $@ ; $(MAKE) -f Makefile.lite $(CONFIG)) - -utf8: - (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) diff --git a/3rdparty/libflac/src/share/getopt/CMakeLists.txt b/3rdparty/libflac/src/share/getopt/CMakeLists.txt new file mode 100644 index 00000000000..d905615e156 --- /dev/null +++ b/3rdparty/libflac/src/share/getopt/CMakeLists.txt @@ -0,0 +1,13 @@ +check_include_file("string.h" HAVE_STRING_H) + +if(NOT WIN32) + find_package(Intl) +endif() + +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/3rdparty/libflac/src/share/getopt/Makefile.am b/3rdparty/libflac/src/share/getopt/Makefile.am deleted file mode 100644 index f40464e638b..00000000000 --- a/3rdparty/libflac/src/share/getopt/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -I$(top_srcdir)/include/share - -noinst_LIBRARIES = libgetopt.a - -libgetopt_a_SOURCES = getopt.c getopt1.c - -EXTRA_DIST = \ - Makefile.lite \ - getopt_static.dsp \ - getopt_static.vcproj - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" diff --git a/3rdparty/libflac/src/share/getopt/Makefile.in b/3rdparty/libflac/src/share/getopt/Makefile.in deleted file mode 100644 index 4a2fbc9b452..00000000000 --- a/3rdparty/libflac/src/share/getopt/Makefile.in +++ /dev/null @@ -1,496 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -I$(top_srcdir)/include/share - -noinst_LIBRARIES = libgetopt.a - -libgetopt_a_SOURCES = getopt.c getopt1.c - -EXTRA_DIST = \ - Makefile.lite \ - getopt_static.dsp \ - getopt_static.vcproj - -subdir = src/share/getopt -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LIBRARIES = $(noinst_LIBRARIES) - -libgetopt_a_AR = $(AR) cru -libgetopt_a_LIBADD = -am_libgetopt_a_OBJECTS = getopt.$(OBJEXT) getopt1.$(OBJEXT) -libgetopt_a_OBJECTS = $(am_libgetopt_a_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/getopt.Po ./$(DEPDIR)/getopt1.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libgetopt_a_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(libgetopt_a_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/share/getopt/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLIBRARIES: - -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -libgetopt.a: $(libgetopt_a_OBJECTS) $(libgetopt_a_DEPENDENCIES) - -rm -f libgetopt.a - $(libgetopt_a_AR) libgetopt.a $(libgetopt_a_OBJECTS) $(libgetopt_a_LIBADD) - $(RANLIB) libgetopt.a - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LIBRARIES) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am - - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/share/getopt/Makefile.lite b/3rdparty/libflac/src/share/getopt/Makefile.lite deleted file mode 100644 index e36f341d37b..00000000000 --- a/3rdparty/libflac/src/share/getopt/Makefile.lite +++ /dev/null @@ -1,16 +0,0 @@ -# -# GNU makefile -# - -topdir = ../../.. - -LIB_NAME = libgetopt -INCLUDES = -I$(topdir)/include -I$(topdir)/include/share - -SRCS_C = \ - getopt.c \ - getopt1.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/share/getopt/getopt.c b/3rdparty/libflac/src/share/getopt/getopt.c index 279dff0216b..39fab80e2c3 100644 --- a/3rdparty/libflac/src/share/getopt/getopt.c +++ b/3rdparty/libflac/src/share/getopt/getopt.c @@ -6,7 +6,7 @@ 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: - http://sourceforge.net/projects/flac + 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 @@ -32,8 +32,8 @@ 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + 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 <stdio.h>. Ditto for AIX 3.2 and <stdlib.h>. */ @@ -41,7 +41,7 @@ # define _NO_PROTO #endif -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -86,7 +86,7 @@ #ifdef VMS # include <unixlib.h> -# if HAVE_STRING_H - 0 +# ifdef HAVE_STRING_H # include <string.h> # endif #endif @@ -220,13 +220,11 @@ static char *posixly_correct; whose names are inconsistent. */ #ifndef getenv -extern char *getenv (); +extern char *getenv (const char * name); #endif static char * -my_index (str, chr) - const char *str; - int chr; +my_index (const char *str, int chr) { while (*str) { @@ -314,8 +312,7 @@ static void exchange (char **); #endif static void -exchange (argv) - char **argv; +exchange (char **argv) { int bottom = first_nonopt; int middle = last_nonopt; @@ -399,10 +396,7 @@ exchange (argv) 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; +share___getopt_initialize (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 @@ -447,7 +441,7 @@ share___getopt_initialize (argc, argv, optstring) if (nonoption_flags_max_len < argc) nonoption_flags_max_len = argc; __getopt_nonoption_flags = - (char *) malloc (nonoption_flags_max_len); + malloc (nonoption_flags_max_len); if (__getopt_nonoption_flags == NULL) nonoption_flags_max_len = -1; else @@ -523,13 +517,13 @@ share___getopt_initialize (argc, argv, optstring) 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___getopt_internal ( + int argc, + char *const *argv, + const char *optstring, + const struct share__option *longopts, + int *longind, + int long_only ) { share__optarg = NULL; @@ -665,8 +659,7 @@ share___getopt_internal (argc, argv, optstring, longopts, longind, long_only) for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { - if ((unsigned int) (nameend - nextchar) - == (unsigned int) strlen (p->name)) + if ((size_t) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -854,7 +847,7 @@ share___getopt_internal (argc, argv, optstring, longopts, longind, long_only) for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { - if ((unsigned int) (nameend - nextchar) == strlen (p->name)) + if ((size_t) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -979,10 +972,7 @@ share___getopt_internal (argc, argv, optstring, longopts, longind, long_only) } int -share__getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; +share__getopt (int argc, char *const *argv, const char *optstring) { return share___getopt_internal (argc, argv, optstring, (const struct share__option *) 0, @@ -998,9 +988,7 @@ share__getopt (argc, argv, optstring) the above definition of `share__getopt'. */ int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int c; int digit_optind = 0; diff --git a/3rdparty/libflac/src/share/getopt/getopt1.c b/3rdparty/libflac/src/share/getopt/getopt1.c index 1e57486b6cb..fc526784606 100644 --- a/3rdparty/libflac/src/share/getopt/getopt1.c +++ b/3rdparty/libflac/src/share/getopt/getopt1.c @@ -6,7 +6,7 @@ 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: - http://sourceforge.net/projects/flac + 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 @@ -29,16 +29,13 @@ 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., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #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)'. */ @@ -49,6 +46,9 @@ #include <stdio.h> +#include "share/getopt.h" +/*[JEC] was:#include "getopt.h"*/ + /* 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 @@ -79,13 +79,7 @@ #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; +int share__getopt_long(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); } @@ -95,13 +89,7 @@ share__getopt_long (argc, argv, options, long_options, opt_index) 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; +int share__getopt_long_only(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); } @@ -113,10 +101,7 @@ share__getopt_long_only (argc, argv, options, long_options, opt_index) #include <stdio.h> -int -main (argc, argv) - int argc; - char **argv; +int main(int argc, char **argv) { int c; int digit_optind = 0; diff --git a/3rdparty/libflac/src/share/getopt/getopt_static.dsp b/3rdparty/libflac/src/share/getopt/getopt_static.dsp deleted file mode 100644 index 1cdbd71080d..00000000000 --- a/3rdparty/libflac/src/share/getopt/getopt_static.dsp +++ /dev/null @@ -1,112 +0,0 @@ -# Microsoft Developer Studio Project File - Name="getopt_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=getopt_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "getopt_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "getopt_static.mak" CFG="getopt_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "getopt_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "getopt_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "getopt" -# PROP Scc_LocalPath "..\..\.." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "getopt_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ELSEIF "$(CFG)" == "getopt_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "getopt_static - Win32 Release" -# Name "getopt_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=.\getopt.c -# End Source File -# Begin Source File - -SOURCE=.\getopt1.c -# End Source File -# End Group -# Begin Group "Private Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Protected Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\include\share\getopt.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/share/getopt/getopt_static.vcproj b/3rdparty/libflac/src/share/getopt/getopt_static.vcproj deleted file mode 100644 index 028c82d0b45..00000000000 --- a/3rdparty/libflac/src/share/getopt/getopt_static.vcproj +++ /dev/null @@ -1,185 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="getopt_static" - ProjectGUID="{4cefbc80-c215-11db-8314-0800200c9a66}" - RootNamespace="getopt_static" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\..\obj\debug\lib" - IntermediateDirectory="Debug_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\debug\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\..\obj\release\lib" - IntermediateDirectory="Release_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\release\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\getopt.c" - > - </File> - <File - RelativePath=".\getopt1.c" - > - </File> - </Filter> - <Filter - Name="Public Header Files" - > - <File - RelativePath="..\..\..\include\share\getopt.h" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/share/grabbag/CMakeLists.txt b/3rdparty/libflac/src/share/grabbag/CMakeLists.txt new file mode 100644 index 00000000000..203ae3f4c27 --- /dev/null +++ b/3rdparty/libflac/src/share/grabbag/CMakeLists.txt @@ -0,0 +1,14 @@ +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/3rdparty/libflac/src/share/grabbag/Makefile.am b/3rdparty/libflac/src/share/grabbag/Makefile.am deleted file mode 100644 index 879b15511a5..00000000000 --- a/3rdparty/libflac/src/share/grabbag/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -I$(top_srcdir)/include - -noinst_LTLIBRARIES = libgrabbag.la - -libgrabbag_la_SOURCES = \ - cuesheet.c \ - file.c \ - picture.c \ - replaygain.c \ - seektable.c - -EXTRA_DIST = \ - Makefile.lite \ - grabbag_static.dsp \ - grabbag_static.vcproj - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" diff --git a/3rdparty/libflac/src/share/grabbag/Makefile.in b/3rdparty/libflac/src/share/grabbag/Makefile.in deleted file mode 100644 index a7780a3c644..00000000000 --- a/3rdparty/libflac/src/share/grabbag/Makefile.in +++ /dev/null @@ -1,512 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -I$(top_srcdir)/include - -noinst_LTLIBRARIES = libgrabbag.la - -libgrabbag_la_SOURCES = \ - cuesheet.c \ - file.c \ - picture.c \ - replaygain.c \ - seektable.c - - -EXTRA_DIST = \ - Makefile.lite \ - grabbag_static.dsp \ - grabbag_static.vcproj - -subdir = src/share/grabbag -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libgrabbag_la_LDFLAGS = -libgrabbag_la_LIBADD = -am_libgrabbag_la_OBJECTS = cuesheet.lo file.lo picture.lo replaygain.lo \ - seektable.lo -libgrabbag_la_OBJECTS = $(am_libgrabbag_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cuesheet.Plo ./$(DEPDIR)/file.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/picture.Plo ./$(DEPDIR)/replaygain.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/seektable.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libgrabbag_la_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(libgrabbag_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/share/grabbag/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libgrabbag.la: $(libgrabbag_la_OBJECTS) $(libgrabbag_la_DEPENDENCIES) - $(LINK) $(libgrabbag_la_LDFLAGS) $(libgrabbag_la_OBJECTS) $(libgrabbag_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cuesheet.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/picture.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replaygain.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/seektable.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am - - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/share/grabbag/Makefile.lite b/3rdparty/libflac/src/share/grabbag/Makefile.lite deleted file mode 100644 index daf19751719..00000000000 --- a/3rdparty/libflac/src/share/grabbag/Makefile.lite +++ /dev/null @@ -1,19 +0,0 @@ -# -# GNU makefile -# - -topdir = ../../.. - -LIB_NAME = libgrabbag -INCLUDES = -I$(topdir)/include - -SRCS_C = \ - cuesheet.c \ - file.c \ - picture.c \ - replaygain.c \ - seektable.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/share/grabbag/alloc.c b/3rdparty/libflac/src/share/grabbag/alloc.c new file mode 100644 index 00000000000..4e5fb60c83d --- /dev/null +++ b/3rdparty/libflac/src/share/grabbag/alloc.c @@ -0,0 +1,48 @@ +/* alloc - Convenience routines for safely allocating memory + * Copyright (C) 2007-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdlib.h> + +#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/3rdparty/libflac/src/share/grabbag/cuesheet.c b/3rdparty/libflac/src/share/grabbag/cuesheet.c index 03f7cdaa75b..0d19ee72587 100644 --- a/3rdparty/libflac/src/share/grabbag/cuesheet.c +++ b/3rdparty/libflac/src/share/grabbag/cuesheet.c @@ -1,5 +1,6 @@ /* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,22 +17,25 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif -#include "share/grabbag.h" -#include "FLAC/assert.h" #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <limits.h> +#include "FLAC/assert.h" +#include "share/compat.h" +#include "share/grabbag.h" +#include "share/safe_str.h" -unsigned grabbag__cuesheet_msf_to_frame(unsigned minutes, unsigned seconds, unsigned frames) +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(unsigned frame, unsigned *minutes, unsigned *seconds, unsigned *frames) +void grabbag__cuesheet_frame_to_msf(uint32_t frame, uint32_t *minutes, uint32_t *seconds, uint32_t *frames) { *frames = frame % 75; frame /= 75; @@ -41,17 +45,21 @@ void grabbag__cuesheet_frame_to_msf(unsigned frame, unsigned *minutes, unsigned } /* 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) +static FLAC__int64 local__parse_int64_(const char *s) { - int ret = 0; + 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'); + if(c >= '0' && c <= '9') { + if(ret >= (INT64_MAX / 10)) + return -1; + else + ret = ret * 10 + (c - '0'); + } else return -1; @@ -59,44 +67,45 @@ static int local__parse_int_(const char *s) } /* 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) +static int local__parse_int_(const char *s) { - FLAC__int64 ret = 0; - char c; - - if(*s == '\0') + FLAC__int64 ret64 = local__parse_int64_(s); + if(ret64 < 0 || ret64 > INT_MAX) return -1; - - while('\0' != (c = *s++)) - if(c >= '0' && c <= '9') - ret = ret * 10 + (c - '0'); - else - return -1; - - return ret; + return ret64; } -/* accept '[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 +/* 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) +static FLAC__int64 local__parse_msf_(const char *s, uint32_t sample_rate) { FLAC__int64 ret, field; char c; + if(sample_rate == 0) + return -1; + 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'); + if(c >= '0' && c <= '9') { + if(field >= (INT64_MAX / 10)) + return -1; + else + field = field * 10 + (c - '0'); + } else return -1; } - ret = field * 60 * 44100; + if(field >= INT64_MAX / (60 * sample_rate)) + return -1; + ret = field * 60 * sample_rate; c = *s++; if(c >= '0' && c <= '9') @@ -117,7 +126,12 @@ static FLAC__int64 local__parse_msf_(const char *s) if(field >= 60) return -1; - ret += field * 44100; + { + FLAC__int64 tmp = ret; + ret += field * sample_rate; + if(ret < tmp) + return -1; + } c = *s++; if(c >= '0' && c <= '9') @@ -139,7 +153,58 @@ static FLAC__int64 local__parse_msf_(const char *s) if(field >= 75) return -1; - ret += field * (44100 / 75); + { + FLAC__int64 tmp = ret; + ret += field * (sample_rate / 75); + if(ret < tmp) + return -1; + } + + 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; + + if(sample_rate == 0) + return -1; + + c = *s++; + if(c >= '0' && c <= '9') + field = (c - '0'); + else + return -1; + while(':' != (c = *s++)) { + if(c >= '0' && c <= '9') { + if(field >= (INT64_MAX / 10)) + return -1; + else + field = field * 10 + (c - '0'); + } + else + return -1; + } + + if(field >= INT64_MAX / (60 * sample_rate)) + return -1; + ret = field * 60 * sample_rate; + + 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; } @@ -198,20 +263,22 @@ static char *local__get_field_(char **s, FLAC__bool allow_quotes) return p; } -static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, unsigned *last_line_read, FLAC__StreamMetadata *cuesheet, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset) +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) { -#if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ -#define FLAC__STRCASECMP stricmp -#else -#define FLAC__STRCASECMP strcasecmp -#endif char buffer[4096], *line, *field; - unsigned forced_leadout_track_num = 0; + 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; @@ -245,7 +312,7 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, *error_message = "CD-DA CATALOG number must be 13 decimal digits"; return false; } - strcpy(cs->media_catalog_number, field); + safe_strncpy(cs->media_catalog_number, field, sizeof(cs->media_catalog_number)); disc_has_catalog = true; } else if(0 == FLAC__STRCASECMP(field, "FLAGS")) { @@ -302,18 +369,29 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, *error_message = "INDEX is missing an offset after the index number"; return false; } - xx = local__parse_msf_(field); + /* 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; } - xx = local__parse_int64_(field); + /* 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) { - *error_message = "illegal INDEX offset"; - return false; + 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; @@ -349,7 +427,7 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, *error_message = "ISRC command must come after TRACK but before INDEX"; return false; } - if(0 == (field = local__get_field_(&line, /*allow_quotes=*/false))) { + if(0 == (field = local__get_field_(&line, /*allow_quotes=*/true))) { *error_message = "ISRC is missing ISRC number"; return false; } @@ -363,7 +441,7 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, *error_message = "invalid ISRC number"; return false; } - strcpy(cs->tracks[cs->num_tracks-1].isrc, field); + 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")) { @@ -468,7 +546,7 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, *error_message = "illegal FLAC__lead-out track number"; return false; } - forced_leadout_track_num = (unsigned)track_num; + 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"; @@ -530,10 +608,9 @@ static FLAC__bool local__cuesheet_parse_(FILE *file, const char **error_message, return false; } return true; -#undef FLAC__STRCASECMP } -FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_message, unsigned *last_line_read, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset) +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; @@ -549,7 +626,7 @@ FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_mes return 0; } - if(!local__cuesheet_parse_(file, error_message, last_line_read, cuesheet, is_cdda, lead_out_offset)) { + 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; } @@ -560,7 +637,7 @@ FLAC__StreamMetadata *grabbag__cuesheet_parse(FILE *file, const char **error_mes void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, const char *file_reference) { const FLAC__StreamMetadata_CueSheet *cs; - unsigned track_num, index_num; + uint32_t track_num, index_num; FLAC__ASSERT(0 != file); FLAC__ASSERT(0 != cuesheet); @@ -572,10 +649,12 @@ void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, co fprintf(file, "CATALOG %s\n", cs->media_catalog_number); fprintf(file, "FILE %s\n", file_reference); + FLAC__ASSERT(cs->num_tracks > 0); + 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", (unsigned)track->number, track->type == 0? "AUDIO" : "DATA"); + fprintf(file, " TRACK %02u %s\n", (uint32_t)track->number, track->type == 0? "AUDIO" : "DATA"); if(track->pre_emphasis) fprintf(file, " FLAGS PRE\n"); @@ -583,29 +662,20 @@ void grabbag__cuesheet_emit(FILE *file, const FLAC__StreamMetadata *cuesheet, co fprintf(file, " ISRC %s\n", track->isrc); for(index_num = 0; index_num < track->num_indices; index_num++) { - const FLAC__StreamMetadata_CueSheet_Index *index = track->indices + index_num; + const FLAC__StreamMetadata_CueSheet_Index *indx = track->indices + index_num; - fprintf(file, " INDEX %02u ", (unsigned)index->number); + fprintf(file, " INDEX %02u ", (uint32_t)indx->number); if(cs->is_cd) { - const unsigned logical_frame = (unsigned)((track->offset + index->offset) / (44100 / 75)); - unsigned m, s, f; + 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 -#ifdef _MSC_VER - fprintf(file, "%I64u\n", track->offset + index->offset); -#else - fprintf(file, "%llu\n", (unsigned long long)(track->offset + index->offset)); -#endif + fprintf(file, "%" PRIu64 "\n", (track->offset + indx->offset)); } } -#ifdef _MSC_VER - fprintf(file, "REM FLAC__lead-in %I64u\n", cs->lead_in); - fprintf(file, "REM FLAC__lead-out %u %I64u\n", (unsigned)cs->tracks[track_num].number, cs->tracks[track_num].offset); -#else - fprintf(file, "REM FLAC__lead-in %llu\n", (unsigned long long)cs->lead_in); - fprintf(file, "REM FLAC__lead-out %u %llu\n", (unsigned)cs->tracks[track_num].number, (unsigned long long)cs->tracks[track_num].offset); -#endif + 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/3rdparty/libflac/src/share/grabbag/file.c b/3rdparty/libflac/src/share/grabbag/file.c index d073c4bf1fd..307645f5737 100644 --- a/3rdparty/libflac/src/share/grabbag/file.c +++ b/3rdparty/libflac/src/share/grabbag/file.c @@ -1,5 +1,6 @@ /* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,7 +17,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -26,9 +27,8 @@ #include <fcntl.h> /* for _O_BINARY */ #else #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */ -#include <utime.h> /* for utime() */ #endif -#if defined __CYGWIN__ || defined __EMX__ +#if defined __EMX__ #include <io.h> /* for setmode(), O_BINARY */ #include <fcntl.h> /* for _O_BINARY */ #endif @@ -46,26 +46,33 @@ #include <winbase.h> #endif #include "share/grabbag.h" +#include "share/compat.h" void grabbag__file_copy_metadata(const char *srcpath, const char *destpath) { - struct stat srcstat; - struct utimbuf srctime; + struct flac_stat_s srcstat; - if(0 == stat(srcpath, &srcstat)) { + if(0 == flac_stat(srcpath, &srcstat)) { +#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) && !defined(_WIN32) + 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; - (void)chmod(destpath, srcstat.st_mode); - (void)utime(destpath, &srctime); +#endif + (void)flac_chmod(destpath, srcstat.st_mode); + (void)flac_utime(destpath, &srctime); } } -off_t grabbag__file_get_filesize(const char *srcpath) +FLAC__off_t grabbag__file_get_filesize(const char *srcpath) { - struct stat srcstat; + struct flac_stat_s srcstat; - if(0 == stat(srcpath, &srcstat)) + if(0 == flac_stat(srcpath, &srcstat)) return srcstat.st_size; else return -1; @@ -77,8 +84,10 @@ const char *grabbag__file_get_basename(const char *srcpath) p = strrchr(srcpath, '/'); if(0 == p) { +#if defined _WIN32 && !defined __CYGWIN__ p = strrchr(srcpath, '\\'); if(0 == p) +#endif return srcpath; } return ++p; @@ -86,9 +95,9 @@ const char *grabbag__file_get_basename(const char *srcpath) FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only) { - struct stat stats; + struct flac_stat_s stats; - if(0 == stat(filename, &stats)) { + if(0 == flac_stat(filename, &stats)) { #if !defined _MSC_VER && !defined __MINGW32__ if(read_only) { stats.st_mode &= ~S_IWUSR; @@ -104,7 +113,7 @@ FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only else stats.st_mode |= S_IWRITE; #endif - if(0 != chmod(filename, stats.st_mode)) + if(0 != flac_chmod(filename, stats.st_mode)) return false; } else @@ -115,9 +124,13 @@ FLAC__bool grabbag__file_change_stats(const char *filename, FLAC__bool read_only FLAC__bool grabbag__file_are_same(const char *f1, const char *f2) { -#if defined _MSC_VER || defined __MINGW32__ +#if defined _WIN32 && !defined __CYGWIN__ +#if !defined(WINAPI_FAMILY_PARTITION) +#define WINAPI_FAMILY_PARTITION(x) x +#define WINAPI_PARTITION_DESKTOP 1 +#endif /* see - * http://www.hydrogenaudio.org/forums/index.php?showtopic=49439&pid=444300&st=0 + * 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 @@ -127,10 +140,11 @@ FLAC__bool grabbag__file_are_same(const char *f1, const char *f2) BY_HANDLE_FILE_INFORMATION info1, info2; HANDLE h1, h2; BOOL ok = 1; - h1 = CreateFile(f1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - h2 = CreateFile(f2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + 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; +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) ok &= GetFileInformationByHandle(h1, &info1); ok &= GetFileInformationByHandle(h2, &info2); if(ok) @@ -139,20 +153,27 @@ FLAC__bool grabbag__file_are_same(const char *f1, const char *f2) info1.nFileIndexHigh == info2.nFileIndexHigh && info1.nFileIndexLow == info2.nFileIndexLow ; +#else // !WINAPI_PARTITION_DESKTOP + FILE_ID_INFO id_info1, id_info2; + same = GetFileInformationByHandleEx(h1, FileIdInfo, &id_info1, sizeof (id_info1)) && + GetFileInformationByHandleEx(h2, FileIdInfo, &id_info2, sizeof (id_info2)) && + id_info1.VolumeSerialNumber == id_info2.VolumeSerialNumber && + memcmp(&id_info1.FileId, &id_info2.FileId, sizeof(id_info1.FileId)) == 0; +#endif // !WINAPI_PARTITION_DESKTOP if(h1 != INVALID_HANDLE_VALUE) CloseHandle(h1); if(h2 != INVALID_HANDLE_VALUE) CloseHandle(h2); return same; #else - struct stat s1, s2; - return f1 && f2 && stat(f1, &s1) == 0 && stat(f2, &s2) == 0 && s1.st_ino == s2.st_ino && s1.st_dev == s2.st_dev; + 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 == unlink(filename); + return grabbag__file_change_stats(filename, /*read_only=*/false) && 0 == flac_unlink(filename); } FILE *grabbag__file_get_binary_stdin(void) @@ -163,9 +184,6 @@ FILE *grabbag__file_get_binary_stdin(void) */ #if defined _MSC_VER || defined __MINGW32__ _setmode(_fileno(stdin), _O_BINARY); -#elif defined __CYGWIN__ - /* almost certainly not needed for any modern Cygwin, but let's be safe... */ - setmode(_fileno(stdin), _O_BINARY); #elif defined __EMX__ setmode(fileno(stdin), O_BINARY); #endif @@ -181,9 +199,6 @@ FILE *grabbag__file_get_binary_stdout(void) */ #if defined _MSC_VER || defined __MINGW32__ _setmode(_fileno(stdout), _O_BINARY); -#elif defined __CYGWIN__ - /* almost certainly not needed for any modern Cygwin, but let's be safe... */ - setmode(_fileno(stdout), _O_BINARY); #elif defined __EMX__ setmode(fileno(stdout), O_BINARY); #endif diff --git a/3rdparty/libflac/src/share/grabbag/grabbag_static.dsp b/3rdparty/libflac/src/share/grabbag/grabbag_static.dsp deleted file mode 100644 index 11835bd4af9..00000000000 --- a/3rdparty/libflac/src/share/grabbag/grabbag_static.dsp +++ /dev/null @@ -1,144 +0,0 @@ -# Microsoft Developer Studio Project File - Name="grabbag_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=grabbag_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "grabbag_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "grabbag_static.mak" CFG="grabbag_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "grabbag_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "grabbag_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "grabbag" -# PROP Scc_LocalPath "..\..\.." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "grabbag_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ELSEIF "$(CFG)" == "grabbag_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include" /D "FLAC__NO_DLL" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "grabbag_static - Win32 Release" -# Name "grabbag_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=.\cuesheet.c -# End Source File -# Begin Source File - -SOURCE=.\file.c -# End Source File -# Begin Source File - -SOURCE=.\picture.c -# End Source File -# Begin Source File - -SOURCE=.\replaygain.c -# End Source File -# Begin Source File - -SOURCE=.\seektable.c -# End Source File -# End Group -# Begin Group "Private Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\include\share\grabbag\cuesheet.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\include\share\grabbag\file.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\include\share\grabbag\picture.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\include\share\grabbag\replaygain.h -# End Source File -# Begin Source File - -SOURCE=..\..\..\include\share\grabbag\seektable.h -# End Source File -# End Group -# Begin Group "Protected Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\include\share\grabbag.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/share/grabbag/grabbag_static.vcproj b/3rdparty/libflac/src/share/grabbag/grabbag_static.vcproj deleted file mode 100644 index f5482028bd5..00000000000 --- a/3rdparty/libflac/src/share/grabbag/grabbag_static.vcproj +++ /dev/null @@ -1,221 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="grabbag_static" - ProjectGUID="{4cefbc81-c215-11db-8314-0800200c9a66}" - RootNamespace="grabbag_static" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\..\obj\debug\lib" - IntermediateDirectory="Debug_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\debug\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\..\obj\release\lib" - IntermediateDirectory="Release_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\release\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\cuesheet.c" - > - </File> - <File - RelativePath=".\file.c" - > - </File> - <File - RelativePath=".\picture.c" - > - </File> - <File - RelativePath=".\replaygain.c" - > - </File> - <File - RelativePath=".\seektable.c" - > - </File> - </Filter> - <Filter - Name="Public Header Files" - > - <File - RelativePath="..\..\..\include\share\grabbag.h" - > - </File> - <Filter - Name="grabbag" - > - <File - RelativePath="..\..\..\include\share\grabbag\cuesheet.h" - > - </File> - <File - RelativePath="..\..\..\include\share\grabbag\file.h" - > - </File> - <File - RelativePath="..\..\..\include\share\grabbag\picture.h" - > - </File> - <File - RelativePath="..\..\..\include\share\grabbag\replaygain.h" - > - </File> - <File - RelativePath="..\..\..\include\share\grabbag\seektable.h" - > - </File> - </Filter> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/share/grabbag/picture.c b/3rdparty/libflac/src/share/grabbag/picture.c index 0e37273803d..9a4aafe2769 100644 --- a/3rdparty/libflac/src/share/grabbag/picture.c +++ b/3rdparty/libflac/src/share/grabbag/picture.c @@ -1,5 +1,6 @@ /* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2006,2007 Josh Coalson + * Copyright (C) 2006-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -26,11 +27,13 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#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 = (char*)safe_malloc_add_2op_(size, /*+*/1); + char *x = safe_malloc_add_2op_(size, /*+*/1); if(x) { memcpy(x, s, size); x[size] = '\0'; @@ -139,8 +142,11 @@ static FLAC__bool local__extract_resolution_color_info_(FLAC__StreamMetadata_Pic 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) { - unsigned color_type = data[17]; + /* First check whether clen makes sense or causes overflow in this bit of code */ + if(clen + 12 <= clen || clen + 12 > len) + return false; + else 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) { @@ -170,8 +176,6 @@ static FLAC__bool local__extract_resolution_color_info_(FLAC__StreamMetadata_Pic picture->colors = clen / 3u; return true; } - else if(clen + 12 > len) - return false; else { data += 12 + clen; len -= 12 + clen; @@ -259,22 +263,72 @@ static FLAC__bool local__extract_resolution_color_info_(FLAC__StreamMetadata_Pic 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", + "empty file" +}; + +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 == 0) + return error_messages[12]; + + if (size >= (FLAC__off_t)(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, (FLAC__uint32)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; - 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" - }; FLAC__ASSERT(0 != spec); FLAC__ASSERT(0 != error_message); @@ -287,8 +341,10 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con *error_message = 0; - if(0 == (obj = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PICTURE))) + 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; @@ -348,47 +404,22 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con *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)) + if(strlen(spec) == 0) + *error_message = error_messages[1]; + else 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 */ - const off_t size = grabbag__file_get_filesize(spec); - if(size < 0) - *error_message = error_messages[5]; - else { - FLAC__byte *buffer = (FLAC__byte*)safe_malloc_(size); - if(0 == buffer) - *error_message = error_messages[0]; - else { - FILE *f = fopen(spec, "rb"); - if(0 == f) - *error_message = error_messages[5]; - else { - if(fread(buffer, 1, size, f) != (size_t)size) - *error_message = error_messages[6]; - fclose(f); - if(0 == *error_message) { - 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]; - } - } - } - } + *error_message = read_file (spec, obj); } } } if(*error_message == 0) { if( - obj->data.picture.type == FLAC__STREAM_METADATA_PICTURE_TYPE_FILE_ICON_STANDARD && + 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 || @@ -405,3 +436,80 @@ FLAC__StreamMetadata *grabbag__picture_parse_specification(const char *spec, con 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/3rdparty/libflac/src/share/grabbag/replaygain.c b/3rdparty/libflac/src/share/grabbag/replaygain.c index b3d3d210e38..32c96031828 100644 --- a/3rdparty/libflac/src/share/grabbag/replaygain.c +++ b/3rdparty/libflac/src/share/grabbag/replaygain.c @@ -1,5 +1,6 @@ /* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,15 +17,10 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif -#include "share/grabbag.h" -#include "share/replaygain_analysis.h" -#include "FLAC/assert.h" -#include "FLAC/metadata.h" -#include "FLAC/stream_decoder.h" #include <locale.h> #include <math.h> #include <stdio.h> @@ -35,6 +31,13 @@ #endif #include <sys/stat.h> /* 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 @@ -45,13 +48,18 @@ #endif #define local_max(a,b) ((a)>(b)?(a):(b)) +#ifdef abs32 +#undef abs32 +#endif +#define abs32(a) (((a)==INT32_MIN)?INT32_MAX:abs(a)) + 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 unsigned GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED = 190; +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 + @@ -67,19 +75,19 @@ const FLAC__byte * const GRABBAG__REPLAYGAIN_TAG_ALBUM_GAIN = (const FLAC__byte 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 stat *stats) +static FLAC__bool get_file_stats_(const char *filename, struct flac_stat_s *stats) { FLAC__ASSERT(0 != filename); FLAC__ASSERT(0 != stats); - return (0 == stat(filename, stats)); + return (0 == flac_stat(filename, stats)); } -static void set_file_stats_(const char *filename, struct stat *stats) +static void set_file_stats_(const char *filename, struct flac_stat_s *stats) { FLAC__ASSERT(0 != filename); FLAC__ASSERT(0 != stats); - (void)chmod(filename, stats->st_mode); + (void)flac_chmod(filename, stats->st_mode); } static FLAC__bool append_tag_(FLAC__StreamMetadata *block, const char *format, const FLAC__byte *name, float value) @@ -102,11 +110,7 @@ static FLAC__bool append_tag_(FLAC__StreamMetadata *block, const char *format, c if (0 == saved_locale) return false; setlocale(LC_ALL, "C"); -#if defined _MSC_VER || defined __MINGW32__ - _snprintf(buffer, sizeof(buffer)-1, format, name, value); -#else - snprintf(buffer, sizeof(buffer)-1, format, name, value); -#endif + flac_snprintf(buffer, sizeof(buffer), format, name, value); setlocale(LC_ALL, saved_locale); free(saved_locale); @@ -116,65 +120,41 @@ static FLAC__bool append_tag_(FLAC__StreamMetadata *block, const char *format, c return FLAC__metadata_object_vorbiscomment_append_comment(block, entry, /*copy=*/true); } -FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency) +FLAC__bool grabbag__replaygain_is_valid_sample_frequency(uint32_t sample_frequency) { - static const unsigned valid_sample_rates[] = { - 8000, - 11025, - 12000, - 16000, - 22050, - 24000, - 32000, - 44100, - 48000 - }; - static const unsigned n_valid_sample_rates = sizeof(valid_sample_rates) / sizeof(valid_sample_rates[0]); - - unsigned i; - - for(i = 0; i < n_valid_sample_rates; i++) - if(sample_frequency == valid_sample_rates[i]) - return true; - return false; + return ValidGainFrequency( sample_frequency ); } -FLAC__bool grabbag__replaygain_init(unsigned 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, unsigned bps, unsigned samples) +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 Float_t lbuffer[2048], rbuffer[2048]; - static const unsigned nbuffer = sizeof(lbuffer) / sizeof(lbuffer[0]); + static flac_float_t lbuffer[2048], rbuffer[2048]; + static const uint32_t nbuffer = sizeof(lbuffer) / sizeof(lbuffer[0]); FLAC__int32 block_peak = 0, s; - unsigned i, j; + 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); + FLAC__ASSERT(bps >= FLAC__MIN_BITS_PER_SAMPLE && bps <= FLAC__MAX_BITS_PER_SAMPLE); + FLAC__ASSERT(FLAC__MIN_BITS_PER_SAMPLE == 4 && FLAC__MAX_BITS_PER_SAMPLE == 32); if(bps == 16) { if(is_stereo) { j = 0; while(samples > 0) { - const unsigned n = local_min(samples, nbuffer); + const uint32_t n = local_min(samples, nbuffer); for(i = 0; i < n; i++, j++) { s = input[0][j]; - lbuffer[i] = (Float_t)s; + lbuffer[i] = (flac_float_t)s; s = abs(s); block_peak = local_max(block_peak, s); s = input[1][j]; - rbuffer[i] = (Float_t)s; + rbuffer[i] = (flac_float_t)s; s = abs(s); block_peak = local_max(block_peak, s); } @@ -186,10 +166,10 @@ FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__ else { j = 0; while(samples > 0) { - const unsigned n = local_min(samples, nbuffer); + const uint32_t n = local_min(samples, nbuffer); for(i = 0; i < n; i++, j++) { s = input[0][j]; - lbuffer[i] = (Float_t)s; + lbuffer[i] = (flac_float_t)s; s = abs(s); block_peak = local_max(block_peak, s); } @@ -199,7 +179,7 @@ FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__ } } } - else { /* bps must be < 32 according to above assertion */ + else { const double scale = ( (bps > 16)? (double)1. / (double)(1u << (bps - 16)) : @@ -209,16 +189,16 @@ FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__ if(is_stereo) { j = 0; while(samples > 0) { - const unsigned n = local_min(samples, nbuffer); + const uint32_t n = local_min(samples, nbuffer); for(i = 0; i < n; i++, j++) { s = input[0][j]; - lbuffer[i] = (Float_t)(scale * (double)s); - s = abs(s); + lbuffer[i] = (flac_float_t)(scale * (double)s); + s = abs32(s); block_peak = local_max(block_peak, s); s = input[1][j]; - rbuffer[i] = (Float_t)(scale * (double)s); - s = abs(s); + rbuffer[i] = (flac_float_t)(scale * (double)s); + s = abs32(s); block_peak = local_max(block_peak, s); } samples -= n; @@ -229,11 +209,11 @@ FLAC__bool grabbag__replaygain_analyze(const FLAC__int32 * const input[], FLAC__ else { j = 0; while(samples > 0) { - const unsigned n = local_min(samples, nbuffer); + const uint32_t n = local_min(samples, nbuffer); for(i = 0; i < n; i++, j++) { s = input[0][j]; - lbuffer[i] = (Float_t)(scale * (double)s); - s = abs(s); + lbuffer[i] = (flac_float_t)(scale * (double)s); + s = abs32(s); block_peak = local_max(block_peak, s); } samples -= n; @@ -271,19 +251,19 @@ void grabbag__replaygain_get_title(float *gain, float *peak) typedef struct { - unsigned channels; - unsigned bits_per_sample; - unsigned sample_rate; + 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 unsigned bits_per_sample = frame->header.bits_per_sample; - const unsigned channels = frame->header.channels; - const unsigned sample_rate = frame->header.sample_rate; - const unsigned samples = frame->header.blocksize; + 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; @@ -498,15 +478,17 @@ static const char *store_to_file_pre_(const char *filename, FLAC__Metadata_Chain static const char *store_to_file_post_(const char *filename, FLAC__Metadata_Chain *chain, FLAC__bool preserve_modtime) { - struct stat stats; + 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 FLAC__Metadata_ChainStatusString[FLAC__metadata_chain_status(chain)]; + return error; } FLAC__metadata_chain_delete(chain); @@ -520,7 +502,7 @@ static const char *store_to_file_post_(const char *filename, FLAC__Metadata_Chai 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; + FLAC__StreamMetadata *block = NULL; const char *error; if(0 != (error = store_to_file_pre_(filename, &chain, &block))) @@ -540,7 +522,7 @@ const char *grabbag__replaygain_store_to_file(const char *filename, float album_ const char *grabbag__replaygain_store_to_file_reference(const char *filename, FLAC__bool preserve_modtime) { FLAC__Metadata_Chain *chain; - FLAC__StreamMetadata *block; + FLAC__StreamMetadata *block = NULL; const char *error; if(0 != (error = store_to_file_pre_(filename, &chain, &block))) @@ -560,7 +542,7 @@ const char *grabbag__replaygain_store_to_file_reference(const char *filename, FL 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; + FLAC__StreamMetadata *block = NULL; const char *error; if(0 != (error = store_to_file_pre_(filename, &chain, &block))) @@ -580,7 +562,7 @@ const char *grabbag__replaygain_store_to_file_album(const char *filename, float 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; + FLAC__StreamMetadata *block = NULL; const char *error; if(0 != (error = store_to_file_pre_(filename, &chain, &block))) @@ -611,8 +593,7 @@ static FLAC__bool parse_double_(const FLAC__StreamMetadata_VorbisComment_Entry * if(0 == q) return false; q++; - memset(s, 0, sizeof(s)-1); - strncpy(s, q, local_min(sizeof(s)-1, entry->length - (q-p))); + safe_strncpy(s, q, local_min(sizeof(s), (size_t) (entry->length - (q-p)))); v = strtod(s, &end); if(end == s) @@ -625,6 +606,8 @@ static FLAC__bool parse_double_(const FLAC__StreamMetadata_VorbisComment_Entry * 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); @@ -637,20 +620,38 @@ FLAC__bool grabbag__replaygain_load_from_vorbiscomment(const FLAC__StreamMetadat */ *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)))) - return !strict && grabbag__replaygain_load_from_vorbiscomment(block, !album_mode, /*strict=*/true, reference, gain, peak); + 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)))) - return !strict && grabbag__replaygain_load_from_vorbiscomment(block, !album_mode, /*strict=*/true, reference, gain, peak); + res = false; - if(!parse_double_(block->data.vorbis_comment.comments + gain_offset, gain)) - return !strict && grabbag__replaygain_load_from_vorbiscomment(block, !album_mode, /*strict=*/true, reference, gain, peak); - if(!parse_double_(block->data.vorbis_comment.comments + peak_offset, peak)) - return !strict && grabbag__replaygain_load_from_vorbiscomment(block, !album_mode, /*strict=*/true, reference, gain, peak); + 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; + if(res && *peak < 0.0) + res = false; - return true; + 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) diff --git a/3rdparty/libflac/src/share/grabbag/seektable.c b/3rdparty/libflac/src/share/grabbag/seektable.c index 55ac766ed14..01caa998fdd 100644 --- a/3rdparty/libflac/src/share/grabbag/seektable.c +++ b/3rdparty/libflac/src/share/grabbag/seektable.c @@ -1,5 +1,6 @@ /* grabbag - Convenience lib for various routines common to several tools - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -16,49 +17,24 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include "share/grabbag.h" +#include "share/compat.h" #include "FLAC/assert.h" #include <stdlib.h> /* for atoi() */ #include <string.h> -#ifdef _MSC_VER -/* There's no strtoll() in MSVC6 so we just write a specialized one */ -static FLAC__int64 local__strtoll(const char *src, char **endptr) +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) { - FLAC__bool neg = false; - FLAC__int64 ret = 0; - int c; - FLAC__ASSERT(0 != src); - if(*src == '-') { - neg = true; - src++; - } - while(0 != (c = *src)) { - c -= '0'; - if(c >= 0 && c <= 9) - ret = (ret * 10) + c; - else - break; - src++; - } - if(endptr) - *endptr = (char*)src; - return neg? -ret : ret; -} -#endif - -FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec, FLAC__bool only_explicit_placeholders, FLAC__uint64 total_samples_to_encode, unsigned sample_rate, FLAC__StreamMetadata *seektable_template, FLAC__bool *spec_has_real_points) -{ - unsigned i; + uint32_t i; const char *pt; FLAC__ASSERT(0 != spec); FLAC__ASSERT(0 != seektable_template); - FLAC__ASSERT(seektable_template->type = FLAC__METADATA_TYPE_SEEKTABLE); + FLAC__ASSERT(seektable_template->type == FLAC__METADATA_TYPE_SEEKTABLE); if(0 != spec_has_real_points) *spec_has_real_points = false; @@ -77,22 +53,23 @@ FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec if(0 != spec_has_real_points) *spec_has_real_points = true; if(!only_explicit_placeholders) { - const int n = (unsigned)atoi(pt); + const int n = (uint32_t)atoi(pt); if(n > 0) - if(!FLAC__metadata_object_seektable_template_append_spaced_points(seektable_template, (unsigned)n, total_samples_to_encode)) + 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(total_samples_to_encode > 0 && sample_rate > 0) { /* we can only do these if we know the number of samples and sample rate to encode up front */ if(0 != spec_has_real_points) *spec_has_real_points = true; if(!only_explicit_placeholders) { const double sec = atof(pt); if(sec > 0.0) { - unsigned samples = (unsigned)(sec * (double)sample_rate); + 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)) @@ -107,11 +84,7 @@ FLAC__bool grabbag__seektable_convert_specification_to_template(const char *spec *spec_has_real_points = true; if(!only_explicit_placeholders) { char *endptr; -#ifdef _MSC_VER - const FLAC__int64 n = local__strtoll(pt, &endptr); -#else const FLAC__int64 n = (FLAC__int64)strtoll(pt, &endptr, 10); -#endif 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 */ diff --git a/3rdparty/libflac/src/share/grabbag/snprintf.c b/3rdparty/libflac/src/share/grabbag/snprintf.c new file mode 100644 index 00000000000..bd7ffba8e30 --- /dev/null +++ b/3rdparty/libflac/src/share/grabbag/snprintf.c @@ -0,0 +1,101 @@ +/* grabbag - Convenience lib for various routines common to several tools + * Copyright (C) 2013-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <stdarg.h> + +#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/3rdparty/libflac/src/share/replaygain_analysis/CMakeLists.txt b/3rdparty/libflac/src/share/replaygain_analysis/CMakeLists.txt new file mode 100644 index 00000000000..4362b902595 --- /dev/null +++ b/3rdparty/libflac/src/share/replaygain_analysis/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(replaygain_analysis STATIC + replaygain_analysis.c) diff --git a/3rdparty/libflac/src/share/replaygain_analysis/Makefile.am b/3rdparty/libflac/src/share/replaygain_analysis/Makefile.am deleted file mode 100644 index de841aa78e6..00000000000 --- a/3rdparty/libflac/src/share/replaygain_analysis/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -I$(top_srcdir)/include/share - -noinst_LTLIBRARIES = libreplaygain_analysis.la - -libreplaygain_analysis_la_SOURCES = replaygain_analysis.c - -EXTRA_DIST = \ - Makefile.lite \ - replaygain_analysis_static.dsp \ - replaygain_analysis_static.vcproj - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" diff --git a/3rdparty/libflac/src/share/replaygain_analysis/Makefile.in b/3rdparty/libflac/src/share/replaygain_analysis/Makefile.in deleted file mode 100644 index 8c19187b718..00000000000 --- a/3rdparty/libflac/src/share/replaygain_analysis/Makefile.in +++ /dev/null @@ -1,500 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -I$(top_srcdir)/include/share - -noinst_LTLIBRARIES = libreplaygain_analysis.la - -libreplaygain_analysis_la_SOURCES = replaygain_analysis.c - -EXTRA_DIST = \ - Makefile.lite \ - replaygain_analysis_static.dsp \ - replaygain_analysis_static.vcproj - -subdir = src/share/replaygain_analysis -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libreplaygain_analysis_la_LDFLAGS = -libreplaygain_analysis_la_LIBADD = -am_libreplaygain_analysis_la_OBJECTS = replaygain_analysis.lo -libreplaygain_analysis_la_OBJECTS = \ - $(am_libreplaygain_analysis_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/replaygain_analysis.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libreplaygain_analysis_la_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(libreplaygain_analysis_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/share/replaygain_analysis/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libreplaygain_analysis.la: $(libreplaygain_analysis_la_OBJECTS) $(libreplaygain_analysis_la_DEPENDENCIES) - $(LINK) $(libreplaygain_analysis_la_LDFLAGS) $(libreplaygain_analysis_la_OBJECTS) $(libreplaygain_analysis_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replaygain_analysis.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am - - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/share/replaygain_analysis/Makefile.lite b/3rdparty/libflac/src/share/replaygain_analysis/Makefile.lite deleted file mode 100644 index 8c4c6982659..00000000000 --- a/3rdparty/libflac/src/share/replaygain_analysis/Makefile.lite +++ /dev/null @@ -1,15 +0,0 @@ -# -# GNU makefile -# - -topdir = ../../.. - -LIB_NAME = libreplaygain_analysis -INCLUDES = -I$(topdir)/include/share - -SRCS_C = \ - replaygain_analysis.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis.c b/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis.c index c64231f61da..37b77ab099a 100644 --- a/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis.c +++ b/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis.c @@ -14,7 +14,7 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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 @@ -38,8 +38,8 @@ * * to initialize everything. Call * - * AnalyzeSamples ( const Float_t* left_samples, - * const Float_t* right_samples, + * AnalyzeSamples ( const flac_float_t* left_samples, + * const flac_float_t* right_samples, * size_t num_samples, * int num_channels ); * @@ -59,11 +59,11 @@ * * Pseudo-code to process an album: * - * Float_t l_samples [4096]; - * Float_t r_samples [4096]; + * flac_float_t l_samples [4096]; + * flac_float_t r_samples [4096]; * size_t num_samples; - * unsigned int num_songs; - * unsigned int i; + * uint32_t num_songs; + * uint32_t i; * * InitGainAnalysis ( 44100 ); * for ( i = 1; i <= num_songs; i++ ) { @@ -89,7 +89,7 @@ * Optimization/clarity suggestions are welcome. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -97,165 +97,278 @@ #include <stdlib.h> #include <string.h> #include <math.h> +#include "share/alloc.h" +#include "share/compat.h" +#include "share/replaygain_analysis.h" -#include "replaygain_analysis.h" - -Float_t ReplayGainReferenceLoudness = 89.0; /* in dB SPL */ - -typedef unsigned short Uint16_t; -typedef signed short Int16_t; -typedef unsigned int Uint32_t; -typedef signed int Int32_t; +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 MAX_SAMP_FREQ 48000. /* maximum allowed sample frequency [Hz] */ -#define RMS_WINDOW_TIME 0.050 /* Time slice size [s] */ +#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) -/* [JEC] the following was originally #defined as: - * (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME) - * but that seemed to fail to take into account the ceil() part of the - * sampleWindow calculation in ResetSampleFrequency(), and was causing - * buffer overflows for 48kHz analysis, hence the +1. - */ -#ifndef __sun - #define MAX_SAMPLES_PER_WINDOW (size_t) (MAX_SAMP_FREQ * RMS_WINDOW_TIME + 1.) /* max. Samples per Time slice */ -#else - /* [JEC] Solaris Forte compiler doesn't like float calc in array indices */ - #define MAX_SAMPLES_PER_WINDOW (size_t) (2401) -#endif #define PINK_REF 64.82 /* 298640883795 */ /* calibration value */ -static Float_t linprebuf [MAX_ORDER * 2]; -static Float_t* linpre; /* left input samples, with pre-buffer */ -static Float_t lstepbuf [MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; -static Float_t* lstep; /* left "first step" (i.e. post first filter) samples */ -static Float_t loutbuf [MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; -static Float_t* lout; /* left "out" (i.e. post second filter) samples */ -static Float_t rinprebuf [MAX_ORDER * 2]; -static Float_t* rinpre; /* right input samples ... */ -static Float_t rstepbuf [MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; -static Float_t* rstep; -static Float_t routbuf [MAX_SAMPLES_PER_WINDOW + MAX_ORDER]; -static Float_t* rout; -static unsigned int sampleWindow; /* number of samples required to reach number of milliseconds required for RMS window */ -static unsigned long totsamp; +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; -static int freqindex; -#ifndef __sun -static Uint32_t A [(size_t)(STEPS_per_dB * MAX_dB)]; -static Uint32_t B [(size_t)(STEPS_per_dB * MAX_dB)]; +#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 [12000]; -static Uint32_t B [12000]; +static uint32_t A [120 * 100]; +static uint32_t B [120 * 100]; #endif -/* for each filter: - [0] 48 kHz, [1] 44.1 kHz, [2] 32 kHz, [3] 24 kHz, [4] 22050 Hz, [5] 16 kHz, [6] 12 kHz, [7] is 11025 Hz, [8] 8 kHz */ - -#ifdef WIN32 +#ifdef _MSC_VER #pragma warning ( disable : 4305 ) #endif -static const Float_t AYule [9] [11] = { - { 1., -3.84664617118067, 7.81501653005538,-11.34170355132042, 13.05504219327545,-12.28759895145294, 9.48293806319790, -5.87257861775999, 2.75465861874613, -0.86984376593551, 0.13919314567432 }, - { 1., -3.47845948550071, 6.36317777566148, -8.54751527471874, 9.47693607801280, -8.81498681370155, 6.85401540936998, -4.39470996079559, 2.19611684890774, -0.75104302451432, 0.13149317958808 }, - { 1., -2.37898834973084, 2.84868151156327, -2.64577170229825, 2.23697657451713, -1.67148153367602, 1.00595954808547, -0.45953458054983, 0.16378164858596, -0.05032077717131, 0.02347897407020 }, - { 1., -1.61273165137247, 1.07977492259970, -0.25656257754070, -0.16276719120440, -0.22638893773906, 0.39120800788284, -0.22138138954925, 0.04500235387352, 0.02005851806501, 0.00302439095741 }, - { 1., -1.49858979367799, 0.87350271418188, 0.12205022308084, -0.80774944671438, 0.47854794562326, -0.12453458140019, -0.04067510197014, 0.08333755284107, -0.04237348025746, 0.02977207319925 }, - { 1., -0.62820619233671, 0.29661783706366, -0.37256372942400, 0.00213767857124, -0.42029820170918, 0.22199650564824, 0.00613424350682, 0.06747620744683, 0.05784820375801, 0.03222754072173 }, - { 1., -1.04800335126349, 0.29156311971249, -0.26806001042947, 0.00819999645858, 0.45054734505008, -0.33032403314006, 0.06739368333110, -0.04784254229033, 0.01639907836189, 0.01807364323573 }, - { 1., -0.51035327095184, -0.31863563325245, -0.20256413484477, 0.14728154134330, 0.38952639978999, -0.23313271880868, -0.05246019024463, -0.02505961724053, 0.02442357316099, 0.01818801111503 }, - { 1., -0.25049871956020, -0.43193942311114, -0.03424681017675, -0.04678328784242, 0.26408300200955, 0.15113130533216, -0.17556493366449, -0.18823009262115, 0.05477720428674, 0.04704409688120 } +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 const Float_t BYule [9] [11] = { - { 0.03857599435200, -0.02160367184185, -0.00123395316851, -0.00009291677959, -0.01655260341619, 0.02161526843274, -0.02074045215285, 0.00594298065125, 0.00306428023191, 0.00012025322027, 0.00288463683916 }, - { 0.05418656406430, -0.02911007808948, -0.00848709379851, -0.00851165645469, -0.00834990904936, 0.02245293253339, -0.02596338512915, 0.01624864962975, -0.00240879051584, 0.00674613682247, -0.00187763777362 }, - { 0.15457299681924, -0.09331049056315, -0.06247880153653, 0.02163541888798, -0.05588393329856, 0.04781476674921, 0.00222312597743, 0.03174092540049, -0.01390589421898, 0.00651420667831, -0.00881362733839 }, - { 0.30296907319327, -0.22613988682123, -0.08587323730772, 0.03282930172664, -0.00915702933434, -0.02364141202522, -0.00584456039913, 0.06276101321749, -0.00000828086748, 0.00205861885564, -0.02950134983287 }, - { 0.33642304856132, -0.25572241425570, -0.11828570177555, 0.11921148675203, -0.07834489609479, -0.00469977914380, -0.00589500224440, 0.05724228140351, 0.00832043980773, -0.01635381384540, -0.01760176568150 }, - { 0.44915256608450, -0.14351757464547, -0.22784394429749, -0.01419140100551, 0.04078262797139, -0.12398163381748, 0.04097565135648, 0.10478503600251, -0.01863887810927, -0.03193428438915, 0.00541907748707 }, - { 0.56619470757641, -0.75464456939302, 0.16242137742230, 0.16744243493672, -0.18901604199609, 0.30931782841830, -0.27562961986224, 0.00647310677246, 0.08647503780351, -0.03788984554840, -0.00588215443421 }, - { 0.58100494960553, -0.53174909058578, -0.14289799034253, 0.17520704835522, 0.02377945217615, 0.15558449135573, -0.25344790059353, 0.01628462406333, 0.06920467763959, -0.03721611395801, -0.00749618797172 }, - { 0.53648789255105, -0.42163034350696, -0.00275953611929, 0.04267842219415, -0.10214864179676, 0.14590772289388, -0.02459864859345, -0.11202315195388, -0.04060034127000, 0.04788665548180, -0.02217936801134 } -}; +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 }, + }, -static const Float_t AButter [9] [3] = { - { 1., -1.97223372919527, 0.97261396931306 }, - { 1., -1.96977855582618, 0.97022847566350 }, - { 1., -1.95835380975398, 0.95920349965459 }, - { 1., -1.95002759149878, 0.95124613669835 }, - { 1., -1.94561023566527, 0.94705070426118 }, - { 1., -1.92783286977036, 0.93034775234268 }, - { 1., -1.91858953033784, 0.92177618768381 }, - { 1., -1.91542108074780, 0.91885558323625 }, - { 1., -1.88903307939452, 0.89487434461664 } }; -static const Float_t BButter [9] [3] = { - { 0.98621192462708, -1.97242384925416, 0.98621192462708 }, - { 0.98500175787242, -1.97000351574484, 0.98500175787242 }, - { 0.97938932735214, -1.95877865470428, 0.97938932735214 }, - { 0.97531843204928, -1.95063686409857, 0.97531843204928 }, - { 0.97316523498161, -1.94633046996323, 0.97316523498161 }, - { 0.96454515552826, -1.92909031105652, 0.96454515552826 }, - { 0.96009142950541, -1.92018285901082, 0.96009142950541 }, - { 0.95856916599601, -1.91713833199203, 0.95856916599601 }, - { 0.94597685600279, -1.89195371200558, 0.94597685600279 } -}; - -#ifdef WIN32 +#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 Float_t* input, Float_t* output, size_t nSamples, const Float_t* a, const Float_t* b, size_t order ) +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; - for ( i = 0; i < nSamples; i++ ) { - y = input[i] * b[0]; - for ( k = 1; k <= order; k++ ) - y += input[i-k] * b[k] - output[i-k] * a[k]; - output[i] = (Float_t)y; + 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 */ -int +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; - /* zero out initial values */ - for ( i = 0; i < MAX_ORDER; i++ ) - linprebuf[i] = lstepbuf[i] = loutbuf[i] = rinprebuf[i] = rstepbuf[i] = routbuf[i] = 0.; + 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) ) { - switch ( (int)(samplefreq) ) { - case 48000: freqindex = 0; break; - case 44100: freqindex = 1; break; - case 32000: freqindex = 2; break; - case 24000: freqindex = 3; break; - case 22050: freqindex = 4; break; - case 16000: freqindex = 5; break; - case 12000: freqindex = 6; break; - case 11025: freqindex = 7; break; - case 8000: freqindex = 8; break; - default: return INIT_GAIN_ANALYSIS_ERROR; + return INIT_GAIN_ANALYSIS_ERROR; } - sampleWindow = (int) ceil (samplefreq * RMS_WINDOW_TIME); + /* 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.; @@ -263,15 +376,28 @@ ResetSampleFrequency ( long samplefreq ) { memset ( A, 0, sizeof(A) ); - return INIT_GAIN_ANALYSIS_OK; + 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; - } + if (ResetSampleFrequency(samplefreq) != INIT_GAIN_ANALYSIS_OK) { + return INIT_GAIN_ANALYSIS_ERROR; + } linpre = linprebuf + MAX_ORDER; rinpre = rinprebuf + MAX_ORDER; @@ -288,15 +414,19 @@ InitGainAnalysis ( long samplefreq ) /* returns GAIN_ANALYSIS_OK if successful, GAIN_ANALYSIS_ERROR if not */ int -AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size_t num_samples, int num_channels ) +AnalyzeSamples ( const flac_float_t* left_samples, const flac_float_t* right_samples, size_t num_samples, int num_channels ) { - const Float_t* curleft; - const Float_t* curright; + 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; @@ -309,33 +439,35 @@ AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size default: return GAIN_ANALYSIS_ERROR; } - if ( num_samples < MAX_ORDER ) { - memcpy ( linprebuf + MAX_ORDER, left_samples , num_samples * sizeof(Float_t) ); - memcpy ( rinprebuf + MAX_ORDER, right_samples, num_samples * sizeof(Float_t) ); - } - else { - memcpy ( linprebuf + MAX_ORDER, left_samples, MAX_ORDER * sizeof(Float_t) ); - memcpy ( rinprebuf + MAX_ORDER, right_samples, MAX_ORDER * sizeof(Float_t) ); + 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 { - curleft = left_samples + cursamplepos; - curright = right_samples + cursamplepos; + downsample = replaygainfilter->downsample; + curleft = left_samples + cursamplepos * downsample; + curright = right_samples + cursamplepos * downsample; } - filter ( curleft , lstep + totsamp, cursamples, AYule[freqindex], BYule[freqindex], YULE_ORDER ); - filter ( curright, rstep + totsamp, cursamples, AYule[freqindex], BYule[freqindex], YULE_ORDER ); + 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, AButter[freqindex], BButter[freqindex], BUTTER_ORDER ); - filter ( rstep + totsamp, rout + totsamp, cursamples, AButter[freqindex], BButter[freqindex], BUTTER_ORDER ); + 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]; @@ -352,35 +484,43 @@ AnalyzeSamples ( const Float_t* left_samples, const Float_t* right_samples, size 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(Float_t) ); - memmove ( routbuf , routbuf + totsamp, MAX_ORDER * sizeof(Float_t) ); - memmove ( lstepbuf, lstepbuf + totsamp, MAX_ORDER * sizeof(Float_t) ); - memmove ( rstepbuf, rstepbuf + totsamp, MAX_ORDER * sizeof(Float_t) ); + 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(Float_t) ); - memmove ( rinprebuf, rinprebuf + num_samples, (MAX_ORDER-num_samples) * sizeof(Float_t) ); - memcpy ( linprebuf + MAX_ORDER - num_samples, left_samples, num_samples * sizeof(Float_t) ); - memcpy ( rinprebuf + MAX_ORDER - num_samples, right_samples, num_samples * sizeof(Float_t) ); + 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 { - memcpy ( linprebuf, left_samples + num_samples - MAX_ORDER, MAX_ORDER * sizeof(Float_t) ); - memcpy ( rinprebuf, right_samples + num_samples - MAX_ORDER, MAX_ORDER * sizeof(Float_t) ); + 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 Float_t -analyzeResult ( Uint32_t* Array, size_t len ) +static flac_float_t +analyzeResult ( uint32_t* Array, size_t len ) { - Uint32_t elems; - Int32_t upper; + uint32_t elems; + int32_t upper; size_t i; elems = 0; @@ -389,21 +529,26 @@ analyzeResult ( Uint32_t* Array, size_t len ) if ( elems == 0 ) return GAIN_NOT_ENOUGH_SAMPLES; - upper = (Int32_t) ceil (elems * (1. - RMS_PERCENTILE)); +/* 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 (Float_t) ((Float_t)PINK_REF - (Float_t)i / (Float_t)STEPS_per_dB); + return (flac_float_t) ((flac_float_t)PINK_REF - (flac_float_t)i / (flac_float_t)STEPS_per_dB); } -Float_t +flac_float_t GetTitleGain ( void ) { - Float_t retval; - unsigned int i; + flac_float_t retval; + uint32_t i; retval = analyzeResult ( A, sizeof(A)/sizeof(*A) ); @@ -421,7 +566,7 @@ GetTitleGain ( void ) } -Float_t +flac_float_t GetAlbumGain ( void ) { return analyzeResult ( B, sizeof(B)/sizeof(*B) ); diff --git a/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis_static.dsp b/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis_static.dsp deleted file mode 100644 index e4364309d57..00000000000 --- a/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis_static.dsp +++ /dev/null @@ -1,108 +0,0 @@ -# Microsoft Developer Studio Project File - Name="replaygain_analysis_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=replaygain_analysis_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "replaygain_analysis_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "replaygain_analysis_static.mak" CFG="replaygain_analysis_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "replaygain_analysis_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "replaygain_analysis_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "replaygain_analysis" -# PROP Scc_LocalPath "..\..\.." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "replaygain_analysis_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\..\include\share" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ELSEIF "$(CFG)" == "replaygain_analysis_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include\share" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "replaygain_analysis_static - Win32 Release" -# Name "replaygain_analysis_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=.\replaygain_analysis.c -# End Source File -# End Group -# Begin Group "Private Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Protected Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\include\share\replaygain_analysis.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis_static.vcproj b/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis_static.vcproj deleted file mode 100644 index a6ffda29b4a..00000000000 --- a/3rdparty/libflac/src/share/replaygain_analysis/replaygain_analysis_static.vcproj +++ /dev/null @@ -1,181 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="replaygain_analysis_static" - ProjectGUID="{4cefbc89-c215-11db-8314-0800200c9a66}" - RootNamespace="replaygain_analysis_static" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\..\obj\debug\lib" - IntermediateDirectory="Debug_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\..\include\share" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\debug\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\..\obj\release\lib" - IntermediateDirectory="Release_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\..\include\share" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\release\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Public Header Files" - > - <File - RelativePath="..\..\..\include\share\replaygain_analysis.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\replaygain_analysis.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/CMakeLists.txt b/3rdparty/libflac/src/share/replaygain_synthesis/CMakeLists.txt new file mode 100644 index 00000000000..0736f4fce6e --- /dev/null +++ b/3rdparty/libflac/src/share/replaygain_synthesis/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(replaygain_synthesis STATIC + replaygain_synthesis.c) diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/Makefile.am b/3rdparty/libflac/src/share/replaygain_synthesis/Makefile.am deleted file mode 100644 index 4ea9e8a28ae..00000000000 --- a/3rdparty/libflac/src/share/replaygain_synthesis/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = foreign - -SUBDIRS = include . - -INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/include/share - -noinst_LTLIBRARIES = libreplaygain_synthesis.la - -libreplaygain_synthesis_la_SOURCES = replaygain_synthesis.c - -EXTRA_DIST = \ - Makefile.lite \ - replaygain_synthesis_static.dsp \ - replaygain_synthesis_static.vcproj - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/Makefile.in b/3rdparty/libflac/src/share/replaygain_synthesis/Makefile.in deleted file mode 100644 index 7ae61da4732..00000000000 --- a/3rdparty/libflac/src/share/replaygain_synthesis/Makefile.in +++ /dev/null @@ -1,602 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -AUTOMAKE_OPTIONS = foreign - -SUBDIRS = include . - -INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/include/share - -noinst_LTLIBRARIES = libreplaygain_synthesis.la - -libreplaygain_synthesis_la_SOURCES = replaygain_synthesis.c - -EXTRA_DIST = \ - Makefile.lite \ - replaygain_synthesis_static.dsp \ - replaygain_synthesis_static.vcproj - -subdir = src/share/replaygain_synthesis -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libreplaygain_synthesis_la_LDFLAGS = -libreplaygain_synthesis_la_LIBADD = -am_libreplaygain_synthesis_la_OBJECTS = replaygain_synthesis.lo -libreplaygain_synthesis_la_OBJECTS = \ - $(am_libreplaygain_synthesis_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/replaygain_synthesis.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libreplaygain_synthesis_la_SOURCES) - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = $(SUBDIRS) -SOURCES = $(libreplaygain_synthesis_la_SOURCES) - -all: all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/share/replaygain_synthesis/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libreplaygain_synthesis.la: $(libreplaygain_synthesis_la_OBJECTS) $(libreplaygain_synthesis_la_DEPENDENCIES) - $(LINK) $(libreplaygain_synthesis_la_LDFLAGS) $(libreplaygain_synthesis_la_OBJECTS) $(libreplaygain_synthesis_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replaygain_synthesis.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - else \ - include_option=--include; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile $(LTLIBRARIES) -installdirs: installdirs-recursive -installdirs-am: - -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-recursive - -dvi-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-recursive ctags ctags-recursive distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \ - pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \ - tags-recursive uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive - - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/Makefile.lite b/3rdparty/libflac/src/share/replaygain_synthesis/Makefile.lite deleted file mode 100644 index e58e708821f..00000000000 --- a/3rdparty/libflac/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 -I$(topdir)/include/share - -SRCS_C = \ - replaygain_synthesis.c - -include $(topdir)/build/lib.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/include/Makefile.am b/3rdparty/libflac/src/share/replaygain_synthesis/include/Makefile.am deleted file mode 100644 index 4418640f410..00000000000 --- a/3rdparty/libflac/src/share/replaygain_synthesis/include/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -# replaygain_synthesis - Routines for applying ReplayGain to a signal -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -SUBDIRS = private diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/include/Makefile.in b/3rdparty/libflac/src/share/replaygain_synthesis/include/Makefile.in deleted file mode 100644 index 47c6376ec91..00000000000 --- a/3rdparty/libflac/src/share/replaygain_synthesis/include/Makefile.in +++ /dev/null @@ -1,520 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# replaygain_synthesis - Routines for applying ReplayGain to a signal -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -SUBDIRS = private -subdir = src/share/replaygain_synthesis/include -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = $(SUBDIRS) -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/share/replaygain_synthesis/include/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - else \ - include_option=--include; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: - -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/include/private/Makefile.am b/3rdparty/libflac/src/share/replaygain_synthesis/include/private/Makefile.am deleted file mode 100644 index 081d7ba41b7..00000000000 --- a/3rdparty/libflac/src/share/replaygain_synthesis/include/private/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -# replaygain_synthesis - Routines for applying ReplayGain to a signal -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -noinst_HEADERS = \ - fast_float_math_hack.h diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/include/private/Makefile.in b/3rdparty/libflac/src/share/replaygain_synthesis/include/private/Makefile.in deleted file mode 100644 index 95f6bcc9ce7..00000000000 --- a/3rdparty/libflac/src/share/replaygain_synthesis/include/private/Makefile.in +++ /dev/null @@ -1,424 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# replaygain_synthesis - Routines for applying ReplayGain to a signal -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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 - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -noinst_HEADERS = \ - fast_float_math_hack.h - -subdir = src/share/replaygain_synthesis/include/private -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = -HEADERS = $(noinst_HEADERS) - -DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/share/replaygain_synthesis/include/private/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(HEADERS) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool ctags distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags uninstall uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/include/private/fast_float_math_hack.h b/3rdparty/libflac/src/share/replaygain_synthesis/include/private/fast_float_math_hack.h deleted file mode 100644 index d8608fc444b..00000000000 --- a/3rdparty/libflac/src/share/replaygain_synthesis/include/private/fast_float_math_hack.h +++ /dev/null @@ -1,39 +0,0 @@ -# ifdef __ICL /* only Intel C compiler has fmath ??? */ - - #include <mathf.h> - -/* Nearest integer, absolute value, etc. */ - - #define ceil ceilf - #define fabs fabsf - #define floor floorf - #define fmod fmodf - #define rint rintf - #define hypot hypotf - -/* Power functions */ - - #define pow powf - #define sqrt sqrtf - -/* Exponential and logarithmic functions */ - - #define exp expf - #define log logf - #define log10 log10f - -/* Trigonometric functions */ - - #define acos acosf - #define asin asinf - #define atan atanf - #define cos cosf - #define sin sinf - #define tan tanf - -/* Hyperbolic functions */ - #define cosh coshf - #define sinh sinhf - #define tanh tanhf - -# endif diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis.c b/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis.c index e5615766d7b..8d4fda6b928 100644 --- a/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis.c +++ b/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis.c @@ -1,5 +1,6 @@ /* replaygain_synthesis - Routines for applying ReplayGain to a signal - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,26 +35,17 @@ * Additional code by Magnus Holmgren and Gian-Carlo Pascutto */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include <string.h> /* for memset() */ #include <math.h> -#include "private/fast_float_math_hack.h" -#include "replaygain_synthesis.h" +#include "share/compat.h" +#include "share/replaygain_synthesis.h" #include "FLAC/assert.h" -#ifndef FLaC__INLINE -#define FLaC__INLINE -#endif - -/* adjust for compilers that can't understand using LL suffix for int64_t literals */ -#ifdef _MSC_VER -#define FLAC__I64L(x) x -#else #define FLAC__I64L(x) x##LL -#endif /* @@ -88,9 +80,9 @@ * XORed values of both generators. */ -static unsigned int random_int_(void) +static uint32_t random_int_(void) { - static const unsigned char parity_[256] = { + 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, @@ -100,10 +92,10 @@ static unsigned int random_int_(void) 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 unsigned int r1_ = 1; - static unsigned int r2_ = 1; + static uint32_t r1_ = 1; + static uint32_t r2_ = 1; - unsigned int t1, t2, t3, t4; + 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 @@ -210,17 +202,17 @@ static double scalar16_(const float* x, const float* y) void FLAC__replaygain_synthesis__init_dither_context(DitherContext *d, int bits, int shapingtype) { - static unsigned char default_dither [] = { 92, 92, 88, 84, 81, 78, 74, 67, 0, 0 }; + 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 index; + int indx; if (shapingtype < 0) shapingtype = 0; if (shapingtype > 3) shapingtype = 3; d->ShapingType = (NoiseShaping)shapingtype; - index = bits - 11 - shapingtype; - if (index < 0) index = 0; - if (index > 9) index = 9; + 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) ); @@ -228,24 +220,31 @@ void FLAC__replaygain_synthesis__init_dither_context(DitherContext *d, int bits, 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[index] / (((FLAC__int64)1) << bits); + 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 FLaC__INLINE FLAC__int64 dither_output_(DitherContext *d, FLAC__bool do_dithering, int shapingtype, int i, double Sum, int k) +static int64_t dither_output_(DitherContext *d, FLAC__bool do_dithering, int shapingtype, int i, double Sum, int k) { - union { - double d; - FLAC__int64 i; - } doubletmp; double Sum2; - FLAC__int64 val; - -#define ROUND64(x) ( doubletmp.d = (x) + d->Add + (FLAC__int64)FLAC__I64L(0x001FFFFD80000000), doubletmp.i - (FLAC__int64)FLAC__I64L(0x433FFFFD80000000) ) + int64_t val; if(do_dithering) { if(shapingtype == 0) { @@ -253,21 +252,19 @@ static FLaC__INLINE FLAC__int64 dither_output_(DitherContext *d, FLAC__bool do_d Sum2 = tmp - d->LastRandomNumber [k]; d->LastRandomNumber [k] = (int)tmp; Sum2 = Sum += Sum2; - val = ROUND64(Sum2) & d->Mask; + 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(Sum2) & d->Mask; + val = ROUND64(d, Sum2) & d->Mask; d->ErrorHistory [k] [(-1-i)&15] = (float)(Sum - val); } return val; } - else - return ROUND64(Sum); -#undef ROUND64 + return ROUND64(d, Sum); } #if 0 @@ -301,43 +298,8 @@ static FLaC__INLINE FLAC__int64 dither_output_(DitherContext *d, FLAC__bool do_d #endif -size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool little_endian_data_out, FLAC__bool unsigned_data_out, const FLAC__int32 * const input[], unsigned wide_samples, unsigned channels, const unsigned source_bps, const unsigned target_bps, const double scale, const FLAC__bool hard_limit, FLAC__bool do_dithering, DitherContext *dither_context) +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__int32 conv_factors_[33] = { - -1, /* 0 bits-per-sample (not supported) */ - -1, /* 1 bits-per-sample (not supported) */ - -1, /* 2 bits-per-sample (not supported) */ - -1, /* 3 bits-per-sample (not supported) */ - 268435456, /* 4 bits-per-sample */ - 134217728, /* 5 bits-per-sample */ - 67108864, /* 6 bits-per-sample */ - 33554432, /* 7 bits-per-sample */ - 16777216, /* 8 bits-per-sample */ - 8388608, /* 9 bits-per-sample */ - 4194304, /* 10 bits-per-sample */ - 2097152, /* 11 bits-per-sample */ - 1048576, /* 12 bits-per-sample */ - 524288, /* 13 bits-per-sample */ - 262144, /* 14 bits-per-sample */ - 131072, /* 15 bits-per-sample */ - 65536, /* 16 bits-per-sample */ - 32768, /* 17 bits-per-sample */ - 16384, /* 18 bits-per-sample */ - 8192, /* 19 bits-per-sample */ - 4096, /* 20 bits-per-sample */ - 2048, /* 21 bits-per-sample */ - 1024, /* 22 bits-per-sample */ - 512, /* 23 bits-per-sample */ - 256, /* 24 bits-per-sample */ - 128, /* 25 bits-per-sample */ - 64, /* 26 bits-per-sample */ - 32, /* 27 bits-per-sample */ - 16, /* 28 bits-per-sample */ - 8, /* 29 bits-per-sample */ - 4, /* 30 bits-per-sample */ - 2, /* 31 bits-per-sample */ - 1 /* 32 bits-per-sample */ - }; static const FLAC__int64 hard_clip_factors_[33] = { 0, /* 0 bits-per-sample (not supported) */ 0, /* 1 bits-per-sample (not supported) */ @@ -373,7 +335,7 @@ size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool l -1073741824, /* 31 bits-per-sample */ (FLAC__int64)(-1073741824) * 2 /* 32 bits-per-sample */ }; - const FLAC__int32 conv_factor = conv_factors_[target_bps]; + 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 @@ -384,11 +346,11 @@ size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool l const double multi_scale = scale / (double)(1u << (source_bps-1)); FLAC__byte * const start = data_out; - unsigned i, channel; + uint32_t i, channel; const FLAC__int32 *input_; double sample; - const unsigned bytes_per_sample = target_bps / 8; - const unsigned last_history_index = dither_context->LastHistoryIndex; + 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; @@ -403,7 +365,7 @@ size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool l FLAC__ASSERT((target_bps & 7) == 0); for(channel = 0; channel < channels; channel++) { - const unsigned incr = bytes_per_sample * channels; + 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) { @@ -416,9 +378,9 @@ size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool l else if(sample > 0.5) sample = tanh((sample - 0.5) / (1-0.5)) * (1-0.5) + 0.5; } - sample *= 2147483647.f; + sample *= 2147483647.; - val64 = dither_output_(dither_context, do_dithering, noise_shaping, (i + last_history_index) % 32, sample, channel) / conv_factor; + 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) @@ -427,7 +389,7 @@ size_t FLAC__replaygain_synthesis__apply_gain(FLAC__byte *data_out, FLAC__bool l val32 = (FLAC__int32)hard_clip_factor; uval32 = (FLAC__uint32)val32; - if (unsigned_data_out) + if (uint32_t_data_out) uval32 ^= twiggle; if (little_endian_data_out) { diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis_static.dsp b/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis_static.dsp deleted file mode 100644 index a443efa0035..00000000000 --- a/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis_static.dsp +++ /dev/null @@ -1,108 +0,0 @@ -# Microsoft Developer Studio Project File - Name="replaygain_synthesis_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=replaygain_synthesis_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "replaygain_synthesis_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "replaygain_synthesis_static.mak" CFG="replaygain_synthesis_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "replaygain_synthesis_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "replaygain_synthesis_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "replaygain_synthesis" -# PROP Scc_LocalPath "..\..\.." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "replaygain_synthesis_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\..\include" /I "..\..\..\include\share" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ELSEIF "$(CFG)" == "replaygain_synthesis_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include" /I "..\..\..\include\share" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "replaygain_synthesis_static - Win32 Release" -# Name "replaygain_synthesis_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=.\replaygain_synthesis.c -# End Source File -# End Group -# Begin Group "Private Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\include\private\fast_float_math_hack.h -# End Source File -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\include\share\replaygain_synthesis.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj b/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj deleted file mode 100644 index 627ab496ad5..00000000000 --- a/3rdparty/libflac/src/share/replaygain_synthesis/replaygain_synthesis_static.vcproj +++ /dev/null @@ -1,185 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="replaygain_synthesis_static" - ProjectGUID="{4cefbc8a-c215-11db-8314-0800200c9a66}" - RootNamespace="replaygain_synthesis_static" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\..\obj\debug\lib" - IntermediateDirectory="Debug_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\..\include;..\..\..\include\share" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\debug\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\..\obj\release\lib" - IntermediateDirectory="Release_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\..\include;..\..\..\include\share" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\release\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\include\private\fast_float_math_hack.h" - > - </File> - </Filter> - <Filter - Name="Public Header Files" - > - <File - RelativePath="..\..\..\include\share\replaygain_synthesis.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\replaygain_synthesis.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/share/utf8/CMakeLists.txt b/3rdparty/libflac/src/share/utf8/CMakeLists.txt new file mode 100644 index 00000000000..389b09e26cc --- /dev/null +++ b/3rdparty/libflac/src/share/utf8/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) + +add_library(utf8 STATIC + charset.c + iconvert.c + utf8.c) + +target_link_libraries(utf8 PUBLIC grabbag $<TARGET_NAME_IF_EXISTS:Iconv::Iconv>) diff --git a/3rdparty/libflac/src/share/utf8/Makefile.am b/3rdparty/libflac/src/share/utf8/Makefile.am deleted file mode 100644 index bc42c2dfd62..00000000000 --- a/3rdparty/libflac/src/share/utf8/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -I$(top_srcdir)/include/share - -noinst_LTLIBRARIES = libutf8.la - -libutf8_la_SOURCES = charset.c charset.h iconvert.c utf8.c - -EXTRA_DIST = \ - Makefile.lite \ - charmaps.h \ - makemap.c \ - charset_test.c \ - charsetmap.h \ - iconvert.h \ - utf8_static.dsp \ - utf8_static.vcproj - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" diff --git a/3rdparty/libflac/src/share/utf8/Makefile.in b/3rdparty/libflac/src/share/utf8/Makefile.in deleted file mode 100644 index b3c9ff7886a..00000000000 --- a/3rdparty/libflac/src/share/utf8/Makefile.in +++ /dev/null @@ -1,507 +0,0 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCAS = @CCAS@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ -DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ -FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBICONV = @LIBICONV@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ -OBJEXT = @OBJEXT@ -OBJ_FORMAT = @OBJ_FORMAT@ -OGG_CFLAGS = @OGG_CFLAGS@ -OGG_LIBS = @OGG_LIBS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -AUTOMAKE_OPTIONS = foreign - -INCLUDES = -I$(top_srcdir)/include/share - -noinst_LTLIBRARIES = libutf8.la - -libutf8_la_SOURCES = charset.c charset.h iconvert.c utf8.c - -EXTRA_DIST = \ - Makefile.lite \ - charmaps.h \ - makemap.c \ - charset_test.c \ - charsetmap.h \ - iconvert.h \ - utf8_static.dsp \ - utf8_static.vcproj - -subdir = src/share/utf8 -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libutf8_la_LDFLAGS = -libutf8_la_LIBADD = -am_libutf8_la_OBJECTS = charset.lo iconvert.lo utf8.lo -libutf8_la_OBJECTS = $(am_libutf8_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/charset.Plo ./$(DEPDIR)/iconvert.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/utf8.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libutf8_la_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(libutf8_la_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/share/utf8/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libutf8.la: $(libutf8_la_OBJECTS) $(libutf8_la_DEPENDENCIES) - $(LINK) $(libutf8_la_LDFLAGS) $(libutf8_la_OBJECTS) $(libutf8_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/charset.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iconvert.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf8.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am - - -debug: - $(MAKE) all CFLAGS="@DEBUG@" - -profile: - $(MAKE) all CFLAGS="@PROFILE@" -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/3rdparty/libflac/src/share/utf8/Makefile.lite b/3rdparty/libflac/src/share/utf8/Makefile.lite deleted file mode 100644 index 95e4a7fafc3..00000000000 --- a/3rdparty/libflac/src/share/utf8/Makefile.lite +++ /dev/null @@ -1,17 +0,0 @@ -# -# GNU makefile -# - -topdir = ../../.. - -LIB_NAME = libutf8 -INCLUDES = -I$(topdir)/include -I$(topdir)/include/share - -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/3rdparty/libflac/src/share/utf8/charmaps.h b/3rdparty/libflac/src/share/utf8/charmaps.h index 690d8906f8e..16d049a2a75 100644 --- a/3rdparty/libflac/src/share/utf8/charmaps.h +++ b/3rdparty/libflac/src/share/utf8/charmaps.h @@ -4,7 +4,7 @@ * with a decent iconv. */ -static const unsigned short mapping_iso_8859_2[256] = { +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, @@ -41,7 +41,7 @@ static const unsigned short mapping_iso_8859_2[256] = { static struct { const char *name; - const unsigned short *map; + const uint16_t *map; struct charset *charset; } maps[] = { { "ISO-8859-2", mapping_iso_8859_2, 0 }, diff --git a/3rdparty/libflac/src/share/utf8/charset.c b/3rdparty/libflac/src/share/utf8/charset.c index dcef6fc94b3..5c5693d15c6 100644 --- a/3rdparty/libflac/src/share/utf8/charset.c +++ b/3rdparty/libflac/src/share/utf8/charset.c @@ -1,19 +1,19 @@ /* * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * + * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * 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. */ /* @@ -27,11 +27,11 @@ * 8-bit char, 16-bit short and 32-bit int. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif -#ifndef HAVE_ICONV /* should be ifdef USE_CHARSET_CONVERT */ +#if !defined _WIN32 && !defined HAVE_ICONV /* should be && defined USE_CHARSET_CONVERT */ #include <stdlib.h> @@ -56,7 +56,7 @@ static int ascii_strcasecmp(const char *s1, const char *s2) char c1, c2; for (;; s1++, s2++) { - if (!*s1 || !*s1) + if (!*s1 || !*s2) break; if (*s1 == *s2) continue; @@ -69,7 +69,7 @@ static int ascii_strcasecmp(const char *s1, const char *s2) if (c1 != c2) break; } - return (unsigned char)*s1 - (unsigned char)*s2; + return (uint8_t)*s1 - (uint8_t)*s2; } /* @@ -78,7 +78,7 @@ static int ascii_strcasecmp(const char *s1, const char *s2) int utf8_mbtowc(int *pwc, const char *s, size_t n) { - unsigned char c; + uint8_t c; int wc, i, k; if (!n || !s) @@ -129,7 +129,7 @@ int utf8_mbtowc(int *pwc, const char *s, size_t n) int utf8_wctomb(char *s, int wc1) { - unsigned int wc = wc1; + uint32_t wc = wc1; if (!s) return 0; @@ -231,7 +231,7 @@ static int mbtowc_ascii(void *map, int *pwc, const char *s, size_t n) (void)map; if (!n || !s) return 0; - wc = (unsigned char)*s; + wc = (uint8_t)*s; if (wc & ~0x7f) return -1; if (pwc) @@ -263,7 +263,7 @@ static int mbtowc_iso1(void *map, int *pwc, const char *s, size_t n) (void)map; if (!n || !s) return 0; - wc = (unsigned char)*s; + wc = (uint8_t)*s; if (wc & ~0xff) return -1; if (pwc) @@ -287,18 +287,18 @@ static int wctomb_iso1(void *map, char *s, int wc) */ struct map { - const unsigned short *from; + 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; - unsigned short wc; + uint16_t wc; if (!n || !s) return 0; - wc = map->from[(unsigned char)*s]; + wc = map->from[(uint8_t)*s]; if (wc == 0xffff) return -1; if (pwc) @@ -316,8 +316,8 @@ static int mbtowc_8bit(void *map1, int *pwc, const char *s, size_t n) */ struct inverse_map { - unsigned char first[256]; - unsigned char next[256]; + uint8_t first[256]; + uint8_t next[256]; }; /* @@ -328,13 +328,13 @@ struct inverse_map { /* #define HASH(i) 0 */ /* #define HASH(i) 99 */ -static struct inverse_map *make_inverse_map(const unsigned short *from) +static struct inverse_map *make_inverse_map(const uint16_t *from) { struct inverse_map *to; char used[256]; int i, j, k; - to = (struct inverse_map *)malloc(sizeof(struct inverse_map)); + to = malloc(sizeof(struct inverse_map)); if (!to) return 0; for (i = 0; i < 256; i++) @@ -359,10 +359,10 @@ static struct inverse_map *make_inverse_map(const unsigned short *from) return to; } -int wctomb_8bit(void *map1, char *s, int wc1) +static int wctomb_8bit(void *map1, char *s, int wc1) { struct map *map = map1; - unsigned short wc = wc1; + uint16_t wc = wc1; int i; if (!s) @@ -447,9 +447,9 @@ struct charset *charset_find(const char *code) for (i = 0; maps[i].name; i++) if (!ascii_strcasecmp(code, maps[i].name)) { if (!maps[i].charset) { - maps[i].charset = (struct charset *)malloc(sizeof(struct charset)); + maps[i].charset = malloc(sizeof(struct charset)); if (maps[i].charset) { - struct map *map = (struct map *)malloc(sizeof(struct map)); + struct map *map = malloc(sizeof(struct map)); if (!map) { free(maps[i].charset); maps[i].charset = 0; @@ -485,7 +485,7 @@ int charset_convert(const char *fromcode, const char *tocode, { int ret = 0; struct charset *charset1, *charset2; - char *tobuf, *p, *newbuf; + char *tobuf, *p; int i, j, wc; charset1 = charset_find(fromcode); @@ -493,7 +493,7 @@ int charset_convert(const char *fromcode, const char *tocode, if (!charset1 || !charset2 ) return -1; - tobuf = (char *)safe_malloc_mul2add_(fromlen, /*times*/charset2->max, /*+*/1); + tobuf = safe_malloc_mul2add_(fromlen, /*times*/charset2->max, /*+*/1); if (!tobuf) return -2; @@ -520,8 +520,10 @@ int charset_convert(const char *fromcode, const char *tocode, *tolen = p - tobuf; *p++ = '\0'; if (to) { - newbuf = realloc(tobuf, p - tobuf); - *to = newbuf ? newbuf : tobuf; + char *tobuf_saved = tobuf; + *to = realloc(tobuf, p - tobuf); + if (*to == NULL) + *to = tobuf_saved; } else free(tobuf); diff --git a/3rdparty/libflac/src/share/utf8/charset.h b/3rdparty/libflac/src/share/utf8/charset.h index b5e2fb7384e..ea8e31e1e63 100644 --- a/3rdparty/libflac/src/share/utf8/charset.h +++ b/3rdparty/libflac/src/share/utf8/charset.h @@ -1,19 +1,19 @@ /* * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * + * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * 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 <stdlib.h> diff --git a/3rdparty/libflac/src/share/utf8/charset_test.c b/3rdparty/libflac/src/share/utf8/charset_test.c index 1d5bf717557..6761100cede 100644 --- a/3rdparty/libflac/src/share/utf8/charset_test.c +++ b/3rdparty/libflac/src/share/utf8/charset_test.c @@ -1,22 +1,22 @@ /* * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * + * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -119,8 +119,8 @@ void test_utf8() assert(charset_mbtowc(charset, &wc, "\377\277\277\277\277\277", 9) == -1); /* Encoder */ - strcpy(s, "......."); - assert(charset_wctomb(charset, s, 1 << 31) == -1 && + 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......")); @@ -161,7 +161,7 @@ void test_ascii() assert(charset_mbtowc(charset, &wc, "\200", 2) == -1); /* Encoder */ - strcpy(s, ".."); + 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); @@ -182,7 +182,7 @@ void test_iso1() assert(charset_mbtowc(charset, &wc, "\302\200", 9) == 1 && wc == 0xc2); /* Encoder */ - strcpy(s, ".."); + 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.")); @@ -203,7 +203,7 @@ void test_iso2() assert(charset_mbtowc(charset, &wc, "\377", 2) == 1 && wc == 0x2d9); /* Encoder */ - strcpy(s, ".."); + 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.")); @@ -230,7 +230,7 @@ void test_convert() 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", + 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", diff --git a/3rdparty/libflac/src/share/utf8/charsetmap.h b/3rdparty/libflac/src/share/utf8/charsetmap.h deleted file mode 100644 index b81259051f0..00000000000 --- a/3rdparty/libflac/src/share/utf8/charsetmap.h +++ /dev/null @@ -1,79 +0,0 @@ -/* This file was automatically generated by make_code_map.pl - please don't edit directly - Daniel Resare <noa@metamatrix.se> -*/ -charset_map maps[] = { - {"ISO-8859-1", - { - 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,0x00A1,0x00A2,0x00A3,0x00A4,0x00A5,0x00A6,0x00A7, - 0x00A8,0x00A9,0x00AA,0x00AB,0x00AC,0x00AD,0x00AE,0x00AF, - 0x00B0,0x00B1,0x00B2,0x00B3,0x00B4,0x00B5,0x00B6,0x00B7, - 0x00B8,0x00B9,0x00BA,0x00BB,0x00BC,0x00BD,0x00BE,0x00BF, - 0x00C0,0x00C1,0x00C2,0x00C3,0x00C4,0x00C5,0x00C6,0x00C7, - 0x00C8,0x00C9,0x00CA,0x00CB,0x00CC,0x00CD,0x00CE,0x00CF, - 0x00D0,0x00D1,0x00D2,0x00D3,0x00D4,0x00D5,0x00D6,0x00D7, - 0x00D8,0x00D9,0x00DA,0x00DB,0x00DC,0x00DD,0x00DE,0x00DF, - 0x00E0,0x00E1,0x00E2,0x00E3,0x00E4,0x00E5,0x00E6,0x00E7, - 0x00E8,0x00E9,0x00EA,0x00EB,0x00EC,0x00ED,0x00EE,0x00EF, - 0x00F0,0x00F1,0x00F2,0x00F3,0x00F4,0x00F5,0x00F6,0x00F7, - 0x00F8,0x00F9,0x00FA,0x00FB,0x00FC,0x00FD,0x00FE,0x00FF - } - }, - {"ISO-8859-2", - { - 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 - } - }, - {NULL} -}; diff --git a/3rdparty/libflac/src/share/utf8/iconvert.c b/3rdparty/libflac/src/share/utf8/iconvert.c index f0311ee0610..9a1e3f6b2a1 100644 --- a/3rdparty/libflac/src/share/utf8/iconvert.c +++ b/3rdparty/libflac/src/share/utf8/iconvert.c @@ -1,35 +1,37 @@ /* * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * + * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif -#ifdef HAVE_ICONV +#if !defined _WIN32 && defined HAVE_ICONV #include <assert.h> #include <errno.h> #include <iconv.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> #include "iconvert.h" #include "share/alloc.h" +#include "share/safe_str.h" /* * Convert data from one encoding to another. Return: @@ -60,7 +62,7 @@ int iconvert(const char *fromcode, const char *tocode, char *ib; char *ob; char *utfbuf = 0, *outbuf, *newbuf; - size_t utflen, outlen, ibl, obl, k; + size_t utflen, outlen, ibl, obl, obp, k; char tbuf[2048]; cd1 = iconv_open("UTF-8", fromcode); @@ -76,18 +78,17 @@ int iconvert(const char *fromcode, const char *tocode, 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. */ - tocode1 = (char *)safe_malloc_add_2op_(strlen(tocode), /*+*/11); - if (!tocode1) + + rc = asprintf(&tocode1, "%s//TRANSLIT", tocode); + if (rc < 0 || ! tocode1) goto fail; - strcpy(tocode1, tocode); - strcat(tocode1, "//TRANSLIT"); cd2 = iconv_open(tocode1, "UTF-8"); free(tocode1); @@ -101,7 +102,7 @@ int iconvert(const char *fromcode, const char *tocode, } utflen = 1; /*fromlen * 2 + 1; XXX */ - utfbuf = (char *)malloc(utflen); + utfbuf = malloc(utflen); if (!utfbuf) goto fail; @@ -123,11 +124,12 @@ int iconvert(const char *fromcode, const char *tocode, if(utflen*2 < utflen) /* overflow check */ goto fail; utflen *= 2; - newbuf = (char *)realloc(utfbuf, utflen); + obp = ob - utfbuf; /* save position */ + newbuf = realloc(utfbuf, utflen); if (!newbuf) goto fail; - ob = (ob - utfbuf) + newbuf; - obl = utflen - (ob - newbuf); + ob = newbuf + obp; + obl = utflen - obp; utfbuf = newbuf; } else { @@ -148,7 +150,7 @@ int iconvert(const char *fromcode, const char *tocode, iconv_close(cd1); return ret; } - newbuf = (char *)safe_realloc_add_2op_(utfbuf, (ob - utfbuf), /*+*/1); + newbuf = safe_realloc_nofree_add_2op_(utfbuf, (ob - utfbuf), /*+*/1); if (!newbuf) goto fail; ob = (ob - utfbuf) + newbuf; @@ -160,7 +162,9 @@ int iconvert(const char *fromcode, const char *tocode, /* Truncate the buffer to be tidy */ utflen = ob - utfbuf; - newbuf = (char *)realloc(utfbuf, utflen); + if (utflen == 0) + goto fail; + newbuf = realloc(utfbuf, utflen); if (!newbuf) goto fail; utfbuf = newbuf; @@ -199,7 +203,7 @@ int iconvert(const char *fromcode, const char *tocode, outlen += ob - tbuf; /* Convert from UTF-8 for real */ - outbuf = (char *)safe_malloc_add_2op_(outlen, /*+*/1); + outbuf = safe_malloc_add_2op_(outlen, /*+*/1); if (!outbuf) goto fail; ib = utfbuf; diff --git a/3rdparty/libflac/src/share/utf8/iconvert.h b/3rdparty/libflac/src/share/utf8/iconvert.h index 1a1a06a13ab..a2d75a27026 100644 --- a/3rdparty/libflac/src/share/utf8/iconvert.h +++ b/3rdparty/libflac/src/share/utf8/iconvert.h @@ -1,22 +1,22 @@ /* * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * + * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif diff --git a/3rdparty/libflac/src/share/utf8/makemap.c b/3rdparty/libflac/src/share/utf8/makemap.c index 72a9de18def..790021c69fa 100644 --- a/3rdparty/libflac/src/share/utf8/makemap.c +++ b/3rdparty/libflac/src/share/utf8/makemap.c @@ -1,22 +1,22 @@ /* * Copyright (C) 2001 Edmund Grimley Evans <edmundo@rano.org> - * + * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) const char *ib; char *ob; size_t ibl, obl, k; - unsigned char c, buf[4]; + uint8_t c, buf[4]; int i, wc; if (argc != 2) { diff --git a/3rdparty/libflac/src/share/utf8/utf8.c b/3rdparty/libflac/src/share/utf8/utf8.c index 303fe23a060..34af187b8bc 100644 --- a/3rdparty/libflac/src/share/utf8/utf8.c +++ b/3rdparty/libflac/src/share/utf8/utf8.c @@ -4,238 +4,117 @@ * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * 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. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif +#include <stdio.h> #include <stdlib.h> -#include <string.h> #include "share/alloc.h" -#include "utf8.h" -#include "charset.h" - +#include "share/utf8.h" #ifdef _WIN32 - /* Thanks to Peter Harris <peter.harris@hummingbird.com> for this win32 - * code. - */ - -#include <stdio.h> #include <windows.h> -static unsigned char *make_utf8_string(const wchar_t *unicode) +int utf8_encode(const char *from, char **to) { - size_t size = 0, n; - int index = 0, out_index = 0; - unsigned char *out; - unsigned short c; - - /* first calculate the size of the target string */ - c = unicode[index++]; - while(c) { - if(c < 0x0080) { - n = 1; - } else if(c < 0x0800) { - n = 2; - } else { - n = 3; - } - if(size+n < size) /* overflow check */ - return NULL; - size += n; - c = unicode[index++]; - } - - out = safe_malloc_add_2op_(size, /*+*/1); - if (out == NULL) - return NULL; - index = 0; - - c = unicode[index++]; - while(c) - { - if(c < 0x080) { - out[out_index++] = (unsigned char)c; - } else if(c < 0x800) { - out[out_index++] = 0xc0 | (c >> 6); - out[out_index++] = 0x80 | (c & 0x3f); - } else { - out[out_index++] = 0xe0 | (c >> 12); - out[out_index++] = 0x80 | ((c >> 6) & 0x3f); - out[out_index++] = 0x80 | (c & 0x3f); - } - c = unicode[index++]; - } - out[out_index] = 0x00; - - return out; -} + wchar_t *unicode = NULL; + char *utf8 = NULL; + int ret = -1; -static wchar_t *make_unicode_string(const unsigned char *utf8) -{ - size_t size = 0; - int index = 0, out_index = 0; - wchar_t *out; - unsigned char c; - - /* first calculate the size of the target string */ - c = utf8[index++]; - while(c) { - if((c & 0x80) == 0) { - index += 0; - } else if((c & 0xe0) == 0xe0) { - index += 2; - } else { - index += 1; - } - if(size + 1 == 0) /* overflow check */ - return NULL; - size++; - c = utf8[index++]; - } - - if(size + 1 == 0) /* overflow check */ - return NULL; - out = safe_malloc_mul_2op_(size+1, /*times*/sizeof(wchar_t)); - if (out == NULL) - return NULL; - index = 0; - - c = utf8[index++]; - while(c) - { - if((c & 0x80) == 0) { - out[out_index++] = c; - } else if((c & 0xe0) == 0xe0) { - out[out_index] = (c & 0x1F) << 12; - c = utf8[index++]; - out[out_index] |= (c & 0x3F) << 6; - c = utf8[index++]; - out[out_index++] |= (c & 0x3F); - } else { - out[out_index] = (c & 0x3F) << 6; - c = utf8[index++]; - out[out_index++] |= (c & 0x3F); - } - c = utf8[index++]; - } - out[out_index] = 0; - - return out; -} + do { + int len; -int utf8_encode(const char *from, char **to) -{ - wchar_t *unicode; - int wchars, err; + 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; - wchars = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, - strlen(from), NULL, 0); + 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; - if(wchars == 0) - { - fprintf(stderr, "Unicode translation error %d\n", GetLastError()); - return -1; - } + ret = 0; - if(wchars < 0) /* underflow check */ - return -1; + } while(0); - unicode = safe_calloc_((size_t)wchars + 1, sizeof(unsigned short)); - if(unicode == NULL) - { - fprintf(stderr, "Out of memory processing string to UTF8\n"); - return -1; - } + free(unicode); - err = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, from, - strlen(from), unicode, wchars); - if(err != wchars) - { - free(unicode); - fprintf(stderr, "Unicode translation error %d\n", GetLastError()); - return -1; + if(ret == 0) { + *to = utf8; + } else { + free(utf8); + *to = NULL; } - /* On NT-based windows systems, we could use WideCharToMultiByte(), but - * MS doesn't actually have a consistent API across win32. - */ - *to = make_utf8_string(unicode); - - free(unicode); - return 0; + return ret; } int utf8_decode(const char *from, char **to) { - wchar_t *unicode; - int chars, err; - - /* On NT-based windows systems, we could use MultiByteToWideChar(CP_UTF8), but - * MS doesn't actually have a consistent API across win32. - */ - unicode = make_unicode_string(from); - if(unicode == NULL) - { - fprintf(stderr, "Out of memory processing string from UTF8 to UNICODE16\n"); - return -1; - } - - chars = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, - -1, NULL, 0, NULL, NULL); - - if(chars < 0) /* underflow check */ - return -1; - - if(chars == 0) - { - fprintf(stderr, "Unicode translation error %d\n", GetLastError()); - free(unicode); - return -1; - } - - *to = safe_calloc_((size_t)chars + 1, sizeof(unsigned char)); - if(*to == NULL) - { - fprintf(stderr, "Out of memory processing string to local charset\n"); - free(unicode); - return -1; - } - - err = WideCharToMultiByte(GetConsoleCP(), WC_COMPOSITECHECK, unicode, - -1, *to, chars, NULL, NULL); - if(err != chars) - { - fprintf(stderr, "Unicode translation error %d\n", GetLastError()); - free(unicode); - free(*to); - *to = NULL; - return -1; - } - - free(unicode); - return 0; + 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 */ @@ -245,7 +124,11 @@ int utf8_decode(const char *from, char **to) #include <langinfo.h> #endif +#include <string.h> + +#include "share/safe_str.h" #include "iconvert.h" +#include "charset.h" static const char *current_charset(void) { @@ -298,7 +181,7 @@ static int convert_string(const char *fromcode, const char *tocode, s = safe_malloc_add_2op_(fromlen, /*+*/1); if (!s) return -1; - strcpy(s, from); + snprintf(s, fromlen + 1, "%s", from); *to = s; for (; *s; s++) if (*s & ~0x7f) diff --git a/3rdparty/libflac/src/share/utf8/utf8_static.dsp b/3rdparty/libflac/src/share/utf8/utf8_static.dsp deleted file mode 100644 index c655ef7d0aa..00000000000 --- a/3rdparty/libflac/src/share/utf8/utf8_static.dsp +++ /dev/null @@ -1,116 +0,0 @@ -# Microsoft Developer Studio Project File - Name="utf8_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=utf8_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "utf8_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "utf8_static.mak" CFG="utf8_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "utf8_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "utf8_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "utf8" -# PROP Scc_LocalPath "..\..\.." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "utf8_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I ".\include" /I "..\..\..\include" /I "..\..\..\include\share" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ELSEIF "$(CFG)" == "utf8_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\..\include" /I "..\..\..\include\share" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "utf8_static - Win32 Release" -# Name "utf8_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=.\charset.c -# End Source File -# Begin Source File - -SOURCE=.\iconvert.c -# End Source File -# Begin Source File - -SOURCE=.\utf8.c -# End Source File -# End Group -# Begin Group "Private Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Protected Header Files" - -# PROP Default_Filter "" -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\..\include\share\utf8.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/share/utf8/utf8_static.vcproj b/3rdparty/libflac/src/share/utf8/utf8_static.vcproj deleted file mode 100644 index bcc8ca3c796..00000000000 --- a/3rdparty/libflac/src/share/utf8/utf8_static.vcproj +++ /dev/null @@ -1,201 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="utf8_static" - ProjectGUID="{4cefbc92-c215-11db-8314-0800200c9a66}" - RootNamespace="utf8_static" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\..\obj\debug\lib" - IntermediateDirectory="Debug_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\..\include;..\..\..\include\share" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\debug\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\..\obj\release\lib" - IntermediateDirectory="Release_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\..\include;..\..\..\include\share" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\release\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\charmaps.h" - > - </File> - <File - RelativePath=".\charset.h" - > - </File> - <File - RelativePath=".\charsetmap.h" - > - </File> - </Filter> - <Filter - Name="Public Header Files" - > - <File - RelativePath="..\..\..\include\share\utf8.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\charset.c" - > - </File> - <File - RelativePath=".\iconvert.c" - > - </File> - <File - RelativePath=".\utf8.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/share/win_utf8_io/win_utf8_io.c b/3rdparty/libflac/src/share/win_utf8_io/win_utf8_io.c new file mode 100644 index 00000000000..3ae35b31b2b --- /dev/null +++ b/3rdparty/libflac/src/share/win_utf8_io/win_utf8_io.c @@ -0,0 +1,398 @@ +/* libFLAC - Free Lossless Audio Codec library + * Copyright (C) 2013-2023 Xiph.Org Foundation + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of the Xiph.org Foundation nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <io.h> +#include <windows.h> +#include "share/win_utf8_io.h" + +#define UTF8_BUFFER_SIZE 32768 + +/* detect whether it is Windows APP (UWP) or standard Win32 envionment */ +#ifdef WINAPI_FAMILY_PARTITION + #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + #define FLAC_WINDOWS_APP 1 + #else + #define FLAC_WINDOWS_APP 0 + #endif +#else + #define FLAC_WINDOWS_APP 0 +#endif + +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) +{ +#if !FLAC_WINDOWS_APP + typedef int (__cdecl *wgetmainargs_t)(int*, wchar_t***, wchar_t***, int, int*); + wgetmainargs_t wgetmainargs; + HMODULE handle; +#endif // !FLAC_WINDOWS_APP + int wargc; + wchar_t **wargv; + wchar_t **wenv; + char **utf8argv; + int ret, i; + +#if FLAC_WINDOWS_APP + wargc = __argc; + wargv = __wargv; + wenv = _wenviron; +#else // !FLAC_WINDOWS_APP + 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; + } +#endif // !FLAC_WINDOWS_APP + if ((utf8argv = (char **)calloc(wargc, sizeof(char*))) == NULL) { + #if !FLAC_WINDOWS_APP + FreeLibrary(handle); + #endif // !FLAC_WINDOWS_APP + return 1; + } + + ret = 0; + for (i=0; i<wargc; i++) { + if ((utf8argv[i] = utf8_from_wchar(wargv[i])) == NULL) { + ret = 1; + break; + } + } + +#if !FLAC_WINDOWS_APP + FreeLibrary(handle); /* do not free it when wargv or wenv are still in use */ +#endif // !FLAC_WINDOWS_APP + + if (ret == 0) { + *argc = wargc; + *argv = utf8argv; + } else { + for (i=0; i<wargc; i++) + free(utf8argv[i]); + free(utf8argv); + } + + return ret; +} + +/* similar to CreateFileW but accepts UTF-8 encoded lpFileName */ +HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) +{ + wchar_t *wname; + HANDLE handle = INVALID_HANDLE_VALUE; + + if ((wname = wchar_from_utf8(lpFileName)) != NULL) { +#if !FLAC_WINDOWS_APP + handle = CreateFileW(wname, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); +#else // FLAC_WINDOWS_APP + CREATEFILE2_EXTENDED_PARAMETERS params; + params.dwSize = sizeof(params); + params.dwFileAttributes = dwFlagsAndAttributes & 0xFFFF; + params.dwFileFlags = dwFlagsAndAttributes & 0xFFF00000; + params.dwSecurityQosFlags = dwFlagsAndAttributes & 0x000F0000; + params.lpSecurityAttributes = lpSecurityAttributes; + params.hTemplateFile = hTemplateFile; + handle = CreateFile2(wname, dwDesiredAccess, dwShareMode, dwCreationDisposition, ¶ms); +#endif // FLAC_WINDOWS_APP + free(wname); + } + + return handle; +} + +/* return number of characters in the UTF-8 string */ +size_t strlen_utf8(const char *str) +{ + size_t len; + len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); /* includes terminating null */ + if (len != 0) + return len-1; + else + return strlen(str); +} + +/* get the console width in characters */ +int win_get_console_width(void) +{ + int width = 80; +#if !FLAC_WINDOWS_APP + CONSOLE_SCREEN_BUFFER_INFO csbi; + HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); + if(hOut != INVALID_HANDLE_VALUE && hOut != NULL) + if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0) + width = csbi.dwSize.X; +#endif // !FLAC_WINDOWS_APP + return width; +} + +/* print functions */ + +#if !FLAC_WINDOWS_APP +static int wprint_console(FILE *stream, const wchar_t *text, size_t len) +{ + DWORD out; + int ret; + + do { + if (stream == stdout) { + HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); + if (hOut == INVALID_HANDLE_VALUE || hOut == NULL || GetFileType(hOut) != FILE_TYPE_CHAR) + break; + if (WriteConsoleW(hOut, text, len, &out, NULL) == 0) + return -1; + return out; + } + if (stream == stderr) { + HANDLE hErr = GetStdHandle(STD_ERROR_HANDLE); + if (hErr == INVALID_HANDLE_VALUE || hErr == NULL || GetFileType(hErr) != FILE_TYPE_CHAR) + break; + if (WriteConsoleW(hErr, text, len, &out, NULL) == 0) + return -1; + return out; + } + } while(0); + + ret = fputws(text, stream); + if (ret < 0) + return ret; + return len; +} +#endif // !FLAC_WINDOWS_APP + +int printf_utf8(const char *format, ...) +{ + int ret; + va_list argptr; + va_start(argptr, format); + + ret = vfprintf_utf8(stdout, format, argptr); + + va_end(argptr); + + return ret; +} + +int fprintf_utf8(FILE *stream, const char *format, ...) +{ + int ret; + va_list argptr; + va_start(argptr, format); + + ret = vfprintf_utf8(stream, format, argptr); + + va_end(argptr); + + return ret; +} + +int vfprintf_utf8(FILE *stream, const char *format, va_list argptr) +{ + char *utmp = NULL; + wchar_t *wout = NULL; + int ret = -1; + + do { + if (!(utmp = (char *)malloc(UTF8_BUFFER_SIZE))) break; + if ((ret = local_vsnprintf(utmp, UTF8_BUFFER_SIZE, format, argptr)) <= 0) break; + if (!(wout = wchar_from_utf8(utmp))) { + ret = -1; + break; + } +#if !FLAC_WINDOWS_APP + ret = wprint_console(stream, wout, wcslen(wout)); +#else // FLAC_WINDOWS_APP + OutputDebugStringW(wout); + ret = 0; +#endif // FLAC_WINDOWS_APP + } while(0); + + free(utmp); + free(wout); + + return ret; +} + +/* file functions */ + +FILE* fopen_utf8(const char *filename, const char *mode) +{ + wchar_t *wname = NULL; + wchar_t *wmode = NULL; + FILE *f = NULL; + + do { + if (!(wname = wchar_from_utf8(filename))) break; + if (!(wmode = wchar_from_utf8(mode))) break; + f = _wfopen(wname, wmode); + } while(0); + + free(wname); + free(wmode); + + return f; +} + +int stat64_utf8(const char *path, struct __stat64 *buffer) +{ + wchar_t *wpath; + int ret; + + if (!(wpath = wchar_from_utf8(path))) return -1; + ret = _wstat64(wpath, buffer); + free(wpath); + + return ret; +} + +int chmod_utf8(const char *filename, int pmode) +{ + wchar_t *wname; + int ret; + + if (!(wname = wchar_from_utf8(filename))) return -1; + ret = _wchmod(wname, pmode); + free(wname); + + return ret; +} + +int utime_utf8(const char *filename, struct utimbuf *times) +{ + wchar_t *wname; + struct __utimbuf64 ut; + int ret; + + if (!(wname = wchar_from_utf8(filename))) return -1; + ut.actime = times->actime; + ut.modtime = times->modtime; + ret = _wutime64(wname, &ut); + free(wname); + + return ret; +} + +int unlink_utf8(const char *filename) +{ + wchar_t *wname; + int ret; + + if (!(wname = wchar_from_utf8(filename))) return -1; + ret = _wunlink(wname); + free(wname); + + return ret; +} + +int rename_utf8(const char *oldname, const char *newname) +{ + wchar_t *wold = NULL; + wchar_t *wnew = NULL; + int ret = -1; + + do { + if (!(wold = wchar_from_utf8(oldname))) break; + if (!(wnew = wchar_from_utf8(newname))) break; + ret = _wrename(wold, wnew); + } while(0); + + free(wold); + free(wnew); + + return ret; +} diff --git a/3rdparty/libflac/src/test_grabbag/CMakeLists.txt b/3rdparty/libflac/src/test_grabbag/CMakeLists.txt new file mode 100644 index 00000000000..56abe81094c --- /dev/null +++ b/3rdparty/libflac/src/test_grabbag/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(cuesheet) +add_subdirectory(picture) diff --git a/3rdparty/libflac/src/test_grabbag/Makefile.am b/3rdparty/libflac/src/test_grabbag/Makefile.am index 825d1cbe39b..ea710091fb2 100644 --- a/3rdparty/libflac/src/test_grabbag/Makefile.am +++ b/3rdparty/libflac/src/test_grabbag/Makefile.am @@ -1,8 +1,9 @@ # FLAC - Free Lossless Audio Codec -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference licenses. The codec libraries +# 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 @@ -18,4 +19,4 @@ SUBDIRS = cuesheet picture EXTRA_DIST = \ - Makefile.lite + CMakeLists.txt diff --git a/3rdparty/libflac/src/test_grabbag/Makefile.in b/3rdparty/libflac/src/test_grabbag/Makefile.in index 752b7b1b3aa..3d857214bc7 100644 --- a/3rdparty/libflac/src/test_grabbag/Makefile.in +++ b/3rdparty/libflac/src/test_grabbag/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,10 +15,11 @@ @SET_MAKE@ # FLAC - Free Lossless Audio Codec -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference licenses. The codec libraries +# 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 @@ -30,17 +31,67 @@ # 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. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +103,114 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +subdir = src/test_grabbag +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,186 +219,179 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ SUBDIRS = cuesheet picture - EXTRA_DIST = \ - Makefile.lite + CMakeLists.txt -subdir = src/test_grabbag -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -DIST_SOURCES = - -RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ - ps-recursive install-info-recursive uninstall-info-recursive \ - all-recursive install-data-recursive install-exec-recursive \ - installdirs-recursive install-recursive uninstall-recursive \ - check-recursive installcheck-recursive -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -DIST_SUBDIRS = $(SUBDIRS) all: all-recursive .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/test_grabbag/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test_grabbag/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/test_grabbag/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo @@ -253,21 +399,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - # This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -275,152 +426,131 @@ $(RECURSIVE_TARGETS): else \ local_target="$$target"; \ fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - if (etags --etags-include --version) >/dev/null 2>&1; then \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ + empty_fix=.; \ else \ include_option=--include; \ + empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -f $$subdir/TAGS && \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done - list='$(SUBDIRS)'; for subdir in $$list; do \ + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ - test -d $(distdir)/$$subdir \ - || mkdir $(distdir)/$$subdir \ - || exit 1; \ - (cd $$subdir && \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" \ - distdir=../$(distdir)/$$subdir \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ @@ -430,7 +560,6 @@ check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: - install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive @@ -441,16 +570,22 @@ install-am: all-am installcheck: installcheck-recursive install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -461,25 +596,46 @@ clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags +distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: +html: html-recursive + +html-am: + info: info-recursive info-am: install-data-am: +install-dvi: install-dvi-recursive + +install-dvi-am: + install-exec-am: +install-html: install-html-recursive + +install-html-am: + install-info: install-info-recursive +install-info-am: + install-man: +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-recursive @@ -498,26 +654,25 @@ ps: ps-recursive ps-am: -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ - clean-generic clean-libtool clean-recursive ctags \ - ctags-recursive distclean distclean-generic distclean-libtool \ - distclean-recursive distclean-tags distdir dvi dvi-am \ - dvi-recursive info info-am info-recursive install install-am \ - install-data install-data-am install-data-recursive \ - install-exec install-exec-am install-exec-recursive \ - install-info install-info-am install-info-recursive install-man \ - install-recursive install-strip installcheck installcheck-am \ - installdirs installdirs-am installdirs-recursive \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am \ - pdf-recursive ps ps-am ps-recursive tags tags-recursive \ - uninstall uninstall-am uninstall-info-am \ - uninstall-info-recursive uninstall-recursive +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/test_grabbag/Makefile.lite b/3rdparty/libflac/src/test_grabbag/Makefile.lite deleted file mode 100644 index 93512c315f1..00000000000 --- a/3rdparty/libflac/src/test_grabbag/Makefile.lite +++ /dev/null @@ -1,40 +0,0 @@ -# test_grabbag - Simple testers for the grabbag library -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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/3rdparty/libflac/src/test_grabbag/cuesheet/CMakeLists.txt b/3rdparty/libflac/src/test_grabbag/cuesheet/CMakeLists.txt new file mode 100644 index 00000000000..5f9a646c996 --- /dev/null +++ b/3rdparty/libflac/src/test_grabbag/cuesheet/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(test_cuesheet + main.c + $<$<BOOL:${WIN32}>:../../../include/share/win_utf8_io.h> + $<$<BOOL:${WIN32}>:../../share/win_utf8_io/win_utf8_io.c>) +target_link_libraries(test_cuesheet FLAC grabbag) diff --git a/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.am b/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.am index 1d6d709b46c..1cee3707257 100644 --- a/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.am +++ b/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.am @@ -1,5 +1,6 @@ # test_cuesheet - Simple tester for cuesheet routines in grabbag -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,21 +12,26 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 = \ - Makefile.lite \ - test_cuesheet.dsp \ - test_cuesheet.vcproj + CMakeLists.txt -noinst_PROGRAMS = test_cuesheet +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include +check_PROGRAMS = test_cuesheet test_cuesheet_SOURCES = \ main.c + +if OS_IS_WINDOWS +win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la +endif + 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 \ - @OGG_LIBS@ \ - -lm + $(win_utf8_lib) + +CLEANFILES = test_cuesheet.exe diff --git a/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.in b/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.in index aee54dad67d..618857338dc 100644 --- a/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.in +++ b/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # test_cuesheet - Simple tester for cuesheet routines in grabbag -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,20 +28,70 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ +# 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. VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +103,106 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +check_PROGRAMS = test_cuesheet$(EXEEXT) +subdir = src/test_grabbag/cuesheet +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_test_cuesheet_OBJECTS = main.$(OBJEXT) +test_cuesheet_OBJECTS = $(am_test_cuesheet_OBJECTS) +test_cuesheet_DEPENDENCIES = \ + $(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) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/main.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_cuesheet_SOURCES) +DIST_SOURCES = $(test_cuesheet_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,267 +211,242 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ EXTRA_DIST = \ - Makefile.lite \ - test_cuesheet.dsp \ - test_cuesheet.vcproj - + CMakeLists.txt -noinst_PROGRAMS = test_cuesheet +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include test_cuesheet_SOURCES = \ main.c +@OS_IS_WINDOWS_TRUE@win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la 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 \ - @OGG_LIBS@ \ - -lm - -subdir = src/test_grabbag/cuesheet -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -noinst_PROGRAMS = test_cuesheet$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) - -am_test_cuesheet_OBJECTS = main.$(OBJEXT) -test_cuesheet_OBJECTS = $(am_test_cuesheet_OBJECTS) -test_cuesheet_DEPENDENCIES = \ - $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \ - $(top_builddir)/src/libFLAC/libFLAC.la -test_cuesheet_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/main.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(test_cuesheet_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(test_cuesheet_SOURCES) + $(win_utf8_lib) +CLEANFILES = test_cuesheet.exe all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/test_grabbag/cuesheet/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -test_cuesheet$(EXEEXT): $(test_cuesheet_OBJECTS) $(test_cuesheet_DEPENDENCIES) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test_grabbag/cuesheet/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/test_grabbag/cuesheet/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test_cuesheet$(EXEEXT): $(test_cuesheet_OBJECTS) $(test_cuesheet_DEPENDENCIES) $(EXTRA_test_cuesheet_DEPENDENCIES) @rm -f test_cuesheet$(EXEEXT) - $(LINK) $(test_cuesheet_LDFLAGS) $(test_cuesheet_OBJECTS) $(test_cuesheet_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(test_cuesheet_OBJECTS) $(test_cuesheet_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -334,99 +454,94 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am -all-am: Makefile $(PROGRAMS) - +all-am: Makefile installdirs: install: install-am install-exec: install-exec-am @@ -438,51 +553,80 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -499,18 +643,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.lite b/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.lite deleted file mode 100644 index 0178b1e5bd8..00000000000 --- a/3rdparty/libflac/src/test_grabbag/cuesheet/Makefile.lite +++ /dev/null @@ -1,40 +0,0 @@ -# test_cuesheet - Simple tester for cuesheet routines in grabbag -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -PROGRAM_NAME = test_cuesheet - -INCLUDES = -I./include -I$(topdir)/include - -ifeq ($(DARWIN_BUILD),yes) -EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm -else -LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -L$(OGG_LIB_DIR) -logg -lm -endif - -SRCS_C = \ - main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/test_grabbag/cuesheet/main.c b/3rdparty/libflac/src/test_grabbag/cuesheet/main.c index bb99834c6fe..b3d0e9abf63 100644 --- a/3rdparty/libflac/src/test_grabbag/cuesheet/main.c +++ b/3rdparty/libflac/src/test_grabbag/cuesheet/main.c @@ -1,5 +1,6 @@ /* test_cuesheet - Simple tester for cuesheet routines in grabbag - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -28,12 +29,12 @@ #include "FLAC/metadata.h" #include "share/grabbag.h" -static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64 lead_out_offset) +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; + const char *error_message, *tmpfilenamebase; char tmpfilename[4096]; - unsigned last_line_read; + uint32_t last_line_read; FLAC__StreamMetadata *cuesheet; FLAC__ASSERT(strlen(infilename) + 2 < sizeof(tmpfilename)); @@ -44,11 +45,11 @@ static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64 if(0 == strcmp(infilename, "-")) { fin = stdin; } - else if(0 == (fin = fopen(infilename, "r"))) { + 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, is_cdda, lead_out_offset))) { + if(0 != (cuesheet = grabbag__cuesheet_parse(fin, &error_message, &last_line_read, sample_rate, is_cdda, lead_out_offset))) { if(fin != stdin) fclose(fin); } @@ -63,8 +64,12 @@ static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64 FLAC__metadata_object_delete(cuesheet); return 1; } - sprintf(tmpfilename, "%s.1", infilename); - if(0 == (fout = fopen(tmpfilename, "w"))) { + + 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; @@ -76,11 +81,11 @@ static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64 /* * pass 2 */ - if(0 == (fin = fopen(tmpfilename, "r"))) { + 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, is_cdda, lead_out_offset))) { + if(0 != (cuesheet = grabbag__cuesheet_parse(fin, &error_message, &last_line_read, sample_rate, is_cdda, lead_out_offset))) { if(fin != stdin) fclose(fin); } @@ -95,8 +100,8 @@ static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64 FLAC__metadata_object_delete(cuesheet); return 1; } - sprintf(tmpfilename, "%s.2", infilename); - if(0 == (fout = fopen(tmpfilename, "w"))) { + 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; @@ -111,28 +116,32 @@ static int do_cuesheet(const char *infilename, FLAC__bool is_cdda, FLAC__uint64 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 [ cdda ]\n"; + const char *usage = "usage: test_cuesheet cuesheet_file lead_out_offset [ [ sample_rate ] cdda ]\n"; if(argc > 1 && 0 == strcmp(argv[1], "-h")) { - printf(usage); + puts(usage); return 0; } - if(argc < 3 || argc > 4) { - fprintf(stderr, usage); + if(argc < 3 || argc > 5) { + fputs(usage, stderr); return 255; } lead_out_offset = (FLAC__uint64)strtoul(argv[2], 0, 10); - if(argc == 4) { - if(0 == strcmp(argv[3], "cdda")) - is_cdda = true; - else { - fprintf(stderr, usage); - return 255; + 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], is_cdda, lead_out_offset); + return do_cuesheet(argv[1], sample_rate, is_cdda, lead_out_offset); } diff --git a/3rdparty/libflac/src/test_grabbag/cuesheet/test_cuesheet.dsp b/3rdparty/libflac/src/test_grabbag/cuesheet/test_cuesheet.dsp deleted file mode 100644 index 7baeef57334..00000000000 --- a/3rdparty/libflac/src/test_grabbag/cuesheet/test_cuesheet.dsp +++ /dev/null @@ -1,96 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_cuesheet" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=test_cuesheet - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "test_cuesheet.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "test_cuesheet.mak" CFG="test_cuesheet - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "test_cuesheet - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "test_cuesheet - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "test_cuesheet - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\..\obj\release\lib\grabbag_static.lib ..\..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\..\obj\release\lib\libFLAC_static.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "test_cuesheet - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\..\obj\debug\lib\grabbag_static.lib ..\..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\..\obj\debug\lib\libFLAC_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "test_cuesheet - Win32 Release" -# Name "test_cuesheet - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=.\main.c -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/test_grabbag/cuesheet/test_cuesheet.vcproj b/3rdparty/libflac/src/test_grabbag/cuesheet/test_cuesheet.vcproj deleted file mode 100644 index e916beed82b..00000000000 --- a/3rdparty/libflac/src/test_grabbag/cuesheet/test_cuesheet.vcproj +++ /dev/null @@ -1,202 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="test_cuesheet" - ProjectGUID="{4cefbc8b-c215-11db-8314-0800200c9a66}" - RootNamespace="test_cuesheet" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".;..\..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\main.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/test_grabbag/picture/CMakeLists.txt b/3rdparty/libflac/src/test_grabbag/picture/CMakeLists.txt new file mode 100644 index 00000000000..77f1a3887ad --- /dev/null +++ b/3rdparty/libflac/src/test_grabbag/picture/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(test_picture + main.c + $<$<BOOL:${WIN32}>:../../../include/share/win_utf8_io.h> + $<$<BOOL:${WIN32}>:../../share/win_utf8_io/win_utf8_io.c>) +target_link_libraries(test_picture FLAC grabbag) diff --git a/3rdparty/libflac/src/test_grabbag/picture/Makefile.am b/3rdparty/libflac/src/test_grabbag/picture/Makefile.am index 1f5d6553da1..45e145718e5 100644 --- a/3rdparty/libflac/src/test_grabbag/picture/Makefile.am +++ b/3rdparty/libflac/src/test_grabbag/picture/Makefile.am @@ -1,5 +1,6 @@ # test_picture - Simple tester for picture routines in grabbag -# Copyright (C) 2006,2007 Josh Coalson +# Copyright (C) 2006-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,20 +12,26 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 = \ - Makefile.lite \ - test_picture.dsp \ - test_picture.vcproj + CMakeLists.txt -noinst_PROGRAMS = test_picture +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 \ - @OGG_LIBS@ \ - -lm + $(win_utf8_lib) + +CLEANFILES = test_picture.exe diff --git a/3rdparty/libflac/src/test_grabbag/picture/Makefile.in b/3rdparty/libflac/src/test_grabbag/picture/Makefile.in index ae08e49d64b..43f1a7aff34 100644 --- a/3rdparty/libflac/src/test_grabbag/picture/Makefile.in +++ b/3rdparty/libflac/src/test_grabbag/picture/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # test_picture - Simple tester for picture routines in grabbag -# Copyright (C) 2006,2007 Josh Coalson +# Copyright (C) 2006-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,20 +28,70 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ +# 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. VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +103,106 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +check_PROGRAMS = test_picture$(EXEEXT) +subdir = src/test_grabbag/picture +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_test_picture_OBJECTS = main.$(OBJEXT) +test_picture_OBJECTS = $(am_test_picture_OBJECTS) +test_picture_DEPENDENCIES = \ + $(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) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/main.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_picture_SOURCES) +DIST_SOURCES = $(test_picture_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,265 +211,242 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ EXTRA_DIST = \ - Makefile.lite \ - test_picture.dsp \ - test_picture.vcproj - + CMakeLists.txt -noinst_PROGRAMS = test_picture +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include test_picture_SOURCES = \ main.c +@OS_IS_WINDOWS_TRUE@win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la 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 \ - @OGG_LIBS@ \ - -lm - -subdir = src/test_grabbag/picture -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -noinst_PROGRAMS = test_picture$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) - -am_test_picture_OBJECTS = main.$(OBJEXT) -test_picture_OBJECTS = $(am_test_picture_OBJECTS) -test_picture_DEPENDENCIES = \ - $(top_builddir)/src/share/grabbag/libgrabbag.la \ - $(top_builddir)/src/libFLAC/libFLAC.la -test_picture_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/main.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(test_picture_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(test_picture_SOURCES) + $(win_utf8_lib) +CLEANFILES = test_picture.exe all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/test_grabbag/picture/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -test_picture$(EXEEXT): $(test_picture_OBJECTS) $(test_picture_DEPENDENCIES) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test_grabbag/picture/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/test_grabbag/picture/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test_picture$(EXEEXT): $(test_picture_OBJECTS) $(test_picture_DEPENDENCIES) $(EXTRA_test_picture_DEPENDENCIES) @rm -f test_picture$(EXEEXT) - $(LINK) $(test_picture_LDFLAGS) $(test_picture_OBJECTS) $(test_picture_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(test_picture_OBJECTS) $(test_picture_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -332,99 +454,94 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am -all-am: Makefile $(PROGRAMS) - +all-am: Makefile installdirs: install: install-am install-exec: install-exec-am @@ -436,51 +553,80 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -497,18 +643,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/test_grabbag/picture/Makefile.lite b/3rdparty/libflac/src/test_grabbag/picture/Makefile.lite deleted file mode 100644 index af7ab5fa5e5..00000000000 --- a/3rdparty/libflac/src/test_grabbag/picture/Makefile.lite +++ /dev/null @@ -1,40 +0,0 @@ -# test_picture - Simple tester for picture routines in grabbag -# Copyright (C) 2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -PROGRAM_NAME = test_picture - -INCLUDES = -I./include -I$(topdir)/include - -ifeq ($(DARWIN_BUILD),yes) -EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm -else -LIBS = -lgrabbag -lreplaygain_analysis -lFLAC -L$(OGG_LIB_DIR) -logg -lm -endif - -SRCS_C = \ - main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/test_grabbag/picture/main.c b/3rdparty/libflac/src/test_grabbag/picture/main.c index 2ca34a6519a..fe43be94c96 100644 --- a/3rdparty/libflac/src/test_grabbag/picture/main.c +++ b/3rdparty/libflac/src/test_grabbag/picture/main.c @@ -1,5 +1,6 @@ /* test_picture - Simple tester for picture routines in grabbag - * Copyright (C) 2006,2007 Josh Coalson + * Copyright (C) 2006-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -56,34 +57,30 @@ static FLAC__bool debug_ = false; static FLAC__bool failed_(const char *msg) { - if(msg) - printf("FAILED, %s\n", msg); - else - printf("FAILED\n"); + if(msg) + printf("FAILED, %s\n", msg); + else + printf("FAILED\n"); - return false; + return false; } -static FLAC__bool test_one_picture(const char *prefix, const PictureFile *pf, const char *res, FLAC__bool fn_only) +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) -#if defined _MSC_VER || defined __MINGW32__ - _snprintf(s, sizeof(s)-1, "%s/%s", prefix, pf->path); -#else - snprintf(s, sizeof(s)-1, "%s/%s", prefix, pf->path); -#endif + 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 -#if defined _MSC_VER || defined __MINGW32__ - _snprintf(s, sizeof(s)-1, "%u|%s|%s|%s|%s/%s", (unsigned)pf->type, pf->mime_type, pf->description, res, prefix, pf->path); -#else - snprintf(s, sizeof(s)-1, "%u|%s|%s|%s|%s/%s", (unsigned)pf->type, pf->mime_type, pf->description, res, prefix, pf->path); -#endif + 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); - if(0 == (obj = grabbag__picture_parse_specification(s, &error))) + + 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", @@ -121,10 +118,11 @@ static FLAC__bool test_one_picture(const char *prefix, const PictureFile *pf, co 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"); + printf("\n+++ grabbag unit test: picture\n\n"); /* invalid spec: no filename */ printf("testing grabbag__picture_parse_specification(\"\")... "); @@ -188,19 +186,19 @@ static FLAC__bool do_picture(const char *prefix) /* 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, "", /*fn_only=*/true)) + 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, "", /*fn_only=*/false)) + if(!test_one_picture(prefix, picturefiles+i, NULL, /*fn_only=*/false)) return false; - picturefiles[0].width = 320; - picturefiles[0].height = 240; - picturefiles[0].depth = 3; - picturefiles[0].colors = 2; - if(!test_one_picture(prefix, picturefiles+0, "320x240x3/2", /*fn_only=*/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; @@ -211,12 +209,12 @@ int main(int argc, char *argv[]) const char *usage = "usage: test_pictures path_prefix\n"; if(argc > 1 && 0 == strcmp(argv[1], "-h")) { - printf(usage); + puts(usage); return 0; } if(argc != 2) { - fprintf(stderr, usage); + fputs(usage, stderr); return 255; } diff --git a/3rdparty/libflac/src/test_grabbag/picture/test_picture.dsp b/3rdparty/libflac/src/test_grabbag/picture/test_picture.dsp deleted file mode 100644 index 5d6454a4050..00000000000 --- a/3rdparty/libflac/src/test_grabbag/picture/test_picture.dsp +++ /dev/null @@ -1,96 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_picture" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=test_picture - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "test_picture.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "test_picture.mak" CFG="test_picture - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "test_picture - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "test_picture - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "test_picture - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\..\obj\release\lib\grabbag_static.lib ..\..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\..\obj\release\lib\libFLAC_static.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "test_picture - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\..\obj\debug\lib\grabbag_static.lib ..\..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\..\obj\debug\lib\libFLAC_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "test_picture - Win32 Release" -# Name "test_picture - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=.\main.c -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/test_grabbag/picture/test_picture.vcproj b/3rdparty/libflac/src/test_grabbag/picture/test_picture.vcproj deleted file mode 100644 index bd300ec1b3f..00000000000 --- a/3rdparty/libflac/src/test_grabbag/picture/test_picture.vcproj +++ /dev/null @@ -1,202 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="test_picture" - ProjectGUID="{4cefbc8f-c215-11db-8314-0800200c9a66}" - RootNamespace="test_picture" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".;..\..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\main.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/test_libFLAC++/CMakeLists.txt b/3rdparty/libflac/src/test_libFLAC++/CMakeLists.txt new file mode 100644 index 00000000000..2fa7b1e7722 --- /dev/null +++ b/3rdparty/libflac/src/test_libFLAC++/CMakeLists.txt @@ -0,0 +1,10 @@ +add_executable(test_libFLAC++ + decoders.cpp + encoders.cpp + main.cpp + metadata.cpp + metadata_manip.cpp + metadata_object.cpp + $<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h> + $<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>) +target_link_libraries(test_libFLAC++ FLAC++ test_libs_common grabbag) diff --git a/3rdparty/libflac/src/test_libFLAC++/Makefile.am b/3rdparty/libflac/src/test_libFLAC++/Makefile.am index 462cbf2d798..8bf746f72ae 100644 --- a/3rdparty/libflac/src/test_libFLAC++/Makefile.am +++ b/3rdparty/libflac/src/test_libFLAC++/Makefile.am @@ -1,5 +1,6 @@ # test_libFLAC++ - Unit tester for libFLAC++ -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,25 +12,30 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 = \ - Makefile.lite \ - test_libFLAC++.dsp \ - test_libFLAC++.vcproj + CMakeLists.txt + +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 -noinst_PROGRAMS = test_libFLAC++ 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@ \ - @MINGW_WINSOCK_LIBS@ \ -lm + test_libFLAC___SOURCES = \ decoders.cpp \ encoders.cpp \ @@ -40,3 +46,5 @@ test_libFLAC___SOURCES = \ decoders.h \ encoders.h \ metadata.h + +CLEANFILES = test_libFLAC++.exe diff --git a/3rdparty/libflac/src/test_libFLAC++/Makefile.in b/3rdparty/libflac/src/test_libFLAC++/Makefile.in index 0d11f8b98c6..825dad695d1 100644 --- a/3rdparty/libflac/src/test_libFLAC++/Makefile.in +++ b/3rdparty/libflac/src/test_libFLAC++/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # test_libFLAC++ - Unit tester for libFLAC++ -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2002-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,20 +28,70 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ +# 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. VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +103,130 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +check_PROGRAMS = test_libFLAC++$(EXEEXT) +subdir = src/test_libFLAC++ +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_test_libFLAC___OBJECTS = decoders.$(OBJEXT) encoders.$(OBJEXT) \ + main.$(OBJEXT) metadata.$(OBJEXT) metadata_manip.$(OBJEXT) \ + metadata_object.$(OBJEXT) +test_libFLAC___OBJECTS = $(am_test_libFLAC___OBJECTS) +test_libFLAC___DEPENDENCIES = \ + $(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) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/decoders.Po ./$(DEPDIR)/encoders.Po \ + ./$(DEPDIR)/main.Po ./$(DEPDIR)/metadata.Po \ + ./$(DEPDIR)/metadata_manip.Po ./$(DEPDIR)/metadata_object.Po +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@AM_V@) +am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) +am__v_CXX_0 = @echo " CXX " $@; +am__v_CXX_1 = +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) +am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) +am__v_CXXLD_0 = @echo " CXXLD " $@; +am__v_CXXLD_1 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_libFLAC___SOURCES) +DIST_SOURCES = $(test_libFLAC___SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,174 +235,156 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ EXTRA_DIST = \ - Makefile.lite \ - test_libFLAC++.dsp \ - test_libFLAC++.vcproj - + CMakeLists.txt -noinst_PROGRAMS = test_libFLAC++ +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include +@OS_IS_WINDOWS_TRUE@win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la 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@ \ - @MINGW_WINSOCK_LIBS@ \ -lm test_libFLAC___SOURCES = \ @@ -247,117 +398,96 @@ test_libFLAC___SOURCES = \ encoders.h \ metadata.h -subdir = src/test_libFLAC++ -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -noinst_PROGRAMS = test_libFLAC++$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) - -am_test_libFLAC___OBJECTS = decoders.$(OBJEXT) encoders.$(OBJEXT) \ - main.$(OBJEXT) metadata.$(OBJEXT) metadata_manip.$(OBJEXT) \ - metadata_object.$(OBJEXT) -test_libFLAC___OBJECTS = $(am_test_libFLAC___OBJECTS) -test_libFLAC___DEPENDENCIES = \ - $(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 -test_libFLAC___LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/decoders.Po ./$(DEPDIR)/encoders.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/metadata.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/metadata_manip.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/metadata_object.Po -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(test_libFLAC___SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(test_libFLAC___SOURCES) - +CLEANFILES = test_libFLAC++.exe all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/test_libFLAC++/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -test_libFLAC++$(EXEEXT): $(test_libFLAC___OBJECTS) $(test_libFLAC___DEPENDENCIES) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test_libFLAC++/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/test_libFLAC++/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test_libFLAC++$(EXEEXT): $(test_libFLAC___OBJECTS) $(test_libFLAC___DEPENDENCIES) $(EXTRA_test_libFLAC___DEPENDENCIES) @rm -f test_libFLAC++$(EXEEXT) - $(CXXLINK) $(test_libFLAC___LDFLAGS) $(test_libFLAC___OBJECTS) $(test_libFLAC___LDADD) $(LIBS) + $(AM_V_CXXLD)$(CXXLINK) $(test_libFLAC___OBJECTS) $(test_libFLAC___LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoders.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoders.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_manip.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_object.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoders.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoders.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_manip.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_object.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .cpp.o: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< .cpp.obj: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: -@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCXX_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -365,99 +495,94 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am -all-am: Makefile $(PROGRAMS) - +all-am: Makefile installdirs: install: install-am install-exec: install-exec-am @@ -469,51 +594,90 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/decoders.Po + -rm -f ./$(DEPDIR)/encoders.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/metadata.Po + -rm -f ./$(DEPDIR)/metadata_manip.Po + -rm -f ./$(DEPDIR)/metadata_object.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/decoders.Po + -rm -f ./$(DEPDIR)/encoders.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/metadata.Po + -rm -f ./$(DEPDIR)/metadata_manip.Po + -rm -f ./$(DEPDIR)/metadata_object.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -530,18 +694,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/test_libFLAC++/Makefile.lite b/3rdparty/libflac/src/test_libFLAC++/Makefile.lite deleted file mode 100644 index cf7eb4b4e8d..00000000000 --- a/3rdparty/libflac/src/test_libFLAC++/Makefile.lite +++ /dev/null @@ -1,47 +0,0 @@ -# test_libFLAC++ - Unit tester for libFLAC++ -# Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -PROGRAM_NAME = test_libFLAC++ - -INCLUDES = -I$(topdir)/include - -ifeq ($(DARWIN_BUILD),yes) -EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a $(libdir)/libFLAC++.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm -else -LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC++ -lFLAC -L$(OGG_LIB_DIR) -logg -lm -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/3rdparty/libflac/src/test_libFLAC++/decoders.cpp b/3rdparty/libflac/src/test_libFLAC++/decoders.cpp index fc78c0d5614..9f375f346b1 100644 --- a/3rdparty/libflac/src/test_libFLAC++/decoders.cpp +++ b/3rdparty/libflac/src/test_libFLAC++/decoders.cpp @@ -1,5 +1,6 @@ /* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -24,17 +25,12 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#if defined _MSC_VER || defined __MINGW32__ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif #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" @@ -61,8 +57,8 @@ static const char * const LayerString[] = { static ::FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, picture_, unknown_; static ::FLAC__StreamMetadata *expected_metadata_sequence_[9]; -static unsigned num_expected_; -static off_t flacfilesize_; +static uint32_t num_expected_; +static FLAC__off_t flacfilesize_; static const char *flacfilename(bool is_ogg) { @@ -84,7 +80,7 @@ static FLAC__bool die_s_(const char *msg, const FLAC::Decoder::Stream *decoder) else printf("FAILED"); - printf(", state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); + printf(", state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); return false; } @@ -124,11 +120,12 @@ static bool generate_file_(FLAC__bool is_ogg) class DecoderCommon { public: Layer layer_; - unsigned current_metadata_number_; + 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); @@ -155,7 +152,7 @@ void DecoderCommon::common_metadata_callback_(const ::FLAC__StreamMetadata *meta if(error_occurred_) return; - printf("%d... ", current_metadata_number_); + printf("%u... ", current_metadata_number_); fflush(stdout); if(current_metadata_number_ >= num_expected_) { @@ -174,7 +171,7 @@ void DecoderCommon::common_metadata_callback_(const ::FLAC__StreamMetadata *meta void DecoderCommon::common_error_callback_(::FLAC__StreamDecoderErrorStatus status) { if(!ignore_errors_) { - printf("ERROR: got error callback: err = %u (%s)\n", (unsigned)status, ::FLAC__StreamDecoderErrorStatusString[status]); + printf("ERROR: got error callback: err = %u (%s)\n", (uint32_t)status, ::FLAC__StreamDecoderErrorStatusString[status]); error_occurred_ = true; } } @@ -197,6 +194,9 @@ public: 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) @@ -234,7 +234,7 @@ public: if(error_occurred_) return ::FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - if(fseeko(file_, (off_t)absolute_byte_offset, SEEK_SET) < 0) { + if(fseeko(file_, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0) { error_occurred_ = true; return ::FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; } @@ -250,7 +250,7 @@ public: if(error_occurred_) return ::FLAC__STREAM_DECODER_TELL_STATUS_ERROR; - off_t offset = ftello(file_); + FLAC__off_t offset = ftello(file_); *absolute_byte_offset = (FLAC__uint64)offset; if(offset < 0) { @@ -326,7 +326,7 @@ bool StreamDecoder::test_respond(bool is_ogg) 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", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); + printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); return false; } printf("OK\n"); @@ -334,7 +334,7 @@ bool StreamDecoder::test_respond(bool is_ogg) printf("testing finish()... "); if(!finish()) { State state = get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); + printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); return false; } printf("OK\n"); @@ -384,7 +384,7 @@ bool FileDecoder::test_respond(bool is_ogg) case LAYER_FILE: { printf("opening %sFLAC file... ", is_ogg? "Ogg ":""); - FILE *file = ::fopen(flacfilename(is_ogg), "rb"); + FILE *file = ::flac_fopen(flacfilename(is_ogg), "rb"); if(0 == file) { printf("ERROR (%s)\n", strerror(errno)); return false; @@ -412,7 +412,7 @@ bool FileDecoder::test_respond(bool is_ogg) 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", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); + printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); return false; } printf("OK\n"); @@ -420,7 +420,7 @@ bool FileDecoder::test_respond(bool is_ogg) printf("testing finish()... "); if(!finish()) { State state = get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); + printf("FAILED, returned false, state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); return false; } printf("OK\n"); @@ -459,6 +459,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing is_valid()... "); if(!decoder->is_valid()) { printf("FAILED, returned false\n"); + delete decoder; return false; } printf("OK\n"); @@ -481,6 +482,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing is_valid()... "); if(!decoder->is_valid()) { printf("FAILED, returned false\n"); + delete decoder; return false; } printf("OK\n"); @@ -504,6 +506,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) break; default: die_("internal error 006"); + delete decoder; return false; } if(init_status != ::FLAC__STREAM_DECODER_INIT_STATUS_OK) @@ -531,6 +534,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing is_valid()... "); if(!decoder->is_valid()) { printf("FAILED, returned false\n"); + delete decoder; return false; } printf("OK\n"); @@ -551,7 +555,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) case LAYER_STREAM: case LAYER_SEEKABLE_STREAM: printf("opening %sFLAC file... ", is_ogg? "Ogg ":""); - dynamic_cast<StreamDecoder*>(decoder)->file_ = ::fopen(flacfilename(is_ogg), "rb"); + dynamic_cast<StreamDecoder*>(decoder)->file_ = ::flac_fopen(flacfilename(is_ogg), "rb"); if(0 == dynamic_cast<StreamDecoder*>(decoder)->file_) { printf("ERROR (%s)\n", strerror(errno)); return false; @@ -564,7 +568,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) case LAYER_FILE: { printf("opening FLAC file... "); - FILE *file = ::fopen(flacfilename(is_ogg), "rb"); + FILE *file = ::flac_fopen(flacfilename(is_ogg), "rb"); if(0 == file) { printf("ERROR (%s)\n", strerror(errno)); return false; @@ -593,7 +597,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing get_state()... "); FLAC::Decoder::Stream::State state = decoder->get_state(); - printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); + printf("returned state = %u (%s)... OK\n", (uint32_t)((::FLAC__StreamDecoderState)state), state.as_cstring()); dynamic_cast<DecoderCommon*>(decoder)->current_metadata_number_ = 0; dynamic_cast<DecoderCommon*>(decoder)->ignore_errors_ = false; @@ -654,7 +658,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing get_channels()... "); { - unsigned channels = decoder->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; @@ -664,7 +668,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing get_bits_per_sample()... "); { - unsigned bits_per_sample = decoder->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; @@ -674,7 +678,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing get_sample_rate()... "); { - unsigned sample_rate = decoder->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; @@ -684,7 +688,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing get_blocksize()... "); { - unsigned blocksize = decoder->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) @@ -694,7 +698,7 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing get_channel_assignment()... "); { ::FLAC__ChannelAssignment ca = decoder->get_channel_assignment(); - printf("returned %u (%s)... OK\n", (unsigned)ca, ::FLAC__ChannelAssignmentString[ca]); + printf("returned %u (%s)... OK\n", (uint32_t)ca, ::FLAC__ChannelAssignmentString[ca]); } if(layer < LAYER_FILE) { @@ -723,8 +727,8 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("testing finish()... "); if(!decoder->finish()) { - FLAC::Decoder::Stream::State state = decoder->get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)state), state.as_cstring()); + 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"); @@ -741,11 +745,10 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes the seektable */ 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_; @@ -804,7 +807,8 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) num_expected_ = 0; expected_metadata_sequence_[num_expected_++] = &streaminfo_; expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; + if(!is_ogg) /* encoder removes seektable for ogg */ + expected_metadata_sequence_[num_expected_++] = &seektable_; expected_metadata_sequence_[num_expected_++] = &application1_; expected_metadata_sequence_[num_expected_++] = &application2_; expected_metadata_sequence_[num_expected_++] = &cuesheet_; @@ -833,11 +837,10 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes the seektable */ 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_; @@ -874,11 +877,10 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes the seektable */ 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_; @@ -924,11 +926,10 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes seektable */ 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_; @@ -1077,11 +1078,10 @@ static bool test_stream_decoder(Layer layer, bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes the seektable */ 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_; diff --git a/3rdparty/libflac/src/test_libFLAC++/decoders.h b/3rdparty/libflac/src/test_libFLAC++/decoders.h index 422c31c5ccd..4bbce132bd5 100644 --- a/3rdparty/libflac/src/test_libFLAC++/decoders.h +++ b/3rdparty/libflac/src/test_libFLAC++/decoders.h @@ -1,5 +1,6 @@ /* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 diff --git a/3rdparty/libflac/src/test_libFLAC++/encoders.cpp b/3rdparty/libflac/src/test_libFLAC++/encoders.cpp index 6b1ab69448e..0e356afe42c 100644 --- a/3rdparty/libflac/src/test_libFLAC++/encoders.cpp +++ b/3rdparty/libflac/src/test_libFLAC++/encoders.cpp @@ -1,5 +1,6 @@ /* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,11 +12,15 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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" @@ -28,6 +33,12 @@ extern "C" { #include <stdio.h> #include <stdlib.h> #include <string.h> +#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 */ @@ -45,7 +56,7 @@ static const char * const LayerString[] = { 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 unsigned num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]); +static const uint32_t num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]); static const char *flacfilename(bool is_ogg) { @@ -67,10 +78,10 @@ static bool die_s_(const char *msg, const FLAC::Encoder::Stream *encoder) else printf("FAILED"); - printf(", state = %u (%s)\n", (unsigned)((::FLAC__StreamEncoderState)state), state.as_cstring()); + 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", (unsigned)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); + printf(" verify decoder state = %u (%s)\n", (uint32_t)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); } return false; @@ -96,10 +107,13 @@ public: // 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, unsigned samples, unsigned current_frame); + ::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) @@ -117,7 +131,7 @@ public: return ::FLAC__STREAM_ENCODER_READ_STATUS_ABORT; } -::FLAC__StreamEncoderWriteStatus StreamEncoder::write_callback(const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame) +::FLAC__StreamEncoderWriteStatus StreamEncoder::write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame) { (void)samples, (void)current_frame; @@ -131,7 +145,7 @@ public: { if(layer_==LAYER_STREAM) return ::FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED; - else if(fseek(file_, (long)absolute_byte_offset, SEEK_SET) < 0) + 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; @@ -139,10 +153,10 @@ public: ::FLAC__StreamEncoderTellStatus StreamEncoder::tell_callback(FLAC__uint64 *absolute_byte_offset) { - long pos; + FLAC__off_t pos; if(layer_==LAYER_STREAM) return ::FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED; - else if((pos = ftell(file_)) < 0) + else if((pos = ftello(file_)) < 0) return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR; else { *absolute_byte_offset = (FLAC__uint64)pos; @@ -163,10 +177,10 @@ public: ~FileEncoder() { } // from FLAC::Encoder::File - void progress_callback(FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate); + 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, unsigned frames_written, unsigned 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; } @@ -186,7 +200,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) FILE *file = 0; FLAC__int32 samples[1024]; FLAC__int32 *samples_array[1] = { samples }; - unsigned i; + uint32_t i; printf("\n+++ libFLAC++ unit test: FLAC::Encoder::%s (layer: %s, format: %s)\n\n", layer<LAYER_FILE? "Stream":"File", LayerString[layer], is_ogg? "Ogg FLAC":"FLAC"); @@ -201,6 +215,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) printf("testing is_valid()... "); if(!encoder->is_valid()) { printf("FAILED, returned false\n"); + delete encoder; return false; } printf("OK\n"); @@ -238,7 +253,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) printf("OK\n"); printf("testing set_compression_level()... "); - if(!encoder->set_compression_level((unsigned)(-1))) + if(!encoder->set_compression_level((uint32_t)(-1))) return die_s_("returned false", encoder); printf("OK\n"); @@ -307,9 +322,14 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) return die_s_("returned false", encoder); printf("OK\n"); + printf("testing set_limit_min_bitrate()... "); + if(!encoder->set_limit_min_bitrate(true)) + return die_s_("returned false", encoder); + printf("OK\n"); + if(layer < LAYER_FILENAME) { printf("opening file for FLAC output... "); - file = ::fopen(flacfilename(is_ogg), "w+b"); + file = ::flac_fopen(flacfilename(is_ogg), "w+b"); if(0 == file) { printf("ERROR (%s)\n", strerror(errno)); return false; @@ -347,17 +367,17 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) printf("testing get_state()... "); FLAC::Encoder::Stream::State state = encoder->get_state(); - printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__StreamEncoderState)state), state.as_cstring()); + 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", (unsigned)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); + printf("returned state = %u (%s)... OK\n", (uint32_t)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); { FLAC__uint64 absolute_sample; - unsigned frame_number; - unsigned channel; - unsigned sample; + uint32_t frame_number; + uint32_t channel; + uint32_t sample; FLAC__int32 expected; FLAC__int32 got; @@ -424,7 +444,7 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) printf("testing get_max_lpc_order()... "); if(encoder->get_max_lpc_order() != 0) { - printf("FAILED, expected %u, got %u\n", 0, encoder->get_max_lpc_order()); + printf("FAILED, expected %d, got %u\n", 0, encoder->get_max_lpc_order()); return false; } printf("OK\n"); @@ -457,32 +477,35 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) printf("testing get_min_residual_partition_order()... "); if(encoder->get_min_residual_partition_order() != 0) { - printf("FAILED, expected %u, got %u\n", 0, encoder->get_min_residual_partition_order()); + 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 %u, got %u\n", 0, encoder->get_max_residual_partition_order()); + 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 %u, got %u\n", 0, encoder->get_rice_parameter_search_dist()); + 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) { -#ifdef _MSC_VER - printf("FAILED, expected %I64u, got %I64u\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate()); -#else - printf("FAILED, expected %llu, got %llu\n", (unsigned long long)streaminfo_.data.stream_info.total_samples, (unsigned long long)encoder->get_total_samples_estimate()); -#endif + printf("FAILED, expected %" PRIu64 ", got %" PRIu64 "\n", streaminfo_.data.stream_info.total_samples, encoder->get_total_samples_estimate()); + return false; + } + printf("OK\n"); + + printf("testing get_limit_min_bitrate()... "); + if(encoder->get_limit_min_bitrate() != true) { + printf("FAILED, expected true, got false\n"); return false; } printf("OK\n"); @@ -503,8 +526,8 @@ static bool test_stream_encoder(Layer layer, bool is_ogg) printf("testing finish()... "); if(!encoder->finish()) { - FLAC::Encoder::Stream::State state = encoder->get_state(); - printf("FAILED, returned false, state = %u (%s)\n", (unsigned)((::FLAC__StreamEncoderState)state), state.as_cstring()); + 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"); diff --git a/3rdparty/libflac/src/test_libFLAC++/encoders.h b/3rdparty/libflac/src/test_libFLAC++/encoders.h index 2b5c8c73971..9da415c5235 100644 --- a/3rdparty/libflac/src/test_libFLAC++/encoders.h +++ b/3rdparty/libflac/src/test_libFLAC++/encoders.h @@ -1,5 +1,6 @@ /* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 diff --git a/3rdparty/libflac/src/test_libFLAC++/main.cpp b/3rdparty/libflac/src/test_libFLAC++/main.cpp index 6a3a0a34e71..7183def77bd 100644 --- a/3rdparty/libflac/src/test_libFLAC++/main.cpp +++ b/3rdparty/libflac/src/test_libFLAC++/main.cpp @@ -1,5 +1,6 @@ /* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,11 +12,15 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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" diff --git a/3rdparty/libflac/src/test_libFLAC++/metadata.cpp b/3rdparty/libflac/src/test_libFLAC++/metadata.cpp index 135f61eff56..a31031b629e 100644 --- a/3rdparty/libflac/src/test_libFLAC++/metadata.cpp +++ b/3rdparty/libflac/src/test_libFLAC++/metadata.cpp @@ -1,5 +1,6 @@ /* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,11 +12,15 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 <stdio.h> diff --git a/3rdparty/libflac/src/test_libFLAC++/metadata.h b/3rdparty/libflac/src/test_libFLAC++/metadata.h index 090dcc4b6a4..8c45bc0a263 100644 --- a/3rdparty/libflac/src/test_libFLAC++/metadata.h +++ b/3rdparty/libflac/src/test_libFLAC++/metadata.h @@ -1,5 +1,6 @@ /* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 diff --git a/3rdparty/libflac/src/test_libFLAC++/metadata_manip.cpp b/3rdparty/libflac/src/test_libFLAC++/metadata_manip.cpp index 27336f92a0c..5d395dbd4cf 100644 --- a/3rdparty/libflac/src/test_libFLAC++/metadata_manip.cpp +++ b/3rdparty/libflac/src/test_libFLAC++/metadata_manip.cpp @@ -1,5 +1,6 @@ /* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,28 +12,23 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include <stdio.h> #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcpy()/memset() */ -#if defined _MSC_VER || defined __MINGW32__ -#include <sys/utime.h> /* for utime() */ -#include <io.h> /* for chmod() */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#else #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */ -#include <utime.h> /* for utime() */ +#ifdef _MSC_VER +#include <sys/utime.h> +#endif +#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__ #include <unistd.h> /* for chown(), unlink() */ #endif #include <sys/stat.h> /* for stat(), maybe chmod() */ @@ -40,6 +36,9 @@ #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" } @@ -69,14 +68,14 @@ protected: struct OurMetadata { FLAC::Metadata::Prototype *blocks[64]; - unsigned num_blocks; + 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 unsigned mc_our_block_number_ = 0; +static uint32_t mc_our_block_number_ = 0; static const char *flacfilename(bool is_ogg) { @@ -92,7 +91,7 @@ static bool die_(const char *msg) static bool die_c_(const char *msg, FLAC::Metadata::Chain::Status status) { printf("ERROR: %s\n", msg); - printf(" status=%u (%s)\n", (unsigned)((::FLAC__Metadata_ChainStatus)status), status.as_cstring()); + printf(" status=%u (%s)\n", (uint32_t)((::FLAC__Metadata_ChainStatus)status), status.as_cstring()); return false; } @@ -100,7 +99,7 @@ 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", (unsigned)((::FLAC__Metadata_SimpleIteratorStatus)status), status.as_cstring()); + printf(" status=%u (%s)\n", (uint32_t)((::FLAC__Metadata_SimpleIteratorStatus)status), status.as_cstring()); return false; } @@ -108,7 +107,7 @@ 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", (unsigned)size); + fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size); exit(1); } return x; @@ -126,9 +125,9 @@ static char *strdup_or_die_(const char *s) /* functions for working with our metadata copy */ -static bool replace_in_our_metadata_(FLAC::Metadata::Prototype *block, unsigned position, bool copy) +static bool replace_in_our_metadata_(FLAC::Metadata::Prototype *block, uint32_t position, bool copy) { - unsigned i; + uint32_t i; FLAC::Metadata::Prototype *obj = block; FLAC__ASSERT(position < our_metadata_.num_blocks); if(copy) { @@ -146,9 +145,9 @@ static bool replace_in_our_metadata_(FLAC::Metadata::Prototype *block, unsigned return true; } -static bool insert_to_our_metadata_(FLAC::Metadata::Prototype *block, unsigned position, bool copy) +static bool insert_to_our_metadata_(FLAC::Metadata::Prototype *block, uint32_t position, bool copy) { - unsigned i; + uint32_t i; FLAC::Metadata::Prototype *obj = block; if(copy) { if(0 == (obj = FLAC::Metadata::clone(block))) @@ -172,9 +171,9 @@ static bool insert_to_our_metadata_(FLAC::Metadata::Prototype *block, unsigned p return true; } -static void delete_from_our_metadata_(unsigned position) +static void delete_from_our_metadata_(uint32_t position) { - unsigned i; + 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++) @@ -189,11 +188,11 @@ static void delete_from_our_metadata_(unsigned position) } } -void add_to_padding_length_(unsigned index, int delta) +void add_to_padding_length_(uint32_t indx, int delta) { - FLAC::Metadata::Padding *padding = dynamic_cast<FLAC::Metadata::Padding *>(our_metadata_.blocks[index]); + FLAC::Metadata::Padding *padding = dynamic_cast<FLAC::Metadata::Padding *>(our_metadata_.blocks[indx]); FLAC__ASSERT(0 != padding); - padding->set_length((unsigned)((int)padding->get_length() + delta)); + padding->set_length((uint32_t)((int)padding->get_length() + delta)); } /* @@ -203,13 +202,15 @@ void add_to_padding_length_(unsigned index, int delta) 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; - if(0 == (*tempfilename = (char*)malloc(strlen(filename) + strlen(tempfile_suffix) + 1))) + *tempfilename = (char*)malloc(destlen); + if (*tempfilename == 0) return false; - strcpy(*tempfilename, filename); - strcat(*tempfilename, tempfile_suffix); + flac_snprintf(*tempfilename, destlen, "%s%s", filename, tempfile_suffix); - if(0 == (*tempfile = fopen(*tempfilename, "wb"))) + *tempfile = flac_fopen(*tempfilename, "wb"); + if (*tempfile == 0) return false; return true; @@ -217,13 +218,13 @@ bool open_tempfile_(const char *filename, FILE **tempfile, char **tempfilename) void cleanup_tempfile_(FILE **tempfile, char **tempfilename) { - if(0 != *tempfile) { + if (*tempfile != 0) { (void)fclose(*tempfile); *tempfile = 0; } - if(0 != *tempfilename) { - (void)unlink(*tempfilename); + if (*tempfilename != 0) { + (void)flac_unlink(*tempfilename); free(*tempfilename); *tempfilename = 0; } @@ -242,14 +243,14 @@ bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilen } #if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ - /* on some flavors of windows, rename() will fail if the destination already exists */ - if(unlink(filename) < 0) { + /* 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 != rename(*tempfilename, filename)) { + if(0 != flac_rename(*tempfilename, filename)) { cleanup_tempfile_(tempfile, tempfilename); return false; } @@ -259,27 +260,32 @@ bool transport_tempfile_(const char *filename, FILE **tempfile, char **tempfilen return true; } -bool get_file_stats_(const char *filename, struct stat *stats) +bool get_file_stats_(const char *filename, struct flac_stat_s *stats) { FLAC__ASSERT(0 != filename); FLAC__ASSERT(0 != stats); - return (0 == stat(filename, stats)); + return (0 == flac_stat(filename, stats)); } -void set_file_stats_(const char *filename, struct stat *stats) +void set_file_stats_(const char *filename, struct flac_stat_s *stats) { - struct utimbuf srctime; - FLAC__ASSERT(0 != filename); FLAC__ASSERT(0 != stats); +#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) && !defined(_WIN32) + 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; - (void)chmod(filename, stats->st_mode); - (void)utime(filename, &srctime); +#endif + (void)flac_chmod(filename, stats->st_mode); + (void)flac_utime(filename, &srctime); #if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__ - (void)chown(filename, stats->st_uid, (gid_t)(-1)); - (void)chown(filename, (uid_t)(-1), stats->st_gid); + FLAC_CHECK_RETURN(chown(filename, stats->st_uid, (gid_t)(-1))); + FLAC_CHECK_RETURN(chown(filename, (uid_t)(-1), stats->st_gid)); #endif } @@ -296,7 +302,7 @@ static size_t chain_write_cb_(const void *ptr, size_t size, size_t nmemb, ::FLAC static int chain_seek_cb_(::FLAC__IOHandle handle, FLAC__int64 offset, int whence) { - off_t o = (off_t)offset; + FLAC__off_t o = (FLAC__off_t)offset; FLAC__ASSERT(offset == o); return fseeko((FILE*)handle, o, whence); } @@ -329,14 +335,14 @@ static bool write_chain_(FLAC::Metadata::Chain &chain, bool use_padding, bool pr callbacks.eof = chain_eof_cb_; if(chain.check_if_tempfile_needed(use_padding)) { - struct stat stats; + 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 = fopen(filename, "rb"))) + if(0 == (file = flac_fopen(filename, "rb"))) return false; /*@@@@ chain status still says OK though */ if(!open_tempfile_(filename, &tempfile, &tempfilename)) { fclose(file); @@ -357,11 +363,13 @@ static bool write_chain_(FLAC::Metadata::Chain &chain, bool use_padding, bool pr set_file_stats_(filename, &stats); } else { - FILE *file = fopen(filename, "r+b"); + 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)) + if(!chain.write(use_padding, (::FLAC__IOHandle)file, callbacks)) { + fclose(file); return false; + } fclose(file); } } @@ -383,7 +391,7 @@ static bool read_chain_(FLAC::Metadata::Chain &chain, const char *filename, bool { bool ret; - FILE *file = fopen(filename, "rb"); + 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); @@ -395,9 +403,9 @@ static bool read_chain_(FLAC::Metadata::Chain &chain, const char *filename, bool /* function for comparing our metadata to a FLAC::Metadata::Chain */ -static bool compare_chain_(FLAC::Metadata::Chain &chain, unsigned current_position, FLAC::Metadata::Prototype *current_block) +static bool compare_chain_(FLAC::Metadata::Chain &chain, uint32_t current_position, FLAC::Metadata::Prototype *current_block) { - unsigned i; + uint32_t i; FLAC::Metadata::Iterator iterator; bool next_ok = true; @@ -467,7 +475,7 @@ void OurFileDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) if(error_occurred_) return; - printf("%d... ", mc_our_block_number_); + printf("%u... ", mc_our_block_number_); fflush(stdout); if(!ignore_metadata_) { @@ -489,14 +497,14 @@ void OurFileDecoder::metadata_callback(const ::FLAC__StreamMetadata *metadata) void OurFileDecoder::error_callback(::FLAC__StreamDecoderErrorStatus status) { error_occurred_ = true; - printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (unsigned)status); + 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]; - unsigned i = 0, n = 0; + uint32_t i = 0, n = 0; printf("generating %sFLAC file for test\n", is_ogg? "Ogg " : ""); @@ -517,7 +525,7 @@ static bool generate_file_(bool include_extras, bool is_ogg) memset(streaminfo.data.stream_info.md5sum, 0, 16); { - const unsigned vendor_string_length = (unsigned)strlen(FLAC__VENDOR_STRING); + 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; @@ -532,7 +540,7 @@ static bool generate_file_(bool include_extras, bool is_ogg) if (0 == (cuesheet = ::FLAC__metadata_object_new(::FLAC__METADATA_TYPE_CUESHEET))) return die_("priming our metadata"); cuesheet->is_last = false; - strcpy(cuesheet->data.cue_sheet.media_catalog_number, "bogo-MCN"); + 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)) @@ -763,7 +771,7 @@ static bool test_level_0_() 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=*/(unsigned)(-1), /*max_height=*/(unsigned)(-1), /*max_depth=*/(unsigned)(-1), /*max_colors=*/(unsigned)(-1))) + 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_()) */ @@ -780,7 +788,7 @@ static bool test_level_0_() 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=*/(unsigned)(-1), /*max_height=*/(unsigned)(-1), /*max_depth=*/(unsigned)(-1), /*max_colors=*/(unsigned)(-1))) + 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_()) */ @@ -803,7 +811,7 @@ static bool test_level_1_() FLAC::Metadata::Padding *padding; FLAC::Metadata::Application *app; FLAC__byte data[1000]; - unsigned our_current_position = 0; + uint32_t our_current_position = 0; // initialize 'data' to avoid Valgrind errors memset(data, 0, sizeof(data)); @@ -831,7 +839,7 @@ static bool test_level_1_() 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", (unsigned)iterator.is_writable()); + 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"); @@ -914,39 +922,59 @@ static bool test_level_1_() if(0 == (app = new FLAC::Metadata::Application())) return die_("new FLAC::Metadata::Application()"); - app->set_id((const unsigned char *)"duh"); + app->set_id((const uint8_t *)"duh"); printf("creating PADDING block\n"); - if(0 == (padding = new FLAC::Metadata::Padding())) + 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()) + 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)) + 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", (unsigned)iterator.is_writable()); + 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 + else { + delete app; + delete padding; return die_("iterator.set_block() returned true but shouldn't have"); + } + + if(iterator.status() != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT) + return die_("iterator.status() should have been FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT"); printf("[S]VP\tnext\n"); - if(!iterator.next()) + 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()) + 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"); @@ -990,6 +1018,9 @@ static bool test_level_1_() if(iterator.delete_block(false)) return die_ss_("iterator.delete_block(false) should have returned false", iterator); + if(iterator.status() != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT) + return die_("iterator.status() should have been FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT"); + if(!test_file_(/*is_ogg=*/false, /*ignore_metadata=*/false)) return false; @@ -1083,7 +1114,7 @@ static bool test_level_1_() our_current_position++; printf("S[V]P\tinsert APPLICATION after, expand into padding of exceeding size\n"); - app->set_id((const unsigned char *)"euh"); /* twiddle the id so that our comparison doesn't miss transposition */ + 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)) @@ -1099,7 +1130,7 @@ static bool test_level_1_() our_current_position++; printf("SVA[P]\tset APPLICATION, expand into padding of exceeding size\n"); - app->set_id((const unsigned char *)"fuh"); /* twiddle the id */ + 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)) @@ -1110,7 +1141,7 @@ static bool test_level_1_() return false; printf("SVA[A]P\tset APPLICATION (grow), don't expand into padding\n"); - app->set_id((const unsigned char *)"guh"); /* twiddle the id */ + 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)) @@ -1122,7 +1153,7 @@ static bool test_level_1_() return false; printf("SVA[A]P\tset APPLICATION (shrink), don't fill in with padding\n"); - app->set_id((const unsigned char *)"huh"); /* twiddle the id */ + 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)) @@ -1134,7 +1165,7 @@ static bool test_level_1_() return false; printf("SVA[A]P\tset APPLICATION (grow), expand into padding of exceeding size\n"); - app->set_id((const unsigned char *)"iuh"); /* twiddle the id */ + 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)) @@ -1147,7 +1178,7 @@ static bool test_level_1_() return false; printf("SVA[A]P\tset APPLICATION (shrink), fill in with padding\n"); - app->set_id((const unsigned char *)"juh"); /* twiddle the id */ + 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)) @@ -1182,7 +1213,7 @@ static bool test_level_1_() return false; printf("SVAAP[P]\tset APPLICATION (grow)\n"); - app->set_id((const unsigned char *)"kuh"); /* twiddle the id */ + 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)) @@ -1470,7 +1501,7 @@ static bool test_level_2_(bool filename_based, bool is_ogg) FLAC::Metadata::Application *app; FLAC::Metadata::Padding *padding; FLAC__byte data[2000]; - unsigned our_current_position; + uint32_t our_current_position; // initialize 'data' to avoid Valgrind errors memset(data, 0, sizeof(data)); @@ -1558,7 +1589,7 @@ static bool test_level_2_(bool filename_based, bool is_ogg) return die_("getting block from iterator"); if(0 == (app = new FLAC::Metadata::Application())) return die_("new FLAC::Metadata::Application()"); - app->set_id((const unsigned char *)"duh"); + 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; @@ -2076,7 +2107,7 @@ static bool test_level_2_misc_(bool is_ogg) printf("read chain (callback-based)\n"); { - FILE *file = fopen(flacfilename(is_ogg), "rb"); + FILE *file = flac_fopen(flacfilename(is_ogg), "rb"); if(0 == file) return die_("opening file"); if(!chain.read((::FLAC__IOHandle)file, callbacks)) { @@ -2097,7 +2128,7 @@ static bool test_level_2_misc_(bool is_ogg) printf("read chain (callback-based)\n"); { - FILE *file = fopen(flacfilename(is_ogg), "rb"); + FILE *file = flac_fopen(flacfilename(is_ogg), "rb"); if(0 == file) return die_("opening file"); if(!chain.read((::FLAC__IOHandle)file, callbacks)) { @@ -2125,7 +2156,7 @@ static bool test_level_2_misc_(bool is_ogg) printf("read chain (callback-based)\n"); { - FILE *file = fopen(flacfilename(is_ogg), "rb"); + FILE *file = flac_fopen(flacfilename(is_ogg), "rb"); if(0 == file) return die_("opening file"); if(!chain.read((::FLAC__IOHandle)file, callbacks)) { diff --git a/3rdparty/libflac/src/test_libFLAC++/metadata_object.cpp b/3rdparty/libflac/src/test_libFLAC++/metadata_object.cpp index 9e9aec440ff..ab4cfbfeee0 100644 --- a/3rdparty/libflac/src/test_libFLAC++/metadata_object.cpp +++ b/3rdparty/libflac/src/test_libFLAC++/metadata_object.cpp @@ -1,5 +1,6 @@ /* test_libFLAC++ - Unit tester for libFLAC++ - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,16 +12,21 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 "FLAC/assert.h" -#include "FLAC++/metadata.h" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> /* for malloc() */ #include <string.h> /* 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_; @@ -34,7 +40,7 @@ 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", (unsigned)size); + fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size); exit(1); } return x; @@ -50,18 +56,18 @@ static char *strdup_or_die_(const char *s) return x; } -static bool index_is_equal_(const ::FLAC__StreamMetadata_CueSheet_Index &index, const ::FLAC__StreamMetadata_CueSheet_Index &indexcopy) +static bool index_is_equal_(const ::FLAC__StreamMetadata_CueSheet_Index &indx, const ::FLAC__StreamMetadata_CueSheet_Index &indxcopy) { - if(indexcopy.offset != index.offset) + if(indxcopy.offset != indx.offset) return false; - if(indexcopy.number != index.number) + 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) { - unsigned i; + uint32_t i; if(trackcopy->offset != track->offset) return false; @@ -243,7 +249,7 @@ static void free_metadata_blocks_() bool test_metadata_object_streaminfo() { - unsigned expected_length; + uint32_t expected_length; printf("testing class FLAC::Metadata::StreamInfo\n"); @@ -476,7 +482,7 @@ bool test_metadata_object_streaminfo() bool test_metadata_object_padding() { - unsigned expected_length; + uint32_t expected_length; printf("testing class FLAC::Metadata::Padding\n"); @@ -637,7 +643,7 @@ bool test_metadata_object_padding() bool test_metadata_object_application() { - unsigned expected_length; + uint32_t expected_length; printf("testing class FLAC::Metadata::Application\n"); @@ -807,7 +813,7 @@ bool test_metadata_object_application() bool test_metadata_object_seektable() { - unsigned expected_length; + uint32_t expected_length; printf("testing class FLAC::Metadata::SeekTable\n"); @@ -1006,7 +1012,7 @@ bool test_metadata_object_seektable() bool test_metadata_object_vorbiscomment() { - unsigned expected_length; + uint32_t expected_length; printf("testing class FLAC::Metadata::VorbisComment::Entry\n"); @@ -1021,7 +1027,7 @@ bool test_metadata_object_vorbiscomment() } printf("OK\n"); - printf("testing Entry::Entry(const char *field, unsigned field_length)... "); + 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()"); @@ -1037,7 +1043,7 @@ bool test_metadata_object_vorbiscomment() printf("OK\n"); } - printf("testing Entry::Entry(const char *field_name, const char *field_value, unsigned field_value_length)... "); + 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()"); @@ -1119,7 +1125,7 @@ bool test_metadata_object_vorbiscomment() return die_("entry mismatch"); printf("OK\n"); - printf("testing Entry::set_field_value(const char *field_value, unsigned field_value_length)... "); + 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"))) @@ -1137,7 +1143,7 @@ bool test_metadata_object_vorbiscomment() return die_("entry mismatch"); printf("OK\n"); - printf("testing Entry::set_field(const char *field, unsigned field_length)... "); + 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"))) @@ -1422,7 +1428,7 @@ bool test_metadata_object_vorbiscomment() bool test_metadata_object_cuesheet() { - unsigned expected_length; + uint32_t expected_length; printf("testing class FLAC::Metadata::CueSheet::Track\n"); @@ -1694,7 +1700,7 @@ bool test_metadata_object_cuesheet() { char mcn[129]; memset(mcn, 0, sizeof(mcn)); - strcpy(mcn, "1234567890123"); + 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"); @@ -1801,7 +1807,7 @@ bool test_metadata_object_cuesheet() bool test_metadata_object_picture() { - unsigned expected_length; + uint32_t expected_length; printf("testing class FLAC::Metadata::Picture\n"); @@ -2020,7 +2026,7 @@ bool test_metadata_object_picture() printf("testing Picture::set_colors()... +\n"); printf(" Picture::get_colors()... "); block.set_colors(1u>16); - if(block.get_colors() != 1u>16) + if(block.get_colors() != (1u>16)) return die_("value mismatch, expected 2^16"); printf("OK\n"); diff --git a/3rdparty/libflac/src/test_libFLAC++/test_libFLAC++.dsp b/3rdparty/libflac/src/test_libFLAC++/test_libFLAC++.dsp deleted file mode 100644 index 0d256024d02..00000000000 --- a/3rdparty/libflac/src/test_libFLAC++/test_libFLAC++.dsp +++ /dev/null @@ -1,136 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_libFLAC++" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=test_libFLAC++ - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "test_libFLAC++.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "test_libFLAC++.mak" CFG="test_libFLAC++ - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "test_libFLAC++ - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "test_libFLAC++ - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "test_libFLAC++ - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GR /GX /O2 /I "..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\test_libs_common_static.lib ..\..\obj\release\lib\libFLAC++_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "test_libFLAC++ - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\test_libs_common_static.lib ..\..\obj\debug\lib\libFLAC++_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "test_libFLAC++ - Win32 Release" -# Name "test_libFLAC++ - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\decoders.cpp -# End Source File -# Begin Source File - -SOURCE=.\encoders.cpp -# End Source File -# Begin Source File - -SOURCE=.\main.cpp -# End Source File -# Begin Source File - -SOURCE=.\metadata.cpp -# End Source File -# Begin Source File - -SOURCE=.\metadata_manip.cpp -# End Source File -# Begin Source File - -SOURCE=.\metadata_object.cpp -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\decoders.h -# End Source File -# Begin Source File - -SOURCE=.\encoders.h -# End Source File -# Begin Source File - -SOURCE=.\metadata.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\README -# End Source File -# End Target -# End Project diff --git a/3rdparty/libflac/src/test_libFLAC++/test_libFLAC++.vcproj b/3rdparty/libflac/src/test_libFLAC++/test_libFLAC++.vcproj deleted file mode 100644 index ed392ab4d0e..00000000000 --- a/3rdparty/libflac/src/test_libFLAC++/test_libFLAC++.vcproj +++ /dev/null @@ -1,234 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="test_libFLAC++" - ProjectGUID="{4cefbc8d-c215-11db-8314-0800200c9a66}" - RootNamespace="test_libFLAC++" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\decoders.h" - > - </File> - <File - RelativePath=".\encoders.h" - > - </File> - <File - RelativePath=".\metadata.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\decoders.cpp" - > - </File> - <File - RelativePath=".\encoders.cpp" - > - </File> - <File - RelativePath=".\main.cpp" - > - </File> - <File - RelativePath=".\metadata.cpp" - > - </File> - <File - RelativePath=".\metadata_manip.cpp" - > - </File> - <File - RelativePath=".\metadata_object.cpp" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/test_libFLAC/CMakeLists.txt b/3rdparty/libflac/src/test_libFLAC/CMakeLists.txt new file mode 100644 index 00000000000..36a58200805 --- /dev/null +++ b/3rdparty/libflac/src/test_libFLAC/CMakeLists.txt @@ -0,0 +1,25 @@ +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 + "$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/bitreader.c" + "$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/bitwriter.c" + "$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/crc.c" + "$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/md5.c" + $<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h> + $<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>) + +target_compile_definitions(test_libFLAC PRIVATE + $<$<BOOL:${ENABLE_64_BIT_WORDS}>:ENABLE_64_BIT_WORDS>) +target_include_directories(test_libFLAC PRIVATE + "$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/include") +target_link_libraries(test_libFLAC FLAC grabbag test_libs_common) diff --git a/3rdparty/libflac/src/test_libFLAC/Makefile.am b/3rdparty/libflac/src/test_libFLAC/Makefile.am index d38f2999a7b..c77f87e85d9 100644 --- a/3rdparty/libflac/src/test_libFLAC/Makefile.am +++ b/3rdparty/libflac/src/test_libFLAC/Makefile.am @@ -1,5 +1,6 @@ # test_libFLAC - Unit tester for libFLAC -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,37 +12,52 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 = \ - Makefile.lite \ - test_libFLAC.dsp \ - test_libFLAC.vcproj + CMakeLists.txt -INCLUDES = -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 +flac__no_dll = -DFLAC__NO_DLL +endif + +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -I$(top_srcdir)/src/libFLAC/include $(flac__no_dll) -noinst_PROGRAMS = test_libFLAC 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-static.la \ + $(win_utf8_lib) \ @OGG_LIBS@ \ - @MINGW_WINSOCK_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 + metadata.h \ + md5.h + +CLEANFILES = test_libFLAC.exe diff --git a/3rdparty/libflac/src/test_libFLAC/Makefile.in b/3rdparty/libflac/src/test_libFLAC/Makefile.in index b43bc65b6df..ee0dcf8cdc1 100644 --- a/3rdparty/libflac/src/test_libFLAC/Makefile.in +++ b/3rdparty/libflac/src/test_libFLAC/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # test_libFLAC - Unit tester for libFLAC -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,20 +28,70 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ +# 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. VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +103,116 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +check_PROGRAMS = test_libFLAC$(EXEEXT) +subdir = src/test_libFLAC +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_test_libFLAC_OBJECTS = bitreader.$(OBJEXT) bitwriter.$(OBJEXT) \ + crc.$(OBJEXT) decoders.$(OBJEXT) encoders.$(OBJEXT) \ + endswap.$(OBJEXT) format.$(OBJEXT) main.$(OBJEXT) \ + metadata.$(OBJEXT) metadata_manip.$(OBJEXT) \ + metadata_object.$(OBJEXT) md5.$(OBJEXT) +test_libFLAC_OBJECTS = $(am_test_libFLAC_OBJECTS) +test_libFLAC_DEPENDENCIES = \ + $(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) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/bitreader.Po \ + ./$(DEPDIR)/bitwriter.Po ./$(DEPDIR)/crc.Po \ + ./$(DEPDIR)/decoders.Po ./$(DEPDIR)/encoders.Po \ + ./$(DEPDIR)/endswap.Po ./$(DEPDIR)/format.Po \ + ./$(DEPDIR)/main.Po ./$(DEPDIR)/md5.Po ./$(DEPDIR)/metadata.Po \ + ./$(DEPDIR)/metadata_manip.Po ./$(DEPDIR)/metadata_object.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_libFLAC_SOURCES) +DIST_SOURCES = $(test_libFLAC_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,298 +221,277 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ EXTRA_DIST = \ - Makefile.lite \ - test_libFLAC.dsp \ - test_libFLAC.vcproj - - -INCLUDES = -I$(top_srcdir)/src/libFLAC/include + CMakeLists.txt -noinst_PROGRAMS = test_libFLAC +@OS_IS_WINDOWS_TRUE@win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la +@OS_IS_WINDOWS_TRUE@flac__no_dll = -DFLAC__NO_DLL +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include -I$(top_srcdir)/src/libFLAC/include $(flac__no_dll) 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-static.la \ + $(win_utf8_lib) \ @OGG_LIBS@ \ - @MINGW_WINSOCK_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 - -subdir = src/test_libFLAC -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -noinst_PROGRAMS = test_libFLAC$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) - -am_test_libFLAC_OBJECTS = bitwriter.$(OBJEXT) decoders.$(OBJEXT) \ - encoders.$(OBJEXT) format.$(OBJEXT) main.$(OBJEXT) \ - metadata.$(OBJEXT) metadata_manip.$(OBJEXT) \ - metadata_object.$(OBJEXT) -test_libFLAC_OBJECTS = $(am_test_libFLAC_OBJECTS) -test_libFLAC_DEPENDENCIES = \ - $(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 -test_libFLAC_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/bitwriter.Po ./$(DEPDIR)/decoders.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/encoders.Po ./$(DEPDIR)/format.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/main.Po ./$(DEPDIR)/metadata.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/metadata_manip.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/metadata_object.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(test_libFLAC_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(test_libFLAC_SOURCES) + metadata.h \ + md5.h +CLEANFILES = test_libFLAC.exe all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/test_libFLAC/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -test_libFLAC$(EXEEXT): $(test_libFLAC_OBJECTS) $(test_libFLAC_DEPENDENCIES) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test_libFLAC/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/test_libFLAC/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test_libFLAC$(EXEEXT): $(test_libFLAC_OBJECTS) $(test_libFLAC_DEPENDENCIES) $(EXTRA_test_libFLAC_DEPENDENCIES) @rm -f test_libFLAC$(EXEEXT) - $(LINK) $(test_libFLAC_LDFLAGS) $(test_libFLAC_OBJECTS) $(test_libFLAC_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(test_libFLAC_OBJECTS) $(test_libFLAC_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitwriter.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoders.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoders.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/format.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_manip.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_object.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitreader.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bitwriter.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decoders.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encoders.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/endswap.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/format.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_manip.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_object.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -365,99 +499,94 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am -all-am: Makefile $(PROGRAMS) - +all-am: Makefile installdirs: install: install-am install-exec: install-exec-am @@ -469,51 +598,102 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/bitreader.Po + -rm -f ./$(DEPDIR)/bitwriter.Po + -rm -f ./$(DEPDIR)/crc.Po + -rm -f ./$(DEPDIR)/decoders.Po + -rm -f ./$(DEPDIR)/encoders.Po + -rm -f ./$(DEPDIR)/endswap.Po + -rm -f ./$(DEPDIR)/format.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/md5.Po + -rm -f ./$(DEPDIR)/metadata.Po + -rm -f ./$(DEPDIR)/metadata_manip.Po + -rm -f ./$(DEPDIR)/metadata_object.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/bitreader.Po + -rm -f ./$(DEPDIR)/bitwriter.Po + -rm -f ./$(DEPDIR)/crc.Po + -rm -f ./$(DEPDIR)/decoders.Po + -rm -f ./$(DEPDIR)/encoders.Po + -rm -f ./$(DEPDIR)/endswap.Po + -rm -f ./$(DEPDIR)/format.Po + -rm -f ./$(DEPDIR)/main.Po + -rm -f ./$(DEPDIR)/md5.Po + -rm -f ./$(DEPDIR)/metadata.Po + -rm -f ./$(DEPDIR)/metadata_manip.Po + -rm -f ./$(DEPDIR)/metadata_object.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -530,18 +710,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/test_libFLAC/Makefile.lite b/3rdparty/libflac/src/test_libFLAC/Makefile.lite deleted file mode 100644 index 60d9920316e..00000000000 --- a/3rdparty/libflac/src/test_libFLAC/Makefile.lite +++ /dev/null @@ -1,47 +0,0 @@ -# test_libFLAC - Unit tester for libFLAC -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -PROGRAM_NAME = test_libFLAC - -INCLUDES = -I../libFLAC/include -I$(topdir)/include - -ifeq ($(DARWIN_BUILD),yes) -EXPLICIT_LIBS = $(libdir)/libgrabbag.a $(libdir)/libreplaygain_analysis.a $(libdir)/libtest_libs_common.a $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm -else -LIBS = -lgrabbag -lreplaygain_analysis -ltest_libs_common -lFLAC -L$(OGG_LIB_DIR) -logg -lm -endif - -SRCS_C = \ - bitwriter.c \ - decoders.c \ - encoders.c \ - format.c \ - main.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/3rdparty/libflac/src/test_libFLAC/bitreader.c b/3rdparty/libflac/src/test_libFLAC/bitreader.c new file mode 100644 index 00000000000..d40bd1f2e14 --- /dev/null +++ b/3rdparty/libflac/src/test_libFLAC/bitreader.c @@ -0,0 +1,355 @@ +/* test_libFLAC - Unit tester for libFLAC + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include "FLAC/assert.h" +#include "share/compat.h" +#include "private/bitreader.h" /* from the libFLAC private include area */ +#include "bitreader.h" +#include <stdio.h> +#include <string.h> /* 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__bool read_limit_set; /* whether reads are limited */ + uint32_t read_limit; /* the remaining size of what can be read */ + uint32_t last_seen_framesync; /* the location of the last seen framesync, if it is in the buffer, in bits from front of buffer */ + FLAC__BitReaderReadCallback read_callback; + void *client_data; +}; + +static FLAC__bool read_callback(FLAC__byte buffer[], size_t *bytes, void *data); + +static void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out) +{ + uint32_t i, j; + if(br == 0) { + fprintf(out, "bitreader is NULL\n"); + } + else { + fprintf(out, "bitreader: capacity=%u words=%u bytes=%u consumed: words=%u, bits=%u\n", br->capacity, br->words, br->bytes, br->consumed_words, br->consumed_bits); + + for(i = 0; i < br->words; i++) { + fprintf(out, "%08X: ", i); + for(j = 0; j < FLAC__BITS_PER_WORD; j++) + if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits)) + fprintf(out, "."); + else + fprintf(out, "%01d", br->buffer[i] & ((brword)1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); + fprintf(out, "\n"); + } + if(br->bytes > 0) { + fprintf(out, "%08X: ", i); + for(j = 0; j < br->bytes*8; j++) + if(i < br->consumed_words || (i == br->consumed_words && j < br->consumed_bits)) + fprintf(out, "."); + else + fprintf(out, "%01d", br->buffer[i] & ((brword)1 << (br->bytes*8-j-1)) ? 1:0); + fprintf(out, "\n"); + } + } +} + +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/3rdparty/libflac/src/test_libFLAC/bitreader.h b/3rdparty/libflac/src/test_libFLAC/bitreader.h new file mode 100644 index 00000000000..f497acf6f02 --- /dev/null +++ b/3rdparty/libflac/src/test_libFLAC/bitreader.h @@ -0,0 +1,27 @@ +/* test_libFLAC - Unit tester for libFLAC + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef FLAC__TEST_LIBFLAC_BITREADER_H +#define FLAC__TEST_LIBFLAC_BITREADER_H + +#include "FLAC/ordinals.h" + +FLAC__bool test_bitreader(void); + +#endif diff --git a/3rdparty/libflac/src/test_libFLAC/bitwriter.c b/3rdparty/libflac/src/test_libFLAC/bitwriter.c index 7bc23a87ce3..0aafff2f12b 100644 --- a/3rdparty/libflac/src/test_libFLAC/bitwriter.c +++ b/3rdparty/libflac/src/test_libFLAC/bitwriter.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,57 +12,99 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include "FLAC/assert.h" +#include "share/compat.h" #include "private/bitwriter.h" /* from the libFLAC private include area */ #include "bitwriter.h" #include <stdio.h> #include <string.h> /* for memcmp() */ -/* adjust for compilers that can't understand using LLU suffix for uint64_t literals */ -#ifdef _MSC_VER -#define FLAC__U64L(x) x -#else -#define FLAC__U64L(x) x##LLU -#endif - /* * 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; when full, accum is appended to buffer */ - unsigned capacity; /* of buffer in words */ - unsigned words; /* # of complete words in buffer */ - unsigned bits; /* # of used bits in accum */ + 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 TOTAL_BITS(bw) ((bw)->words*sizeof(bwword)*8 + (bw)->bits) +#define WORDS_TO_BITS(words) ((words) * FLAC__BITS_PER_WORD) +#define TOTAL_BITS(bw) (WORDS_TO_BITS((bw)->words) + (bw)->bits) +static void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out) +{ + uint32_t i, j; + if(bw == 0) { + fprintf(out, "bitwriter is NULL\n"); + } + else { + fprintf(out, "bitwriter: capacity=%u words=%u bits=%u total_bits=%u\n", bw->capacity, bw->words, bw->bits, TOTAL_BITS(bw)); + + for(i = 0; i < bw->words; i++) { + fprintf(out, "%08X: ", i); + for(j = 0; j < FLAC__BITS_PER_WORD; j++) + fprintf(out, "%01d", bw->buffer[i] & ((bwword)1 << (FLAC__BITS_PER_WORD-j-1)) ? 1:0); + fprintf(out, "\n"); + } + if(bw->bits > 0) { + fprintf(out, "%08X: ", i); + for(j = 0; j < bw->bits; j++) + fprintf(out, "%01d", bw->accum & ((bwword)1 << (bw->bits-j-1)) ? 1:0); + fprintf(out, "\n"); + } + } +} FLAC__bool test_bitwriter(void) { FLAC__BitWriter *bw; FLAC__bool ok; - unsigned i, j; + 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 - unsigned words, bits; /* what we think bw->words and bw->bits should be */ +#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"); @@ -92,9 +135,8 @@ FLAC__bool test_bitwriter(void) printf("OK\n"); printf("testing init... "); - FLAC__bitwriter_init(bw); - if(0 == bw) { - printf("FAILED, returned NULL\n"); + if(!FLAC__bitwriter_init(bw)) { + printf("FAILED, returned false\n"); return false; } printf("OK\n"); @@ -115,19 +157,14 @@ FLAC__bool test_bitwriter(void) printf("OK\n"); printf("testing init... "); - FLAC__bitwriter_init(bw); - if(0 == bw) { - printf("FAILED, returned NULL\n"); + if(!FLAC__bitwriter_init(bw)) { + printf("FAILED, returned false\n"); return false; } printf("OK\n"); printf("testing clear... "); FLAC__bitwriter_clear(bw); - if(0 == bw) { - printf("FAILED, returned NULL\n"); - return false; - } printf("OK\n"); printf("testing delete... "); @@ -146,10 +183,11 @@ FLAC__bool test_bitwriter(void) printf("OK\n"); printf("testing init... "); - ok = FLAC__bitwriter_init(bw); - printf("%s\n", ok?"OK":"FAILED"); - if(!ok) + if(!FLAC__bitwriter_init(bw)) { + printf("FAILED, returned false\n"); return false; + } + printf("OK\n"); printf("testing clear... "); FLAC__bitwriter_clear(bw); @@ -179,10 +217,12 @@ FLAC__bool test_bitwriter(void) FLAC__bitwriter_dump(bw, stdout); return false; } - words = 4; - bits = 24; + /* 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 byte count %u != %u\n", bw->words, words); + printf("FAILED word count %u != %u\n", bw->words, words); FLAC__bitwriter_dump(bw, stdout); return false; } @@ -197,7 +237,7 @@ FLAC__bool test_bitwriter(void) return false; } if((bw->accum & 0x00ffffff) != test_pattern1[words]) { - printf("FAILED pattern match (bw->accum=%08X != %08X)\n", 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; } @@ -215,7 +255,7 @@ FLAC__bool test_bitwriter(void) test_pattern1[words] <<= 6; test_pattern1[words] |= 0x3d; if(bw->words != words) { - printf("FAILED byte count %u != %u\n", bw->words, words); + printf("FAILED word count %u != %u\n", bw->words, words); FLAC__bitwriter_dump(bw, stdout); return false; } @@ -230,7 +270,7 @@ FLAC__bool test_bitwriter(void) return false; } if((bw->accum & 0x3fffffff) != test_pattern1[words]) { - printf("FAILED pattern match (bw->accum=%08X != %08X)\n", 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; } @@ -300,11 +340,15 @@ FLAC__bool test_bitwriter(void) 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); @@ -314,11 +358,15 @@ FLAC__bool test_bitwriter(void) 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); @@ -328,11 +376,15 @@ FLAC__bool test_bitwriter(void) 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); @@ -342,11 +394,15 @@ FLAC__bool test_bitwriter(void) 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); @@ -356,11 +412,15 @@ FLAC__bool test_bitwriter(void) 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); @@ -370,11 +430,15 @@ FLAC__bool test_bitwriter(void) 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); @@ -383,7 +447,7 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x0000000000000000)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000000000); + 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) { @@ -393,7 +457,7 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x000000000000007F)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x000000000000007F); + 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) { @@ -403,7 +467,7 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x0000000000000080)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000000080); + 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) { @@ -413,7 +477,7 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x00000000000007FF)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x00000000000007FF); + 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) { @@ -423,7 +487,7 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x0000000000000800)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000000800); + 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) { @@ -433,7 +497,7 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x000000000000FFFF)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x000000000000FFFF); + 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) { @@ -443,12 +507,16 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x0000000000010000)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000010000); + 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); @@ -457,12 +525,16 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x00000000001FFFFF)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x00000000001FFFFF); + 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); @@ -471,12 +543,16 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x0000000000200000)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000000200000); + 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); @@ -485,12 +561,16 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x0000000003FFFFFF)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000003FFFFFF); + 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); @@ -499,12 +579,16 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x0000000004000000)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000004000000); + 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); @@ -513,12 +597,16 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x000000007FFFFFFF)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x000000007FFFFFFF); + 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); @@ -527,12 +615,16 @@ FLAC__bool test_bitwriter(void) printf("testing utf8_uint64(0x0000000080000000)... "); FLAC__bitwriter_clear(bw); - FLAC__bitwriter_write_utf8_uint64(bw, 0x0000000080000000); + 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); @@ -542,11 +634,15 @@ FLAC__bool test_bitwriter(void) 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); @@ -559,11 +655,19 @@ FLAC__bool test_bitwriter(void) 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); diff --git a/3rdparty/libflac/src/test_libFLAC/bitwriter.h b/3rdparty/libflac/src/test_libFLAC/bitwriter.h index 44b6ade55bd..9b6a82488df 100644 --- a/3rdparty/libflac/src/test_libFLAC/bitwriter.h +++ b/3rdparty/libflac/src/test_libFLAC/bitwriter.h @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 diff --git a/3rdparty/libflac/src/test_libFLAC/crc.c b/3rdparty/libflac/src/test_libFLAC/crc.c new file mode 100644 index 00000000000..8b87671190d --- /dev/null +++ b/3rdparty/libflac/src/test_libFLAC/crc.c @@ -0,0 +1,274 @@ +/* test_libFLAC - Unit tester for libFLAC + * Copyright (C) 2014-2023 Xiph.Org Foundation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> + +#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/3rdparty/libflac/src/plugin_xmms/tag.h b/3rdparty/libflac/src/test_libFLAC/crc.h index d952fbc6d52..11523cd8907 100644 --- a/3rdparty/libflac/src/plugin_xmms/tag.h +++ b/3rdparty/libflac/src/test_libFLAC/crc.h @@ -1,5 +1,5 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2002,2003,2004,2005,2006 Daisuke Shimamura +/* test_libFLAC - Unit tester for libFLAC + * Copyright (C) 2014-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,14 +11,16 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 +#ifndef FLAC__TEST_LIBFLAC_CRC_H +#define FLAC__TEST_LIBFLAC_CRC_H -gchar *flac_format_song_title(gchar * filename); +#include "FLAC/ordinals.h" + +FLAC__bool test_crc(void); #endif diff --git a/3rdparty/libflac/src/test_libFLAC/decoders.c b/3rdparty/libflac/src/test_libFLAC/decoders.c index 1d731cd484d..ae114ceda87 100644 --- a/3rdparty/libflac/src/test_libFLAC/decoders.c +++ b/3rdparty/libflac/src/test_libFLAC/decoders.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -24,16 +25,12 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#if defined _MSC_VER || defined __MINGW32__ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif -#endif #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" @@ -54,15 +51,16 @@ static const char * const LayerString[] = { typedef struct { Layer layer; FILE *file; - unsigned current_metadata_number; + 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 unsigned num_expected_; -static off_t flacfilesize_; +static uint32_t num_expected_; +static FLAC__off_t flacfilesize_; static const char *flacfilename(FLAC__bool is_ogg) { @@ -84,11 +82,17 @@ static FLAC__bool die_s_(const char *msg, const FLAC__StreamDecoder *decoder) else printf("FAILED"); - printf(", state = %u (%s)\n", (unsigned)state, FLAC__StreamDecoderStateString[state]); + 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_); @@ -169,7 +173,7 @@ static FLAC__StreamDecoderSeekStatus stream_decoder_seek_callback_(const FLAC__S if(dcd->error_occurred) return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; - if(fseeko(dcd->file, (off_t)absolute_byte_offset, SEEK_SET) < 0) { + if(fseeko(dcd->file, (FLAC__off_t)absolute_byte_offset, SEEK_SET) < 0) { dcd->error_occurred = true; return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR; } @@ -180,7 +184,7 @@ static FLAC__StreamDecoderSeekStatus stream_decoder_seek_callback_(const FLAC__S static FLAC__StreamDecoderTellStatus stream_decoder_tell_callback_(const FLAC__StreamDecoder *decoder, FLAC__uint64 *absolute_byte_offset, void *client_data) { StreamDecoderClientData *dcd = (StreamDecoderClientData*)client_data; - off_t offset; + FLAC__off_t offset; (void)decoder; @@ -277,9 +281,15 @@ static void stream_decoder_metadata_callback_(const FLAC__StreamDecoder *decoder if(dcd->error_occurred) return; - printf("%d... ", dcd->current_metadata_number); + 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; @@ -305,7 +315,7 @@ static void stream_decoder_error_callback_(const FLAC__StreamDecoder *decoder, F } if(!dcd->ignore_errors) { - printf("ERROR: got error callback: err = %u (%s)\n", (unsigned)status, FLAC__StreamDecoderErrorStatusString[status]); + printf("ERROR: got error callback: err = %u (%s)\n", (uint32_t)status, FLAC__StreamDecoderErrorStatusString[status]); dcd->error_occurred = true; } } @@ -320,7 +330,7 @@ static FLAC__bool stream_decoder_test_respond_(FLAC__StreamDecoder *decoder, Str /* 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 ":""); - dcd->file = fopen(flacfilename(is_ogg), "rb"); + open_test_file(dcd, is_ogg, "rb"); if(0 == dcd->file) { printf("ERROR (%s)\n", strerror(errno)); return false; @@ -471,7 +481,7 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) if(layer < LAYER_FILENAME) { printf("opening %sFLAC file... ", is_ogg? "Ogg ":""); - decoder_client_data.file = fopen(flacfilename(is_ogg), "rb"); + open_test_file(&decoder_client_data, is_ogg, "rb"); if(0 == decoder_client_data.file) { printf("ERROR (%s)\n", strerror(errno)); return false; @@ -575,7 +585,7 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_decoder_get_channels()... "); { - unsigned channels = FLAC__stream_decoder_get_channels(decoder); + 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; @@ -585,7 +595,7 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_decoder_get_bits_per_sample()... "); { - unsigned bits_per_sample = FLAC__stream_decoder_get_bits_per_sample(decoder); + 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; @@ -595,7 +605,7 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_decoder_get_sample_rate()... "); { - unsigned sample_rate = FLAC__stream_decoder_get_sample_rate(decoder); + 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; @@ -605,7 +615,7 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_decoder_get_blocksize()... "); { - unsigned blocksize = FLAC__stream_decoder_get_blocksize(decoder); + 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) @@ -615,7 +625,7 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_decoder_get_channel_assignment()... "); { FLAC__ChannelAssignment ca = FLAC__stream_decoder_get_channel_assignment(decoder); - printf("returned %u (%s)... OK\n", (unsigned)ca, FLAC__ChannelAssignmentString[ca]); + printf("returned %u (%s)... OK\n", (uint32_t)ca, FLAC__ChannelAssignmentString[ca]); } if(layer < LAYER_FILE) { @@ -660,11 +670,10 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes the seektable */ 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_; @@ -717,7 +726,8 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) num_expected_ = 0; expected_metadata_sequence_[num_expected_++] = &streaminfo_; expected_metadata_sequence_[num_expected_++] = &padding_; - expected_metadata_sequence_[num_expected_++] = &seektable_; + if(!is_ogg) /* encoder removes seektable for ogg */ + expected_metadata_sequence_[num_expected_++] = &seektable_; expected_metadata_sequence_[num_expected_++] = &application1_; expected_metadata_sequence_[num_expected_++] = &application2_; expected_metadata_sequence_[num_expected_++] = &cuesheet_; @@ -742,11 +752,10 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes the seektable */ 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_; @@ -779,11 +788,10 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes the seektable */ 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_; @@ -823,11 +831,10 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes the seektable */ 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_; @@ -952,11 +959,10 @@ static FLAC__bool test_stream_decoder(Layer layer, FLAC__bool is_ogg) printf("OK\n"); num_expected_ = 0; - if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping */ + if(is_ogg) { /* encoder moves vorbis comment after streaminfo according to ogg mapping. Also removes the seektable */ 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_; diff --git a/3rdparty/libflac/src/test_libFLAC/decoders.h b/3rdparty/libflac/src/test_libFLAC/decoders.h index 11df1062752..431eb176d24 100644 --- a/3rdparty/libflac/src/test_libFLAC/decoders.h +++ b/3rdparty/libflac/src/test_libFLAC/decoders.h @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 diff --git a/3rdparty/libflac/src/test_libFLAC/encoders.c b/3rdparty/libflac/src/test_libFLAC/encoders.c index 5927cb832d2..d3fd39dd78e 100644 --- a/3rdparty/libflac/src/test_libFLAC/encoders.c +++ b/3rdparty/libflac/src/test_libFLAC/encoders.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -28,6 +29,7 @@ #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" @@ -47,7 +49,7 @@ static const char * const LayerString[] = { 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 unsigned num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]); +static const uint32_t num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]); static const char *flacfilename(FLAC__bool is_ogg) { @@ -69,10 +71,10 @@ static FLAC__bool die_s_(const char *msg, const FLAC__StreamEncoder *encoder) else printf("FAILED"); - printf(", state = %u (%s)\n", (unsigned)state, FLAC__StreamEncoderStateString[state]); + 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", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); + printf(" verify decoder state = %u (%s)\n", (uint32_t)dstate, FLAC__StreamDecoderStateString[dstate]); } return false; @@ -105,7 +107,7 @@ static FLAC__StreamEncoderReadStatus stream_encoder_read_callback_(const FLAC__S 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, unsigned samples, unsigned current_frame, void *client_data) +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; @@ -119,7 +121,7 @@ static FLAC__StreamEncoderSeekStatus stream_encoder_seek_callback_(const FLAC__S { FILE *f = (FILE*)client_data; (void)encoder; - if(fseek(f, (long)absolute_byte_offset, SEEK_SET) < 0) + 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; @@ -128,9 +130,9 @@ static FLAC__StreamEncoderSeekStatus stream_encoder_seek_callback_(const FLAC__S static FLAC__StreamEncoderTellStatus stream_encoder_tell_callback_(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) { FILE *f = (FILE*)client_data; - long pos; + FLAC__off_t pos; (void)encoder; - if((pos = ftell(f)) < 0) + if((pos = ftello(f)) < 0) return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR; else { *absolute_byte_offset = (FLAC__uint64)pos; @@ -143,7 +145,7 @@ static void stream_encoder_metadata_callback_(const FLAC__StreamEncoder *encoder (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, unsigned frames_written, unsigned total_frames_estimate, 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; } @@ -157,7 +159,7 @@ static FLAC__bool test_stream_encoder(Layer layer, FLAC__bool is_ogg) FILE *file = 0; FLAC__int32 samples[1024]; FLAC__int32 *samples_array[1]; - unsigned i; + uint32_t i; samples_array[0] = samples; @@ -204,7 +206,7 @@ static FLAC__bool test_stream_encoder(Layer layer, FLAC__bool is_ogg) printf("OK\n"); printf("testing FLAC__stream_encoder_set_compression_level()... "); - if(!FLAC__stream_encoder_set_compression_level(encoder, (unsigned)(-1))) + if(!FLAC__stream_encoder_set_compression_level(encoder, (uint32_t)(-1))) return die_s_("returned false", encoder); printf("OK\n"); @@ -273,9 +275,14 @@ static FLAC__bool test_stream_encoder(Layer layer, FLAC__bool is_ogg) return die_s_("returned false", encoder); printf("OK\n"); + printf("testing FLAC__stream_encoder_set_limit_min_bitrate()... "); + if(!FLAC__stream_encoder_set_limit_min_bitrate(encoder, true)) + return die_s_("returned false", encoder); + printf("OK\n"); + if(layer < LAYER_FILENAME) { printf("opening file for FLAC output... "); - file = fopen(flacfilename(is_ogg), "w+b"); + file = flac_fopen(flacfilename(is_ogg), "w+b"); if(0 == file) { printf("ERROR (%s)\n", strerror(errno)); return false; @@ -318,17 +325,17 @@ static FLAC__bool test_stream_encoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_encoder_get_state()... "); state = FLAC__stream_encoder_get_state(encoder); - printf("returned state = %u (%s)... OK\n", (unsigned)state, FLAC__StreamEncoderStateString[state]); + 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", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); + printf("returned state = %u (%s)... OK\n", (uint32_t)dstate, FLAC__StreamDecoderStateString[dstate]); { FLAC__uint64 absolute_sample; - unsigned frame_number; - unsigned channel; - unsigned sample; + uint32_t frame_number; + uint32_t channel; + uint32_t sample; FLAC__int32 expected; FLAC__int32 got; @@ -395,7 +402,7 @@ static FLAC__bool test_stream_encoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_encoder_get_max_lpc_order()... "); if(FLAC__stream_encoder_get_max_lpc_order(encoder) != 0) { - printf("FAILED, expected %u, got %u\n", 0, FLAC__stream_encoder_get_max_lpc_order(encoder)); + printf("FAILED, expected %d, got %u\n", 0, FLAC__stream_encoder_get_max_lpc_order(encoder)); return false; } printf("OK\n"); @@ -428,35 +435,37 @@ static FLAC__bool test_stream_encoder(Layer layer, FLAC__bool is_ogg) printf("testing FLAC__stream_encoder_get_min_residual_partition_order()... "); if(FLAC__stream_encoder_get_min_residual_partition_order(encoder) != 0) { - printf("FAILED, expected %u, got %u\n", 0, FLAC__stream_encoder_get_min_residual_partition_order(encoder)); + 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 %u, got %u\n", 0, FLAC__stream_encoder_get_max_residual_partition_order(encoder)); + 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 %u, got %u\n", 0, FLAC__stream_encoder_get_rice_parameter_search_dist(encoder)); + 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) { -#ifdef _MSC_VER - printf("FAILED, expected %I64u, got %I64u\n", streaminfo_.data.stream_info.total_samples, FLAC__stream_encoder_get_total_samples_estimate(encoder)); -#else - printf("FAILED, expected %llu, got %llu\n", (unsigned long long)streaminfo_.data.stream_info.total_samples, (unsigned long long)FLAC__stream_encoder_get_total_samples_estimate(encoder)); -#endif + 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"); + + printf("testing FLAC__stream_encoder_get_limit_min_bitrate()... "); + if(FLAC__stream_encoder_get_limit_min_bitrate(encoder) != true) { + printf("FAILED, expected true, got false\n"); + return false; + } /* init the dummy sample buffer */ for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++) diff --git a/3rdparty/libflac/src/test_libFLAC/encoders.h b/3rdparty/libflac/src/test_libFLAC/encoders.h index 86c3690943c..7bdcaf5c0a0 100644 --- a/3rdparty/libflac/src/test_libFLAC/encoders.h +++ b/3rdparty/libflac/src/test_libFLAC/encoders.h @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 diff --git a/3rdparty/libflac/src/test_libFLAC/endswap.c b/3rdparty/libflac/src/test_libFLAC/endswap.c new file mode 100644 index 00000000000..808f81f3a6d --- /dev/null +++ b/3rdparty/libflac/src/test_libFLAC/endswap.c @@ -0,0 +1,111 @@ +/* test_libFLAC - Unit tester for libFLAC + * Copyright (C) 2014-2023 Xiph.Org Foundation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> + +#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_BIG_ENDIAN ? "big" : "little"); + + 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/3rdparty/libflac/src/plugin_xmms/http.h b/3rdparty/libflac/src/test_libFLAC/endswap.h index 00254307269..952b17f09ac 100644 --- a/3rdparty/libflac/src/plugin_xmms/http.h +++ b/3rdparty/libflac/src/test_libFLAC/endswap.h @@ -1,4 +1,5 @@ -/* libxmms-flac - XMMS FLAC input plugin +/* test_libFLAC - Unit tester for libFLAC + * Copyright (C) 2014-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -10,17 +11,16 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 +#ifndef FLAC__TEST_LIBFLAC_ENDSWAP_H +#define FLAC__TEST_LIBFLAC_ENDSWAP_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); +#include "FLAC/ordinals.h" +FLAC__bool test_endswap(void); #endif diff --git a/3rdparty/libflac/src/test_libFLAC/format.c b/3rdparty/libflac/src/test_libFLAC/format.c index 7ac115d0f20..c5e8bf27857 100644 --- a/3rdparty/libflac/src/test_libFLAC/format.c +++ b/3rdparty/libflac/src/test_libFLAC/format.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2004-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -28,11 +29,11 @@ static const char *true_false_string_[2] = { "false", "true" }; static struct { - unsigned rate; + uint32_t rate; FLAC__bool valid; FLAC__bool subset; } SAMPLE_RATES[] = { - { 0 , false, false }, + { 0 , true , true }, { 1 , true , true }, { 9 , true , true }, { 10 , true , true }, @@ -64,11 +65,14 @@ static struct { { 500010 , true , true }, { 655349 , true , false }, { 655350 , true , true }, - { 655351 , false, false }, - { 655360 , false, false }, - { 700000 , false, false }, - { 700010 , false, false }, - { 1000000, false, false }, + { 655351 , true , false }, + { 655360 , true , false }, + { 700000 , true , false }, + { 700010 , true , false }, + { 705600 , true , false }, + { 768000 , true , false }, + { 1000000, true , false }, + { 1048575, true , false }, { 1100000, false, false } }; @@ -88,7 +92,7 @@ static struct { }; static struct { - unsigned length; + uint32_t length; const FLAC__byte *string; FLAC__bool valid; } VCENTRY_VALUES[] = { @@ -152,7 +156,7 @@ static struct { }; static struct { - unsigned length; + uint32_t length; const FLAC__byte *string; FLAC__bool valid; } VCENTRIES[] = { @@ -193,7 +197,7 @@ static struct { FLAC__bool test_format(void) { - unsigned i; + uint32_t i; printf("\n+++ libFLAC unit test: format\n\n"); @@ -235,7 +239,7 @@ FLAC__bool test_format(void) 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, (unsigned)(-1)) != VCENTRY_VALUES_NT[i].valid) { + 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; } diff --git a/3rdparty/libflac/src/test_libFLAC/format.h b/3rdparty/libflac/src/test_libFLAC/format.h index e48a0e09299..f78d55df23a 100644 --- a/3rdparty/libflac/src/test_libFLAC/format.h +++ b/3rdparty/libflac/src/test_libFLAC/format.h @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2004-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 diff --git a/3rdparty/libflac/src/test_libFLAC/main.c b/3rdparty/libflac/src/test_libFLAC/main.c index 1807ff583c1..a4be0fee025 100644 --- a/3rdparty/libflac/src/test_libFLAC/main.c +++ b/3rdparty/libflac/src/test_libFLAC/main.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,24 +12,38 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #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(int argc, char *argv[]) +int main(void) { - (void)argc, (void)argv; + 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; diff --git a/3rdparty/libflac/src/test_libFLAC/md5.c b/3rdparty/libflac/src/test_libFLAC/md5.c new file mode 100644 index 00000000000..bac4a74ad48 --- /dev/null +++ b/3rdparty/libflac/src/test_libFLAC/md5.c @@ -0,0 +1,221 @@ +/* test_libFLAC - Unit tester for libFLAC + * Copyright (C) 2014-2023 Xiph.Org Foundation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> + +#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/3rdparty/libflac/src/plugin_xmms/plugin.h b/3rdparty/libflac/src/test_libFLAC/md5.h index 334c167be69..6863268d3e5 100644 --- a/3rdparty/libflac/src/plugin_xmms/plugin.h +++ b/3rdparty/libflac/src/test_libFLAC/md5.h @@ -1,5 +1,5 @@ -/* libxmms-flac - XMMS FLAC input plugin - * Copyright (C) 2004,2005,2006,2007 Josh Coalson +/* test_libFLAC - Unit tester for libFLAC + * Copyright (C) 2014-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,14 +11,16 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 +#ifndef FLAC__TEST_LIBFLAC_MD5_H +#define FLAC__TEST_LIBFLAC_MD5_H -void set_track_info(const char* title, int length_in_msec); +#include "FLAC/ordinals.h" + +FLAC__bool test_md5(void); #endif diff --git a/3rdparty/libflac/src/test_libFLAC/metadata.c b/3rdparty/libflac/src/test_libFLAC/metadata.c index aacb6bfd28c..0347f6d2bfe 100644 --- a/3rdparty/libflac/src/test_libFLAC/metadata.c +++ b/3rdparty/libflac/src/test_libFLAC/metadata.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif diff --git a/3rdparty/libflac/src/test_libFLAC/metadata.h b/3rdparty/libflac/src/test_libFLAC/metadata.h index 055156405dc..51bdf7aab13 100644 --- a/3rdparty/libflac/src/test_libFLAC/metadata.h +++ b/3rdparty/libflac/src/test_libFLAC/metadata.h @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,9 +12,9 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 diff --git a/3rdparty/libflac/src/test_libFLAC/metadata_manip.c b/3rdparty/libflac/src/test_libFLAC/metadata_manip.c index b3875318af0..334dc3ae867 100644 --- a/3rdparty/libflac/src/test_libFLAC/metadata_manip.c +++ b/3rdparty/libflac/src/test_libFLAC/metadata_manip.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -26,13 +27,8 @@ #if defined _MSC_VER || defined __MINGW32__ #include <sys/utime.h> /* for utime() */ #include <io.h> /* for chmod() */ -#if _MSC_VER <= 1600 /* @@@ [2G limit] */ -#define fseeko fseek -#define ftello ftell -#endif #else #include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */ -#include <utime.h> /* for utime() */ #include <unistd.h> /* for chown(), unlink() */ #endif #include <sys/stat.h> /* for stat(), maybe chmod() */ @@ -40,6 +36,9 @@ #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" @@ -62,14 +61,14 @@ typedef struct { typedef struct { FLAC__StreamMetadata *blocks[64]; - unsigned num_blocks; + 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 unsigned mc_our_block_number_ = 0; +static uint32_t mc_our_block_number_ = 0; static const char *flacfilename(FLAC__bool is_ogg) { @@ -100,7 +99,7 @@ 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", (unsigned)size); + fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size); exit(1); } return x; @@ -118,9 +117,9 @@ static char *strdup_or_die_(const char *s) /* functions for working with our metadata copy */ -static FLAC__bool replace_in_our_metadata_(FLAC__StreamMetadata *block, unsigned position, FLAC__bool copy) +static FLAC__bool replace_in_our_metadata_(FLAC__StreamMetadata *block, uint32_t position, FLAC__bool copy) { - unsigned i; + uint32_t i; FLAC__StreamMetadata *obj = block; FLAC__ASSERT(position < our_metadata_.num_blocks); if(copy) { @@ -138,9 +137,9 @@ static FLAC__bool replace_in_our_metadata_(FLAC__StreamMetadata *block, unsigned return true; } -static FLAC__bool insert_to_our_metadata_(FLAC__StreamMetadata *block, unsigned position, FLAC__bool copy) +static FLAC__bool insert_to_our_metadata_(FLAC__StreamMetadata *block, uint32_t position, FLAC__bool copy) { - unsigned i; + uint32_t i; FLAC__StreamMetadata *obj = block; if(copy) { if(0 == (obj = FLAC__metadata_object_clone(block))) @@ -164,9 +163,9 @@ static FLAC__bool insert_to_our_metadata_(FLAC__StreamMetadata *block, unsigned return true; } -static void delete_from_our_metadata_(unsigned position) +static void delete_from_our_metadata_(uint32_t position) { - unsigned i; + 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++) @@ -188,13 +187,16 @@ static void delete_from_our_metadata_(unsigned position) 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; - if(0 == (*tempfilename = (char*)malloc(strlen(filename) + strlen(tempfile_suffix) + 1))) + *tempfilename = malloc(dest_len); + if (*tempfilename == NULL) return false; - strcpy(*tempfilename, filename); - strcat(*tempfilename, tempfile_suffix); + safe_strncpy(*tempfilename, filename, dest_len); + safe_strncat(*tempfilename, tempfile_suffix, dest_len); - if(0 == (*tempfile = fopen(*tempfilename, "wb"))) + *tempfile = flac_fopen(*tempfilename, "wb"); + if (*tempfile == NULL) return false; return true; @@ -202,13 +204,13 @@ static FLAC__bool open_tempfile_(const char *filename, FILE **tempfile, char **t static void cleanup_tempfile_(FILE **tempfile, char **tempfilename) { - if(0 != *tempfile) { + if (*tempfile != NULL) { (void)fclose(*tempfile); *tempfile = 0; } - if(0 != *tempfilename) { - (void)unlink(*tempfilename); + if (*tempfilename != NULL) { + (void)flac_unlink(*tempfilename); free(*tempfilename); *tempfilename = 0; } @@ -227,14 +229,14 @@ static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, cha } #if defined _MSC_VER || defined __MINGW32__ || defined __EMX__ - /* on some flavors of windows, rename() will fail if the destination already exists */ - if(unlink(filename) < 0) { + /* 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 != rename(*tempfilename, filename)) { + if(0 != flac_rename(*tempfilename, filename)) { cleanup_tempfile_(tempfile, tempfilename); return false; } @@ -244,27 +246,32 @@ static FLAC__bool transport_tempfile_(const char *filename, FILE **tempfile, cha return true; } -static FLAC__bool get_file_stats_(const char *filename, struct stat *stats) +static FLAC__bool get_file_stats_(const char *filename, struct flac_stat_s *stats) { FLAC__ASSERT(0 != filename); FLAC__ASSERT(0 != stats); - return (0 == stat(filename, stats)); + return (0 == flac_stat(filename, stats)); } -static void set_file_stats_(const char *filename, struct stat *stats) +static void set_file_stats_(const char *filename, struct flac_stat_s *stats) { +#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L) && !defined(_WIN32) + 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); - srctime.actime = stats->st_atime; - srctime.modtime = stats->st_mtime; - (void)chmod(filename, stats->st_mode); - (void)utime(filename, &srctime); -#if !defined _MSC_VER && !defined __MINGW32__ && !defined __EMX__ - (void)chown(filename, stats->st_uid, -1); - (void)chown(filename, -1, stats->st_gid); + (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 } @@ -281,7 +288,7 @@ static size_t chain_write_cb_(const void *ptr, size_t size, size_t nmemb, FLAC__ static int chain_seek_cb_(FLAC__IOHandle handle, FLAC__int64 offset, int whence) { - off_t o = (off_t)offset; + FLAC__off_t o = (FLAC__off_t)offset; FLAC__ASSERT(offset == o); return fseeko((FILE*)handle, o, whence); } @@ -314,14 +321,14 @@ static FLAC__bool write_chain_(FLAC__Metadata_Chain *chain, FLAC__bool use_paddi callbacks.eof = chain_eof_cb_; if(FLAC__metadata_chain_check_if_tempfile_needed(chain, use_padding)) { - struct stat stats; + 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 = fopen(filename, "rb"))) + if(0 == (file = flac_fopen(filename, "rb"))) return false; /*@@@@ chain status still says OK though */ if(!open_tempfile_(filename, &tempfile, &tempfilename)) { fclose(file); @@ -342,7 +349,7 @@ static FLAC__bool write_chain_(FLAC__Metadata_Chain *chain, FLAC__bool use_paddi set_file_stats_(filename, &stats); } else { - FILE *file = fopen(filename, "r+b"); + 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)) @@ -371,7 +378,7 @@ static FLAC__bool read_chain_(FLAC__Metadata_Chain *chain, const char *filename, { FLAC__bool ret; - FILE *file = fopen(filename, "rb"); + FILE *file = flac_fopen(filename, "rb"); if(0 == file) return false; /*@@@@ chain status still says OK though */ ret = is_ogg? @@ -386,9 +393,9 @@ static FLAC__bool read_chain_(FLAC__Metadata_Chain *chain, const char *filename, /* function for comparing our metadata to a FLAC__Metadata_Chain */ -static FLAC__bool compare_chain_(FLAC__Metadata_Chain *chain, unsigned current_position, FLAC__StreamMetadata *current_block) +static FLAC__bool compare_chain_(FLAC__Metadata_Chain *chain, uint32_t current_position, FLAC__StreamMetadata *current_block) { - unsigned i; + uint32_t i; FLAC__Metadata_Iterator *iterator; FLAC__StreamMetadata *block; FLAC__bool next_ok = true; @@ -465,7 +472,7 @@ static void decoder_metadata_callback_null_(const FLAC__StreamDecoder *decoder, { (void)decoder, (void)metadata, (void)client_data; - printf("%d... ", mc_our_block_number_); + printf("%u... ", mc_our_block_number_); fflush(stdout); mc_our_block_number_++; @@ -482,7 +489,7 @@ static void decoder_metadata_callback_compare_(const FLAC__StreamDecoder *decode if(dcd->error_occurred) return; - printf("%d... ", mc_our_block_number_); + printf("%u... ", mc_our_block_number_); fflush(stdout); if(mc_our_block_number_ >= our_metadata_.num_blocks) { @@ -504,14 +511,14 @@ static void decoder_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__St (void)decoder; dcd->error_occurred = true; - printf("ERROR: got error callback, status = %s (%u)\n", FLAC__StreamDecoderErrorStatusString[status], (unsigned)status); + 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]; - unsigned i = 0, n = 0; + uint32_t i = 0, n = 0; printf("generating %sFLAC file for test\n", is_ogg? "Ogg " : ""); @@ -532,7 +539,7 @@ static FLAC__bool generate_file_(FLAC__bool include_extras, FLAC__bool is_ogg) memset(streaminfo.data.stream_info.md5sum, 0, 16); { - const unsigned vendor_string_length = (unsigned)strlen(FLAC__VENDOR_STRING); + 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; @@ -547,7 +554,7 @@ static FLAC__bool generate_file_(FLAC__bool include_extras, FLAC__bool is_ogg) if (0 == (cuesheet = FLAC__metadata_object_new(FLAC__METADATA_TYPE_CUESHEET))) return die_("priming our metadata"); cuesheet->is_last = false; - strcpy(cuesheet->data.cue_sheet.media_catalog_number, "bogo-MCN"); + 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)) @@ -748,7 +755,7 @@ static FLAC__bool test_level_0_(void) 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=*/(unsigned)(-1), /*max_height=*/(unsigned)(-1), /*max_depth=*/(unsigned)(-1), /*max_colors=*/(unsigned)(-1))) + 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_()) */ @@ -770,7 +777,7 @@ static FLAC__bool test_level_1_(void) FLAC__Metadata_SimpleIterator *iterator; FLAC__StreamMetadata *block, *app, *padding; FLAC__byte data[1000]; - unsigned our_current_position = 0; + uint32_t our_current_position = 0; /* initialize 'data' to avoid Valgrind errors */ memset(data, 0, sizeof(data)); @@ -796,7 +803,7 @@ static FLAC__bool test_level_1_(void) 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", (unsigned)FLAC__metadata_simple_iterator_is_writable(iterator)); + 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"); @@ -892,7 +899,7 @@ static FLAC__bool test_level_1_(void) return die_("FLAC__metadata_simple_iterator_init() returned false"); our_current_position = 0; - printf("is writable = %u\n", (unsigned)FLAC__metadata_simple_iterator_is_writable(iterator)); + 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)) @@ -900,6 +907,9 @@ static FLAC__bool test_level_1_(void) else return die_("FLAC__metadata_simple_iterator_set_block() returned true but shouldn't have"); + if(FLAC__metadata_simple_iterator_status(iterator) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT) + return die_("FLAC__metadata_simple_iterator_status() should have been FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT"); + printf("[S]VP\tnext\n"); if(!FLAC__metadata_simple_iterator_next(iterator)) return die_("iterator ended early\n"); @@ -951,6 +961,9 @@ static FLAC__bool test_level_1_(void) 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(FLAC__metadata_simple_iterator_status(iterator) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT) + return die_("FLAC__metadata_simple_iterator_status() should have been FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ILLEGAL_INPUT"); + if(!test_file_(/*is_ogg=*/false, decoder_metadata_callback_compare_)) return false; @@ -1431,7 +1444,7 @@ static FLAC__bool test_level_2_(FLAC__bool filename_based, FLAC__bool is_ogg) FLAC__Metadata_Chain *chain; FLAC__StreamMetadata *block, *app, *padding; FLAC__byte data[2000]; - unsigned our_current_position; + uint32_t our_current_position; /* initialize 'data' to avoid Valgrind errors */ memset(data, 0, sizeof(data)); @@ -1995,7 +2008,7 @@ static FLAC__bool test_level_2_misc_(FLAC__bool is_ogg) printf("read chain (callback-based)\n"); { - FILE *file = fopen(flacfilename(is_ogg), "rb"); + 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)) { @@ -2016,7 +2029,7 @@ static FLAC__bool test_level_2_misc_(FLAC__bool is_ogg) printf("read chain (callback-based)\n"); { - FILE *file = fopen(flacfilename(is_ogg), "rb"); + 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)) { @@ -2044,7 +2057,7 @@ static FLAC__bool test_level_2_misc_(FLAC__bool is_ogg) printf("read chain (callback-based)\n"); { - FILE *file = fopen(flacfilename(is_ogg), "rb"); + 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)) { diff --git a/3rdparty/libflac/src/test_libFLAC/metadata_object.c b/3rdparty/libflac/src/test_libFLAC/metadata_object.c index 617248fb14f..ea6b69fd7ba 100644 --- a/3rdparty/libflac/src/test_libFLAC/metadata_object.c +++ b/3rdparty/libflac/src/test_libFLAC/metadata_object.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,28 +12,29 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include "FLAC/assert.h" #include "FLAC/metadata.h" #include "test_libs_common/metadata_utils.h" +#include "share/compat.h" #include "metadata.h" #include <stdio.h> #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcmp() */ -static FLAC__byte *make_dummydata_(FLAC__byte *dummydata, unsigned len) +static FLAC__byte *make_dummydata_(FLAC__byte *dummydata, uint32_t len) { FLAC__byte *ret; - if(0 == (ret = (FLAC__byte*)malloc(len))) { + if(0 == (ret = malloc(len))) { printf("FAILED, malloc error\n"); exit(1); } @@ -44,18 +46,14 @@ static FLAC__byte *make_dummydata_(FLAC__byte *dummydata, unsigned len) static FLAC__bool compare_track_(const FLAC__StreamMetadata_CueSheet_Track *from, const FLAC__StreamMetadata_CueSheet_Track *to) { - unsigned i; + uint32_t i; if(from->offset != to->offset) { -#ifdef _MSC_VER - printf("FAILED, track offset mismatch, expected %I64u, got %I64u\n", to->offset, from->offset); -#else - printf("FAILED, track offset mismatch, expected %llu, got %llu\n", (unsigned long long)to->offset, (unsigned long long)from->offset); -#endif + 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", (unsigned)to->number, (unsigned)from->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)) { @@ -63,15 +61,15 @@ static FLAC__bool compare_track_(const FLAC__StreamMetadata_CueSheet_Track *from return false; } if(from->type != to->type) { - printf("FAILED, track type mismatch, expected %u, got %u\n", (unsigned)to->type, (unsigned)from->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", (unsigned)to->pre_emphasis, (unsigned)from->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", (unsigned)to->num_indices, (unsigned)from->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) { @@ -83,15 +81,11 @@ static FLAC__bool compare_track_(const FLAC__StreamMetadata_CueSheet_Track *from else { for(i = 0; i < to->num_indices; i++) { if(from->indices[i].offset != to->indices[i].offset) { -#ifdef _MSC_VER - printf("FAILED, track indices[%u].offset mismatch, expected %I64u, got %I64u\n", i, to->indices[i].offset, from->indices[i].offset); -#else - printf("FAILED, track indices[%u].offset mismatch, expected %llu, got %llu\n", i, (unsigned long long)to->indices[i].offset, (unsigned long long)from->indices[i].offset); -#endif + 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, (unsigned)to->indices[i].number, (unsigned)from->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; } } @@ -100,28 +94,20 @@ static FLAC__bool compare_track_(const FLAC__StreamMetadata_CueSheet_Track *from return true; } -static FLAC__bool compare_seekpoint_array_(const FLAC__StreamMetadata_SeekPoint *from, const FLAC__StreamMetadata_SeekPoint *to, unsigned n) +static FLAC__bool compare_seekpoint_array_(const FLAC__StreamMetadata_SeekPoint *from, const FLAC__StreamMetadata_SeekPoint *to, uint32_t n) { - unsigned i; + 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) { -#ifdef _MSC_VER - printf("FAILED, point[%u].sample_number mismatch, expected %I64u, got %I64u\n", i, to[i].sample_number, from[i].sample_number); -#else - printf("FAILED, point[%u].sample_number mismatch, expected %llu, got %llu\n", i, (unsigned long long)to[i].sample_number, (unsigned long long)from[i].sample_number); -#endif + 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) { -#ifdef _MSC_VER - printf("FAILED, point[%u].stream_offset mismatch, expected %I64u, got %I64u\n", i, to[i].stream_offset, from[i].stream_offset); -#else - printf("FAILED, point[%u].stream_offset mismatch, expected %llu, got %llu\n", i, (unsigned long long)to[i].stream_offset, (unsigned long long)from[i].stream_offset); -#endif + 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) { @@ -133,9 +119,9 @@ static FLAC__bool compare_seekpoint_array_(const FLAC__StreamMetadata_SeekPoint return true; } -static FLAC__bool check_seektable_(const FLAC__StreamMetadata *block, unsigned num_points, const FLAC__StreamMetadata_SeekPoint *array) +static FLAC__bool check_seektable_(const FLAC__StreamMetadata *block, uint32_t num_points, const FLAC__StreamMetadata_SeekPoint *array) { - const unsigned expected_length = num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; + 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); @@ -163,7 +149,7 @@ static FLAC__bool check_seektable_(const FLAC__StreamMetadata *block, unsigned n static void entry_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, const char *field) { entry->length = strlen(field); - entry->entry = (FLAC__byte*)malloc(entry->length+1); + entry->entry = malloc(entry->length+1); FLAC__ASSERT(0 != entry->entry); memcpy(entry->entry, field, entry->length); entry->entry[entry->length] = '\0'; @@ -171,7 +157,7 @@ static void entry_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, const ch static void entry_clone_(FLAC__StreamMetadata_VorbisComment_Entry *entry) { - FLAC__byte *x = (FLAC__byte*)malloc(entry->length+1); + FLAC__byte *x = malloc(entry->length+1); FLAC__ASSERT(0 != x); memcpy(x, entry->entry, entry->length); x[entry->length] = '\0'; @@ -181,7 +167,7 @@ static void entry_clone_(FLAC__StreamMetadata_VorbisComment_Entry *entry) static void vc_calc_len_(FLAC__StreamMetadata *block) { const FLAC__StreamMetadata_VorbisComment *vc = &block->data.vorbis_comment; - unsigned i; + uint32_t i; block->length = FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN / 8; block->length += vc->vendor_string.length; @@ -192,14 +178,14 @@ static void vc_calc_len_(FLAC__StreamMetadata *block) } } -static void vc_resize_(FLAC__StreamMetadata *block, unsigned num) +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) { - unsigned i; + uint32_t i; for(i = num; i < vc->num_comments; i++) { if(0 != vc->comments[i].entry) free(vc->comments[i].entry); @@ -213,20 +199,24 @@ static void vc_resize_(FLAC__StreamMetadata *block, unsigned num) } } else { - vc->comments = (FLAC__StreamMetadata_VorbisComment_Entry*)realloc(vc->comments, sizeof(FLAC__StreamMetadata_VorbisComment_Entry)*num); + uint32_t i; + 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)); + for(i = vc->num_comments; i < num; i++) { + vc->comments[i].length = 0; + vc->comments[i].entry = malloc(1); + vc->comments[i].entry[0] = '\0'; + } } vc->num_comments = num; vc_calc_len_(block); } -static int vc_find_from_(FLAC__StreamMetadata *block, const char *name, unsigned start) +static int vc_find_from_(FLAC__StreamMetadata *block, const char *name, uint32_t start) { - const unsigned n = strlen(name); - unsigned i; + 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] == '=') @@ -244,7 +234,7 @@ static void vc_set_vs_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC vc_calc_len_(block); } -static void vc_set_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, unsigned pos, const char *field) +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); @@ -253,16 +243,18 @@ static void vc_set_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__S vc_calc_len_(block); } -static void vc_insert_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, unsigned pos, const char *field) +static void vc_insert_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, uint32_t pos, const char *field) { + FLAC__StreamMetadata_VorbisComment_Entry temp; vc_resize_(block, block->data.vorbis_comment.num_comments+1); + temp = block->data.vorbis_comment.comments[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)); + block->data.vorbis_comment.comments[pos] = temp; vc_set_new_(entry, block, pos, field); vc_calc_len_(block); } -static void vc_delete_(FLAC__StreamMetadata *block, unsigned pos) +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); @@ -275,22 +267,22 @@ static void vc_delete_(FLAC__StreamMetadata *block, unsigned pos) static void vc_replace_new_(FLAC__StreamMetadata_VorbisComment_Entry *entry, FLAC__StreamMetadata *block, const char *field, FLAC__bool all) { - int index; + int indx; char field_name[256]; const char *eq = strchr(field, '='); - FLAC__ASSERT(eq>field && (unsigned)(eq-field) < sizeof(field_name)); + FLAC__ASSERT(eq>field && (uint32_t)(eq-field) < sizeof(field_name)); memcpy(field_name, field, eq-field); field_name[eq-field]='\0'; - index = vc_find_from_(block, field_name, 0); - if(index < 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, (unsigned)index, field); + vc_set_new_(entry, block, (uint32_t)indx, field); if(all) { - for(index = index+1; index >= 0 && (unsigned)index < block->data.vorbis_comment.num_comments; ) - if((index = vc_find_from_(block, field_name, (unsigned)index)) >= 0) - vc_delete_(block, (unsigned)index); + 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); } } @@ -312,7 +304,7 @@ 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 = (FLAC__StreamMetadata_CueSheet_Index*)malloc(bytes); + FLAC__StreamMetadata_CueSheet_Index *x = malloc(bytes); FLAC__ASSERT(0 != x); memcpy(x, track->indices, bytes); track->indices = x; @@ -322,7 +314,7 @@ static void track_clone_(FLAC__StreamMetadata_CueSheet_Track *track) static void cs_calc_len_(FLAC__StreamMetadata *block) { const FLAC__StreamMetadata_CueSheet *cs = &block->data.cue_sheet; - unsigned i; + uint32_t i; block->length = ( FLAC__STREAM_METADATA_CUESHEET_MEDIA_CATALOG_NUMBER_LEN + @@ -349,7 +341,7 @@ static void cs_calc_len_(FLAC__StreamMetadata *block) } } -static void tr_resize_(FLAC__StreamMetadata *block, unsigned track_num, unsigned num) +static void tr_resize_(FLAC__StreamMetadata *block, uint32_t track_num, uint32_t num) { FLAC__StreamMetadata_CueSheet_Track *tr; @@ -367,7 +359,7 @@ static void tr_resize_(FLAC__StreamMetadata *block, unsigned track_num, unsigned } } else { - tr->indices = (FLAC__StreamMetadata_CueSheet_Index*)realloc(tr->indices, sizeof(FLAC__StreamMetadata_CueSheet_Index)*num); + 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)); @@ -377,7 +369,7 @@ static void tr_resize_(FLAC__StreamMetadata *block, unsigned track_num, unsigned cs_calc_len_(block); } -static void tr_set_new_(FLAC__StreamMetadata *block, unsigned track_num, unsigned pos, FLAC__StreamMetadata_CueSheet_Index index) +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; @@ -387,12 +379,12 @@ static void tr_set_new_(FLAC__StreamMetadata *block, unsigned track_num, unsigne FLAC__ASSERT(pos < tr->num_indices); - tr->indices[pos] = index; + tr->indices[pos] = indx; cs_calc_len_(block); } -static void tr_insert_new_(FLAC__StreamMetadata *block, unsigned track_num, unsigned pos, FLAC__StreamMetadata_CueSheet_Index index) +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; @@ -404,11 +396,11 @@ static void tr_insert_new_(FLAC__StreamMetadata *block, unsigned track_num, unsi 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, index); + tr_set_new_(block, track_num, pos, indx); cs_calc_len_(block); } -static void tr_delete_(FLAC__StreamMetadata *block, unsigned track_num, unsigned pos) +static void tr_delete_(FLAC__StreamMetadata *block, uint32_t track_num, uint32_t pos) { FLAC__StreamMetadata_CueSheet_Track *tr; @@ -423,14 +415,14 @@ static void tr_delete_(FLAC__StreamMetadata *block, unsigned track_num, unsigned cs_calc_len_(block); } -static void cs_resize_(FLAC__StreamMetadata *block, unsigned num) +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) { - unsigned i; + uint32_t i; for(i = num; i < cs->num_tracks; i++) { if(0 != cs->tracks[i].indices) free(cs->tracks[i].indices); @@ -444,7 +436,7 @@ static void cs_resize_(FLAC__StreamMetadata *block, unsigned num) } } else { - cs->tracks = (FLAC__StreamMetadata_CueSheet_Track*)realloc(cs->tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)*num); + 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)); @@ -454,14 +446,14 @@ static void cs_resize_(FLAC__StreamMetadata *block, unsigned num) cs_calc_len_(block); } -static void cs_set_new_(FLAC__StreamMetadata_CueSheet_Track *track, FLAC__StreamMetadata *block, unsigned pos, FLAC__uint64 offset, FLAC__byte number, const char *isrc, FLAC__bool data, FLAC__bool pre_em) +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, unsigned pos, FLAC__uint64 offset, FLAC__byte number, const char *isrc, FLAC__bool data, FLAC__bool pre_em) +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)); @@ -469,7 +461,7 @@ static void cs_insert_new_(FLAC__StreamMetadata_CueSheet_Track *track, FLAC__Str cs_calc_len_(block); } -static void cs_delete_(FLAC__StreamMetadata *block, unsigned pos) +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); @@ -519,9 +511,9 @@ 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 index; + FLAC__StreamMetadata_CueSheet_Index indx; FLAC__StreamMetadata_CueSheet_Track track; - unsigned i, expected_length, seekpoints; + uint32_t i, expected_length, seekpoints; int j; static FLAC__byte dummydata[4] = { 'a', 'b', 'c', 'd' }; @@ -1810,11 +1802,11 @@ FLAC__bool test_metadata_object(void) return false; printf("OK\n"); - index.offset = 0; - index.number = 1; + indx.offset = 0; + indx.number = 1; printf("testing FLAC__metadata_object_cuesheet_track_insert_index() on empty array..."); - tr_insert_new_(cuesheet, 0, 0, index); - if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 0, index)) { + 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; } @@ -1822,11 +1814,11 @@ FLAC__bool test_metadata_object(void) return false; printf("OK\n"); - index.offset = 10; - index.number = 2; + 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, index); - if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 0, index)) { + 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; } @@ -1834,11 +1826,11 @@ FLAC__bool test_metadata_object(void) return false; printf("OK\n"); - index.offset = 20; - index.number = 3; + 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, index); - if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 1, index)) { + 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; } @@ -1846,11 +1838,11 @@ FLAC__bool test_metadata_object(void) return false; printf("OK\n"); - index.offset = 30; - index.number = 4; + 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, index); - if(!FLAC__metadata_object_cuesheet_track_insert_index(block, 0, 3, index)) { + 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; } @@ -1858,10 +1850,10 @@ FLAC__bool test_metadata_object(void) return false; printf("OK\n"); - index.offset = 0; - index.number = 0; + 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, index); + 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; diff --git a/3rdparty/libflac/src/test_libFLAC/test_libFLAC.dsp b/3rdparty/libflac/src/test_libFLAC/test_libFLAC.dsp deleted file mode 100644 index bc351e3779a..00000000000 --- a/3rdparty/libflac/src/test_libFLAC/test_libFLAC.dsp +++ /dev/null @@ -1,148 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_libFLAC" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=test_libFLAC - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "test_libFLAC.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "test_libFLAC.mak" CFG="test_libFLAC - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "test_libFLAC - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "test_libFLAC - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "test_libFLAC - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\libFLAC\include" /I "..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\obj\release\lib\grabbag_static.lib ..\..\obj\release\lib\replaygain_analysis_static.lib ..\..\obj\release\lib\test_libs_common_static.lib ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "test_libFLAC - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\libFLAC\include" /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\obj\debug\lib\grabbag_static.lib ..\..\obj\debug\lib\replaygain_analysis_static.lib ..\..\obj\debug\lib\test_libs_common_static.lib ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "test_libFLAC - Win32 Release" -# Name "test_libFLAC - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\bitwriter.c -# End Source File -# Begin Source File - -SOURCE=.\decoders.c -# End Source File -# Begin Source File - -SOURCE=.\encoders.c -# End Source File -# Begin Source File - -SOURCE=.\format.c -# End Source File -# Begin Source File - -SOURCE=.\main.c -# End Source File -# Begin Source File - -SOURCE=.\metadata.c -# End Source File -# Begin Source File - -SOURCE=.\metadata_manip.c -# End Source File -# Begin Source File - -SOURCE=.\metadata_object.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\bitwriter.h -# End Source File -# Begin Source File - -SOURCE=.\decoders.h -# End Source File -# Begin Source File - -SOURCE=.\encoders.h -# End Source File -# Begin Source File - -SOURCE=.\format.h -# End Source File -# Begin Source File - -SOURCE=.\metadata.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/test_libFLAC/test_libFLAC.vcproj b/3rdparty/libflac/src/test_libFLAC/test_libFLAC.vcproj deleted file mode 100644 index 47988e74eee..00000000000 --- a/3rdparty/libflac/src/test_libFLAC/test_libFLAC.vcproj +++ /dev/null @@ -1,252 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="test_libFLAC" - ProjectGUID="{4cefbc8c-c215-11db-8314-0800200c9a66}" - RootNamespace="test_libFLAC" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\libFLAC\include;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".;..\libFLAC\include;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath=".\bitwriter.h" - > - </File> - <File - RelativePath=".\decoders.h" - > - </File> - <File - RelativePath=".\encoders.h" - > - </File> - <File - RelativePath=".\format.h" - > - </File> - <File - RelativePath=".\metadata.h" - > - </File> - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\bitwriter.c" - > - </File> - <File - RelativePath=".\decoders.c" - > - </File> - <File - RelativePath=".\encoders.c" - > - </File> - <File - RelativePath=".\format.c" - > - </File> - <File - RelativePath=".\main.c" - > - </File> - <File - RelativePath=".\metadata.c" - > - </File> - <File - RelativePath=".\metadata_manip.c" - > - </File> - <File - RelativePath=".\metadata_object.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/test_libs_common/CMakeLists.txt b/3rdparty/libflac/src/test_libs_common/CMakeLists.txt new file mode 100644 index 00000000000..8a0c87125b1 --- /dev/null +++ b/3rdparty/libflac/src/test_libs_common/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library(test_libs_common STATIC + file_utils_flac.c + metadata_utils.c) +target_link_libraries(test_libs_common PUBLIC FLAC) diff --git a/3rdparty/libflac/src/test_libs_common/Makefile.am b/3rdparty/libflac/src/test_libs_common/Makefile.am index f363f8b6ebb..30e1f157d35 100644 --- a/3rdparty/libflac/src/test_libs_common/Makefile.am +++ b/3rdparty/libflac/src/test_libs_common/Makefile.am @@ -1,5 +1,6 @@ # test_libs_common - Common code to library unit tests -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,11 +12,11 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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. -INCLUDES = -I$(top_srcdir)/include +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include noinst_LTLIBRARIES = libtest_libs_common.la @@ -24,7 +25,5 @@ libtest_libs_common_la_SOURCES = \ metadata_utils.c EXTRA_DIST = \ - Makefile.lite \ - README \ - test_libs_common_static.dsp \ - test_libs_common_static.vcproj + CMakeLists.txt \ + README diff --git a/3rdparty/libflac/src/test_libs_common/Makefile.in b/3rdparty/libflac/src/test_libs_common/Makefile.in index 424c04e49cc..83af7f9f290 100644 --- a/3rdparty/libflac/src/test_libs_common/Makefile.in +++ b/3rdparty/libflac/src/test_libs_common/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # test_libs_common - Common code to library unit tests -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,20 +28,71 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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. -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +104,105 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +subdir = src/test_libs_common +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +libtest_libs_common_la_LIBADD = +am_libtest_libs_common_la_OBJECTS = file_utils_flac.lo \ + metadata_utils.lo +libtest_libs_common_la_OBJECTS = $(am_libtest_libs_common_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/file_utils_flac.Plo \ + ./$(DEPDIR)/metadata_utils.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libtest_libs_common_la_SOURCES) +DIST_SOURCES = $(libtest_libs_common_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,264 +211,239 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - -INCLUDES = -I$(top_srcdir)/include - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +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 = \ - Makefile.lite \ - README \ - test_libs_common_static.dsp \ - test_libs_common_static.vcproj - -subdir = src/test_libs_common -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) - -libtest_libs_common_la_LDFLAGS = -libtest_libs_common_la_LIBADD = -am_libtest_libs_common_la_OBJECTS = file_utils_flac.lo metadata_utils.lo -libtest_libs_common_la_OBJECTS = $(am_libtest_libs_common_la_OBJECTS) - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/file_utils_flac.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/metadata_utils.Plo -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(libtest_libs_common_la_SOURCES) -DIST_COMMON = README $(srcdir)/Makefile.in Makefile.am -SOURCES = $(libtest_libs_common_la_SOURCES) + CMakeLists.txt \ + README all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/test_libs_common/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test_libs_common/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/test_libs_common/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" = "$$p" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libtest_libs_common.la: $(libtest_libs_common_la_OBJECTS) $(libtest_libs_common_la_DEPENDENCIES) - $(LINK) $(libtest_libs_common_la_LDFLAGS) $(libtest_libs_common_la_OBJECTS) $(libtest_libs_common_la_LIBADD) $(LIBS) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } + +libtest_libs_common.la: $(libtest_libs_common_la_OBJECTS) $(libtest_libs_common_la_DEPENDENCIES) $(EXTRA_libtest_libs_common_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(libtest_libs_common_la_OBJECTS) $(libtest_libs_common_la_LIBADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_utils_flac.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_utils.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file_utils_flac.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metadata_utils.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -331,99 +451,93 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) - installdirs: install: install-am install-exec: install-exec-am @@ -435,16 +549,22 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -455,31 +575,55 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/file_utils_flac.Plo + -rm -f ./$(DEPDIR)/metadata_utils.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/file_utils_flac.Plo + -rm -f ./$(DEPDIR)/metadata_utils.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -496,18 +640,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-generic clean-libtool clean-noinstLTLIBRARIES \ + cscopelist-am ctags ctags-am distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/test_libs_common/Makefile.lite b/3rdparty/libflac/src/test_libs_common/Makefile.lite deleted file mode 100644 index fe7c92f8051..00000000000 --- a/3rdparty/libflac/src/test_libs_common/Makefile.lite +++ /dev/null @@ -1,35 +0,0 @@ -# test_libs_common - Common code to library unit tests -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -LIB_NAME = libtest_libs_common - -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/3rdparty/libflac/src/test_libs_common/file_utils_flac.c b/3rdparty/libflac/src/test_libs_common/file_utils_flac.c index a52fee09f26..3cc8c308a73 100644 --- a/3rdparty/libflac/src/test_libs_common/file_utils_flac.c +++ b/3rdparty/libflac/src/test_libs_common/file_utils_flac.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -26,6 +27,7 @@ #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> /* for stat() */ +#include "share/compat.h" #ifdef min #undef min @@ -50,7 +52,7 @@ typedef struct { FILE *file; } encoder_client_struct; -static FLAC__StreamEncoderWriteStatus encoder_write_callback_(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data) +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; @@ -67,20 +69,20 @@ static void encoder_metadata_callback_(const FLAC__StreamEncoder *encoder, const (void)encoder, (void)metadata, (void)client_data; } -FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_filename, off_t *output_filesize, unsigned length, const FLAC__StreamMetadata *streaminfo, FLAC__StreamMetadata **metadata, unsigned num_metadata) +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; - unsigned i, n; + 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 = fopen(output_filename, "wb"))) + if(0 == (encoder_client_data.file = flac_fopen(output_filename, "wb"))) return false; encoder = FLAC__stream_encoder_new(); @@ -141,9 +143,9 @@ FLAC__bool file_utils__generate_flacfile(FLAC__bool is_ogg, const char *output_f FLAC__stream_encoder_delete(encoder); if(0 != output_filesize) { - struct stat filestats; + struct flac_stat_s filestats; - if(stat(output_filename, &filestats) != 0) + if(flac_stat(output_filename, &filestats) != 0) return false; else *output_filesize = filestats.st_size; diff --git a/3rdparty/libflac/src/test_libs_common/metadata_utils.c b/3rdparty/libflac/src/test_libs_common/metadata_utils.c index fe192e7c017..929ca63912f 100644 --- a/3rdparty/libflac/src/test_libs_common/metadata_utils.c +++ b/3rdparty/libflac/src/test_libs_common/metadata_utils.c @@ -1,5 +1,6 @@ /* test_libFLAC - Unit tester for libFLAC - * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2002-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,21 +12,22 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * 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 */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include "FLAC/metadata.h" #include "test_libs_common/metadata_utils.h" +#include "share/compat.h" #include <stdio.h> #include <stdlib.h> /* for malloc() */ #include <string.h> /* for memcmp() */ @@ -61,61 +63,57 @@ FLAC__bool mutils__compare_block_data_streaminfo(const FLAC__StreamMetadata_Stre return false; } if(blockcopy->total_samples != block->total_samples) { -#ifdef _MSC_VER - printf("FAILED, total_samples mismatch, expected %I64u, got %I64u\n", block->total_samples, blockcopy->total_samples); -#else - printf("FAILED, total_samples mismatch, expected %llu, got %llu\n", (unsigned long long)block->total_samples, (unsigned long long)blockcopy->total_samples); -#endif + 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", - (unsigned)block->md5sum[0], - (unsigned)block->md5sum[1], - (unsigned)block->md5sum[2], - (unsigned)block->md5sum[3], - (unsigned)block->md5sum[4], - (unsigned)block->md5sum[5], - (unsigned)block->md5sum[6], - (unsigned)block->md5sum[7], - (unsigned)block->md5sum[8], - (unsigned)block->md5sum[9], - (unsigned)block->md5sum[10], - (unsigned)block->md5sum[11], - (unsigned)block->md5sum[12], - (unsigned)block->md5sum[13], - (unsigned)block->md5sum[14], - (unsigned)block->md5sum[15], - (unsigned)blockcopy->md5sum[0], - (unsigned)blockcopy->md5sum[1], - (unsigned)blockcopy->md5sum[2], - (unsigned)blockcopy->md5sum[3], - (unsigned)blockcopy->md5sum[4], - (unsigned)blockcopy->md5sum[5], - (unsigned)blockcopy->md5sum[6], - (unsigned)blockcopy->md5sum[7], - (unsigned)blockcopy->md5sum[8], - (unsigned)blockcopy->md5sum[9], - (unsigned)blockcopy->md5sum[10], - (unsigned)blockcopy->md5sum[11], - (unsigned)blockcopy->md5sum[12], - (unsigned)blockcopy->md5sum[13], - (unsigned)blockcopy->md5sum[14], - (unsigned)blockcopy->md5sum[15] + (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, unsigned block_length) +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, unsigned block_length) +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); @@ -123,14 +121,14 @@ FLAC__bool mutils__compare_block_data_application(const FLAC__StreamMetadata_App } 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", - (unsigned)block->id[0], - (unsigned)block->id[1], - (unsigned)block->id[2], - (unsigned)block->id[3], - (unsigned)blockcopy->id[0], - (unsigned)blockcopy->id[1], - (unsigned)blockcopy->id[2], - (unsigned)blockcopy->id[3] + (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; } @@ -159,26 +157,18 @@ FLAC__bool mutils__compare_block_data_application(const FLAC__StreamMetadata_App FLAC__bool mutils__compare_block_data_seektable(const FLAC__StreamMetadata_SeekTable *block, const FLAC__StreamMetadata_SeekTable *blockcopy) { - unsigned i; + 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) { -#ifdef _MSC_VER - printf("FAILED, points[%u].sample_number mismatch, expected %I64u, got %I64u\n", i, block->points[i].sample_number, blockcopy->points[i].sample_number); -#else - printf("FAILED, points[%u].sample_number mismatch, expected %llu, got %llu\n", i, (unsigned long long)block->points[i].sample_number, (unsigned long long)blockcopy->points[i].sample_number); -#endif + 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) { -#ifdef _MSC_VER - printf("FAILED, points[%u].stream_offset mismatch, expected %I64u, got %I64u\n", i, block->points[i].stream_offset, blockcopy->points[i].stream_offset); -#else - printf("FAILED, points[%u].stream_offset mismatch, expected %llu, got %llu\n", i, (unsigned long long)block->points[i].stream_offset, (unsigned long long)blockcopy->points[i].stream_offset); -#endif + 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) { @@ -191,7 +181,7 @@ FLAC__bool mutils__compare_block_data_seektable(const FLAC__StreamMetadata_SeekT FLAC__bool mutils__compare_block_data_vorbiscomment(const FLAC__StreamMetadata_VorbisComment *block, const FLAC__StreamMetadata_VorbisComment *blockcopy) { - unsigned i; + 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; @@ -233,22 +223,18 @@ FLAC__bool mutils__compare_block_data_vorbiscomment(const FLAC__StreamMetadata_V FLAC__bool mutils__compare_block_data_cuesheet(const FLAC__StreamMetadata_CueSheet *block, const FLAC__StreamMetadata_CueSheet *blockcopy) { - unsigned i, j; + 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) { -#ifdef _MSC_VER - printf("FAILED, lead_in mismatch, expected %I64u, got %I64u\n", block->lead_in, blockcopy->lead_in); -#else - printf("FAILED, lead_in mismatch, expected %llu, got %llu\n", (unsigned long long)block->lead_in, (unsigned long long)blockcopy->lead_in); -#endif + 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", (unsigned)block->is_cd, (unsigned)blockcopy->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) { @@ -257,19 +243,15 @@ FLAC__bool mutils__compare_block_data_cuesheet(const FLAC__StreamMetadata_CueShe } for(i = 0; i < block->num_tracks; i++) { if(blockcopy->tracks[i].offset != block->tracks[i].offset) { -#ifdef _MSC_VER - printf("FAILED, tracks[%u].offset mismatch, expected %I64u, got %I64u\n", i, block->tracks[i].offset, blockcopy->tracks[i].offset); -#else - printf("FAILED, tracks[%u].offset mismatch, expected %llu, got %llu\n", i, (unsigned long long)block->tracks[i].offset, (unsigned long long)blockcopy->tracks[i].offset); -#endif + 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, (unsigned)block->tracks[i].number, (unsigned)blockcopy->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, (unsigned)block->tracks[i].num_indices, (unsigned)blockcopy->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 */ @@ -279,11 +261,11 @@ FLAC__bool mutils__compare_block_data_cuesheet(const FLAC__StreamMetadata_CueShe return false; } if(blockcopy->tracks[i].type != block->tracks[i].type) { - printf("FAILED, tracks[%u].type mismatch, expected %u, got %u\n", i, (unsigned)block->tracks[i].type, (unsigned)blockcopy->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, (unsigned)block->tracks[i].pre_emphasis, (unsigned)blockcopy->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) { @@ -295,15 +277,11 @@ FLAC__bool mutils__compare_block_data_cuesheet(const FLAC__StreamMetadata_CueShe else { for(j = 0; j < block->tracks[i].num_indices; j++) { if(blockcopy->tracks[i].indices[j].offset != block->tracks[i].indices[j].offset) { -#ifdef _MSC_VER - printf("FAILED, tracks[%u].indices[%u].offset mismatch, expected %I64u, got %I64u\n", i, j, block->tracks[i].indices[j].offset, blockcopy->tracks[i].indices[j].offset); -#else - printf("FAILED, tracks[%u].indices[%u].offset mismatch, expected %llu, got %llu\n", i, j, (unsigned long long)block->tracks[i].indices[j].offset, (unsigned long long)blockcopy->tracks[i].indices[j].offset); -#endif + 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, (unsigned)block->tracks[i].indices[j].number, (unsigned)blockcopy->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; } } @@ -317,13 +295,13 @@ FLAC__bool mutils__compare_block_data_picture(const FLAC__StreamMetadata_Picture { size_t len, lencopy; if(blockcopy->type != block->type) { - printf("FAILED, type mismatch, expected %u, got %u\n", (unsigned)block->type, (unsigned)blockcopy->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", (unsigned)len, (unsigned)lencopy); + 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)) { @@ -333,7 +311,7 @@ FLAC__bool mutils__compare_block_data_picture(const FLAC__StreamMetadata_Picture 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", (unsigned)len, (unsigned)lencopy); + 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)) { @@ -360,14 +338,14 @@ FLAC__bool mutils__compare_block_data_picture(const FLAC__StreamMetadata_Picture printf("FAILED, data_length mismatch, expected %u, got %u\n", block->data_length, blockcopy->data_length); return false; } - if(memcmp(blockcopy->data, block->data, block->data_length)) { + 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, unsigned block_length) +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) { @@ -399,7 +377,7 @@ FLAC__bool mutils__compare_block(const FLAC__StreamMetadata *block, const FLAC__ return false; } if(blockcopy->is_last != block->is_last) { - printf("FAILED, is_last mismatch, expected %u, got %u\n", (unsigned)block->is_last, (unsigned)blockcopy->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) { @@ -430,7 +408,7 @@ 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", (unsigned)size); + fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)size); exit(1); } return x; @@ -440,7 +418,7 @@ 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", (unsigned)n * (unsigned)size); + fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (uint32_t)n * (uint32_t)size); exit(1); } return x; @@ -498,7 +476,7 @@ void mutils__init_metadata_blocks( 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 = 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; @@ -509,31 +487,32 @@ void mutils__init_metadata_blocks( application1->is_last = false; application1->type = FLAC__METADATA_TYPE_APPLICATION; application1->length = 8; - memcpy(application1->data.application.id, "\xfe\xdc\xba\x98", 4); - application1->data.application.data = (FLAC__byte*)malloc_or_die_(4); + 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, "\x76\x54\x32\x10", 4); + memcpy(application2->data.application.id, "Here", 4); application2->data.application.data = 0; { - const unsigned vendor_string_length = (unsigned)strlen(FLAC__VENDOR_STRING); + 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 = (FLAC__byte*)malloc_or_die_(vendor_string_length+1); + 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 = (FLAC__StreamMetadata_VorbisComment_Entry*)malloc_or_die_(vorbiscomment->data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetadata_VorbisComment_Entry)); + 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 = (FLAC__byte*)malloc_or_die_(5+1); + 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; + vorbiscomment->data.vorbis_comment.comments[1].entry = malloc_or_die_(1); + vorbiscomment->data.vorbis_comment.comments[1].entry[0] = '\0'; } cuesheet->is_last = false; @@ -570,14 +549,14 @@ void mutils__init_metadata_blocks( 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 = (FLAC__StreamMetadata_CueSheet_Track*)calloc_or_die_(cuesheet->data.cue_sheet.num_tracks, sizeof(FLAC__StreamMetadata_CueSheet_Track)); + 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 = (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 = 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; @@ -588,7 +567,7 @@ void mutils__init_metadata_blocks( 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 = 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; @@ -625,7 +604,7 @@ void mutils__init_metadata_blocks( unknown->is_last = true; unknown->type = 126; unknown->length = 8; - unknown->data.unknown.data = (FLAC__byte*)malloc_or_die_(unknown->length); + unknown->data.unknown.data = malloc_or_die_(unknown->length); memcpy(unknown->data.unknown.data, "\xfe\xdc\xba\x98\xf0\xe1\xd2\xc3", unknown->length); } diff --git a/3rdparty/libflac/src/test_libs_common/test_libs_common_static.dsp b/3rdparty/libflac/src/test_libs_common/test_libs_common_static.dsp deleted file mode 100644 index 3989317c70d..00000000000 --- a/3rdparty/libflac/src/test_libs_common/test_libs_common_static.dsp +++ /dev/null @@ -1,108 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_libs_common_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=test_libs_common_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "test_libs_common_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "test_libs_common_static.mak" CFG="test_libs_common_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "test_libs_common_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "test_libs_common_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "test_libs_common" -# PROP Scc_LocalPath "..\.." -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "test_libs_common_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\lib" -# PROP Intermediate_Dir "Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /Op /I ".\include" /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ELSEIF "$(CFG)" == "test_libs_common_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\lib" -# PROP Intermediate_Dir "Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I ".\include" /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /nodefaultlib - -!ENDIF - -# Begin Target - -# Name "test_libs_common_static - Win32 Release" -# Name "test_libs_common_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=.\file_utils_flac.c -# End Source File -# Begin Source File - -SOURCE=.\metadata_utils.c -# End Source File -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=..\..\include\test_libs_common\file_utils_flac.h -# End Source File -# Begin Source File - -SOURCE=..\..\include\test_libs_common\metadata_utils.h -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/test_libs_common/test_libs_common_static.vcproj b/3rdparty/libflac/src/test_libs_common/test_libs_common_static.vcproj deleted file mode 100644 index b1c9074ea9a..00000000000 --- a/3rdparty/libflac/src/test_libs_common/test_libs_common_static.vcproj +++ /dev/null @@ -1,177 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="test_libs_common_static" - ProjectGUID="{4cefbc8e-c215-11db-8314-0800200c9a66}" - RootNamespace="test_libs_common_static" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\lib" - IntermediateDirectory="Debug_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\obj\debug\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\lib" - IntermediateDirectory="Release_static" - ConfigurationType="4" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".\include;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLibrarianTool" - OutputFile="..\..\..\obj\release\lib\$(ProjectName).lib" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\file_utils_flac.c" - > - </File> - <File - RelativePath=".\metadata_utils.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/test_seeking/CMakeLists.txt b/3rdparty/libflac/src/test_seeking/CMakeLists.txt new file mode 100644 index 00000000000..51442916cf5 --- /dev/null +++ b/3rdparty/libflac/src/test_seeking/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(test_seeking + main.c + $<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h> + $<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>) +target_link_libraries(test_seeking FLAC) diff --git a/3rdparty/libflac/src/test_seeking/Makefile.am b/3rdparty/libflac/src/test_seeking/Makefile.am index 120e233fb1e..9c9b8da89e4 100644 --- a/3rdparty/libflac/src/test_seeking/Makefile.am +++ b/3rdparty/libflac/src/test_seeking/Makefile.am @@ -1,5 +1,6 @@ # test_seeking - Seeking tester for libFLAC -# Copyright (C) 2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2004-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,24 +12,28 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 = \ - Makefile.lite \ - test_seeking.dsp \ - test_seeking.vcproj + CMakeLists.txt AM_CFLAGS = @OGG_CFLAGS@ -INCLUDES = +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include + +check_PROGRAMS = test_seeking + +if OS_IS_WINDOWS +win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la +endif -noinst_PROGRAMS = test_seeking test_seeking_LDADD = \ $(top_builddir)/src/libFLAC/libFLAC.la \ - @OGG_LIBS@ \ - @MINGW_WINSOCK_LIBS@ \ - -lm + $(win_utf8_lib) + test_seeking_SOURCES = \ main.c + +CLEANFILES = test_seeking.exe diff --git a/3rdparty/libflac/src/test_seeking/Makefile.in b/3rdparty/libflac/src/test_seeking/Makefile.in index 552d9728849..531354c95fd 100644 --- a/3rdparty/libflac/src/test_seeking/Makefile.in +++ b/3rdparty/libflac/src/test_seeking/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # test_seeking - Seeking tester for libFLAC -# Copyright (C) 2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2004-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,20 +28,70 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ +# 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. VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +103,104 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +check_PROGRAMS = test_seeking$(EXEEXT) +subdir = src/test_seeking +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_test_seeking_OBJECTS = main.$(OBJEXT) +test_seeking_OBJECTS = $(am_test_seeking_OBJECTS) +test_seeking_DEPENDENCIES = $(top_builddir)/src/libFLAC/libFLAC.la \ + $(win_utf8_lib) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/main.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_seeking_SOURCES) +DIST_SOURCES = $(test_seeking_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,267 +209,241 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ EXTRA_DIST = \ - Makefile.lite \ - test_seeking.dsp \ - test_seeking.vcproj - + CMakeLists.txt AM_CFLAGS = @OGG_CFLAGS@ - -INCLUDES = - -noinst_PROGRAMS = test_seeking +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include +@OS_IS_WINDOWS_TRUE@win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la test_seeking_LDADD = \ $(top_builddir)/src/libFLAC/libFLAC.la \ - @OGG_LIBS@ \ - @MINGW_WINSOCK_LIBS@ \ - -lm + $(win_utf8_lib) test_seeking_SOURCES = \ main.c -subdir = src/test_seeking -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -noinst_PROGRAMS = test_seeking$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) - -am_test_seeking_OBJECTS = main.$(OBJEXT) -test_seeking_OBJECTS = $(am_test_seeking_OBJECTS) -test_seeking_DEPENDENCIES = $(top_builddir)/src/libFLAC/libFLAC.la -test_seeking_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/main.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(test_seeking_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(test_seeking_SOURCES) - +CLEANFILES = test_seeking.exe all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/test_seeking/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -test_seeking$(EXEEXT): $(test_seeking_OBJECTS) $(test_seeking_DEPENDENCIES) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test_seeking/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/test_seeking/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test_seeking$(EXEEXT): $(test_seeking_OBJECTS) $(test_seeking_DEPENDENCIES) $(EXTRA_test_seeking_DEPENDENCIES) @rm -f test_seeking$(EXEEXT) - $(LINK) $(test_seeking_LDFLAGS) $(test_seeking_OBJECTS) $(test_seeking_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(test_seeking_OBJECTS) $(test_seeking_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -334,99 +451,94 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am -all-am: Makefile $(PROGRAMS) - +all-am: Makefile installdirs: install: install-am install-exec: install-exec-am @@ -438,51 +550,80 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -499,18 +640,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/test_seeking/Makefile.lite b/3rdparty/libflac/src/test_seeking/Makefile.lite deleted file mode 100644 index 0df91a0cb73..00000000000 --- a/3rdparty/libflac/src/test_seeking/Makefile.lite +++ /dev/null @@ -1,40 +0,0 @@ -# test_seeking - Seeking tester for libFLAC -# Copyright (C) 2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -PROGRAM_NAME = test_seeking - -INCLUDES = -I../libFLAC/include -I$(topdir)/include - -ifeq ($(DARWIN_BUILD),yes) -EXPLICIT_LIBS = $(libdir)/libFLAC.a $(OGG_LIB_DIR)/libogg.a -lm -else -LIBS = -lFLAC -L$(OGG_LIB_DIR) -logg -lm -endif - -SRCS_C = \ - main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/test_seeking/main.c b/3rdparty/libflac/src/test_seeking/main.c index 11b549a4883..16ab9f40f4b 100644 --- a/3rdparty/libflac/src/test_seeking/main.c +++ b/3rdparty/libflac/src/test_seeking/main.c @@ -1,5 +1,6 @@ /* test_seeking - Seeking tester for libFLAC - * Copyright (C) 2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2004-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,12 +12,12 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif @@ -33,13 +34,14 @@ #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; - unsigned channels; - unsigned bits_per_sample; + uint32_t channels; + uint32_t bits_per_sample; FLAC__bool quiet; FLAC__bool ignore_errors; FLAC__bool error_occurred; @@ -47,9 +49,9 @@ typedef struct { static FLAC__bool stop_signal_ = false; -static void our_sigint_handler_(int signal) +static void our_sigint_handler_(int signum) { - (void)signal; + (void)signum; printf("(caught SIGINT) "); fflush(stdout); stop_signal_ = true; @@ -70,12 +72,12 @@ static FLAC__bool die_s_(const char *msg, const FLAC__StreamDecoder *decoder) else printf("FAILED"); - printf(", state = %u (%s)\n", (unsigned)state, FLAC__StreamDecoderStateString[state]); + printf(", state = %u (%s)\n", (uint32_t)state, FLAC__StreamDecoderStateString[state]); return false; } -static unsigned local_rand_(void) +static uint32_t local_rand_(void) { #if !defined _MSC_VER && !defined __MINGW32__ #define RNDFUNC random @@ -90,11 +92,11 @@ static unsigned local_rand_(void) #undef RNDFUNC } -static off_t get_filesize_(const char *srcpath) +static FLAC__off_t get_filesize_(const char *srcpath) { - struct stat srcstat; + struct flac_stat_s srcstat; - if(0 == stat(srcpath, &srcstat)) + if(0 == flac_stat(srcpath, &srcstat)) return srcstat.st_size; else return -1; @@ -103,9 +105,9 @@ static off_t get_filesize_(const char *srcpath) static FLAC__bool read_pcm_(FLAC__int32 *pcm[], const char *rawfilename, const char *flacfilename) { FILE *f; - unsigned channels = 0, bps = 0, samples, i, j; + uint32_t channels = 0, bps = 0, samples, i, j; - off_t rawfilesize = get_filesize_(rawfilename); + FLAC__off_t rawfilesize = get_filesize_(rawfilename); if (rawfilesize < 0) { fprintf(stderr, "ERROR: can't determine filesize for %s\n", rawfilename); return false; @@ -146,18 +148,18 @@ static FLAC__bool read_pcm_(FLAC__int32 *pcm[], const char *rawfilename, const c printf("ERROR: PCM verification requires 8 or 16 bps, got %u\n", bps); return false; } - samples = rawfilesize / channels / (bps>>3); + samples = (uint32_t)(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] = (FLAC__int32*)malloc(sizeof(FLAC__int32)*samples))) { + if(0 == (pcm[i] = malloc(sizeof(FLAC__int32)*samples))) { printf("ERROR: allocating space for PCM samples\n"); return false; } } - if(0 == (f = fopen(rawfilename, "rb"))) { + if(0 == (f = flac_fopen(rawfilename, "rb"))) { printf("ERROR: opening %s for reading\n", rawfilename); return false; } @@ -166,17 +168,20 @@ static FLAC__bool read_pcm_(FLAC__int32 *pcm[], const char *rawfilename, const c signed char c; for(i = 0; i < samples; i++) { for(j = 0; j < channels; j++) { - fread(&c, 1, 1, f); - pcm[j][i] = c; + if (fread(&c, 1, 1, f) == 1) + pcm[j][i] = c; } } } else { /* bps == 16 */ - unsigned char c[2]; + uint8_t c[2]; + uint16_t value; for(i = 0; i < samples; i++) { for(j = 0; j < channels; j++) { - fread(&c, 1, 2, f); - pcm[j][i] = ((int)((signed char)c[0])) << 8 | (int)c[1]; + if (fread(&c, 1, 2, f) == 2) { + value = (c[0] << 8) | c[1]; + pcm[j][i] = value & 0x8000 ? 0xffff0000 | value : value; + } } } } @@ -200,18 +205,14 @@ static FLAC__StreamDecoderWriteStatus write_callback_(const FLAC__StreamDecoder FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER); /* decoder guarantees this */ if (!dcd->quiet) -#ifdef _MSC_VER - printf("frame@%I64u(%u)... ", frame->header.number.sample_number, frame->header.blocksize); -#else - printf("frame@%llu(%u)... ", (unsigned long long)frame->header.number.sample_number, frame->header.blocksize); -#endif + 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) { - unsigned c, i, j; + uint32_t c, i, j; for (c = 0; c < frame->header.channels; c++) - for (i = (unsigned)frame->header.number.sample_number, j = 0; j < frame->header.blocksize; i++, j++) + 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; @@ -255,7 +256,7 @@ static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDeco } if(!dcd->ignore_errors) { - printf("ERROR: got error callback: err = %u (%s)\n", (unsigned)status, FLAC__StreamDecoderErrorStatusString[status]); + printf("ERROR: got error callback: err = %u (%s)\n", (uint32_t)status, FLAC__StreamDecoderErrorStatusString[status]); dcd->error_occurred = true; } } @@ -265,11 +266,11 @@ static void error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDeco * 1 - read 2 frames * 2 - read until end */ -static FLAC__bool seek_barrage(FLAC__bool is_ogg, const char *filename, off_t filesize, unsigned count, FLAC__int64 total_samples, unsigned read_mode, FLAC__int32 **pcm) +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; - unsigned i; + uint32_t i; long int n; decoder_client_data.pcm = pcm; @@ -309,11 +310,7 @@ static FLAC__bool seek_barrage(FLAC__bool is_ogg, const char *filename, off_t fi return die_s_("expected FLAC__STREAM_DECODER_END_OF_STREAM", decoder); } -#ifdef _MSC_VER - printf("file's total_samples is %I64u\n", decoder_client_data.total_samples); -#else - printf("file's total_samples is %llu\n", (unsigned long long)decoder_client_data.total_samples); -#endif + 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) @@ -323,7 +320,7 @@ static FLAC__bool seek_barrage(FLAC__bool is_ogg, const char *filename, off_t fi /* @@@ 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); + n = (long int)(9 * filesize / (decoder_client_data.channels * decoder_client_data.bits_per_sample)); } printf("Begin seek barrage, count=%u\n", count); @@ -347,11 +344,7 @@ static FLAC__bool seek_barrage(FLAC__bool is_ogg, const char *filename, off_t fi pos = (FLAC__uint64)(local_rand_() % n); } -#ifdef _MSC_VER - printf("#%u:seek(%I64u)... ", i, pos); -#else - printf("#%u:seek(%llu)... ", i, (unsigned long long)pos); -#endif + printf("#%u:seek(%" PRIu64 ")... ", i, pos); fflush(stdout); if(!FLAC__stream_decoder_seek_absolute(decoder, pos)) { if(pos >= (FLAC__uint64)n) @@ -399,37 +392,20 @@ static FLAC__bool seek_barrage(FLAC__bool is_ogg, const char *filename, off_t fi return true; } -#ifdef _MSC_VER -/* There's no strtoull() in MSVC6 so we just write a specialized one */ -static FLAC__uint64 local__strtoull(const char *src) -{ - FLAC__uint64 ret = 0; - int c; - FLAC__ASSERT(0 != src); - while(0 != (c = *src++)) { - c -= '0'; - if(c >= 0 && c <= 9) - ret = (ret * 10) + c; - else - break; - } - return ret; -} -#endif int main(int argc, char *argv[]) { const char *flacfilename, *rawfilename = 0; - unsigned count = 0, read_mode; + uint32_t count = 0, read_mode; FLAC__int64 samples = -1; - off_t flacfilesize; + 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) { - fprintf(stderr, usage); + fputs(usage, stderr); return 1; } @@ -438,11 +414,7 @@ int main(int argc, char *argv[]) if (argc > 2) count = strtoul(argv[2], 0, 10); if (argc > 3) -#ifdef _MSC_VER - samples = local__strtoull(argv[3]); -#else samples = strtoull(argv[3], 0, 10); -#endif if (argc > 4) rawfilename = argv[4]; @@ -460,7 +432,7 @@ int main(int argc, char *argv[]) srandom(tv.tv_usec); } #else - srand((unsigned)time(0)); + srand((uint32_t)time(0)); #endif flacfilesize = get_filesize_(flacfilename); diff --git a/3rdparty/libflac/src/test_seeking/test_seeking.dsp b/3rdparty/libflac/src/test_seeking/test_seeking.dsp deleted file mode 100644 index 1bdb853ec3c..00000000000 --- a/3rdparty/libflac/src/test_seeking/test_seeking.dsp +++ /dev/null @@ -1,100 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_seeking" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=test_seeking - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "test_seeking.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "test_seeking.mak" CFG="test_seeking - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "test_seeking - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "test_seeking - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "test_seeking - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 ..\..\obj\release\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "test_seeking - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "FLAC__HAS_OGG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\obj\debug\lib\libFLAC_static.lib ..\..\obj\release\lib\ogg_static.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "test_seeking - Win32 Release" -# Name "test_seeking - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\main.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/test_seeking/test_seeking.vcproj b/3rdparty/libflac/src/test_seeking/test_seeking.vcproj deleted file mode 100644 index b4cf8eca0d4..00000000000 --- a/3rdparty/libflac/src/test_seeking/test_seeking.vcproj +++ /dev/null @@ -1,204 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="test_seeking" - ProjectGUID="{4cefbc90-c215-11db-8314-0800200c9a66}" - RootNamespace="test_seeking" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__HAS_OGG;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="..\..\obj\release\lib\ogg_static.lib" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\main.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/test_streams/CMakeLists.txt b/3rdparty/libflac/src/test_streams/CMakeLists.txt new file mode 100644 index 00000000000..f9fafb9d6ee --- /dev/null +++ b/3rdparty/libflac/src/test_streams/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(test_streams main.c) +target_link_libraries(test_streams FLAC grabbag) diff --git a/3rdparty/libflac/src/test_streams/Makefile.am b/3rdparty/libflac/src/test_streams/Makefile.am index 2d562ce62c8..9aa4b025e1e 100644 --- a/3rdparty/libflac/src/test_streams/Makefile.am +++ b/3rdparty/libflac/src/test_streams/Makefile.am @@ -1,5 +1,6 @@ # test_streams - Simple test pattern generator -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,16 +12,18 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 = \ - Makefile.lite \ - test_streams.dsp \ - test_streams.vcproj + CMakeLists.txt -noinst_PROGRAMS = test_streams +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include +check_PROGRAMS = test_streams test_streams_SOURCES = \ main.c -test_streams_LDADD = -lm + +test_streams_LDADD = $(top_builddir)/src/share/grabbag/libgrabbag.la -lm + +CLEANFILES = test_streams.exe diff --git a/3rdparty/libflac/src/test_streams/Makefile.in b/3rdparty/libflac/src/test_streams/Makefile.in index 0621f85c8d8..83c60e7ee11 100644 --- a/3rdparty/libflac/src/test_streams/Makefile.in +++ b/3rdparty/libflac/src/test_streams/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.7.9 from Makefile.am. +# Makefile.in generated by automake 1.16.5 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,7 +15,8 @@ @SET_MAKE@ # test_streams - Simple test pattern generator -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2000-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -27,20 +28,70 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ +# 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. VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = ../.. - +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -52,12 +103,104 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : +build_triplet = @build@ host_triplet = @host@ +check_PROGRAMS = test_streams$(EXEEXT) +subdir = src/test_streams +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am_test_streams_OBJECTS = main.$(OBJEXT) +test_streams_OBJECTS = $(am_test_streams_OBJECTS) +test_streams_DEPENDENCIES = \ + $(top_builddir)/src/share/grabbag/libgrabbag.la +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/main.Po +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(test_streams_SOURCES) +DIST_SOURCES = $(test_streams_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ -ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AS = @AS@ AUTOCONF = @AUTOCONF@ @@ -66,258 +209,236 @@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ -DEBUG_FALSE = @DEBUG_FALSE@ -DEBUG_TRUE = @DEBUG_TRUE@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ -DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@ +DLLTOOL = @DLLTOOL@ DOXYGEN = @DOXYGEN@ -ECHO = @ECHO@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ -FLaC__CPU_IA32_FALSE = @FLaC__CPU_IA32_FALSE@ -FLaC__CPU_IA32_TRUE = @FLaC__CPU_IA32_TRUE@ -FLaC__CPU_PPC_FALSE = @FLaC__CPU_PPC_FALSE@ -FLaC__CPU_PPC_TRUE = @FLaC__CPU_PPC_TRUE@ -FLaC__CPU_SPARC_FALSE = @FLaC__CPU_SPARC_FALSE@ -FLaC__CPU_SPARC_TRUE = @FLaC__CPU_SPARC_TRUE@ -FLaC__HAS_AS_FALSE = @FLaC__HAS_AS_FALSE@ -FLaC__HAS_AS_TRUE = @FLaC__HAS_AS_TRUE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_AS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_DOCBOOK_TO_MAN_FALSE = @FLaC__HAS_DOCBOOK_TO_MAN_FALSE@ -FLaC__HAS_DOCBOOK_TO_MAN_TRUE = @FLaC__HAS_DOCBOOK_TO_MAN_TRUE@ -FLaC__HAS_DOXYGEN_FALSE = @FLaC__HAS_DOXYGEN_FALSE@ -FLaC__HAS_DOXYGEN_TRUE = @FLaC__HAS_DOXYGEN_TRUE@ -FLaC__HAS_GAS_FALSE = @FLaC__HAS_GAS_FALSE@ -FLaC__HAS_GAS_TRUE = @FLaC__HAS_GAS_TRUE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_FALSE@ -FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE = @FLaC__HAS_GAS__TEMPORARILY_DISABLED_TRUE@ -FLaC__HAS_NASM_FALSE = @FLaC__HAS_NASM_FALSE@ -FLaC__HAS_NASM_TRUE = @FLaC__HAS_NASM_TRUE@ -FLaC__HAS_OGG_FALSE = @FLaC__HAS_OGG_FALSE@ -FLaC__HAS_OGG_TRUE = @FLaC__HAS_OGG_TRUE@ -FLaC__HAS_XMMS_FALSE = @FLaC__HAS_XMMS_FALSE@ -FLaC__HAS_XMMS_TRUE = @FLaC__HAS_XMMS_TRUE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_FALSE@ -FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE = @FLaC__INSTALL_XMMS_PLUGIN_LOCALLY_TRUE@ -FLaC__NO_ASM_FALSE = @FLaC__NO_ASM_FALSE@ -FLaC__NO_ASM_TRUE = @FLaC__NO_ASM_TRUE@ -FLaC__SSE_OS_FALSE = @FLaC__SSE_OS_FALSE@ -FLaC__SSE_OS_TRUE = @FLaC__SSE_OS_TRUE@ -FLaC__SYS_DARWIN_FALSE = @FLaC__SYS_DARWIN_FALSE@ -FLaC__SYS_DARWIN_TRUE = @FLaC__SYS_DARWIN_TRUE@ -FLaC__SYS_LINUX_FALSE = @FLaC__SYS_LINUX_FALSE@ -FLaC__SYS_LINUX_TRUE = @FLaC__SYS_LINUX_TRUE@ -FLaC__USE_3DNOW_FALSE = @FLaC__USE_3DNOW_FALSE@ -FLaC__USE_3DNOW_TRUE = @FLaC__USE_3DNOW_TRUE@ -FLaC__USE_ALTIVEC_FALSE = @FLaC__USE_ALTIVEC_FALSE@ -FLaC__USE_ALTIVEC_TRUE = @FLaC__USE_ALTIVEC_TRUE@ -FLaC__WITH_CPPLIBS_FALSE = @FLaC__WITH_CPPLIBS_FALSE@ -FLaC__WITH_CPPLIBS_TRUE = @FLaC__WITH_CPPLIBS_TRUE@ -GAS = @GAS@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ -MINGW_WINSOCK_LIBS = @MINGW_WINSOCK_LIBS@ -NASM = @NASM@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OBJ_FORMAT = @OBJ_FORMAT@ OGG_CFLAGS = @OGG_CFLAGS@ OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ -XMMS_CFLAGS = @XMMS_CFLAGS@ -XMMS_CONFIG = @XMMS_CONFIG@ -XMMS_DATA_DIR = @XMMS_DATA_DIR@ -XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@ -XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@ -XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@ -XMMS_LIBS = @XMMS_LIBS@ -XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@ -XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@ -XMMS_VERSION = @XMMS_VERSION@ -XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ +builddir = @builddir@ datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ +htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ +localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ +mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ - +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ EXTRA_DIST = \ - Makefile.lite \ - test_streams.dsp \ - test_streams.vcproj - + CMakeLists.txt -noinst_PROGRAMS = test_streams +AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include test_streams_SOURCES = \ main.c -test_streams_LDADD = -lm -subdir = src/test_streams -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -noinst_PROGRAMS = test_streams$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) - -am_test_streams_OBJECTS = main.$(OBJEXT) -test_streams_OBJECTS = $(am_test_streams_OBJECTS) -test_streams_DEPENDENCIES = -test_streams_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/main.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \ - $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(test_streams_SOURCES) -DIST_COMMON = $(srcdir)/Makefile.in Makefile.am -SOURCES = $(test_streams_SOURCES) - +test_streams_LDADD = $(top_builddir)/src/share/grabbag/libgrabbag.la -lm +CLEANFILES = test_streams.exe all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/test_streams/Makefile -Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -test_streams$(EXEEXT): $(test_streams_OBJECTS) $(test_streams_DEPENDENCIES) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/test_streams/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/test_streams/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +test_streams$(EXEEXT): $(test_streams_OBJECTS) $(test_streams_DEPENDENCIES) $(EXTRA_test_streams_DEPENDENCIES) @rm -f test_streams$(EXEEXT) - $(LINK) $(test_streams_LDFLAGS) $(test_streams_OBJECTS) $(test_streams_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(test_streams_OBJECTS) $(test_streams_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) .c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ -@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \ -@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ -@am__fastdepCC_TRUE@ fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -325,99 +446,94 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-am +TAGS: tags -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-am + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique + $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-am + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = ../.. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) check: check-am -all-am: Makefile $(PROGRAMS) - +all-am: Makefile installdirs: install: install-am install-exec: install-exec-am @@ -429,51 +545,80 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ +clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + distclean-tags dvi: dvi-am dvi-am: +html: html-am + +html-am: + info: info-am info-am: install-data-am: +install-dvi: install-dvi-am + +install-dvi-am: + install-exec-am: +install-html: install-html-am + +install-html-am: + install-info: install-info-am +install-info-am: + install-man: +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) + -rm -f ./$(DEPDIR)/main.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -490,18 +635,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am info info-am install \ - install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool pdf \ - pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/3rdparty/libflac/src/test_streams/Makefile.lite b/3rdparty/libflac/src/test_streams/Makefile.lite deleted file mode 100644 index af9dab675d4..00000000000 --- a/3rdparty/libflac/src/test_streams/Makefile.lite +++ /dev/null @@ -1,36 +0,0 @@ -# test_streams - Simple test pattern generator -# Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson -# -# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -# -# GNU makefile -# - -topdir = ../.. -libdir = $(topdir)/obj/$(BUILD)/lib - -PROGRAM_NAME = test_streams - -INCLUDES = -I./include -I$(topdir)/include - -LIBS = -lm - -SRCS_C = \ - main.c - -include $(topdir)/build/exe.mk - -# DO NOT DELETE THIS LINE -- make depend depends on it. diff --git a/3rdparty/libflac/src/test_streams/main.c b/3rdparty/libflac/src/test_streams/main.c index c335776dc7b..466bf8ef24f 100644 --- a/3rdparty/libflac/src/test_streams/main.c +++ b/3rdparty/libflac/src/test_streams/main.c @@ -1,5 +1,6 @@ /* test_streams - Simple test pattern generator - * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson + * Copyright (C) 2000-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -11,18 +12,19 @@ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#if HAVE_CONFIG_H +#ifdef HAVE_CONFIG_H # include <config.h> #endif #include <math.h> #include <stdio.h> #include <stdlib.h> +#include "share/compat.h" #if defined _MSC_VER || defined __MINGW32__ #include <time.h> #else @@ -30,11 +32,7 @@ #endif #include "FLAC/assert.h" #include "FLAC/ordinals.h" - -#ifndef M_PI -/* math.h in VC++ doesn't seem to have this (how Microsoft is that?) */ -#define M_PI 3.14159265358979323846 -#endif +#include "share/compat.h" #if !defined _MSC_VER && !defined __MINGW32__ #define GET_RANDOM_BYTE (((unsigned)random()) & 0xff) @@ -45,7 +43,7 @@ static FLAC__bool is_big_endian_host; -static FLAC__bool write_little_endian(FILE *f, FLAC__int32 x, size_t bytes) +static FLAC__bool write_little_endian_unsigned(FILE *f, FLAC__uint32 x, size_t bytes) { while(bytes) { if(fputc(x, f) == EOF) @@ -56,6 +54,11 @@ static FLAC__bool write_little_endian(FILE *f, FLAC__int32 x, size_t 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 @@ -93,12 +96,30 @@ static FLAC__bool write_little_endian_uint32(FILE *f, FLAC__uint32 x) ; } -#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); } + +#if defined(_MSC_VER) +// silence 4 MSVC warnings 'conversion from 'FLAC__uint64' to 'int', possible loss of data' +#pragma warning ( disable : 4244 ) +#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 + ; +} +#if defined(_MSC_VER) +#pragma warning ( default : 4244 ) #endif static FLAC__bool write_big_endian(FILE *f, FLAC__int32 x, size_t bytes) @@ -384,6 +405,32 @@ foo: return false; } +/* a mono full-scale deflection 32bps stream */ +static FLAC__bool generate_fsd32(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? 2147483647 : -2147483648; + if(!write_little_endian_int32(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) { @@ -558,6 +605,64 @@ foo: return false; } +/* a mono sine-wave 32bps stream */ +static FLAC__bool generate_sine32_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 = 0x7fffffff; + 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_int32(f, v)) + goto foo; + } + + fclose(f); + return true; +foo: + fclose(f); + return false; +} + +/* a stereo sine-wave 32bps stream */ +static FLAC__bool generate_sine32_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 = 0x7fffffff; + 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_int32(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_int32(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; @@ -583,7 +688,7 @@ foo: return false; } -static FLAC__bool generate_raw(const char *filename, unsigned channels, unsigned bytes_per_sample, unsigned samples) +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; @@ -600,7 +705,37 @@ static FLAC__bool generate_raw(const char *filename, unsigned channels, unsigned 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(f, v, bytes_per_sample)) + 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; } } @@ -668,17 +803,16 @@ foo: return false; } -static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsigned channels, unsigned bps, unsigned samples, FLAC__bool strict) +/* 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%8) allows 24 bps which is technically supposed to be WAVEFORMATEXTENSIBLE but we - * write 24bps as WAVEFORMATEX since it's unambiguous and matches how flac writes it - */ + const FLAC__bool waveformatextensible = strict && (channels > 2 || (bps != 8 && bps != 16)); + 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; + /* 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); @@ -689,14 +823,74 @@ static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsig if(0 == (f = fopen(filename, "wb"))) return false; - if(fwrite("RIFF", 1, 4, f) < 4) - goto foo; - if(!write_little_endian_uint32(f, padded_size + (waveformatextensible?60:36))) - goto foo; - if(fwrite("WAVEfmt ", 1, 8, f) < 8) - goto foo; - if(!write_little_endian_uint32(f, waveformatextensible?40:16)) - goto foo; + /* 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)) @@ -720,16 +914,27 @@ static FLAC__bool generate_wav(const char *filename, unsigned sample_rate, unsig if(fwrite("\x01\x00\x00\x00\x00\x00\x10\x00\x80\x00\x00\xaa\x00\x38\x9b\x71", 1, 16, f) != 16) goto foo; } - if(fwrite("data", 1, 4, f) < 4) - goto foo; - if(!write_little_endian_uint32(f, true_size)) - 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(f, v, bytes_per_sample)) + if(!write_little_endian_signed(f, v, bytes_per_sample)) goto foo; } } @@ -749,12 +954,12 @@ static FLAC__bool generate_wackywavs(void) FILE *f; FLAC__byte wav[] = { 'R', 'I', 'F', 'F', 76, 0, 0, 0, - 'W', 'A', 'V', 'E', 'f', 'a', 'c', 't', + '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, 0, 0, 0, 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, @@ -781,6 +986,217 @@ foo: 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, 60 + 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; + int seconds = 300; + + if(0 == (f = fopen("noisy-sine.wav", "wb"))) + return false; + + if(!write_simple_wavex_header (f, 44100, 1, 2, 44100*seconds)) + goto foo; + + for (k = 0 ; k < seconds * 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; @@ -841,6 +1257,14 @@ int main(int argc, char *argv[]) if(!generate_fsd24("fsd24-06.raw", pattern06, 100)) return 1; if(!generate_fsd24("fsd24-07.raw", pattern07, 100)) return 1; + if(!generate_fsd32("fsd32-01.raw", pattern01, 100)) return 1; + if(!generate_fsd32("fsd32-02.raw", pattern02, 100)) return 1; + if(!generate_fsd32("fsd32-03.raw", pattern03, 100)) return 1; + if(!generate_fsd32("fsd32-04.raw", pattern04, 100)) return 1; + if(!generate_fsd32("fsd32-05.raw", pattern05, 100)) return 1; + if(!generate_fsd32("fsd32-06.raw", pattern06, 100)) return 1; + if(!generate_fsd32("fsd32-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; @@ -894,29 +1318,76 @@ int main(int argc, char *argv[]) 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_sine32_1("sine32-00.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49)) return 1; + if(!generate_sine32_1("sine32-01.raw", 96000.0, 200000, 441.0, 0.61, 661.5, 0.37)) return 1; + if(!generate_sine32_1("sine32-02.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49)) return 1; + if(!generate_sine32_1("sine32-03.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49)) return 1; + if(!generate_sine32_1("sine32-04.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29)) return 1; + + if(!generate_sine32_2("sine32-10.raw", 48000.0, 200000, 441.0, 0.50, 441.0, 0.49, 1.0)) return 1; + if(!generate_sine32_2("sine32-11.raw", 48000.0, 200000, 441.0, 0.61, 661.5, 0.37, 1.0)) return 1; + if(!generate_sine32_2("sine32-12.raw", 96000.0, 200000, 441.0, 0.50, 882.0, 0.49, 1.0)) return 1; + if(!generate_sine32_2("sine32-13.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.0)) return 1; + if(!generate_sine32_2("sine32-14.raw", 44100.0, 200000, 8820.0, 0.70, 4410.0, 0.29, 1.0)) return 1; + if(!generate_sine32_2("sine32-15.raw", 44100.0, 200000, 441.0, 0.50, 441.0, 0.49, 0.5)) return 1; + if(!generate_sine32_2("sine32-16.raw", 44100.0, 200000, 441.0, 0.61, 661.5, 0.37, 2.0)) return 1; + if(!generate_sine32_2("sine32-17.raw", 44100.0, 200000, 441.0, 0.50, 882.0, 0.49, 0.7)) return 1; + if(!generate_sine32_2("sine32-18.raw", 44100.0, 200000, 441.0, 0.50, 4410.0, 0.49, 1.3)) return 1; + if(!generate_sine32_2("sine32-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; - for(channels = 1; channels <= 8; channels++) { + 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 = 4; bits_per_sample <= 24; 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]; - sprintf(fn, "rt-%u-%u-%u.aiff", channels, bits_per_sample, nsamples[samples]); + 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; - sprintf(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)) + 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) { - sprintf(fn, "rt-%u-%u-%u.raw", channels, bits_per_sample, nsamples[samples]); - if(!generate_raw(fn, channels, bits_per_sample/8, nsamples[samples])) + 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; } } diff --git a/3rdparty/libflac/src/test_streams/test_streams.dsp b/3rdparty/libflac/src/test_streams/test_streams.dsp deleted file mode 100644 index 985cde94266..00000000000 --- a/3rdparty/libflac/src/test_streams/test_streams.dsp +++ /dev/null @@ -1,96 +0,0 @@ -# Microsoft Developer Studio Project File - Name="test_streams" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=test_streams - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "test_streams.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "test_streams.mak" CFG="test_streams - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "test_streams - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "test_streams - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "test_streams - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\..\obj\release\bin" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /D "NDEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "test_streams - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\..\obj\debug\bin" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "_DEBUG" /D "DEBUG" /D "FLAC__NO_DLL" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "test_streams - Win32 Release" -# Name "test_streams - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "c" -# Begin Source File - -SOURCE=.\main.c -# End Source File -# End Group -# End Target -# End Project diff --git a/3rdparty/libflac/src/test_streams/test_streams.vcproj b/3rdparty/libflac/src/test_streams/test_streams.vcproj deleted file mode 100644 index fec5facae7d..00000000000 --- a/3rdparty/libflac/src/test_streams/test_streams.vcproj +++ /dev/null @@ -1,202 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="test_streams" - ProjectGUID="{4cefbc91-c215-11db-8314-0800200c9a66}" - RootNamespace="test_streams" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="..\..\obj\debug\bin" - IntermediateDirectory="Debug" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FLAC__NO_DLL;DEBUG" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="..\..\obj\release\bin" - IntermediateDirectory="Release" - ConfigurationType="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - EnableIntrinsicFunctions="true" - FavorSizeOrSpeed="1" - OmitFramePointers="true" - WholeProgramOptimization="true" - AdditionalIncludeDirectories=".;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;FLAC__NO_DLL" - RuntimeLibrary="0" - BufferSecurityCheck="false" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - CompileAs="0" - DisableSpecificWarnings="4267;4996" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - IgnoreDefaultLibraryNames="uuid.lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - LinkTimeCodeGeneration="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\main.c" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/Makefile.am b/3rdparty/libflac/src/utils/Makefile.am index 3cfe69af8a3..5207b13c8db 100644 --- a/3rdparty/libflac/src/monkeys_audio_utilities/Makefile.am +++ b/3rdparty/libflac/src/utils/Makefile.am @@ -1,8 +1,9 @@ # FLAC - Free Lossless Audio Codec -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This file is part the FLAC project. FLAC is comprised of several -# components distributed under difference licenses. The codec libraries +# 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 @@ -15,4 +16,4 @@ # restrictive of those mentioned above. See the file COPYING.Xiph in this # distribution. -SUBDIRS = flac_mac flac_ren +SUBDIRS = flacdiff flactimer diff --git a/3rdparty/libflac/src/utils/Makefile.in b/3rdparty/libflac/src/utils/Makefile.in new file mode 100644 index 00000000000..c433e152e02 --- /dev/null +++ b/3rdparty/libflac/src/utils/Makefile.in @@ -0,0 +1,676 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# FLAC - Free Lossless Audio Codec +# Copyright (C) 2001-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation +# +# This file is part the FLAC project. FLAC is comprised of several +# components distributed under different licenses. The codec libraries +# are distributed under Xiph.Org's BSD-like license (see the file +# COPYING.Xiph in this distribution). All other programs, libraries, and +# plugins are distributed under the GPL (see COPYING.GPL). The documentation +# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the +# FLAC distribution contains at the top the terms under which it may be +# distributed. +# +# Since this particular file is relevant to all components of FLAC, +# it may be distributed under the Xiph.Org license, which is the least +# restrictive of those mentioned above. See the file COPYING.Xiph in this +# distribution. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/utils +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ +FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ +FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = flacdiff flactimer +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/utils/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/utils/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ + check-am clean clean-generic clean-libtool cscopelist-am ctags \ + ctags-am distclean distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/3rdparty/libflac/src/utils/flacdiff/CMakeLists.txt b/3rdparty/libflac/src/utils/flacdiff/CMakeLists.txt new file mode 100644 index 00000000000..ec9f771cb35 --- /dev/null +++ b/3rdparty/libflac/src/utils/flacdiff/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(flacdiff + main.cpp + $<$<BOOL:${WIN32}>:../../../include/share/win_utf8_io.h> + $<$<BOOL:${WIN32}>:../../share/win_utf8_io/win_utf8_io.c>) +target_link_libraries(flacdiff FLAC++) diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/Makefile.am b/3rdparty/libflac/src/utils/flacdiff/Makefile.am index fef6138791c..b181d980761 100644 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_mac/Makefile.am +++ b/3rdparty/libflac/src/utils/flacdiff/Makefile.am @@ -1,5 +1,6 @@ -# flac_mac - wedge utility to add FLAC support to Monkey's Audio -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# flacdiff - Displays where two FLAC streams differ +# Copyright (C) 2007-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,11 +12,10 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 = \ - flac_mac.dsp \ - flac_mac.vcproj \ - main.c + CMakeLists.txt \ + main.cpp diff --git a/3rdparty/libflac/src/utils/flacdiff/Makefile.in b/3rdparty/libflac/src/utils/flacdiff/Makefile.in new file mode 100644 index 00000000000..2ff13fc002c --- /dev/null +++ b/3rdparty/libflac/src/utils/flacdiff/Makefile.in @@ -0,0 +1,501 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# flacdiff - Displays where two FLAC streams differ +# Copyright (C) 2007-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/utils/flacdiff +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ +FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ +FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + CMakeLists.txt \ + main.cpp + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/utils/flacdiff/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/utils/flacdiff/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/3rdparty/libflac/src/utils/flacdiff/main.cpp b/3rdparty/libflac/src/utils/flacdiff/main.cpp new file mode 100644 index 00000000000..358fe047e23 --- /dev/null +++ b/3rdparty/libflac/src/utils/flacdiff/main.cpp @@ -0,0 +1,230 @@ +/* flacdiff - Displays where two FLAC streams differ + * Copyright (C) 2007-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> +#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("%s", usage); + return 0; + } + else if(argc != 3) { + fprintf(stderr, "%s", usage); + return 255; + } + + return run(argv[1], argv[2])? 0 : 1; +} diff --git a/3rdparty/libflac/src/utils/flactimer/CMakeLists.txt b/3rdparty/libflac/src/utils/flactimer/CMakeLists.txt new file mode 100644 index 00000000000..47bf1e5ff5d --- /dev/null +++ b/3rdparty/libflac/src/utils/flactimer/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(flactimer main.cpp) +target_link_libraries(flactimer FLAC++) diff --git a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/Makefile.am b/3rdparty/libflac/src/utils/flactimer/Makefile.am index ddb7d2f3f0a..0737863078c 100644 --- a/3rdparty/libflac/src/monkeys_audio_utilities/flac_ren/Makefile.am +++ b/3rdparty/libflac/src/utils/flactimer/Makefile.am @@ -1,5 +1,6 @@ -# flac_ren - renamer part of utility to add FLAC support to Monkey's Audio -# Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson +# flactimer - Runs a command and prints timing information +# Copyright (C) 2007-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -11,11 +12,10 @@ # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# 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 = \ - flac_ren.dsp \ - flac_ren.vcproj \ - main.c + CMakeLists.txt \ + main.cpp diff --git a/3rdparty/libflac/src/utils/flactimer/Makefile.in b/3rdparty/libflac/src/utils/flactimer/Makefile.in new file mode 100644 index 00000000000..da3119d3ed1 --- /dev/null +++ b/3rdparty/libflac/src/utils/flactimer/Makefile.in @@ -0,0 +1,501 @@ +# Makefile.in generated by automake 1.16.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2021 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# flactimer - Runs a command and prints timing information +# Copyright (C) 2007-2009 Josh Coalson +# Copyright (C) 2011-2023 Xiph.Org Foundation +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/utils/flactimer +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \ + $(top_srcdir)/m4/add_cxxflags.m4 \ + $(top_srcdir)/m4/ax_add_fortify_source.m4 \ + $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/ax_check_enable_debug.m4 \ + $(top_srcdir)/m4/bswap.m4 $(top_srcdir)/m4/clang.m4 \ + $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gcc_version.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/ogg.m4 \ + $(top_srcdir)/m4/really_gcc.m4 \ + $(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +am__DIST_COMMON = $(srcdir)/Makefile.in +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSCOPE = @CSCOPE@ +CTAGS = @CTAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN = @DOXYGEN@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +ENABLE_64_BIT_WORDS = @ENABLE_64_BIT_WORDS@ +ETAGS = @ETAGS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FLAC__HAS_OGG = @FLAC__HAS_OGG@ +FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@ +FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@ +GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@ +GCC_MINOR_VERSION = @GCC_MINOR_VERSION@ +GCC_VERSION = @GCC_VERSION@ +GIT_COMMIT_VERSION_HASH = @GIT_COMMIT_VERSION_HASH@ +GIT_FOUND = @GIT_FOUND@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ +LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OBJ_FORMAT = @OBJ_FORMAT@ +OGG_CFLAGS = @OGG_CFLAGS@ +OGG_LIBS = @OGG_LIBS@ +OGG_PACKAGE = @OGG_PACKAGE@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PANDOC = @PANDOC@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +RC = @RC@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +EXTRA_DIST = \ + CMakeLists.txt \ + main.cpp + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/utils/flactimer/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/utils/flactimer/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + cscopelist-am ctags-am distclean distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/3rdparty/libflac/src/utils/flactimer/main.cpp b/3rdparty/libflac/src/utils/flactimer/main.cpp new file mode 100644 index 00000000000..120a37ff33c --- /dev/null +++ b/3rdparty/libflac/src/utils/flactimer/main.cpp @@ -0,0 +1,175 @@ +/* flactimer - Runs a command and prints timing information + * Copyright (C) 2007-2009 Josh Coalson + * Copyright (C) 2011-2023 Xiph.Org Foundation + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <string.h> +#include <windows.h> +#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; +} |