Commit Graph

518 Commits

Author SHA1 Message Date
evpobr
e01ee91591 Fix Clang warnings 2020-09-04 10:03:09 +05:00
evpobr
a9f4037de1 Fix warnings reported by Clang 10 2020-08-31 16:59:01 +05:00
evpobr
fe50b95615 CMake: Fix MinGW with Clang compiler warnings 2020-08-31 09:30:42 +05:00
evpobr
acfcd147da Move public headers to include directory 2020-08-26 11:59:26 +05:00
evpobr
41bba15973 Fix compiler warnings
Fix GCC 10.2.0 with -Wall -Wextra warnings.

src/ogg.c: Fix compiler warning

-Wsign-compare in ogg_stream_seek_page_search().

src/misc_test.c: Fix compiler warnings

-Wunused-parameter, -Wunused-variable in filesystem_full_test().

Windows platforms only.

src/ms_adpcm.c: Fix compiler warnings

-Wmaybe-uninitialized in msadpcm_encode_block().

src/ogg.c: Fix compiler warning

Comparison of distinct pointer types lacks a cast in
ogg_read_first_page().
2020-08-20 12:33:20 +05:00
Moonbase59
3a57ea117b Add BWF v2 loudness parameters
Closes: https://github.com/erikd/libsndfile/issues/479
2019-08-27 07:28:25 +10:00
evpobr
22c2fa64c2 tests/command_test.c: Fix format specifiers
Closes: #472
2019-07-02 20:59:35 +10:00
Arthur Taylor
326e4533f3 Opus file support
Ogg: Introduce new functions ogg_sync_fseek(), ogg_ftell(), ogg_next_page(),
ogg_stream_next_page(), ogg_sync_last_page_before(), and
ogg_stream_unpack_page(). Use ogg_sync_* for ogg_read_first_page(). Bump libogg
version requirement from 1.1.3 to 1.3.0 as LibOgg 1.3.0 is required for
ogg_stream_pageout_fill() and ogg_stream_flush_fill().

