From 6f5568e4df63542781ae6551b36ad463f27e9aa7 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Wed, 27 Sep 2006 05:02:11 +0000 Subject: [PATCH] change default padding to 8K, or 64K if input audio stream is >= 20 minutes long --- doc/html/changelog.html | 1 + doc/html/documentation.html | 2 +- man/flac.sgml | 2 +- src/flac/encode.c | 6 +++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/doc/html/changelog.html b/doc/html/changelog.html index 22947d5b..5505a3e8 100644 --- a/doc/html/changelog.html +++ b/doc/html/changelog.html @@ -95,6 +95,7 @@
  • Added support for encoding from non-compressed AIFF-C (SF #1090933).
  • Importing of non-CDDA-compliant cuesheets now only issues a warning, not an error (see here).
  • MD5 comparison failures on decoding are now an error instead of a warning and will also return a non-zero exit code (SF #1493725).
  • +
  • The default padding size is now 8K, or 64K if the input audio stream is more than 20 minutes long.
  • Fixed a bug in cuesheet parsing where it would return an error if the last line of the cuesheet did not end with a newline.
  • Fixed a bug that caused a crash when -a and -t were used together (SF #1229481).
  • Fixed a bug with --sector-align where appended samples were not always totally silent (SF #1237707).
  • diff --git a/doc/html/documentation.html b/doc/html/documentation.html index 0d4ae5d8..8c3a6a16 100644 --- a/doc/html/documentation.html +++ b/doc/html/documentation.html @@ -615,7 +615,7 @@ -P #, --padding=# - Tell the encoder to write a PADDING metadata block of the given length (in bytes) after the STREAMINFO block. This is useful if you plan to tag the file later with an APPLICATION block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the PADDING block. Note that the total length of the PADDING block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no PADDING block at all to be written with --no-padding. The encoder writes a PADDING block of 4096 bytes by default. + Tell the encoder to write a PADDING metadata block of the given length (in bytes) after the STREAMINFO block. This is useful if you plan to tag the file later with an APPLICATION block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the PADDING block. Note that the total length of the PADDING block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no PADDING block at all to be written with --no-padding. The encoder writes a PADDING block of 8192 bytes by default (or 65536 bytes if the input audio stream is more than 20 minutes long). diff --git a/man/flac.sgml b/man/flac.sgml index 36cff769..0ef9b5f8 100644 --- a/man/flac.sgml +++ b/man/flac.sgml @@ -361,7 +361,7 @@ #, =# - Tell the encoder to write a PADDING metadata block of the given length (in bytes) after the STREAMINFO block. This is useful if you plan to tag the file later with an APPLICATION block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the PADDING block. Note that the total length of the PADDING block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no PADDING block at all to be written with --no-padding. The encoder writes a PADDING block of 4096 bytes by default. + Tell the encoder to write a PADDING metadata block of the given length (in bytes) after the STREAMINFO block. This is useful if you plan to tag the file later with an APPLICATION block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the PADDING block. Note that the total length of the PADDING block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no PADDING block at all to be written with --no-padding. The encoder writes a PADDING block of 8192 bytes by default (or 65536 bytes if the input audio stream is more that 20 minutes long). diff --git a/src/flac/encode.c b/src/flac/encode.c index b8cbf34c..47cbe7da 100644 --- a/src/flac/encode.c +++ b/src/flac/encode.c @@ -103,7 +103,7 @@ typedef struct { FLAC__bool fatal_error; } FLACDecoderData; -const int FLAC_ENCODE__DEFAULT_PADDING = 4096; +const int FLAC_ENCODE__DEFAULT_PADDING = 8192; static FLAC__bool is_big_endian_host_; @@ -1516,7 +1516,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio if(options.padding > 0) p = options.padding; if(p < 0) - p = FLAC_ENCODE__DEFAULT_PADDING; + p = e->total_samples_to_encode / e->sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8; if(options.padding != 0) { if(p > 0 && flac_decoder_data->num_metadata_blocks < sizeof(flac_decoder_data->metadata_blocks)/sizeof(flac_decoder_data->metadata_blocks[0])) { flac_decoder_data->metadata_blocks[flac_decoder_data->num_metadata_blocks] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PADDING); @@ -1684,7 +1684,7 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio if(options.padding != 0) { padding.is_last = false; /* the encoder will set this for us */ padding.type = FLAC__METADATA_TYPE_PADDING; - padding.length = (unsigned)(options.padding>0? options.padding : FLAC_ENCODE__DEFAULT_PADDING); + padding.length = (unsigned)(options.padding>0? options.padding : (e->total_samples_to_encode / e->sample_rate < 20*60? FLAC_ENCODE__DEFAULT_PADDING : FLAC_ENCODE__DEFAULT_PADDING*8)); metadata[num_metadata++] = &padding; } } -- 2.34.1