Commit 6f5568e4 authored by Josh Coalson's avatar Josh Coalson

change default padding to 8K, or 64K if input audio stream is >= 20 minutes long

parent 9ca69b9c
......@@ -95,6 +95,7 @@
<li>Added support for encoding from non-compressed AIFF-C (<a href="https://sourceforge.net/tracker/?func=detail&amp;atid=113478&amp;aid=1090933&amp;group_id=13478">SF #1090933</a>).</li>
<li>Importing of non-CDDA-compliant cuesheets now only issues a warning, not an error (see <a href="http://www.hydrogenaudio.org/forums/index.php?showtopic=31282">here</a>).</li>
<li>MD5 comparison failures on decoding are now an error instead of a warning and will also return a non-zero exit code (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1493725&amp;group_id=13478&amp;atid=113478">SF #1493725</a>).</li>
<li>The default padding size is now 8K, or 64K if the input audio stream is more than 20 minutes long.</li>
<li>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.</li>
<li>Fixed a bug that caused a crash when <span class="argument">-a</span> and <span class="argument">-t</span> were used together (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1229481&amp;group_id=13478&amp;atid=113478">SF #1229481</a>).</li>
<li>Fixed a bug with --sector-align where appended samples were not always totally silent (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1237707&amp;group_id=13478&amp;atid=113478">SF #1237707</a>).</li>
......
......@@ -615,7 +615,7 @@
<span class="argument">-P #</span>, <span class="argument">--padding=#</span>
</td>
<td>
Tell the encoder to write a <span class="code">PADDING</span> metadata block of the given length (in bytes) after the <span class="code">STREAMINFO</span> block. This is useful if you plan to tag the file later with an <span class="code">APPLICATION</span> block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the <span class="code">PADDING</span> block. Note that the total length of the <span class="code">PADDING</span> block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no <span class="code">PADDING</span> block at all to be written with <span class="argument">--no-padding</span>. The encoder writes a <span class="code">PADDING</span> block of 4096 bytes by default.
Tell the encoder to write a <span class="code">PADDING</span> metadata block of the given length (in bytes) after the <span class="code">STREAMINFO</span> block. This is useful if you plan to tag the file later with an <span class="code">APPLICATION</span> block; instead of having to rewrite the entire file later just to insert your block, you can write directly over the <span class="code">PADDING</span> block. Note that the total length of the <span class="code">PADDING</span> block will be 4 bytes longer than the length given because of the 4 metadata block header bytes. You can force no <span class="code">PADDING</span> block at all to be written with <span class="argument">--no-padding</span>. The encoder writes a <span class="code">PADDING</span> block of 8192 bytes by default (or 65536 bytes if the input audio stream is more than 20 minutes long).
</td>
</tr>
<tr>
......
......@@ -361,7 +361,7 @@
<term><option>-P</option> <replaceable>#</replaceable>, <option>--padding</option>=<replaceable>#</replaceable></term>
<listitem>
<para>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.</para>
<para>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).</para>
</listitem>
</varlistentry>
......
......@@ -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;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment