1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-08 09:36:24 +01:00

Update libsndfile to 1.0.29pre2+git

This pulls in MANY (over 890) changes compared to our
from our current 1.0.24 version.
This commit is contained in:
Leland Lucius
2020-03-16 22:41:09 -05:00
parent 4ac45bb5f8
commit b749a16943
370 changed files with 39029 additions and 81333 deletions

View File

@@ -1,47 +0,0 @@
## Process this file with automake to produce Makefile.in
bin_PROGRAMS = sndfile-info sndfile-play sndfile-convert sndfile-cmp \
sndfile-metadata-set sndfile-metadata-get sndfile-interleave \
sndfile-deinterleave sndfile-concat sndfile-salvage
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
AM_CPPFLAGS = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS)
CLEANFILES = *~
# This is the BeOS version of sndfile-play. It needs to be compiled with the C++
# compiler.
EXTRA_DIST = sndfile-play-beos.cpp test-sndfile-metadata-set.py
sndfile_info_SOURCES = sndfile-info.c common.c common.h
sndfile_info_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_play_SOURCES = sndfile-play.c common.c common.h
sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS) $(SNDIO_LIBS)
sndfile_convert_SOURCES = sndfile-convert.c common.c common.h
sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_cmp_SOURCES = sndfile-cmp.c common.c common.h
sndfile_cmp_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_metadata_set_SOURCES = sndfile-metadata-set.c common.c common.h
sndfile_metadata_set_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_metadata_get_SOURCES = sndfile-metadata-get.c common.c common.h
sndfile_metadata_get_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_interleave_SOURCES = sndfile-interleave.c common.c common.h
sndfile_interleave_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_deinterleave_SOURCES = sndfile-deinterleave.c common.c common.h
sndfile_deinterleave_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_concat_SOURCES = sndfile-concat.c common.c common.h
sndfile_concat_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_salvage_SOURCES = sndfile-salvage.c common.c common.h
sndfile_salvage_LDADD = $(top_builddir)/src/libsndfile.la

View File

