summaryrefslogtreecommitdiff
path: root/src/flac/encode.c
Commit message (Collapse)AuthorAgeFilesLines
* Warn user when encoding to stdout that checksum isn't written (#445)Martijn van Beurden2022-09-161-0/+7
| | | Fixes https://github.com/xiph/flac/issues/428
* Add and use _nofree variants of safe_realloc functionsMartijn van Beurden2022-08-201-2/+2
| | | | | | | | | | | | | | | | | Parts of the code use realloc like x = safe_realloc(x, somesize); when this is the case, the safe_realloc variant used must free the old memory block in case it fails, otherwise it will leak. However, there are also instances in the code where handling is different: if (0 == (x = safe_realloc(y, somesize))) return false in this case, y should not be freed, as y is not set to NULL we could encounter double frees. Here the safe_realloc_nofree functions are used.
* Bulk update copyright dates to 2022Martijn van Beurden2022-07-261-1/+1
|
* Re-add check for block alignMartijn van Beurden2022-07-161-20/+4
| | | | | | | | In 2003, in commit 94f81b0, a check was added for the block align field in WAVE. If it contradicts other parts of the header, an error was raised. This was (probably erroneously) made inactive with #if 0 in commit 13c63e4. This commit reactivates the check and removes the rest of the inactivated code.
* Improve foreign metadata handlingMartijn van Beurden2022-06-281-2/+9
| | | | | | Add options --keep-foreign-metadata-if-present and improve error messages when on decoding the wrong type of foreign metadata is found.
* Do not add channel mask to vorbis_comment that will be reused laterMartijn van Beurden2022-06-241-2/+5
| | | | This fixes https://github.com/xiph/flac/issues/376
* Add 32-bit encoding, including limiting of residual to 32-bit intMartijn van Beurden2022-06-121-2/+43
|
* Add --limit-min-bitrate to flac and add test for itMartijn van Beurden2022-05-021-0/+1
|
* Change sourceforge URL in flac error messages to githubMartijn van Beurden2022-02-131-1/+1
| | | | Signed-off-by: Ralph Giles <giles@thaumas.net>
* Fix compression ratio display for very small filesMartijn van Beurden2021-03-151-3/+3
| | | | | | | | Because the compression ratio was calculated before processing the input of the last frame, it did not include the size of this last frame. This patch moves the calculation of the compression ratio after the new input has been processed. Now the compression ratio on very small files is correctly displayed.
* flac: Remove variable from expression because it's always equals to falseAndrey Astafyev2019-12-081-1/+1
|
* Suppress compression failure message if it is not an errorKarthik Periagaram2019-02-011-3/+2
| | | | | | | If the user specifies `--no-error-on-compression-fail`, there is no need to treat compression failure as an error. Hence, the failure message should be suppressed along with the non-zero exit code (which already is suppressed).
* flac/encode.c: Fix an integer overflowErik de Castro Lopo2017-02-141-3/+3
| | | | | | | | | | | | | When encoding a 24 bit multichannel W64 file on a 32 bit system, a calculation could overflow resulting in a "got partial sample" error and early termination of the encoding process. The fix was to replace the cast to `size_t` (which is only 32 bits on a 32 bit system) with a cast to `uin64_t`. Thanks to Janne Hyvärinen for helping to track down the problem. Closes: https://sourceforge.net/p/flac/bugs/453
* Yet more purging of `unsigned` typeErik de Castro Lopo2017-01-151-121/+121
|
* Bulk update copyright datesErik de Castro Lopo2016-12-051-1/+1
|
* flac/encode.c: Limit padding sizeErik de Castro Lopo2016-01-091-0/+2
| | | | | | | This prevents a too large padding value overflowing the block length. Patch-from: lvqcl <lvqcl.mail@gmail.com> Closes: https://sourceforge.net/p/flac/bugs/284/
* Whitespace onlyErik de Castro Lopo2015-12-251-5/+5
| | | | Patch-from: lvqcl <lvqcl.mail@gmail.com>
* src/flac/encode.c: Fix undefined behaviourErik de Castro Lopo2015-09-071-3/+2
| | | | Patch-from: lvqcl <lvqcl.mail@gmail.com>
* flac/encode.c: Fix undefinoed behaviourErik de Castro Lopo2015-08-311-1/+1
|
* src/encode.c : Fix potential infinite loop in flac-toflac encoding.Erik de Castro Lopo2015-02-221-1/+14
| | | | | | | | | | A malformed file (generated by AFL) had a 'samples_left_to_process' value of greater than the actual numbe of samples. When re-encoding the decoder would get to the end of the file and then continuously return a decode status of FLAC__STREAM_DECODER_END_OF_STREAM, causing an infinite loop. Solution is to break out of the loop on two consecutive end-of-stream events.
* flac : Fix for https://sourceforge.net/p/flac/bugs/425/Erik de Castro Lopo2015-02-181-11/+11
| | | | | | | | * flac/encode.c : Validate num_tracks field of cuesheet. * libFLAC/stream_encoder.c : Add check for a NULL pointer. * flac/encode.c : Improve bounds checking. Closes: https://sourceforge.net/p/flac/bugs/425/
* Spelling and grammar fixes for console outputKarthik Periagaram2014-12-141-2/+2
| | | | | | | This commit fixes a typo in a console debug message encountered during encoding. It also fixes a grammatical error in the same message. Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
* Update copyright years to include 2014.Erik de Castro Lopo2014-11-251-1/+1
|
* src/ : Remove un-needed MSVC6 workaround.Erik de Castro Lopo2014-07-041-6/+0
| | | | | | | | MSVC6 was not able to cast from a uint64_t to a double and this commit removes some #ifdef hackery designed to work around this problem. Patch-from: lvqcl <lvqcl.mail@gmail.com>
* src/flac/encode.c : Fix compression failure warning when encoding from stdin.Erik de Castro Lopo2014-07-021-6/+7
| | | | Patch-from: lvqcl <lvqcl.mail@gmail.com>
* src/flac/encode.c : Fix cast-align warning on ARM systems.Erik de Castro Lopo2014-06-291-28/+33
| | | | Use the union of pointers trick again.
* flac: Fix channel order for mono files.Erik de Castro Lopo2014-06-281-5/+7
| | | | | | | | | | | | | | | | | | | | | * The default channel mask for mono files was 0x0001 (front left) but it makes more sense to use 0x0004 (front center) for such files. * Also FLAC will accept not only mono WAV files with 0x0001 mask, but also with 0x0002 (requested at https://sourceforge.net/p/flac/bugs/390/) and 0x0004 (e.g. SoX creates mono files with this mask). * The comment about channel support was updated. * The error message "Use --channel-map=none option to store channels in current order; FLAC files must also be decoded with --channel-map=none to restore correct order." is misleading: FLAC never changes the order of channels. Decoding with this options also sets the channel mask of the resulting WAV file to 0. Without this option the mask is equal to the value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag. Patch-from: lvqcl <lvqcl.mail@gmail.com>
* flac: Fix encoder and decode progress messages with --ogg.Erik de Castro Lopo2014-06-281-9/+13
| | | | | | | | | | | | | Problem discussed here: http://lists.xiph.org/pipermail/flac-dev/2014-June/004808.html The values for the interval between two updates (e->stats_mask, e->stats_frames_interval) were set ~10 years ago, and it is small for current CPUs. It was now been increased too (0x3f -> 0xff, etc). The update interval is still less than 1 second. Patch-from: lvqcl <lvqcl.mail@gmail.com>
* flac: Fix padding for --replay-gain option.Erik de Castro Lopo2014-06-281-1/+3
| | | | | | | | | | | | Patches ported from the flac 1.2.1 maintenance branch. http://flac.cvs.sourceforge.net/viewvc/flac/flac/src/flac/encode.c? r1=1.194&r2=1.194.2.1&pathrev=FLAC_RELEASE_1_2_1_MAINTENANCE_BRANCH http://flac.cvs.sourceforge.net/viewvc/flac/flac/src/flac/main.c? r1=1.169&r2=1.169.2.1&pathrev=FLAC_RELEASE_1_2_1_MAINTENANCE_BRANCH Patch-from: lvqcl <lvqcl.mail@gmail.com>
* Update URLs as nedeed.Erik de Castro Lopo2014-06-281-3/+3
| | | | | | | Sourceforge.net links updated as nedeed with some of them being changed to point to xiph.org/flac. Patch-from: lvqcl <lvqcl.mail@gmail.com>
* src/ : Fix two typos.Erik de Castro Lopo2014-06-011-1/+1
| | | | | | | * 'norrmal' -> 'normal'. * 'fames' -> 'frames'. Reported-by: lvqcl <lvqcl.mail@gmail.com>
* Fix all instances of '#if HAVE_CONFIG_H'.Erik de Castro Lopo2014-03-241-1/+1
| | | | | | Should be '#ifdef HAVE_CONFIG_H'. Closes: https://sourceforge.net/p/flac/bugs/410/
* src/flac/encode.c : Improve perf of format_input() when compiled with MSVC.Erik de Castro Lopo2014-02-021-7/+11
| | | | | | | | | | | | | | | MSVS profiler shows that the encoder spends too much time inside format_input() when the input is 24-bit. Increases encoding speed: FLAC -5: from 27.1 to 24.2 seconds FLAC -8: from 76.2 to 73.1 seconds (MSVS 2010, 32-bit flac.exe, 24-bit stereo input file) For GCC compiles the encoding speed remains the same. I suspect that GCC is smart enough to use strict aliasing rule to optimize the code, and MSVS doesn't even know about it. Path-from: lvqcl <lvqcl.mail@gmail.com>
* src/flac/main.c : Change the default beahviour when compression fails.Erik de Castro Lopo2014-02-011-2/+3
| | | | | | | | | | | Previously the flac executable would return a non-zero exit code when the output file was bigger than the input file and this could be disabled with the --no-error-on-compression-fail option. New beaviour is to print the failure message but return a zero exit code in the above situation, and only return a non-zero exit code with the --error--on-compression-fail option. The --no-error-on-compression-fail command line option has been retained.
* src/flac/encode.c : Improve message when compression fails.Erik de Castro Lopo2014-02-011-1/+7
| | | | | | As suggested by Brian Willoughby this is not an "ERROR" but a "FAILURE". Also list a couple of possible causes of this failure and remove the suggestion to contact the developers.
* flac: Implement --no-error-on-compression-fail command line option.Erik de Castro Lopo2013-08-011-4/+5
| | | | | This is designed for the test suite where a number of artificially created files end up bigger than the original.
* flac : Check compression ratio at end of encode process.Erik de Castro Lopo2013-07-211-14/+24
| | | | | | Stash the compression ratio in the EncoderSession struct and at the end of the encode process, check if its > 1.0. Print an error message if it is.
* Set version to 1.3.0 and update coyprights throughout.Erik de Castro Lopo2013-05-261-1/+2
|
* src/flac/encode.c : Use flac_snprintf instead of sprintf.Erik de Castro Lopo2013-04-281-1/+1
|
* Fix -Wshadow warnings when compiling with mingw-gcc.Erik de Castro Lopo2013-04-211-17/+21
|
* A set of windows utf8 patches fromJanne Hyvärinen <cse@sci.fi>.Erik de Castro Lopo2013-04-211-22/+27
|
* Rename _flac_stat to flac_stat_s.Erik de Castro Lopo2013-03-291-1/+1
|
* Huge Windows utf8 I/O patch.Erik de Castro Lopo2013-03-291-4/+4
| | | | Patch from Janne Hyvärinen <cse@sci.fi>.
* Replace broken str* functions with safe versions.Erik de Castro Lopo2013-03-191-2/+3
|
* Wave64 patch from Janne Hyvrinen <cse@sci.fi>.Erik de Castro Lopo2013-03-171-3/+3
| | | | GUID had one word incorrectly in little endian order.
* Fix a couple of Windows 2Gig file size issues.Erik de Castro Lopo2013-03-141-16/+16
| | | | Patch submitted by Janne Hyvärinen <cse@sci.fi>.
* Fix -Wshadow warnings.Erik de Castro Lopo2013-03-111-17/+19
|
* Fix -Wstrict-prototypes -Wmissing-prototypes warnings.Erik de Castro Lopo2013-03-111-8/+1
| | | | | | | The files src/flac/encode.c and src/libFLAC/stream_encoder.c use functions in libFLAC that are marked as 'unpublished debug routines'. This patch moves these functions to new file include/share/private.h and marks them as 'unpublished debug routines'.
* Add appropriate WAV channel masks for 7 and 8 channel files.Erik de Castro Lopo2013-03-021-2/+6
| | | | | | | | | | | This commit accepts the new default channel masks for 6.1 and 7.1 surround input WAV files, and writes the corresponding masks when decoding to WAV without a channel mask from the metadata block. The local copy of the format spec is also updated with the new text from the flac-website repository. Patch from Ralph Giles <giles@mozilla.com>
* Fix to allow the flac command to parse piped WAV input withnu7742012-12-281-21/+11
| | | | | | | | | | | | | | | WAVEFORMATEXTENSIBLE format. MinGW's fseeko() doesn't return error for the attempt to seek on non seekable file (same behavior as MSVC). The simplest solution would be to change #ifdef _MSC_VER to #ifdef _WIN32 here. Instead, this patch tests file with fstat(), and use fseeko() only when it is a regular file. This is confirmed to work properly both on MSVC and MinGW, can seek if stdin is a redirected regular file, and doesn't require #ifdef. Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>