Opus: Add opus support. Document added commands
SFC_(GET|SET)_ORIGINAL_SAMPLERATE. Added or extended tests ogg_opus_test,
compression_size_test, floating_point_test, lossy_comp_test, string_test,
external_libs_test. Change Opus to non-experimental.
2019-02-20 19:30:30 +11:00
Erik de Castro Lopo
bef2abc9e8 tests/command_test.c: Fix ASAN test failure 2019-01-02 12:24:21 +11:00
Erik de Castro Lopo
ba8a7577c6
Add support for more than 1000 cue points in WAV and AIFF files (#434)
This work was originally submitted by Diemo Schwarz <schwarz@ircam.fr> in
PR https://github.com/erikd/libsndfile/pull/197 which was rebased and
cleaned up.

Closes: https://github.com/erikd/libsndfile/pull/197
2018-12-23 20:32:56 +11:00
Arthur Taylor
81a71e08c0 Fix lossy_comp_test sdlcomp_test_(float|double) for Vorbis (#426)
While experimenting, determined that Vobis' analysis stops working on
non-normalized floating point input outside the range of [2000.0, -2000.0], and
seems to get worse the larger the magnitude. As the sdlcomp_test_float and
sldcomp_test_double tests work with non-normalized floats with a magnitude of
32000.0, this explains why they do not work for Vorbis.

This patch fixes the test by reducing the magnitude of the test data at encode
and restoring it at decode if it detects Vorbis, mantaining the same 32000.0
overall magnitude so the envelope values for the test are the same as they are
for other tests and format.

It is unknown at this time if the input range magnitude of 2000.0 is  a
limitation of Vorbis or libvorbis.
2018-10-11 09:26:56 +11:00
evpobr
123cb9f9a5 tests/vrtual_io_test.c: Fix typo
Closes: https://github.com/erikd/libsndfile/issues/417
2018-09-20 07:13:50 +10:00
Michael Panzlaff
7ea3f9d874 src/wav.c: Fix WAV Sampler Chunk tune parsing
Fix parsing of instrument fine tuning instrument field. There is still
a possible rounding error involved which might require further
investigation at some stage.

Update the test as well.
2018-04-29 12:13:42 +10:00
David Seifert
4ab74d919f Fix out-of-tree building 2018-04-21 09:23:25 +10:00
Erik de Castro Lopo
dc56b25f41 tests/error_test.c: Add unrecognised file test 2018-03-17 13:05:25 +11:00
Arthur Taylor
4043ec289f lossy_comp_test: Add tests for NMS_ADPCM in WAV files. 2018-03-08 18:13:03 +11:00
Arthur Taylor
64e5a3f182 Add NMS ADPCM codec implementation and support
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2018-02-03 19:44:33 +11:00
Erik de Castro Lopo
5d4d1feca0 Remove redundant libsndfile.def.in 2017-10-31 18:42:40 +11:00
Erik de Castro Lopo
9b4fdaccc1 tests/header_test.tpl: Fix a memory leak
Found using AddressSanitizer.
2017-10-26 19:21:06 +11:00
David Seifert
b17f14d613 Make git checkout buildable out-of-tree
Currently, libsndfile requires in-tree bootstrapping and creation
of the tarball. For Gentoo, some users might want to build the
latest git checkout. This commit makes out-of-tree building of all
the necessary dependencies possible.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-10-08 18:23:58 +11:00
Erik de Castro Lopo
cc5e831a75 A couple of minor cstyle fixes 2017-10-01 16:33:41 +11:00
David Seifert
e6c42ff027 Make build system completely non-recursive 2017-09-26 19:35:56 +10:00
Erik de Castro Lopo
beee21e5c2 Revert "tests/Makefile.am: Switch away from GNU make rules"
This reverts commit ff26310437.

The GNU make rules actually work. The old style suffix rules do not.
2017-08-10 20:22:18 +10:00
Henner Zeller
f96e5a2047 Add test for flac regression update-header-before-write
Explicitly writing the header with SFC_UPDATE_HEADER_NOW before
the first sf_write() was making sf_write() calls fail. This is a
test to verify that the fix works.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-08-10 20:09:55 +10:00
Erik de Castro Lopo
9923b2a0a2 src/aiff.c: Remove INST chunk writing
This code had egregious errors in the way things were being passed
to psf_binheader_writef and neither the compiler nor the tests
caught it. It was however found when adding safety macros to enforce
correct type being passed to psf_binheader_writef.
2017-05-16 21:03:22 +10:00
evpobr
44269a0892 Tests: Fix win32_ordinal_test 2017-05-06 01:55:14 +10:00
Erik de Castro Lopo
b506de463d Fix MSAN errors
Fix multiple errors uncovered by Clang's Memory Sanitizer.

Closes: https://github.com/erikd/libsndfile/issues/248
2017-05-04 18:42:24 +10:00
Erik de Castro Lopo
cecc9a7498 RF64 tweaks
* Comments.
* Improve the `rf64_long_file_downgrade_test` test.
2017-04-18 20:07:10 +10:00
Erik de Castro Lopo
ff26310437 tests/Makefile.am: Switch away from GNU make rules
Avoid `'%'-style pattern rules are a GNU make extension` warnings.
2017-04-16 19:58:15 +10:00
Erik de Castro Lopo
bf83b95fd9 RF64: Fix an RF64_AUTO_DOWNGRADE bug
Also add a test for this. The test is disabled by default because it
needs to write a 4 Gig file.

Closes: https://github.com/erikd/libsndfile/issues/238
2017-04-16 19:11:45 +10:00
evpobr
a3287d88eb tests: Fix typos in fixes for MSVC
* src/test_main.c: Fix typo in HAVE_SYS_TYPES_H definition
* tests/win32_ordinal_test.c: Use correct "direct.h" header instead of "dirent.h"

Related: https://github.com/erikd/libsndfile/issues/154, https://github.com/erikd/libsndfile/pull/234
2017-04-15 07:45:45 +10:00
Erik de Castro Lopo
197ceb315b tests/Makefile.am: Another fix for autogen file rules
For Make to do its stuff, there needs to be a rule to make both the
`*.h` file and the `*.c` file.
2017-04-14 17:30:37 +10:00
Erik de Castro Lopo
7f7fc24dc3 Fix 'make distcheck'
* tests/pedantic-header-test.sh.in:
  Commit 58737ceb48 started using "sfconfig.h" in the test files,
  which made this test script fail.

* .travis.yaml:
  Add `distcheck` that so PRs are checked.
2017-04-14 16:10:45 +10:00
evpobr
58737ceb48 tests: Fixes for MSVC
* src/test_main.c: Fix undeclared off_t type with MSVC
* tests/misc_test.c: Fix undefined S_ISCHR & S_ISBLK with MSVC
* tests/stdin_test.c: Fix undefined STDIN_FILENO with MSVC
* tests/win32_ordinal_test.c: Fix undeclared getcwd() with MSVC
* Fix missing unistd.h under Win32

Related: https://github.com/erikd/libsndfile/issues/154
2017-04-14 13:03:27 +10:00
Erik de Castro Lopo
261a0dd489 tests/Makefile.am : Fix rules for autogen-ed files
Previously, the `*.c` file was only being rebuilt if the `*.def`
file was changed and not if the `*.tpl` file was changed.
2017-04-14 11:23:44 +10:00
Erik de Castro Lopo
5bcfd5ff0a Include sfconfig.h as needed 2017-04-03 18:54:49 +10:00
Erik de Castro Lopo
798c285506 tests/write_read_test.tpl: Fix function name 2017-04-02 17:43:22 +10:00
Erik de Castro Lopo
6bbd5a9caf tests: Don't use /tmp for temporary files
When the program is run under American Fuzzy Lop, writing to
/tmp/ fails.
2017-03-26 13:04:51 +11:00
Erik de Castro Lopo
8dc7478ee7 tests/error_test.c: Fix uninitialized value error
The `SF_INFO` struct was not initialized before being passed to
`sf_open`.

Closes: https://github.com/erikd/libsndfile/issues/209
2017-03-21 18:35:12 +11:00
Erik de Castro Lopo
3b45c061d2 src/sndfile.c: Check return of write_header()
For some formats (like FLAC) the headers are written *just* before
the first bit of audio data. Until now, there was not check for that
the header write function returned zero.

Test included.
2017-01-30 21:48:56 +11:00
David Seifert
1bfb5a908f Refactor generation of test-suite
It's more preferable to generate the testsuite when running 'make dist'
or 'make distcheck' instead of running it from the configure script.

Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
2017-01-28 21:16:21 +11:00
Erik de Castro Lopo
4a171f8f5f tests/write_read_test.tpl: One more check 2016-12-11 20:14:57 +11:00
Erik de Castro Lopo
0818c1685e tests/chunk_test.c: Add test for large free chunks 2016-11-27 20:02:06 +11:00
Erik de Castro Lopo
1d7b55b483 tests/chunk_test.c: Add wav_subchunk_test 2016-11-09 06:46:07 +11:00
Erik de Castro Lopo
08dfe89c61 tests: Remove need for POSIX truncate function
Windows doesn't have `truncate` and since it was only being used
to truncate the file to zero length, implement a cross platform
`truncate_file_to_zero`.

Based on an idea from <evpobr@gmail.com>.
2016-09-09 19:15:42 +10:00
Erik de Castro Lopo
ba352a1ce7 Remove all use of Variable Length Arrays
VLAs are somewhat unsound and are being made an optional part of ISO
C specification.
2016-09-03 18:11:56 +10:00
Erik de Castro Lopo
05288ca11e Revert "Drop use of __USE_MINGW_ANSI_STDIO"
This reverts commit ac0c02de3c.

This define is needed when cross compiling from Linux to Windows.
2016-07-03 19:02:03 +10:00
Erik de Castro Lopo
ac0c02de3c Drop use of __USE_MINGW_ANSI_STDIO 2016-07-03 11:05:08 +10:00
Erik de Castro Lopo
7b7e0d913b SF_CUES: Fix for big-endian CPUs 2016-04-15 22:27:08 +10:00
Erik de Castro Lopo
9ea30b4c19 Add SFC_GET_CUE_COUNT command
This allows retrieval of the cue marker count before retrieval.
2016-04-15 21:11:40 +10:00