Commit Graph

4439 Commits

Author SHA1 Message Date
Martijn van Beurden dda3e77ea2
On WIN32, set stdout/stderr to UTF-8 (#714)
When stderr (flac) or stdout (metaflac) is redirected to a file,
output of non-ASCII characters fails. This commit should fix that.

Fixes https://github.com/xiph/flac/issues/713

NOTE: To enable this change, metaflac no longer outputs
application block data as binary directly, because that would
potentially result in incorrect UTF-8 codepoint. Instead, all
bytes that cannot be represented as printable ASCII are
replaced with the Unicode replacement character
2024-06-26 09:42:07 +02:00
Martijn van Beurden 706c061457
Fix https://github.com/m-ab-s/media-autobuild_suite/issues/2718 (#711) 2024-06-19 15:22:26 +02:00
Sam James ef1e185e2c
test: stop using which (#709)
`which` is an external command which isn't required by POSIX.

Debian and other distributions (like Gentoo!) are looking
to drop it from their base set of packages.

Switch to `command -v` which is, however, POSIX. See https://lwn.net/Articles/874049/.
2024-06-19 11:36:29 +02:00
Martijn van Beurden 1c5803950e
Do not warn that multithreading is disabled when setting 1 thread (#710) 2024-06-19 08:42:08 +02:00
Steve Lhomme a0f6661beb
export -lssp for static libraries (#704)
.a files in MinGW don't list the other static libraries they depend on.
We need to provide it through the pkg-config file.
2024-06-13 12:03:30 +02:00
Martijn van Beurden d6204ea911 Enable CMake install of api docs from tarball w/o doxygen 2024-06-07 09:18:06 +02:00
Jevin Sweval d21202e3f2 Fix CMake Doxygen install (match Makefile builds) 2024-06-07 09:18:06 +02:00
Kevin Groeneveld 7acdaabe2b Fix fallback to frame header bps.
Commit d4daa86167 ("Check for bps% 8 != 0 if no streaminfo is present")
breaks fallback to frame header bps as it tests decoder_session->bps at
a point where it is guaranteed to be 0 as this is the else case of the
if(decoder_session->bps) block.

Some corrupted FLAC files that used to play before the above mentioned
commit no longer can be played.

Move decoder_session->bps = bps to before the decoder_session->bps
validation to restore functionality more similar to before.
2024-06-06 14:50:27 +02:00
Martijn van Beurden cfe3afca9b
Further improve calculation of when to use wide residual computation (#702) 2024-05-16 16:00:19 +02:00
Martijn van Beurden 1ab3c8e748
Improve calculation of when to use wide residual computation (#700) 2024-05-15 10:42:58 +02:00
Martijn van Beurden 04532802fd
Escape double dashes, so they don't get converted to em dashes (#698)
Fixes https://github.com/xiph/flac/issues/671
2024-05-02 15:54:54 +02:00
Martijn van Beurden f5012d5e88 Update iconv.m4 2024-05-02 08:30:27 +02:00
Martijn van Beurden d6921ed6cd Fix use of --enable-asm-optimizations
Fixes https://github.com/xiph/flac/issues/686
2024-05-02 08:30:27 +02:00
Martijn van Beurden de80349297
Fix bug in CHECK_ORDER_IS_VALID macro in functions with intrinsics (#696)
This fixes a few things I missed with https://github.com/xiph/flac/pull/694
2024-05-01 17:03:19 +02:00
Martijn van Beurden 653b1187a1
Update GNU Free Documentation License (#697) 2024-05-01 12:11:18 +02:00
Martijn van Beurden 0dd1140a71
Add libtool to MacOS dependencies for github actions (#695) 2024-05-01 08:55:23 +02:00
Martijn van Beurden 61f8513c1f
Fix bug in CHECK_ORDER_IS_VALID macro (#694)
Fixes https://github.com/xiph/flac/issues/635
2024-04-30 15:30:30 +02:00
Steve Lhomme 49ab34dfef [CMake] disable fseeko on 32-bit Android before API 24
It can be linked in the NDK so check_function_exists detects it. But it's only supporting _FILE_OFFSET_BITS=64
since Android API 24 [1].

With NDK 26 it's no longer possible to build assuming the API is always available.

[1] https://android.googlesource.com/platform/bionic/+/main/docs/32-bit-abi.md
2024-04-22 14:37:41 +02:00
Steve Lhomme 9977bb5b77 include/share/compat.h : use fseek if fseeko is not available 2024-04-22 14:37:41 +02:00
Martijn van Beurden 5f6a352921
Update github action dependencies to latest versions (#682)
As described here:
https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
2024-03-28 08:04:21 +01:00
Martijn van Beurden 67a65b7ccf
Improve failure handling when multithreading (#681)
In case of encoder failure within a thread, asserts were false
and a locked mutex would be destroyed. This fix leaves in a race
condition: encoder->protected_->state is written without a lock.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62650
2024-03-27 21:51:07 +01:00
Martijn van Beurden d2b2441056
Different loose mid side algorithm compatible with multithreading (#675) 2024-03-09 21:40:03 +01:00
werner mendizabal 8d4ccdfbb1
Update CMakeLists to allow building with emscripten (#664) 2024-03-08 19:03:11 +01:00
Martijn van Beurden 8a685ee77c Silence fuzzer_seek 2024-03-07 21:02:05 +01:00
Martijn van Beurden 9504c76970 Handle missing decoder in FLAC__stream_encoder_get_verify_decoder_state() 2024-03-07 21:02:05 +01:00
Miroslav Lichvar 377289eea9 Handle missing decoder in FLAC__stream_encoder_get_resolved_state_string()
Fix crash when trying to get the decoder's state string while the decoder
is missing due to a memory allocation error.
2024-03-07 21:02:05 +01:00
Martijn van Beurden 79a164ecdf Augment fuzzing to catch https://github.com/xiph/flac/pull/645 2024-03-07 21:02:05 +01:00
Martijn van Beurden 37ca81137a
Refind import cuesheet op after appending seekpoints (#677)
This fixes a heap-use-after-free. The free was part of a realloc,
and the cuesheet op handle was still pointing to the old
allocation

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61292
2024-03-06 16:56:09 +01:00
Sam James e7d336c7a2
flac: foreign_metadata: fix -Walloc-size (#654)
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
src/flac/foreign_metadata.c:803:33: warning: allocation of insufficient size ‘1’ for type ‘foreign_metadata_t’ with size ‘64’ [-Walloc-size]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(foreign_metadata_t)`. GCC then sees we're not
doing anything wrong.

Signed-off-by: Sam James <sam@gentoo.org>
2024-03-06 12:54:37 +01:00
Martijn van Beurden 89a4d2b9fc
Fix format ending up with wrong subformat (#676)
It was possible the format was taken from foreign metadata and the
subformat from command-line options.

Credit: Oss-Fuzz
Issue: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63790
2024-03-05 17:58:17 +01:00
Cristian Rodríguez 0c8afdf35a
fix invalid C23 in process_frame_thread_ (#649)
process_frame_thread_ should return NULL instead of false,
in C23 NULL and _Bool are not compatible and the code is rightfully
rejected by the compiler.

"stream_encoder.c:3595:48: error: incompatible types when returning type
‘_Bool’ but ‘void *’ was expected"
2024-03-05 13:18:25 +01:00
Martijn van Beurden 4194eb677e Let libFLAC send an error when frames are missing 2024-03-03 21:45:17 +01:00
Martijn van Beurden ab99a4b56b Add check that sample/frame number increases correctly 2024-03-03 21:45:17 +01:00
Martijn van Beurden 66152791d8
Let `flac -t` parse all metadata blocks (#626) 2024-03-01 08:50:35 +01:00
Martijn van Beurden 7f7da558f5 Remove checks for semaphore.h in CMake and configure 2024-02-26 21:54:37 +01:00
Martijn van Beurden 82c23ba31a Add more explanation to threading code 2024-02-26 21:54:37 +01:00
Martijn van Beurden 1cea6bb5be Switch from semaphores to mutexes, remove extra debug checks 2024-02-26 21:54:37 +01:00
Martijn van Beurden 9e93c4526b Add extra debug checks for threading 2024-02-26 21:54:37 +01:00
Martijn van Beurden eb59fbe89e Add explanation as to how threading works 2024-02-26 21:54:37 +01:00
Martijn van Beurden 72787c3fee
Add documentation on foreign metadata storage format 2023-11-24 13:45:21 +01:00
Martijn van Beurden 8cf7e7fbb5 Update API version numbers and ABI dumps 2023-09-22 21:10:15 +02:00
Martijn van Beurden 0118be95f9 [CI] Also upload compat reports on failure 2023-09-22 21:10:15 +02:00
Martijn van Beurden c227be6c12 Add multithreading to libFLAC++ and more fuzzers 2023-09-22 21:10:15 +02:00
Martijn van Beurden 8c41e7f62e Add multithreading to CMake 2023-09-22 21:10:15 +02:00
Martijn van Beurden d2f0a1a812 Add multithreading to API documentation and man page 2023-09-22 21:10:15 +02:00
Martijn van Beurden e0ebc8eb7e Limit max number of threads in case of fuzzing
Fuzzing with memory sanitizer gave out-of-memory failures
2023-09-22 21:10:15 +02:00
Martijn van Beurden c1f0eb4bea Raise max number of threads, improve thread testing 2023-09-22 21:10:15 +02:00
Martijn van Beurden 790b759072 Simplify mutex scheme and fix some bugs 2023-09-22 21:10:15 +02:00
Martijn van Beurden 021e82bfcc Add checks for 'overcommitting'
This scales the number of active threads back when threads have to
wait for work too often
2023-09-22 21:10:15 +02:00
Martijn van Beurden bcc37540aa Fix threads busy waiting for MD5 2023-09-22 21:10:15 +02:00