@@ -1,801 +0,0 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 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@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
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@
target_triplet = @target@
bin_PROGRAMS = sndfile-info$(EXEEXT) sndfile-play$(EXEEXT) \
sndfile-convert$(EXEEXT) sndfile-cmp$(EXEEXT) \
sndfile-metadata-set$(EXEEXT) sndfile-metadata-get$(EXEEXT) \
sndfile-interleave$(EXEEXT) sndfile-deinterleave$(EXEEXT) \
sndfile-concat$(EXEEXT) sndfile-salvage$(EXEEXT)
subdir = programs
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/Cfg/depcomp
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/clip_mode.m4 \
$(top_srcdir)/M4/endian.m4 $(top_srcdir)/M4/extra_largefile.m4 \
$(top_srcdir)/M4/extra_pkg.m4 \
$(top_srcdir)/M4/flexible_array.m4 \
$(top_srcdir)/M4/gcc_version.m4 $(top_srcdir)/M4/libtool.m4 \
$(top_srcdir)/M4/lrint.m4 $(top_srcdir)/M4/lrintf.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/mkoctfile_version.m4 \
$(top_srcdir)/M4/octave.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_sndfile_cmp_OBJECTS = sndfile-cmp.$(OBJEXT) common.$(OBJEXT)
sndfile_cmp_OBJECTS = $(am_sndfile_cmp_OBJECTS)
sndfile_cmp_DEPENDENCIES = $(top_builddir)/src/libsndfile.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_sndfile_concat_OBJECTS = sndfile-concat.$(OBJEXT) common.$(OBJEXT)
sndfile_concat_OBJECTS = $(am_sndfile_concat_OBJECTS)
sndfile_concat_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
am_sndfile_convert_OBJECTS = sndfile-convert.$(OBJEXT) \
common.$(OBJEXT)
sndfile_convert_OBJECTS = $(am_sndfile_convert_OBJECTS)
sndfile_convert_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
am_sndfile_deinterleave_OBJECTS = sndfile-deinterleave.$(OBJEXT) \
common.$(OBJEXT)
sndfile_deinterleave_OBJECTS = $(am_sndfile_deinterleave_OBJECTS)
sndfile_deinterleave_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
am_sndfile_info_OBJECTS = sndfile-info.$(OBJEXT) common.$(OBJEXT)
sndfile_info_OBJECTS = $(am_sndfile_info_OBJECTS)
sndfile_info_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
am_sndfile_interleave_OBJECTS = sndfile-interleave.$(OBJEXT) \
common.$(OBJEXT)
sndfile_interleave_OBJECTS = $(am_sndfile_interleave_OBJECTS)
sndfile_interleave_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
am_sndfile_metadata_get_OBJECTS = sndfile-metadata-get.$(OBJEXT) \
common.$(OBJEXT)
sndfile_metadata_get_OBJECTS = $(am_sndfile_metadata_get_OBJECTS)
sndfile_metadata_get_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
am_sndfile_metadata_set_OBJECTS = sndfile-metadata-set.$(OBJEXT) \
common.$(OBJEXT)
sndfile_metadata_set_OBJECTS = $(am_sndfile_metadata_set_OBJECTS)
sndfile_metadata_set_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
am_sndfile_play_OBJECTS = sndfile-play.$(OBJEXT) common.$(OBJEXT)
sndfile_play_OBJECTS = $(am_sndfile_play_OBJECTS)
am__DEPENDENCIES_1 =
sndfile_play_DEPENDENCIES = $(top_builddir)/src/libsndfile.la \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
am_sndfile_salvage_OBJECTS = sndfile-salvage.$(OBJEXT) \
common.$(OBJEXT)
sndfile_salvage_OBJECTS = $(am_sndfile_salvage_OBJECTS)
sndfile_salvage_DEPENDENCIES = $(top_builddir)/src/libsndfile.la
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)/src
depcomp = $(SHELL) $(top_srcdir)/Cfg/depcomp
am__depfiles_maybe = depfiles
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 = $(sndfile_cmp_SOURCES) $(sndfile_concat_SOURCES) \
$(sndfile_convert_SOURCES) $(sndfile_deinterleave_SOURCES) \
$(sndfile_info_SOURCES) $(sndfile_interleave_SOURCES) \
$(sndfile_metadata_get_SOURCES) \
$(sndfile_metadata_set_SOURCES) $(sndfile_play_SOURCES) \
$(sndfile_salvage_SOURCES)
DIST_SOURCES = $(sndfile_cmp_SOURCES) $(sndfile_concat_SOURCES) \
$(sndfile_convert_SOURCES) $(sndfile_deinterleave_SOURCES) \
$(sndfile_info_SOURCES) $(sndfile_interleave_SOURCES) \
$(sndfile_metadata_get_SOURCES) \
$(sndfile_metadata_set_SOURCES) $(sndfile_play_SOURCES) \
$(sndfile_salvage_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)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALSA_LIBS = @ALSA_LIBS@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CLEAN_VERSION = @CLEAN_VERSION@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTERNAL_CFLAGS = @EXTERNAL_CFLAGS@
EXTERNAL_LIBS = @EXTERNAL_LIBS@
FGREP = @FGREP@
FLAC_CFLAGS = @FLAC_CFLAGS@
FLAC_LIBS = @FLAC_LIBS@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GCC_MINOR_VERSION = @GCC_MINOR_VERSION@
GCC_VERSION = @GCC_VERSION@
GETCONF = @GETCONF@
GREP = @GREP@
HAVE_AUTOGEN = @HAVE_AUTOGEN@
HAVE_MKOCTFILE = @HAVE_MKOCTFILE@
HAVE_OCTAVE = @HAVE_OCTAVE@
HAVE_OCTAVE_CONFIG = @HAVE_OCTAVE_CONFIG@
HAVE_WINE = @HAVE_WINE@
HOST_TRIPLET = @HOST_TRIPLET@
HTML_BGCOLOUR = @HTML_BGCOLOUR@
HTML_FGCOLOUR = @HTML_FGCOLOUR@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MKOCTFILE = @MKOCTFILE@
MKOCTFILE_VERSION = @MKOCTFILE_VERSION@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OCTAVE = @OCTAVE@
OCTAVE_CONFIG = @OCTAVE_CONFIG@
OCTAVE_CONFIG_VERSION = @OCTAVE_CONFIG_VERSION@
OCTAVE_DEST_MDIR = @OCTAVE_DEST_MDIR@
OCTAVE_DEST_ODIR = @OCTAVE_DEST_ODIR@
OCTAVE_VERSION = @OCTAVE_VERSION@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
OS_SPECIFIC_CFLAGS = @OS_SPECIFIC_CFLAGS@
OS_SPECIFIC_LINKS = @OS_SPECIFIC_LINKS@
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@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SF_COUNT_MAX = @SF_COUNT_MAX@
SHARED_VERSION_INFO = @SHARED_VERSION_INFO@
SHELL = @SHELL@
SHLIB_VERSION_ARG = @SHLIB_VERSION_ARG@
SIZEOF_SF_COUNT_T = @SIZEOF_SF_COUNT_T@
SNDIO_LIBS = @SNDIO_LIBS@
SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
SQLITE3_LIBS = @SQLITE3_LIBS@
STRIP = @STRIP@
TYPEOF_SF_COUNT_T = @TYPEOF_SF_COUNT_T@
VERSION = @VERSION@
VORBISENC_CFLAGS = @VORBISENC_CFLAGS@
VORBISENC_LIBS = @VORBISENC_LIBS@
VORBIS_CFLAGS = @VORBIS_CFLAGS@
VORBIS_LIBS = @VORBIS_LIBS@
WIN_RC_VERSION = @WIN_RC_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@
htmldocdir = @htmldocdir@
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@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/src $(OS_SPECIFIC_CFLAGS)
CLEANFILES = *~
# This is the BeOS version of sndfile-play. It needs to be compiled with the C++
# compiler.
EXTRA_DIST = sndfile-play-beos.cpp test-sndfile-metadata-set.py
sndfile_info_SOURCES = sndfile-info.c common.c common.h
sndfile_info_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_play_SOURCES = sndfile-play.c common.c common.h
sndfile_play_LDADD = $(top_builddir)/src/libsndfile.la $(OS_SPECIFIC_LINKS) $(ALSA_LIBS) $(SNDIO_LIBS)
sndfile_convert_SOURCES = sndfile-convert.c common.c common.h
sndfile_convert_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_cmp_SOURCES = sndfile-cmp.c common.c common.h
sndfile_cmp_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_metadata_set_SOURCES = sndfile-metadata-set.c common.c common.h
sndfile_metadata_set_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_metadata_get_SOURCES = sndfile-metadata-get.c common.c common.h
sndfile_metadata_get_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_interleave_SOURCES = sndfile-interleave.c common.c common.h
sndfile_interleave_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_deinterleave_SOURCES = sndfile-deinterleave.c common.c common.h
sndfile_deinterleave_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_concat_SOURCES = sndfile-concat.c common.c common.h
sndfile_concat_LDADD = $(top_builddir)/src/libsndfile.la
sndfile_salvage_SOURCES = sndfile-salvage.c common.c common.h
sndfile_salvage_LDADD = $(top_builddir)/src/libsndfile.la
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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) --gnu programs/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu programs/Makefile
.PRECIOUS: 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__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@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)'; 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)'; 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
sndfile-cmp$(EXEEXT): $(sndfile_cmp_OBJECTS) $(sndfile_cmp_DEPENDENCIES) $(EXTRA_sndfile_cmp_DEPENDENCIES)
@rm -f sndfile-cmp$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_cmp_OBJECTS) $(sndfile_cmp_LDADD) $(LIBS)
sndfile-concat$(EXEEXT): $(sndfile_concat_OBJECTS) $(sndfile_concat_DEPENDENCIES) $(EXTRA_sndfile_concat_DEPENDENCIES)
@rm -f sndfile-concat$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_concat_OBJECTS) $(sndfile_concat_LDADD) $(LIBS)
sndfile-convert$(EXEEXT): $(sndfile_convert_OBJECTS) $(sndfile_convert_DEPENDENCIES) $(EXTRA_sndfile_convert_DEPENDENCIES)
@rm -f sndfile-convert$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_convert_OBJECTS) $(sndfile_convert_LDADD) $(LIBS)
sndfile-deinterleave$(EXEEXT): $(sndfile_deinterleave_OBJECTS) $(sndfile_deinterleave_DEPENDENCIES) $(EXTRA_sndfile_deinterleave_DEPENDENCIES)
@rm -f sndfile-deinterleave$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_deinterleave_OBJECTS) $(sndfile_deinterleave_LDADD) $(LIBS)
sndfile-info$(EXEEXT): $(sndfile_info_OBJECTS) $(sndfile_info_DEPENDENCIES) $(EXTRA_sndfile_info_DEPENDENCIES)
@rm -f sndfile-info$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_info_OBJECTS) $(sndfile_info_LDADD) $(LIBS)
sndfile-interleave$(EXEEXT): $(sndfile_interleave_OBJECTS) $(sndfile_interleave_DEPENDENCIES) $(EXTRA_sndfile_interleave_DEPENDENCIES)
@rm -f sndfile-interleave$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_interleave_OBJECTS) $(sndfile_interleave_LDADD) $(LIBS)
sndfile-metadata-get$(EXEEXT): $(sndfile_metadata_get_OBJECTS) $(sndfile_metadata_get_DEPENDENCIES) $(EXTRA_sndfile_metadata_get_DEPENDENCIES)
@rm -f sndfile-metadata-get$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_metadata_get_OBJECTS) $(sndfile_metadata_get_LDADD) $(LIBS)
sndfile-metadata-set$(EXEEXT): $(sndfile_metadata_set_OBJECTS) $(sndfile_metadata_set_DEPENDENCIES) $(EXTRA_sndfile_metadata_set_DEPENDENCIES)
@rm -f sndfile-metadata-set$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_metadata_set_OBJECTS) $(sndfile_metadata_set_LDADD) $(LIBS)
sndfile-play$(EXEEXT): $(sndfile_play_OBJECTS) $(sndfile_play_DEPENDENCIES) $(EXTRA_sndfile_play_DEPENDENCIES)
@rm -f sndfile-play$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_play_OBJECTS) $(sndfile_play_LDADD) $(LIBS)
sndfile-salvage$(EXEEXT): $(sndfile_salvage_OBJECTS) $(sndfile_salvage_DEPENDENCIES) $(EXTRA_sndfile_salvage_DEPENDENCIES)
@rm -f sndfile-salvage$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(sndfile_salvage_OBJECTS) $(sndfile_salvage_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-cmp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-concat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-convert.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-deinterleave.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-info.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-interleave.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-metadata-get.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-metadata-set.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-play.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sndfile-salvage.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.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
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 \
$(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) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(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
distdir: $(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 $(PROGRAMS)
installdirs:
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
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:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
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-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile 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-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 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-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am 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 tags-am uninstall uninstall-am uninstall-binPROGRAMS
# 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:

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2019 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008 George Blood Audio
**
** All rights reserved.
@@ -36,26 +36,27 @@
#include <string.h>
#include <ctype.h>
#include <stdint.h>
#include <math.h>
#include <sndfile.h>
#include "common.h"
#define BUFFER_LEN 4096
#define BUFFER_LEN 4096
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
void
sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels)
sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize)
{ static double data [BUFFER_LEN], max ;
int frames, readcount, k ;
sf_count_t frames, readcount, k ;
frames = BUFFER_LEN / channels ;
readcount = frames ;
sf_command (infile, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
if (max < 1.0)
if (!normalize && max < 1.0)
{ while (readcount > 0)
{ readcount = sf_readf_double (infile, data, frames) ;
sf_writef_double (outfile, data, readcount) ;
@@ -147,6 +148,18 @@ merge_broadcast_info (SNDFILE * infile, SNDFILE * outfile, int format, const MET
REPLACE_IF_NEW (origination_time) ;
REPLACE_IF_NEW (umid) ;
/* Special case loudness values */
#define REPLACE_IF_NEW_INT(x) \
if (info->x != NULL) \
{ binfo.x = round (atof (info->x) * 100.0) ; \
} ;
REPLACE_IF_NEW_INT (loudness_value) ;
REPLACE_IF_NEW_INT (loudness_range) ;
REPLACE_IF_NEW_INT (max_true_peak_level) ;
REPLACE_IF_NEW_INT (max_momentary_loudness) ;
REPLACE_IF_NEW_INT (max_shortterm_loudness) ;
/* Special case for Time Ref. */
if (info->time_ref != NULL)
{ uint64_t ts = atoll (info->time_ref) ;
@@ -252,7 +265,7 @@ sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * in
/* If the input file is not the same as the output file, copy the data. */
if ((infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT))
sfe_copy_data_fp (outfile, infile, sfinfo.channels) ;
sfe_copy_data_fp (outfile, infile, sfinfo.channels, SF_FALSE) ;
else
sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
} ;
@@ -282,35 +295,42 @@ typedef struct
int format ;
} OUTPUT_FORMAT_MAP ;
/* Map a file name extension to a container format. */
static OUTPUT_FORMAT_MAP format_map [] =
{
{ "aif", 3, SF_FORMAT_AIFF },
{ "wav", 0, SF_FORMAT_WAV },
{ "aif", 3, SF_FORMAT_AIFF },
{ "au", 0, SF_FORMAT_AU },
{ "caf", 0, SF_FORMAT_CAF },
{ "flac", 0, SF_FORMAT_FLAC },
{ "snd", 0, SF_FORMAT_AU },
{ "svx", 0, SF_FORMAT_SVX },
{ "paf", 0, SF_ENDIAN_BIG | SF_FORMAT_PAF },
{ "fap", 0, SF_ENDIAN_LITTLE | SF_FORMAT_PAF },
{ "raw", 0, SF_FORMAT_RAW },
{ "gsm", 0, SF_FORMAT_RAW },
{ "vox", 0, SF_FORMAT_RAW },
{ "paf", 0, SF_FORMAT_PAF | SF_ENDIAN_BIG },
{ "fap", 0, SF_FORMAT_PAF | SF_ENDIAN_LITTLE },
{ "svx", 0, SF_FORMAT_SVX },
{ "nist", 0, SF_FORMAT_NIST },
{ "htk", 0, SF_FORMAT_HTK },
{ "sph", 0, SF_FORMAT_NIST },
{ "voc", 0, SF_FORMAT_VOC },
{ "ircam", 0, SF_FORMAT_IRCAM },
{ "sf", 0, SF_FORMAT_IRCAM },
{ "voc", 0, SF_FORMAT_VOC },
{ "w64", 0, SF_FORMAT_W64 },
{ "raw", 0, SF_FORMAT_RAW },
{ "mat", 0, SF_FORMAT_MAT4 },
{ "mat4", 0, SF_FORMAT_MAT4 },
{ "mat5", 0, SF_FORMAT_MAT5 },
{ "mat", 0, SF_FORMAT_MAT4 },
{ "pvf", 0, SF_FORMAT_PVF },
{ "sds", 0, SF_FORMAT_SDS },
{ "sd2", 0, SF_FORMAT_SD2 },
{ "vox", 0, SF_FORMAT_RAW },
{ "xi", 0, SF_FORMAT_XI },
{ "htk", 0, SF_FORMAT_HTK },
{ "sds", 0, SF_FORMAT_SDS },
{ "avr", 0, SF_FORMAT_AVR },
{ "wavex", 0, SF_FORMAT_WAVEX },
{ "sd2", 0, SF_FORMAT_SD2 },
{ "flac", 0, SF_FORMAT_FLAC },
{ "caf", 0, SF_FORMAT_CAF },
{ "wve", 0, SF_FORMAT_WVE },
{ "prc", 0, SF_FORMAT_WVE },
{ "ogg", 0, SF_FORMAT_OGG },
{ "oga", 0, SF_FORMAT_OGG },
{ "opus", 0, SF_FORMAT_OGG }, /* Opus data in an Ogg container. */
{ "mpc", 0, SF_FORMAT_MPC2K },
{ "rf64", 0, SF_FORMAT_RF64 },
} ; /* format_map */
@@ -368,12 +388,95 @@ program_name (const char * argv0)
tmp = strrchr (argv0, '/') ;
argv0 = tmp ? tmp + 1 : argv0 ;
tmp = strrchr (argv0, '/') ;
argv0 = tmp ? tmp + 1 : argv0 ;
/* Remove leading libtool name mangling. */
if (strstr (argv0, "lt-") == argv0)
return argv0 + 3 ;
return argv0 ;
} /* program_name */
const char *
sfe_endian_name (int format)
{
switch (format & SF_FORMAT_ENDMASK)
{ case SF_ENDIAN_FILE : return "file" ;
case SF_ENDIAN_LITTLE : return "little" ;
case SF_ENDIAN_BIG : return "big" ;
case SF_ENDIAN_CPU : return "cpu" ;
default : break ;
} ;
return "unknown" ;
} /* sfe_endian_name */
const char *
sfe_container_name (int format)
{
switch (format & SF_FORMAT_TYPEMASK)
{ case SF_FORMAT_WAV : return "WAV" ;
case SF_FORMAT_AIFF : return "AIFF" ;
case SF_FORMAT_AU : return "AU" ;
case SF_FORMAT_RAW : return "RAW" ;
case SF_FORMAT_PAF : return "PAF" ;
case SF_FORMAT_SVX : return "SVX" ;
case SF_FORMAT_NIST : return "NIST" ;
case SF_FORMAT_VOC : return "VOC" ;
case SF_FORMAT_IRCAM : return "IRCAM" ;
case SF_FORMAT_W64 : return "W64" ;
case SF_FORMAT_MAT4 : return "MAT4" ;
case SF_FORMAT_MAT5 : return "MAT5" ;
case SF_FORMAT_PVF : return "PVF" ;
case SF_FORMAT_XI : return "XI" ;
case SF_FORMAT_HTK : return "HTK" ;
case SF_FORMAT_SDS : return "SDS" ;
case SF_FORMAT_AVR : return "AVR" ;
case SF_FORMAT_WAVEX : return "WAVEX" ;
case SF_FORMAT_SD2 : return "SD2" ;
case SF_FORMAT_FLAC : return "FLAC" ;
case SF_FORMAT_CAF : return "CAF" ;
case SF_FORMAT_WVE : return "WVE" ;
case SF_FORMAT_OGG : return "OGG" ;
case SF_FORMAT_MPC2K : return "MPC2K" ;
case SF_FORMAT_RF64 : return "RF64" ;
default : break ;
} ;
return "unknown" ;
} /* sfe_container_name */
const char *
sfe_codec_name (int format)
{
switch (format & SF_FORMAT_SUBMASK)
{ case SF_FORMAT_PCM_S8 : return "signed 8 bit PCM" ;
case SF_FORMAT_PCM_16 : return "16 bit PCM" ;
case SF_FORMAT_PCM_24 : return "24 bit PCM" ;
case SF_FORMAT_PCM_32 : return "32 bit PCM" ;
case SF_FORMAT_PCM_U8 : return "unsigned 8 bit PCM" ;
case SF_FORMAT_FLOAT : return "32 bit float" ;
case SF_FORMAT_DOUBLE : return "64 bit double" ;
case SF_FORMAT_ULAW : return "u-law" ;
case SF_FORMAT_ALAW : return "a-law" ;
case SF_FORMAT_IMA_ADPCM : return "IMA ADPCM" ;
case SF_FORMAT_MS_ADPCM : return "MS ADPCM" ;
case SF_FORMAT_GSM610 : return "gsm610" ;
case SF_FORMAT_VOX_ADPCM : return "Vox ADPCM" ;
case SF_FORMAT_G721_32 : return "g721 32kbps" ;
case SF_FORMAT_G723_24 : return "g723 24kbps" ;
case SF_FORMAT_G723_40 : return "g723 40kbps" ;
case SF_FORMAT_DWVW_12 : return "12 bit DWVW" ;
case SF_FORMAT_DWVW_16 : return "16 bit DWVW" ;
case SF_FORMAT_DWVW_24 : return "14 bit DWVW" ;
case SF_FORMAT_DWVW_N : return "DWVW" ;
case SF_FORMAT_DPCM_8 : return "8 bit DPCM" ;
case SF_FORMAT_DPCM_16 : return "16 bit DPCM" ;
case SF_FORMAT_VORBIS : return "Vorbis" ;
case SF_FORMAT_ALAC_16 : return "16 bit ALAC" ;
case SF_FORMAT_ALAC_20 : return "20 bit ALAC" ;
case SF_FORMAT_ALAC_24 : return "24 bit ALAC" ;
case SF_FORMAT_ALAC_32 : return "32 bit ALAC" ;
case SF_FORMAT_OPUS : return "Opus" ;
default : break ;
} ;
return "unknown" ;
} /* sfe_codec_name */

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2013 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@@ -32,7 +32,7 @@
#define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof (x [0])))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
typedef struct
{ const char * title ;
@@ -54,6 +54,11 @@ typedef struct
const char * origination_date ;
const char * origination_time ;
const char * umid ;
const char * loudness_value ;
const char * loudness_range ;
const char * max_true_peak_level ;
const char * max_momentary_loudness ;
const char * max_shortterm_loudness ;
const char * coding_history ;
const char * time_ref ;
} METADATA_INFO ;
@@ -62,7 +67,7 @@ typedef SF_BROADCAST_INFO_VAR (2048) SF_BROADCAST_INFO_2K ;
void sfe_apply_metadata_changes (const char * filenames [2], const METADATA_INFO * info) ;
void sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels) ;
void sfe_copy_data_fp (SNDFILE *outfile, SNDFILE *infile, int channels, int normalize) ;
void sfe_copy_data_int (SNDFILE *outfile, SNDFILE *infile, int channels) ;
@@ -71,3 +76,7 @@ int sfe_file_type_of_ext (const char *filename, int format) ;
void sfe_dump_format_map (void) ;
const char * program_name (const char * argv0) ;
const char * sfe_endian_name (int format) ;
const char * sfe_container_name (int format) ;
const char * sfe_codec_name (int format) ;

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008 Conrad Parker <conrad@metadecks.org>
**
** All rights reserved.
@@ -50,10 +50,12 @@ static char * filename1 = NULL, * filename2 = NULL ;
static int
comparison_error (const char * what, sf_count_t frame_offset)
{ char buffer [128] = "" ;
{ char buffer [128] ;
if (frame_offset >= 0)
snprintf (buffer, sizeof (buffer), " (at frame offset %" PRId64 ")", frame_offset) ;
else
buffer [0] = 0 ;
printf ("%s: %s of files %s and %s differ%s.\n", progname, what, filename1, filename2, buffer) ;
return 1 ;
@@ -97,7 +99,7 @@ compare (void)
/* Calculate the framecount that will fit in our data buffers */
items = BUFLEN / sfinfo1.channels ;
while ( (nread1 = sf_readf_double (sf1, buf1, items)) > 0)
while ((nread1 = sf_readf_double (sf1, buf1, items)) > 0)
{ nread2 = sf_readf_double (sf2, buf2, nread1) ;
if (nread2 != nread1)
{ retval = comparison_error ("PCM data lengths", -1) ;
@@ -112,7 +114,7 @@ compare (void)
offset += nread1 ;
} ;
if ( (nread2 = sf_readf_double (sf2, buf2, nread1)) != 0)
if ((nread2 = sf_readf_double (sf2, buf2, items)) != 0)
{ retval = comparison_error ("PCM data lengths", -1) ;
goto out ;
} ;
@@ -124,22 +126,13 @@ out :
return retval ;
} /* compare */
static void
print_version (void)
{ char buffer [256] ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
printf ("\nVersion : %s\n\n", buffer) ;
} /* print_version */
static void
usage_exit (void)
{
print_version () ;
printf ("Usage : %s <filename> <filename>\n", progname) ;
printf (" Compare the PCM data of two sound files.\n\n") ;
exit (0) ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (1) ;
} /* usage_exit */
int
@@ -148,9 +141,7 @@ main (int argc, char *argv [])
progname = program_name (argv [0]) ;
if (argc != 3)
{ usage_exit () ;
return 1 ;
} ;
usage_exit () ;
filename1 = argv [argc - 2] ;
filename2 = argv [argc - 1] ;
@@ -158,7 +149,6 @@ main (int argc, char *argv [])
if (strcmp (filename1, filename2) == 0)
{ printf ("Error : Input filenames are the same.\n\n") ;
usage_exit () ;
return 1 ;
} ;
return compare () ;

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@@ -39,7 +39,7 @@
#include "common.h"
#define BUFFER_LEN (1<<16)
#define BUFFER_LEN (1 << 16)
static void concat_data_fp (SNDFILE *wfile, SNDFILE *rofile, int channels) ;
@@ -61,14 +61,14 @@ usage_exit (const char *progname)
" number of channels.\n"
) ;
exit (0) ;
exit (1) ;
} /* usage_exit */
int
main (int argc, char *argv [])
{ const char *progname, *outfilename ;
SNDFILE *outfile, **infiles ;
SF_INFO sfinfo_out, sfinfo_in ;
SNDFILE *outfile, **infiles ;
SF_INFO sfinfo_out, sfinfo_in ;
void (*func) (SNDFILE*, SNDFILE*, int) ;
int k ;
@@ -127,6 +127,7 @@ main (int argc, char *argv [])
} ;
sf_close (outfile) ;
free (infiles) ;
return 0 ;
} /* main */

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2019 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@@ -54,27 +54,42 @@ usage_exit (const char *progname)
puts ("\n"
" where [option] may be:\n\n"
" -override-sample-rate=X : force sample rate of input to X\n"
" -endian=little : force output file to little endian data\n"
" -endian=big : force output file to big endian data\n"
" -endian=cpu : force output file same endian-ness as the CPU\n"
" -normalize : normalize the data in the output file\n"
) ;
puts (
" where [encoding] may be one of the following:\n\n"
" -pcms8 : force the output to signed 8 bit pcm\n"
" -pcmu8 : force the output to unsigned 8 bit pcm\n"
" -pcm16 : force the output to 16 bit pcm\n"
" -pcm24 : force the output to 24 bit pcm\n"
" -pcm32 : force the output to 32 bit pcm\n"
" -float32 : force the output to 32 bit floating point"
" -pcms8 : signed 8 bit pcm\n"
" -pcmu8 : unsigned 8 bit pcm\n"
" -pcm16 : 16 bit pcm\n"
" -pcm24 : 24 bit pcm\n"
" -pcm32 : 32 bit pcm\n"
" -float32 : 32 bit floating point\n"
" -float64 : 64 bit floating point\n"
" -ulaw : ULAW\n"
" -alaw : ALAW\n"
" -alac16 : 16 bit ALAC (CAF only)\n"
" -alac20 : 20 bit ALAC (CAF only)\n"
" -alac24 : 24 bit ALAC (CAF only)\n"
" -alac32 : 32 bit ALAC (CAF only)\n"
" -ima-adpcm : IMA ADPCM (WAV only)\n"
" -ms-adpcm : MS ADPCM (WAV only)\n"
" -gsm610 : GSM6.10 (WAV only)\n"
" -dwvw12 : 12 bit DWVW (AIFF only)\n"
" -dwvw16 : 16 bit DWVW (AIFF only)\n"
" -dwvw24 : 24 bit DWVW (AIFF only)\n"
" -vorbis : Vorbis (OGG only)\n"
" -opus : Opus (OGG only)\n"
) ;
puts (
" -ulaw : force the output ULAW\n"
" -alaw : force the output ALAW\n"
" -ima-adpcm : force the output to IMA ADPCM (WAV only)\n"
" -ms-adpcm : force the output to MS ADPCM (WAV only)\n"
" -gsm610 : force the GSM6.10 (WAV only)\n"
" -dwvw12 : force the output to 12 bit DWVW (AIFF only)\n"
" -dwvw16 : force the output to 16 bit DWVW (AIFF only)\n"
" -dwvw24 : force the output to 24 bit DWVW (AIFF only)\n"
" -vorbis : force the output to Vorbis (OGG only)\n"
" If no encoding is specified, the program will try to use the encoding\n"
" of the input file in the output file. This will not always work as\n"
" most container formats (eg WAV, AIFF etc) only support a small subset\n"
" of codec formats (eg 16 bit PCM, a-law, Vorbis etc).\n"
) ;
puts (
@@ -85,23 +100,49 @@ usage_exit (const char *progname)
sfe_dump_format_map () ;
puts ("") ;
exit (0) ;
exit (1) ;
} /* usage_exit */
static void
report_format_error_exit (const char * argv0, SF_INFO * sfinfo)
{ int old_format = sfinfo->format ;
int endian = sfinfo->format & SF_FORMAT_ENDMASK ;
int channels = sfinfo->channels ;
sfinfo->format = old_format & (SF_FORMAT_TYPEMASK | SF_FORMAT_SUBMASK) ;
if (endian && sf_format_check (sfinfo))
{ printf ("Error : output file format does not support %s endian-ness.\n", sfe_endian_name (endian)) ;
exit (1) ;
} ;
sfinfo->channels = 1 ;
if (sf_format_check (sfinfo))
{ printf ("Error : output file format does not support %d channels.\n", channels) ;
exit (1) ;
} ;
printf ("\n"
"Error : output file format is invalid.\n"
"The '%s' container does not support '%s' codec data.\n"
"Run '%s --help' for clues.\n\n",
sfe_container_name (sfinfo->format), sfe_codec_name (sfinfo->format), program_name (argv0)) ;
exit (1) ;
} /* report_format_error_exit */
int
main (int argc, char * argv [])
{ const char *progname, *infilename, *outfilename ;
SNDFILE *infile = NULL, *outfile = NULL ;
SF_INFO sfinfo ;
SNDFILE *infile = NULL, *outfile = NULL ;
SF_INFO sfinfo ;
int k, outfilemajor, outfileminor = 0, infileminor ;
int override_sample_rate = 0 ; /* assume no sample rate override. */
int endian = SF_ENDIAN_FILE, normalize = SF_FALSE ;
progname = program_name (argv [0]) ;
if (argc < 3 || argc > 5)
{ usage_exit (progname) ;
return 1 ;
} ;
usage_exit (progname) ;
infilename = argv [argc-2] ;
outfilename = argv [argc-1] ;
@@ -109,19 +150,16 @@ main (int argc, char * argv [])
if (strcmp (infilename, outfilename) == 0)
{ printf ("Error : Input and output filenames are the same.\n\n") ;
usage_exit (progname) ;
return 1 ;
} ;
if (strlen (infilename) > 1 && infilename [0] == '-')
{ printf ("Error : Input filename (%s) looks like an option.\n\n", infilename) ;
usage_exit (progname) ;
return 1 ;
} ;
if (outfilename [0] == '-')
{ printf ("Error : Output filename (%s) looks like an option.\n\n", outfilename) ;
usage_exit (progname) ;
return 1 ;
} ;
for (k = 1 ; k < argc - 2 ; k++)
@@ -149,6 +187,10 @@ main (int argc, char * argv [])
{ outfileminor = SF_FORMAT_FLOAT ;
continue ;
} ;
if (! strcmp (argv [k], "-float64"))
{ outfileminor = SF_FORMAT_DOUBLE ;
continue ;
} ;
if (! strcmp (argv [k], "-ulaw"))
{ outfileminor = SF_FORMAT_ULAW ;
continue ;
@@ -157,6 +199,22 @@ main (int argc, char * argv [])
{ outfileminor = SF_FORMAT_ALAW ;
continue ;
} ;
if (! strcmp (argv [k], "-alac16"))
{ outfileminor = SF_FORMAT_ALAC_16 ;
continue ;
} ;
if (! strcmp (argv [k], "-alac20"))
{ outfileminor = SF_FORMAT_ALAC_20 ;
continue ;
} ;
if (! strcmp (argv [k], "-alac24"))
{ outfileminor = SF_FORMAT_ALAC_24 ;
continue ;
} ;
if (! strcmp (argv [k], "-alac32"))
{ outfileminor = SF_FORMAT_ALAC_32 ;
continue ;
} ;
if (! strcmp (argv [k], "-ima-adpcm"))
{ outfileminor = SF_FORMAT_IMA_ADPCM ;
continue ;
@@ -185,6 +243,10 @@ main (int argc, char * argv [])
{ outfileminor = SF_FORMAT_VORBIS ;
continue ;
} ;
if (! strcmp (argv [k], "-opus"))
{ outfileminor = SF_FORMAT_OPUS ;
continue ;
} ;
if (strstr (argv [k], "-override-sample-rate=") == argv [k])
{ const char *ptr ;
@@ -194,6 +256,31 @@ main (int argc, char * argv [])
continue ;
} ;
if (! strcmp (argv [k], "-endian=little"))
{ endian = SF_ENDIAN_LITTLE ;
continue ;
} ;
if (! strcmp (argv [k], "-endian=big"))
{ endian = SF_ENDIAN_BIG ;
continue ;
} ;
if (! strcmp (argv [k], "-endian=cpu"))
{ endian = SF_ENDIAN_CPU ;
continue ;
} ;
if (! strcmp (argv [k], "-endian=file"))
{ endian = SF_ENDIAN_FILE ;
continue ;
} ;
if (! strcmp (argv [k], "-normalize"))
{ normalize = SF_TRUE ;
continue ;
} ;
printf ("Error : Not able to decode argunment '%s'.\n", argv [k]) ;
exit (1) ;
} ;
@@ -227,6 +314,8 @@ main (int argc, char * argv [])
else
sfinfo.format = outfilemajor | (sfinfo.format & SF_FORMAT_SUBMASK) ;
sfinfo.format |= endian ;
if ((sfinfo.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_XI)
switch (sfinfo.format & SF_FORMAT_SUBMASK)
{ case SF_FORMAT_PCM_16 :
@@ -240,8 +329,16 @@ main (int argc, char * argv [])
} ;
if (sf_format_check (&sfinfo) == 0)
{ printf ("Error : output file format is invalid (0x%08X).\n", sfinfo.format) ;
return 1 ;
{ sf_close (infile) ;
report_format_error_exit (argv [0], &sfinfo) ;
} ;
if ((sfinfo.format & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610 && sfinfo.samplerate != 8000)
{ printf (
"WARNING: GSM 6.10 data format only supports 8kHz sample rate. The converted\n"
"ouput file will contain the input data converted to the GSM 6.10 data format\n"
"but not re-sampled.\n"
) ;
} ;
/* Open the output file. */
@@ -253,10 +350,12 @@ main (int argc, char * argv [])
/* Copy the metadata */
copy_metadata (outfile, infile, sfinfo.channels) ;
if ((outfileminor == SF_FORMAT_DOUBLE) || (outfileminor == SF_FORMAT_FLOAT)
if (normalize
|| (outfileminor == SF_FORMAT_DOUBLE) || (outfileminor == SF_FORMAT_FLOAT)
|| (infileminor == SF_FORMAT_DOUBLE) || (infileminor == SF_FORMAT_FLOAT)
|| (infileminor == SF_FORMAT_OPUS) || (outfileminor == SF_FORMAT_OPUS)
|| (infileminor == SF_FORMAT_VORBIS) || (outfileminor == SF_FORMAT_VORBIS))
sfe_copy_data_fp (outfile, infile, sfinfo.channels) ;
sfe_copy_data_fp (outfile, infile, sfinfo.channels, normalize) ;
else
sfe_copy_data_int (outfile, infile, sfinfo.channels) ;
@@ -269,17 +368,19 @@ main (int argc, char * argv [])
static void
copy_metadata (SNDFILE *outfile, SNDFILE *infile, int channels)
{ SF_INSTRUMENT inst ;
SF_CUES cues ;
SF_BROADCAST_INFO_2K binfo ;
const char *str ;
int k, err = 0, chanmap [256] ;
int k, chanmap [256] ;
for (k = SF_STR_FIRST ; k <= SF_STR_LAST ; k++)
{ str = sf_get_string (infile, k) ;
if (str != NULL)
err = sf_set_string (outfile, k, str) ;
sf_set_string (outfile, k, str) ;
} ;
memset (&inst, 0, sizeof (inst)) ;
memset (&cues, 0, sizeof (cues)) ;
memset (&binfo, 0, sizeof (binfo)) ;
if (channels < ARRAY_LEN (chanmap))
@@ -289,6 +390,9 @@ copy_metadata (SNDFILE *outfile, SNDFILE *infile, int channels)
sf_command (outfile, SFC_SET_CHANNEL_MAP_INFO, chanmap, size) ;
} ;
if (sf_command (infile, SFC_GET_CUE, &cues, sizeof (cues)) == SF_TRUE)
sf_command (outfile, SFC_SET_CUE, &cues, sizeof (cues)) ;
if (sf_command (infile, SFC_GET_INSTRUMENT, &inst, sizeof (inst)) == SF_TRUE)
sf_command (outfile, SFC_SET_INSTRUMENT, &inst, sizeof (inst)) ;

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 2009-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2009-2017 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@@ -89,10 +89,21 @@ main (int argc, char **argv)
exit (1) ;
} ;
if (sfinfo.channels > MAX_CHANNELS)
{ printf ("\nError : Input file '%s' has too many (%d) channels. Limit is %d.\n",
argv [1], sfinfo.channels, MAX_CHANNELS) ;
exit (1) ;
} ;
state.channels = sfinfo.channels ;
sfinfo.channels = 1 ;
snprintf (pathname, sizeof (pathname), "%s", argv [1]) ;
if (snprintf (pathname, sizeof (pathname), "%s", argv [1]) > (int) sizeof (pathname))
{ printf ("\nError : Length of provided filename '%s' exceeds MAX_PATH (%d).\n", argv [1], (int) sizeof (pathname)) ;
exit (1) ;
} ;
if ((cptr = strrchr (pathname, '.')) == NULL)
ext [0] = 0 ;
else
@@ -105,8 +116,13 @@ main (int argc, char **argv)
for (ch = 0 ; ch < state.channels ; ch++)
{ char filename [520] ;
size_t count ;
snprintf (filename, sizeof (filename), "%s_%02d%s", pathname, ch, ext) ;
count = snprintf (filename, sizeof (filename), "%s_%02d%s", pathname, ch, ext) ;
if (count >= sizeof (filename))
{ printf ("File name truncated to %s\n", filename) ;
} ;
if ((state.outfile [ch] = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
{ printf ("Not able to open output file '%s'\n%s\n", filename, sf_strerror (NULL)) ;
@@ -154,7 +170,7 @@ usage_exit (void)
"a_00.wav, a_01.wav and so on.\n"
) ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (0) ;
exit (1) ;
} /* usage_exit */
static void

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2019 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@@ -47,13 +47,13 @@
#include <windows.h>
#endif
static void print_version (void) ;
static void usage_exit (const char *progname) ;
static void info_dump (const char *filename) ;
static int instrument_dump (const char *filename) ;
static int broadcast_dump (const char *filename) ;
static int chanmap_dump (const char *filename) ;
static int cart_dump (const char *filename) ;
static void total_dump (void) ;
static double total_seconds = 0.0 ;
@@ -62,14 +62,10 @@ int
main (int argc, char *argv [])
{ int k ;
print_version () ;
if (argc < 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
{ usage_exit (program_name (argv [0])) ;
return 1 ;
} ;
usage_exit (program_name (argv [0])) ;
if (strcmp (argv [1], "-i") == 0)
if (strcmp (argv [1], "--instrument") == 0)
{ int error = 0 ;
for (k = 2 ; k < argc ; k++)
@@ -77,7 +73,7 @@ main (int argc, char *argv [])
return error ;
} ;
if (strcmp (argv [1], "-b") == 0)
if (strcmp (argv [1], "--broadcast") == 0)
{ int error = 0 ;
for (k = 2 ; k < argc ; k++)
@@ -85,7 +81,7 @@ main (int argc, char *argv [])
return error ;
} ;
if (strcmp (argv [1], "-c") == 0)
if (strcmp (argv [1], "--channel-map") == 0)
{ int error = 0 ;
for (k = 2 ; k < argc ; k++)
@@ -93,6 +89,14 @@ main (int argc, char *argv [])
return error ;
} ;
if (strcmp (argv [1], "--cart") == 0)
{ int error = 0 ;
for (k = 2 ; k < argc ; k++)
error += cart_dump (argv [k]) ;
return error ;
} ;
for (k = 1 ; k < argc ; k++)
info_dump (argv [k]) ;
@@ -108,38 +112,29 @@ main (int argc, char *argv [])
static double data [BUFFER_LEN] ;
static void
print_version (void)
{ char buffer [256] ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
printf ("\nVersion : %s\n\n", buffer) ;
} /* print_version */
static void
usage_exit (const char *progname)
{ printf ("Usage :\n %s <file> ...\n", progname) ;
printf (" Prints out information about one or more sound files.\n\n") ;
printf (" %s -i <file>\n", progname) ;
printf (" %s --instrument <file>\n", progname) ;
printf (" Prints out the instrument data for the given file.\n\n") ;
printf (" %s -b <file>\n", progname) ;
printf (" %s --broadcast <file>\n", progname) ;
printf (" Prints out the broadcast WAV info for the given file.\n\n") ;
printf (" %s --channel-map <file>\n", progname) ;
printf (" Prints out the channel map for the given file.\n\n") ;
printf (" %s --cart <file>\n", progname) ;
printf (" Prints out the cart chunk WAV info for the given file.\n\n") ;
printf ("Using %s.\n\n", sf_version_string ()) ;
#if (defined (_WIN32) || defined (WIN32))
printf ("This is a Unix style command line application which\n"
"should be run in a MSDOS box or Command Shell window.\n\n") ;
printf ("Sleeping for 5 seconds before exiting.\n\n") ;
fflush (stdout) ;
/* This is the officially blessed by microsoft way but I can't get
** it to link.
** Sleep (15) ;
** Instead, use this:
*/
Sleep (5 * 1000) ;
#endif
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (0) ;
exit (1) ;
} /* usage_exit */
/*==============================================================================
@@ -148,15 +143,6 @@ usage_exit (const char *progname)
static double data [BUFFER_LEN] ;
static double
get_signal_max (SNDFILE *file)
{ double max ;
sf_command (file, SFC_CALC_SIGNAL_MAX, &max, sizeof (max)) ;
return max ;
} /* get_signal_max */
static double
calc_decibels (SF_INFO * sfinfo, double max)
{ double decibels ;
@@ -231,8 +217,8 @@ generate_duration_str (SF_INFO *sfinfo)
static void
info_dump (const char *filename)
{ static char strbuffer [BUFFER_LEN] ;
SNDFILE *file ;
SF_INFO sfinfo ;
SNDFILE *file ;
SF_INFO sfinfo ;
double signal_max, decibels ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
@@ -267,7 +253,7 @@ info_dump (const char *filename)
if (sfinfo.frames < 100 * 1024 * 1024)
{ /* Do not use sf_signal_max because it doesn't work for non-seekable files . */
signal_max = get_signal_max (file) ;
sf_command (file, SFC_CALC_SIGNAL_MAX, &signal_max, sizeof (signal_max)) ;
decibels = calc_decibels (&sfinfo, signal_max) ;
printf ("Signal Max : %g (%4.2f dB)\n", signal_max, decibels) ;
} ;
@@ -296,8 +282,8 @@ str_of_type (int mode)
static int
instrument_dump (const char *filename)
{ SNDFILE *file ;
SF_INFO sfinfo ;
{ SNDFILE *file ;
SF_INFO sfinfo ;
SF_INSTRUMENT inst ;
int got_inst, k ;
@@ -335,8 +321,8 @@ instrument_dump (const char *filename)
static int
broadcast_dump (const char *filename)
{ SNDFILE *file ;
SF_INFO sfinfo ;
{ SNDFILE *file ;
SF_INFO sfinfo ;
SF_BROADCAST_INFO_2K bext ;
double time_ref_sec ;
int got_bext ;
@@ -371,28 +357,43 @@ broadcast_dump (const char *filename)
time_ref_sec = ((pow (2.0, 32) * bext.time_reference_high) + (1.0 * bext.time_reference_low)) / sfinfo.samplerate ;
printf ("Description : %.*s\n", (int) sizeof (bext.description), bext.description) ;
printf ("Originator : %.*s\n", (int) sizeof (bext.originator), bext.originator) ;
printf ("Origination ref : %.*s\n", (int) sizeof (bext.originator_reference), bext.originator_reference) ;
printf ("Origination date : %.*s\n", (int) sizeof (bext.origination_date), bext.origination_date) ;
printf ("Origination time : %.*s\n", (int) sizeof (bext.origination_time), bext.origination_time) ;
printf ("Description : %.*s\n", (int) sizeof (bext.description), bext.description) ;
printf ("Originator : %.*s\n", (int) sizeof (bext.originator), bext.originator) ;
printf ("Origination ref : %.*s\n", (int) sizeof (bext.originator_reference), bext.originator_reference) ;
printf ("Origination date : %.*s\n", (int) sizeof (bext.origination_date), bext.origination_date) ;
printf ("Origination time : %.*s\n", (int) sizeof (bext.origination_time), bext.origination_time) ;
if (bext.time_reference_high == 0 && bext.time_reference_low == 0)
printf ("Time ref : 0\n") ;
printf ("Time ref : 0\n") ;
else
printf ("Time ref : 0x%x%08x (%.6f seconds)\n", bext.time_reference_high, bext.time_reference_low, time_ref_sec) ;
printf ("Time ref : 0x%x%08x (%.6f seconds)\n", bext.time_reference_high, bext.time_reference_low, time_ref_sec) ;
printf ("BWF version : %d\n", bext.version) ;
printf ("UMID : %.*s\n", (int) sizeof (bext.umid), bext.umid) ;
printf ("Coding history : %.*s\n", bext.coding_history_size, bext.coding_history) ;
printf ("BWF version : %d\n", bext.version) ;
if (bext.version >= 1)
printf ("UMID : %.*s\n", (int) sizeof (bext.umid), bext.umid) ;
if (bext.version >= 2)
{ /* 0x7fff shall be used to designate an unused value */
/* valid range: -99.99 .. 99.99 */
printf ("Loudness value : %6.2f LUFS\n", bext.loudness_value / 100.0) ;
/* valid range: 0.00 .. 99.99 */
printf ("Loudness range : %6.2f LU\n", bext.loudness_range / 100.0) ;
/* valid range: -99.99 .. 99.99 */
printf ("Max. true peak level : %6.2f dBTP\n", bext.max_true_peak_level / 100.0) ;
printf ("Max. momentary loudness : %6.2f LUFS\n", bext.max_momentary_loudness / 100.0) ;
printf ("Max. short term loudness : %6.2f LUFS\n", bext.max_shortterm_loudness / 100.0) ;
} ;
printf ("Coding history : %.*s\n", bext.coding_history_size, bext.coding_history) ;
return 0 ;
} /* broadcast_dump */
static int
chanmap_dump (const char *filename)
{ SNDFILE *file ;
SF_INFO sfinfo ;
{ SNDFILE *file ;
SF_INFO sfinfo ;
int * channel_map ;
int got_chanmap, k ;
@@ -465,6 +466,60 @@ chanmap_dump (const char *filename)
return 0 ;
} /* chanmap_dump */
static int
cart_dump (const char *filename)
{ SNDFILE *file ;
SF_INFO sfinfo ;
SF_CART_INFO_VAR (1024) cart ;
int got_cart, k ;
memset (&sfinfo, 0, sizeof (sfinfo)) ;
memset (&cart, 0, sizeof (cart)) ;
if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
{ printf ("Error : Not able to open input file %s.\n", filename) ;
fflush (stdout) ;
memset (data, 0, sizeof (data)) ;
puts (sf_strerror (NULL)) ;
return 1 ;
} ;
got_cart = sf_command (file, SFC_GET_CART_INFO, &cart, sizeof (cart)) ;
sf_close (file) ;
if (got_cart == SF_FALSE)
{ printf ("Error : File '%s' does not contain cart information.\n\n", filename) ;
return 1 ;
} ;
printf ("Version : %.*s\n", (int) sizeof (cart.version), cart.version) ;
printf ("Title : %.*s\n", (int) sizeof (cart.title), cart.title) ;
printf ("Artist : %.*s\n", (int) sizeof (cart.artist), cart.artist) ;
printf ("Cut id : %.*s\n", (int) sizeof (cart.cut_id), cart.cut_id) ;
printf ("Category : %.*s\n", (int) sizeof (cart.category), cart.category) ;
printf ("Classification : %.*s\n", (int) sizeof (cart.classification), cart.classification) ;
printf ("Out cue : %.*s\n", (int) sizeof (cart.out_cue), cart.out_cue) ;
printf ("Start date : %.*s\n", (int) sizeof (cart.start_date), cart.start_date) ;
printf ("Start time : %.*s\n", (int) sizeof (cart.start_time), cart.start_time) ;
printf ("End date : %.*s\n", (int) sizeof (cart.end_date), cart.end_date) ;
printf ("End time : %.*s\n", (int) sizeof (cart.end_time), cart.end_time) ;
printf ("App id : %.*s\n", (int) sizeof (cart.producer_app_id), cart.producer_app_id) ;
printf ("App version : %.*s\n", (int) sizeof (cart.producer_app_version), cart.producer_app_version) ;
printf ("User defined : %.*s\n", (int) sizeof (cart.user_def), cart.user_def) ;
printf ("Level ref. : %d\n", cart.level_reference) ;
printf ("Post timers :\n") ;
for (k = 0 ; k < ARRAY_LEN (cart.post_timers) ; k++)
if (cart.post_timers [k].usage [0])
printf (" %d %.*s %d\n", k, (int) sizeof (cart.post_timers [k].usage), cart.post_timers [k].usage, cart.post_timers [k].value) ;
printf ("Reserved : %.*s\n", (int) sizeof (cart.reserved), cart.reserved) ;
printf ("Url : %.*s\n", (int) sizeof (cart.url), cart.url) ;
printf ("Tag text : %.*s\n", cart.tag_text_size, cart.tag_text) ;
return 0 ;
} /* cart_dump */
static void
total_dump (void)
{ printf ("========================================\n") ;

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 2009-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2009-2015 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@@ -82,7 +82,7 @@ main (int argc, char **argv)
usage_exit () ;
} ;
if (argc - 2 > MAX_INPUTS)
if (argc - 3 > MAX_INPUTS)
{ printf ("\nError : Cannot handle more than %d input channels.\n\n", MAX_INPUTS) ;
exit (1) ;
} ;
@@ -146,7 +146,7 @@ usage_exit (void)
{ puts ("\nUsage : sndfile-interleave <input 1> <input 2> ... -o <output file>\n") ;
puts ("Merge two or more mono files into a single multi-channel file.\n") ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (0) ;
exit (1) ;
} /* usage_exit */
@@ -163,7 +163,7 @@ interleave_int (STATE * state)
if (read_len < BUFFER_LEN)
memset (state->din.i + read_len, 0, sizeof (state->din.i [0]) * (BUFFER_LEN - read_len)) ;
for (k = 0 ; k < read_len ; k++)
for (k = 0 ; k < BUFFER_LEN ; k++)
state->dout.i [k * state->channels + ch] = state->din.i [k] ;
max_read_len = MAX (max_read_len, read_len) ;
@@ -189,7 +189,7 @@ interleave_double (STATE * state)
if (read_len < BUFFER_LEN)
memset (state->din.d + read_len, 0, sizeof (state->din.d [0]) * (BUFFER_LEN - read_len)) ;
for (k = 0 ; k < read_len ; k++)
for (k = 0 ; k < BUFFER_LEN ; k++)
state->dout.d [k * state->channels + ch] = state->din.d [k] ;
max_read_len = MAX (max_read_len, read_len) ;

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2010 George Blood Audio
**
** All rights reserved.
@@ -61,7 +61,7 @@ main (int argc, char *argv [])
progname = program_name (argv [0]) ;
/* Check if we've been asked for help. */
if (argc <= 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
if (argc < 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
usage_exit (progname, 0) ;
if (argv [argc - 1][0] != '-')
@@ -77,7 +77,6 @@ main (int argc, char *argv [])
exit (1) ;
} ;
/* Get the time in case we need it later. */
memset (&sfinfo, 0, sizeof (sfinfo)) ;
if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
{ printf ("Error : Open of file '%s' failed : %s\n\n", filename, sf_strerror (file)) ;
@@ -103,23 +102,28 @@ usage_exit (const char *progname, int exit_code)
{ printf ("\nUsage :\n %s [options] <file>\n\nOptions:\n", progname) ;
puts (
" --bext-description Print the 'bext' description.\n"
" --bext-originator Print the 'bext; originator info.\n"
" --bext-orig-ref Print the 'bext' origination reference.\n"
" --bext-umid Print the 'bext' UMID.\n"
" --bext-orig-date Print the 'bext' origination date.\n"
" --bext-orig-time Print the 'bext' origination time.\n"
" --bext-coding-hist Print the 'bext' coding history.\n"
" --bext-description Print the 'bext' description.\n"
" --bext-originator Print the 'bext' originator info.\n"
" --bext-orig-ref Print the 'bext' origination reference.\n"
" --bext-umid Print the 'bext' UMID.\n"
" --bext-orig-date Print the 'bext' origination date.\n"
" --bext-orig-time Print the 'bext' origination time.\n"
" --bext-loudness-value Print the 'bext' loudness value.\n"
" --bext-loudness-range Print the 'bext' loudness range.\n"
" --bext-max-truepeak Print the 'bext' max. true peak level\n"
" --bext-max-momentary Print the 'bext' max. momentary loudness\n"
" --bext-max-shortterm Print the 'bext' max. short term loudness\n"
" --bext-coding-hist Print the 'bext' coding history.\n"
) ;
puts (
" --str-title Print the title metadata.\n"
" --str-copyright Print the copyright metadata.\n"
" --str-artist Print the artist metadata.\n"
" --str-comment Print the comment metadata.\n"
" --str-date Print the creation date metadata.\n"
" --str-album Print the album metadata.\n"
" --str-license Print the license metadata.\n"
" --str-title Print the title metadata.\n"
" --str-copyright Print the copyright metadata.\n"
" --str-artist Print the artist metadata.\n"
" --str-comment Print the comment metadata.\n"
" --str-date Print the creation date metadata.\n"
" --str-album Print the album metadata.\n"
" --str-license Print the license metadata.\n"
) ;
printf ("Using %s.\n\n", sf_version_string ()) ;
@@ -131,20 +135,32 @@ process_args (SNDFILE * file, const SF_BROADCAST_INFO_2K * binfo, int argc, char
{ const char * str ;
int k, do_all = 0 ;
#define HANDLE_BEXT_ARG(cmd,name,field) \
#define HANDLE_BEXT_ARG(cmd, name, field) \
if (do_all || strcmp (argv [k], cmd) == 0) \
{ printf ("%-20s : %.*s\n", name, (int) sizeof (binfo->field), binfo->field) ; \
{ printf ("%-22s : %.*s\n", name, (int) sizeof (binfo->field), binfo->field) ; \
if (! do_all) \
continue ; \
} ;
#define HANDLE_STR_ARG(cmd,name,id) \
#define HANDLE_BEXT_ARG_INT(cmd, name, field) \
if (do_all || strcmp (argv [k], cmd) == 0) \
{ printf ("%-22s : %6.2f\n", name, binfo->field / 100.0) ; \
if (! do_all) \
continue ; \
} ;
#define HANDLE_STR_ARG(cmd, name, id) \
if (do_all || strcmp (argv [k], cmd) == 0) \
{ str = sf_get_string (file, id) ; \
printf ("%-20s : %s\n", name, str ? str : "") ; \
printf ("%-22s : %s\n", name, str ? str : "") ; \
if (! do_all) continue ; \
} ;
if (argc == 0)
{ do_all = 1 ;
argc = 1 ;
} ;
for (k = 0 ; k < argc ; k++)
{ if (do_all || strcmp (argv [k], "--all") == 0)
do_all = 1 ;
@@ -155,6 +171,11 @@ process_args (SNDFILE * file, const SF_BROADCAST_INFO_2K * binfo, int argc, char
HANDLE_BEXT_ARG ("--bext-umid", "UMID", umid) ;
HANDLE_BEXT_ARG ("--bext-orig-date", "Origination date", origination_date) ;
HANDLE_BEXT_ARG ("--bext-orig-time", "Origination time", origination_time) ;
HANDLE_BEXT_ARG_INT ("--bext-loudness-value", "Loudness value", loudness_value) ;
HANDLE_BEXT_ARG_INT ("--bext-loudness-range", "Loudness range", loudness_range) ;
HANDLE_BEXT_ARG_INT ("--bext-max-truepeak", "Max. true peak level", max_true_peak_level) ;
HANDLE_BEXT_ARG_INT ("--bext-max-momentary", "Max. momentary level", max_momentary_loudness) ;
HANDLE_BEXT_ARG_INT ("--bext-max-shortterm", "Max. short term level", max_shortterm_loudness) ;
HANDLE_BEXT_ARG ("--bext-coding-hist", "Coding history", coding_history) ;
HANDLE_STR_ARG ("--str-title", "Name", SF_STR_TITLE) ;

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2008-2010 George Blood Audio
**
** All rights reserved.
@@ -57,6 +57,7 @@ main (int argc, char *argv [])
struct tm timedata ;
const char *progname ;
const char * filenames [2] = { NULL, NULL } ;
char date [128], time [128] ;
int k ;
/* Store the program name. */
@@ -66,16 +67,14 @@ main (int argc, char *argv [])
if (argc < 3 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
usage_exit (progname, 0) ;
/* Clear set all fields of the struct to zero bytes. */
/* Set all fields of the struct to zero bytes. */
memset (&info, 0, sizeof (info)) ;
/* Get the time in case we need it later. */
read_localtime (&timedata) ;
for (k = 1 ; k < argc ; k++)
{ char tmp [20] ;
if (argv [k][0] != '-')
{ if (argv [k][0] != '-')
{ if (filenames [0] == NULL)
filenames [0] = argv [k] ;
else if (filenames [1] == NULL)
@@ -87,7 +86,7 @@ main (int argc, char *argv [])
continue ;
} ;
#define HANDLE_BEXT_ARG(cmd,field) \
#define HANDLE_BEXT_ARG(cmd, field) \
if (strcmp (argv [k], cmd) == 0) \
{ k ++ ; \
if (k == argc) missing_param (argv [k - 1]) ; \
@@ -101,10 +100,15 @@ main (int argc, char *argv [])
HANDLE_BEXT_ARG ("--bext-umid", umid) ;
HANDLE_BEXT_ARG ("--bext-orig-date", origination_date) ;
HANDLE_BEXT_ARG ("--bext-orig-time", origination_time) ;
HANDLE_BEXT_ARG ("--bext-loudness-value", loudness_value) ;
HANDLE_BEXT_ARG ("--bext-loudness-range", loudness_range) ;
HANDLE_BEXT_ARG ("--bext-max-truepeak", max_true_peak_level) ;
HANDLE_BEXT_ARG ("--bext-max-momentary", max_momentary_loudness) ;
HANDLE_BEXT_ARG ("--bext-max-shortterm", max_shortterm_loudness) ;
HANDLE_BEXT_ARG ("--bext-coding-hist", coding_history) ;
HANDLE_BEXT_ARG ("--bext-time-ref", time_ref) ;
#define HANDLE_STR_ARG(cmd,field) \
#define HANDLE_STR_ARG(cmd, field) \
if (strcmp (argv [k], cmd) == 0) \
{ k ++ ; \
if (k == argc) missing_param (argv [k - 1]) ; \
@@ -122,30 +126,30 @@ main (int argc, char *argv [])
/* Following options do not take an argument. */
if (strcmp (argv [k], "--bext-auto-time-date") == 0)
{ snprintf (tmp, sizeof (tmp), "%02d:%02d:%02d", timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
info.origination_time = strdup (tmp) ;
{ snprintf (time, sizeof (time), "%02d:%02d:%02d", timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
info.origination_time = time ;
snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
info.origination_date = strdup (tmp) ;
snprintf (date, sizeof (date), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
info.origination_date = date ;
continue ;
} ;
if (strcmp (argv [k], "--bext-auto-time") == 0)
{ snprintf (tmp, sizeof (tmp), "%02d:%02d:%02d", timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
info.origination_time = strdup (tmp) ;
{ snprintf (time, sizeof (time), "%02d:%02d:%02d", timedata.tm_hour, timedata.tm_min, timedata.tm_sec) ;
info.origination_time = time ;
continue ;
} ;
if (strcmp (argv [k], "--bext-auto-date") == 0)
{ snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
info.origination_date = strdup (tmp) ;
{ snprintf (date, sizeof (date), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
info.origination_date = strdup (date) ;
continue ;
} ;
if (strcmp (argv [k], "--str-auto-date") == 0)
{ snprintf (tmp, sizeof (tmp), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
{ snprintf (date, sizeof (date), "%04d-%02d-%02d", timedata.tm_year + 1900, timedata.tm_mon + 1, timedata.tm_mday) ;
info.date = strdup (tmp) ;
info.date = strdup (date) ;
continue ;
} ;
@@ -207,8 +211,13 @@ usage_exit (const char *progname, int exit_code)
" --bext-umid Set the 'bext' UMID.\n"
" --bext-orig-date Set the 'bext' origination date.\n"
" --bext-orig-time Set the 'bext' origination time.\n"
" --bext-loudness-value Set the 'bext' loudness value.\n"
" --bext-loudness-range Set the 'bext' loudness range.\n"
" --bext-max-truepeak Set the 'bext' max. true peak level\n"
" --bext-max-momentary Set the 'bext' max. momentary loudness\n"
" --bext-max-shortterm Set the 'bext' max. short term loudness\n"
" --bext-coding-hist Set the 'bext' coding history.\n"
" --bext-time-raf Set the 'bext' Time ref.\n"
" --bext-time-ref Set the 'bext' Time ref.\n"
"\n"
" --str-comment Set the metadata comment.\n"
" --str-title Set the metadata title.\n"
@@ -257,6 +266,9 @@ has_bext_fields_set (const METADATA_INFO * info)
if (info->origination_date || info->origination_time || info->umid || info->coding_history || info->time_ref)
return 1 ;
if (info->loudness_value || info->loudness_range || info->max_true_peak_level || info->max_momentary_loudness || info->max_shortterm_loudness)
return 1 ;
return 0 ;
} /* has_bext_fields_set */
@@ -281,4 +293,3 @@ read_localtime (struct tm * timedata)
return ;
} /* read_localtime */

View File

@@ -1,144 +0,0 @@
/*
** Copyright (C) 2001 Marcus Overhagen <marcus@overhagen.de>
**
** 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.
*/
#include <stdio.h>
#include <Application.h>
#include <SoundPlayer.h>
#include <string.h>
#include <sndfile.h>
#define BUFFER_LEN 1024
/*------------------------------------------------------------------------------
** BeOS functions for playing a sound.
*/
#if defined (__BEOS__)
struct shared_data
{
BSoundPlayer *player;
SNDFILE *sndfile;
SF_INFO sfinfo;
sem_id finished;
};
static void
buffer_callback(void *theCookie, void *buf, size_t size, const media_raw_audio_format &format)
{
shared_data *data = (shared_data *)theCookie;
short *buffer = (short *)buf;
int count = size / sizeof(short);
int m, readcount;
if (!data->player->HasData())
return;
readcount = sf_read_short(data->sndfile, buffer, count);
if (readcount == 0)
{ data->player->SetHasData(false);
release_sem(data->finished);
}
if (readcount < count)
{ for (m = readcount ; m < count ; m++)
buffer [m] = 0 ;
}
if (data->sfinfo.pcmbitwidth < 16)
{ for (m = 0 ; m < count ; m++)
buffer [m] *= 256 ;
}
}
static void
beos_play (int argc, char *argv [])
{
shared_data data;
status_t status;
int k;
/* BSoundPlayer requires a BApplication object */
BApplication app("application/x-vnd.MarcusOverhagen-sfplay");
for (k = 1 ; k < argc ; k++)
{ printf ("Playing %s\n", argv [k]) ;
if (! (data.sndfile = sf_open_read (argv [k], &data.sfinfo)))
{ sf_perror (NULL) ;
continue ;
} ;
if (data.sfinfo.channels < 1 || data.sfinfo.channels > 2)
{ printf ("Error : channels = %d.\n", data.sfinfo.channels) ;
sf_close (data.sndfile) ;
continue ;
} ;
data.finished = create_sem(0,"finished");
media_raw_audio_format format =
{ data.sfinfo.samplerate,
data.sfinfo.channels,
media_raw_audio_format::B_AUDIO_SHORT,
B_HOST_IS_LENDIAN ? B_MEDIA_LITTLE_ENDIAN : B_MEDIA_BIG_ENDIAN,
BUFFER_LEN * sizeof(short)
};
BSoundPlayer player(&format,"player",buffer_callback,NULL,&data);
data.player = &player;
if ((status = player.InitCheck()) != B_OK)
{
printf ("Error : BSoundPlayer init failed, %s.\n", strerror(status)) ;
delete_sem(data.finished);
sf_close (data.sndfile) ;
continue ;
}
player.SetVolume(1.0);
player.Start();
player.SetHasData(true);
acquire_sem(data.finished);
player.Stop();
delete_sem(data.finished);
sf_close (data.sndfile) ;
} ;
} /* beos_play */
#endif
/*==============================================================================
** Main function.
*/
int
main (int argc, char *argv [])
{
if (argc < 2)
{ printf ("Usage : %s <input sound file>\n\n", argv [0]) ;
return 1 ;
} ;
beos_play (argc, argv) ;
return 0 ;
} /* main */

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 1999-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 1999-2018 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@@ -39,6 +39,8 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#include "sf_unistd.h"
#endif
#include <sndfile.h>
@@ -52,16 +54,14 @@
#include <sys/time.h>
#endif
#if defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
#if defined (__ANDROID__)
#elif defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#elif (defined (__MACH__) && defined (__APPLE__))
#include <Carbon.h>
#include <CoreAudio/AudioHardware.h>
#elif defined (HAVE_SNDIO_H)
#elif HAVE_SNDIO_H
#include <sndio.h>
#elif (defined (sun) && defined (unix))
@@ -119,10 +119,10 @@ alsa_play (int argc, char *argv [])
int m ;
sf_command (sndfile, SFC_CALC_SIGNAL_MAX, &scale, sizeof (scale)) ;
if (scale < 1e-10)
scale = 1.0 ;
if (scale > 1.0)
scale = 1.0 / scale ;
else
scale = 32700.0 / scale ;
scale = 1.0 ;
while ((readcount = sf_read_float (sndfile, buffer, BUFFER_LEN)))
{ for (m = 0 ; m < readcount ; m++)
@@ -353,11 +353,11 @@ alsa_write_float (snd_pcm_t *alsa_dev, float *data, int frames, int channels)
** Linux/OSS functions for playing a sound.
*/
#if defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
#if !defined (__ANDROID__) && (defined (__linux__) || defined (__FreeBSD_kernel__) || defined (__FreeBSD__))
static int opensoundsys_open_device (int channels, int srate) ;
static void
static int
opensoundsys_play (int argc, char *argv [])
{ static short buffer [BUFFER_LEN] ;
SNDFILE *sndfile ;
@@ -415,7 +415,7 @@ opensoundsys_play (int argc, char *argv [])
sf_close (sndfile) ;
} ;
return ;
return writecount ;
} /* opensoundsys_play */
static int
@@ -444,7 +444,7 @@ opensoundsys_open_device (int channels, int srate)
if (ioctl (fd, SNDCTL_DSP_SETFMT, &fmt) != 0)
{ perror ("opensoundsys_open_device : set format ") ;
exit (1) ;
} ;
} ;
if (ioctl (fd, SNDCTL_DSP_CHANNELS, &channels) != 0)
{ perror ("opensoundsys_open_device : channels ") ;
@@ -470,182 +470,19 @@ opensoundsys_open_device (int channels, int srate)
** Mac OS X functions for playing a sound.
*/
#if (defined (__MACH__) && defined (__APPLE__)) /* MacOSX */
typedef struct
{ AudioStreamBasicDescription format ;
UInt32 buf_size ;
AudioDeviceID device ;
SNDFILE *sndfile ;
SF_INFO sfinfo ;
int fake_stereo ;
int done_playing ;
} MacOSXAudioData ;
#include <math.h>
static OSStatus
macosx_audio_out_callback (AudioDeviceID device, const AudioTimeStamp* current_time,
const AudioBufferList* data_in, const AudioTimeStamp* time_in,
AudioBufferList* data_out, const AudioTimeStamp* time_out,
void* client_data)
{ MacOSXAudioData *audio_data ;
int size, sample_count, read_count, k ;
float *buffer ;
/* Prevent compiler warnings. */
device = device ;
current_time = current_time ;
data_in = data_in ;
time_in = time_in ;
time_out = time_out ;
audio_data = (MacOSXAudioData*) client_data ;
size = data_out->mBuffers [0].mDataByteSize ;
sample_count = size / sizeof (float) ;
buffer = (float*) data_out->mBuffers [0].mData ;
if (audio_data->fake_stereo != 0)
{ read_count = sf_read_float (audio_data->sndfile, buffer, sample_count / 2) ;
for (k = read_count - 1 ; k >= 0 ; k--)
{ buffer [2 * k ] = buffer [k] ;
buffer [2 * k + 1] = buffer [k] ;
} ;
read_count *= 2 ;
}
else
read_count = sf_read_float (audio_data->sndfile, buffer, sample_count) ;
/* Fill the remainder with zeroes. */
if (read_count < sample_count)
{ if (audio_data->fake_stereo == 0)
memset (&(buffer [read_count]), 0, (sample_count - read_count) * sizeof (float)) ;
/* Tell the main application to terminate. */
audio_data->done_playing = SF_TRUE ;
} ;
return noErr ;
} /* macosx_audio_out_callback */
static void
macosx_play (int argc, char *argv [])
{ MacOSXAudioData audio_data ;
OSStatus err ;
UInt32 count, buffer_size ;
int k ;
audio_data.fake_stereo = 0 ;
audio_data.device = kAudioDeviceUnknown ;
/* get the default output device for the HAL */
count = sizeof (AudioDeviceID) ;
if ((err = AudioHardwareGetProperty (kAudioHardwarePropertyDefaultOutputDevice,
&count, (void *) &(audio_data.device))) != noErr)
{ printf ("AudioHardwareGetProperty (kAudioDevicePropertyDefaultOutputDevice) failed.\n") ;
return ;
} ;
/* get the buffersize that the default device uses for IO */
count = sizeof (UInt32) ;
if ((err = AudioDeviceGetProperty (audio_data.device, 0, false, kAudioDevicePropertyBufferSize,
&count, &buffer_size)) != noErr)
{ printf ("AudioDeviceGetProperty (kAudioDevicePropertyBufferSize) failed.\n") ;
return ;
} ;
/* get a description of the data format used by the default device */
count = sizeof (AudioStreamBasicDescription) ;
if ((err = AudioDeviceGetProperty (audio_data.device, 0, false, kAudioDevicePropertyStreamFormat,
&count, &(audio_data.format))) != noErr)
{ printf ("AudioDeviceGetProperty (kAudioDevicePropertyStreamFormat) failed.\n") ;
return ;
} ;
/* Base setup completed. Now play files. */
for (k = 1 ; k < argc ; k++)
{ printf ("Playing %s\n", argv [k]) ;
if (! (audio_data.sndfile = sf_open (argv [k], SFM_READ, &(audio_data.sfinfo))))
{ puts (sf_strerror (NULL)) ;
continue ;
} ;
if (audio_data.sfinfo.channels < 1 || audio_data.sfinfo.channels > 2)
{ printf ("Error : channels = %d.\n", audio_data.sfinfo.channels) ;
continue ;
} ;
audio_data.format.mSampleRate = audio_data.sfinfo.samplerate ;
if (audio_data.sfinfo.channels == 1)
{ audio_data.format.mChannelsPerFrame = 2 ;
audio_data.fake_stereo = 1 ;
}
else
audio_data.format.mChannelsPerFrame = audio_data.sfinfo.channels ;
if ((err = AudioDeviceSetProperty (audio_data.device, NULL, 0, false, kAudioDevicePropertyStreamFormat,
sizeof (AudioStreamBasicDescription), &(audio_data.format))) != noErr)
{ printf ("AudioDeviceSetProperty (kAudioDevicePropertyStreamFormat) failed.\n") ;
return ;
} ;
/* we want linear pcm */
if (audio_data.format.mFormatID != kAudioFormatLinearPCM)
return ;
/* Fire off the device. */
if ((err = AudioDeviceAddIOProc (audio_data.device, macosx_audio_out_callback,
(void *) &audio_data)) != noErr)
{ printf ("AudioDeviceAddIOProc failed.\n") ;
return ;
} ;
err = AudioDeviceStart (audio_data.device, macosx_audio_out_callback) ;
if (err != noErr)
return ;
audio_data.done_playing = SF_FALSE ;
while (audio_data.done_playing == SF_FALSE)
usleep (10 * 1000) ; /* 10 000 milliseconds. */
if ((err = AudioDeviceStop (audio_data.device, macosx_audio_out_callback)) != noErr)
{ printf ("AudioDeviceStop failed.\n") ;
return ;
} ;
err = AudioDeviceRemoveIOProc (audio_data.device, macosx_audio_out_callback) ;
if (err != noErr)
{ printf ("AudioDeviceRemoveIOProc failed.\n") ;
return ;
} ;
sf_close (audio_data.sndfile) ;
} ;
return ;
} /* macosx_play */
#endif /* MacOSX */
/* MacOSX 10.8 use a new Audio API. Someone needs to write some code for it. */
/*------------------------------------------------------------------------------
** Win32 functions for playing a sound.
**
** This API sucks. Its needlessly complicated and is *WAY* too loose with
** passing pointers arounf in integers and and using char* pointers to
** passing pointers around in integers and using char* pointers to
** point to data instead of short*. It plain sucks!
*/
#if (OS_IS_WIN32 == 1)
#define WIN32_BUFFER_LEN (1<<15)
#define WIN32_BUFFER_LEN (1 << 15)
typedef struct
{ HWAVEOUT hwave ;
@@ -701,8 +538,9 @@ win32_audio_out_callback (HWAVEOUT hwave, UINT msg, DWORD_PTR data, DWORD param1
{ Win32_Audio_Data *audio_data ;
/* Prevent compiler warnings. */
hwave = hwave ;
param1 = param2 ;
(void) hwave ;
(void) param1 ;
(void) param2 ;
if (data == 0)
return ;
@@ -825,16 +663,16 @@ win32_play (int argc, char *argv [])
#endif /* Win32 */
/*------------------------------------------------------------------------------
** OpenBDS's sndio.
** OpenBSD's sndio.
*/
#if defined (HAVE_SNDIO_H)
#if HAVE_SNDIO_H
static void
sndio_play (int argc, char *argv [])
{ struct sio_hdl *hdl ;
struct sio_par par ;
short buffer [BUFFER_LEN] ;
short buffer [BUFFER_LEN] ;
SNDFILE *sndfile ;
SF_INFO sfinfo ;
int k, readcount ;
@@ -980,7 +818,7 @@ main (int argc, char *argv [])
if (argc < 2)
{
printf ("\nUsage : %s <input sound file>\n\n", program_name (argv [0])) ;
printf (" Using %s.\n\n", sf_version_string ()) ;
printf ("Using %s.\n\n", sf_version_string ()) ;
#if (OS_IS_WIN32 == 1)
printf ("This is a Unix style command line application which\n"
"should be run in a MSDOS box or Command Shell window.\n\n") ;
@@ -991,7 +829,11 @@ main (int argc, char *argv [])
return 1 ;
} ;
#if defined (__linux__)
#if defined (__ANDROID__)
puts ("*** Playing sound not yet supported on Android.") ;
puts ("*** Please feel free to submit a patch.") ;
return 1 ;
#elif defined (__linux__)
#if HAVE_ALSA_ASOUNDLIB_H
if (access ("/proc/asound/cards", R_OK) == 0)
alsa_play (argc, argv) ;
@@ -1000,20 +842,14 @@ main (int argc, char *argv [])
opensoundsys_play (argc, argv) ;
#elif defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
opensoundsys_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__))
macosx_play (argc, argv) ;
#elif defined HAVE_SNDIO_H
#elif HAVE_SNDIO_H
sndio_play (argc, argv) ;
#elif (defined (sun) && defined (unix))
solaris_play (argc, argv) ;
#elif (OS_IS_WIN32 == 1)
win32_play (argc, argv) ;
#elif defined (__BEOS__)
printf ("This program cannot be compiled on BeOS.\n") ;
printf ("Instead, compile the file sfplay_beos.cpp.\n") ;
return 1 ;
#else
puts ("*** Playing sound not yet supported on this platform.") ;
puts ("*** Playing sound not supported on this platform.") ;
puts ("*** Please feel free to submit a patch.") ;
return 1 ;
#endif

View File

@@ -1,5 +1,5 @@
/*
** Copyright (C) 2010-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
** Copyright (C) 2010-2014 Erik de Castro Lopo <erikd@mega-nerd.com>
**
** All rights reserved.
**
@@ -30,6 +30,8 @@
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "sfconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -37,7 +39,11 @@
#include <ctype.h>
#include <math.h>
#include <errno.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#else
#include "sf_unistd.h"
#endif
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -79,7 +85,7 @@ usage_exit (const char *progname)
{ printf ("Usage :\n\n %s <broken wav file> <fixed w64 file>\n\n", progname) ;
puts ("Salvages the audio data from WAV files which are more than 4G in length.\n") ;
printf ("Using %s.\n\n", sf_version_string ()) ;
exit (0) ;
exit (1) ;
} /* usage_exit */
static void
@@ -157,7 +163,7 @@ salvage_file (const char * broken_wav, const char * fixed_w64)
read_size *= sfinfo.channels ;
if ((sndfile = sf_open (fixed_w64, SFM_WRITE, &sfinfo)) == NULL)
{ printf ("sf_open ('%s') failed : %s\n", broken_wav, sf_strerror (NULL)) ;
{ printf ("sf_open ('%s') failed : %s\n", fixed_w64, sf_strerror (NULL)) ;
exit (1) ;
} ;
@@ -240,7 +246,7 @@ find_data_offset (int fd, int format)
cptr = memchr (buffer, target [0], rlen - slen) ;
if (cptr && memcmp (cptr, target, slen) == 0)
offset = cptr - buffer ;
offset = cptr - buffer ;
else
{ printf ("Error : Could not find data offset.\n") ;
exit (1) ;

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python
#!/usr/bin/env python
# Copyright (C) 2008-2011 Erik de Castro Lopo <erikd@mega-nerd.com>
# Copyright (C) 2008-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
#
# All rights reserved.
#
@@ -32,157 +32,167 @@
# Simple test script for the sndfile-metadata-set program.
import commands, os, sys
from __future__ import print_function
try:
# py2
import commands
except ImportError:
# py3
import subprocess as commands
import os, sys
import time, datetime
class Programs:
def __init__ (self, needs_exe):
if needs_exe:
extension = ".exe"
else:
extension = ""
self.meta_set_prog = "./sndfile-metadata-set" + extension
self.meta_get_prog = "./sndfile-metadata-get" + extension
self.make_sine_prog = "../examples/make_sine" + extension
def _run_command (self, should_fail, cmd):
status, output = commands.getstatusoutput (cmd)
if should_fail and not status:
print("\n\nError : command '%s' should have failed." % cmd)
print(output)
print()
sys.exit (1)
if not should_fail and status:
print("\n\nError : command '%s' should not have failed." % cmd)
print(output)
print()
sys.exit (1)
return output
def meta_set (self, should_fail, args):
return self._run_command (should_fail, self.meta_set_prog + " " + args)
def meta_get (self, should_fail, args):
return self._run_command (should_fail, self.meta_get_prog + " " + args)
def make_sine (self):
return os.system (self.make_sine_prog)
def check_executables (self):
for name in [ self.meta_set_prog, self.meta_get_prog, self.make_sine_prog ]:
if not (os.path.isfile (name)):
print("\n\nError : Can't find executable '%s'. Have you run make?" % name)
sys.exit (1)
def print_test_name (name):
print " %-30s :" % name,
print(" %-30s :" % name, end="")
def assert_info (filename, arg, value):
cmd = "./sndfile-metadata-get %s %s" % (arg, filename)
status, output = commands.getstatusoutput (cmd)
if status:
print "\n\nError : command '%s' should not have failed." % cmd
sys.exit (1)
if output.find (value) < 0:
print "\n\nError : not able to find '%s'." % value
print output
sys.exit (1)
return
def assert_info (programs, filename, arg, value):
output = programs.meta_get (False, "%s %s" % (arg, filename))
if output.find (value) < 0:
print("\n\nError : not able to find '%s'." % value)
print(output)
sys.exit (1)
return
def check_executable (name):
if not (os.path.isfile (name)):
print "\n\nError : Can't find executable '%s'. Have you run make?" % name
sys.exit (1)
def test_empty_fail (programs):
print_test_name ("Empty fail test")
output = programs.meta_set (True, "--bext-description Alpha sine.wav")
print("ok")
def test_empty_fail ():
print_test_name ("Empty fail test")
cmd = "./sndfile-metadata-set --bext-description Alpha sine.wav"
status, output = commands.getstatusoutput (cmd)
if not status:
print "\n\nError : command '%s' should have failed." % cmd
sys.exit (1)
print "ok"
def test_copy (programs):
print_test_name ("Copy test")
output = programs.meta_set (False, "--bext-description \"First Try\" sine.wav output.wav")
assert_info (programs, "output.wav", "--bext-description", "First Try")
print("ok")
def test_copy ():
print_test_name ("Copy test")
cmd = "./sndfile-metadata-set --bext-description \"First Try\" sine.wav output.wav"
status, output = commands.getstatusoutput (cmd)
if status:
print "\n\nError : command '%s' should not have failed." % cmd
sys.exit (1)
assert_info ("output.wav", "--bext-description", "First Try")
print "ok"
def test_update (programs, tests):
print_test_name ("Update test")
for arg, value in tests:
output = programs.meta_set (False, "%s \"%s\" output.wav" % (arg, value))
assert_info (programs, "output.wav", arg, value)
print("ok")
def test_update (tests):
print_test_name ("Update test")
for arg, value in tests:
cmd = "./sndfile-metadata-set %s \"%s\" output.wav" % (arg, value)
status, output = commands.getstatusoutput (cmd)
if status:
print "\n\nError : command '%s' should not have failed." % cmd
sys.exit (1)
assert_info ("output.wav", arg, value)
print "ok"
def test_post_mod (programs, tests):
print_test_name ("Post mod test")
for arg, value in tests:
assert_info (programs, "output.wav", arg, value)
print("ok")
def test_post_mod (tests):
print_test_name ("Post mod test")
for arg, value in tests:
assert_info ("output.wav", arg, value)
print "ok"
def test_auto_date ():
print_test_name ("Auto date test")
cmd = "./sndfile-metadata-set --bext-auto-time-date sine.wav date-time.wav"
status, output = commands.getstatusoutput (cmd)
if status:
print "\n\nError : command '%s' should not have failed." % cmd
sys.exit (1)
target = datetime.date.today ().__str__ ()
assert_info ("date-time.wav", "--bext-orig-date", target)
print "ok"
def test_auto_date (programs):
print_test_name ("Auto date test")
output = programs.meta_set (False, "--bext-auto-time-date sine.wav date-time.wav")
target = datetime.date.today ().__str__ ()
assert_info (programs, "date-time.wav", "--bext-orig-date", target)
print("ok")
#-------------------------------------------------------------------------------
def test_coding_history ():
print_test_name ("Coding history test")
cmd = "./sndfile-metadata-set --bext-coding-hist \"alpha beta\" output.wav"
status, output = commands.getstatusoutput (cmd)
if status:
print "\n\nError : command '%s' should not have failed." % cmd
sys.exit (1)
cmd = "./sndfile-metadata-get --bext-coding-hist output.wav"
status, output = commands.getstatusoutput (cmd)
if status:
print "\n\nError : command '%s' should not have failed." % cmd
sys.exit (1)
print "ok"
def test_coding_history (programs):
print_test_name ("Coding history test")
output = programs.meta_set (False, "--bext-coding-hist \"alpha beta\" output.wav")
output = programs.meta_get (False, "--bext-coding-hist output.wav")
print("ok")
#-------------------------------------------------------------------------------
def test_rewrite ():
print_test_name ("Rewrite test")
cmd = "./sndfile-metadata-set --bext-originator \"Really, really long string\" output.wav"
status, output = commands.getstatusoutput (cmd)
if status:
print "\n\nError : command '%s' should not have failed." % cmd
sys.exit (1)
cmd = "./sndfile-metadata-set --bext-originator \"Short\" output.wav"
status, output = commands.getstatusoutput (cmd)
if status:
print "\n\nError : command '%s' should not have failed." % cmd
sys.exit (1)
cmd = "./sndfile-metadata-get --bext-originator output.wav"
status, output = commands.getstatusoutput (cmd)
if status:
print "\n\nError : command '%s' should not have failed." % cmd
sys.exit (1)
if output.find ("really long") > 0:
print "\n\nError : output '%s' should not contain 'really long'." % output
sys.exit (1)
print "ok"
def test_rewrite (programs):
print_test_name ("Rewrite test")
output = programs.meta_set (False, "--bext-originator \"Really, really long string\" output.wav")
output = programs.meta_set (False, "--bext-originator \"Short\" output.wav")
output = programs.meta_get (False, "--bext-originator output.wav")
if output.find ("really long") > 0:
print("\n\nError : output '%s' should not contain 'really long'." % output)
sys.exit (1)
print("ok")
#===============================================================================
test_dir = "programs"
print("\nTesting WAV metadata manipulation:")
if os.path.isdir (test_dir):
os.chdir (test_dir)
os.chdir (test_dir)
for f in [ "sndfile-metadata-set", "sndfile-metadata-get", "../examples/make_sine" ]:
check_executable (f)
if len (sys.argv) >= 1 and sys.argv [1].endswith ("mingw32"):
needs_exe = True
else:
needs_exe = False
os.system ("../examples/make_sine")
programs = Programs (needs_exe)
programs.check_executables ()
programs.make_sine ()
if not os.path.isfile ("sine.wav"):
print "\n\nError : Can't file file 'sine.wav'."
sys.exit (1)
print("\n\nError : Can't file file 'sine.wav'.")
sys.exit (1)
print ""
test_empty_fail ()
test_copy ()
test_empty_fail (programs)
test_copy (programs)
tests = [
("--bext-description", "Alpha"), ("--bext-originator", "Beta"), ("--bext-orig-ref", "Charlie"),
("--bext-umid", "Delta"), ("--bext-orig-date", "2001-10-01"), ("--bext-orig-time", "01:02:03"),
("--str-title", "Echo"), ("--str-artist", "Fox trot")
]
("--bext-description", "Alpha"), ("--bext-originator", "Beta"), ("--bext-orig-ref", "Charlie"),
("--bext-umid", "Delta"), ("--bext-orig-date", "2001-10-01"), ("--bext-orig-time", "01:02:03"),
("--str-title", "Echo"), ("--str-artist", "Fox trot")
]
test_auto_date ()
test_update (tests)
test_post_mod (tests)
test_auto_date (programs)
test_update (programs, tests)
test_post_mod (programs, tests)
test_update ([ ("--str-artist", "Fox") ])
test_update (programs, [ ("--str-artist", "Fox") ])
# This never worked.
# test_coding_history ()
test_rewrite ()
test_rewrite (programs)
print ""
print()
sys.exit (0)