ref: c71170041fe5294fcfaa44a8dbf337d88c558933
parent: c6f953b2b8c5a9804a61b2b624b7910a535a1844
author: robs <robs>
date: Fri Jan 25 16:57:46 EST 2008
Further length fixes
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,16 +19,20 @@
Bug fixes:
o Fix Sndtool read error causing noise at start. (Reynir Stefánsson)
- o Fix loss of 1 decoded FLAC block when using "trim 0 ...". (robs)
- o Fix trim when first effect with IMA-ADPCM input wav file. (robs)
o Fix mixer with >4 numbers, and mixer -3 behaving as mixer -4. (robs)
o Fix [1748909] sox does not report remaining playtime of mp3s. (robs)
o Fix failure to read AIFF files with empty MARK chunk. (robs)
o Fix spurious 'Premature EOF' message in some circumstances. (robs)
- o Fix -V (without argument) on non-gnu systems. (robs)
o Switched to 16-bit for libao driver since not all its plugins
support it (such as oss, nas, and pulse audio) (Morita Sho)
- o Stop crash when "rec" is ran with no arguments (Morita Sho).
+ o Stop crash when "rec" is run with no arguments (Morita Sho).
+ o Fix -V (without argument) on non-gnu systems. (robs)
+ o Fix reported (with -V) output audio length in some cases. (robs)
+ o Fix actual FLAC output file audio length in some cases. (robs)
+ o Fix poor 24-bit FLAC compression & support newer versions of
+ libFLAC (1.2.x). (robs)
+ o Fix loss of 1 decoded FLAC block when using "trim 0 ...". (robs)
+ o Fix trim when first effect with IMA-ADPCM input wav file. (robs)
Internal improvements:
--- a/src/flac.c
+++ b/src/flac.c
@@ -399,7 +399,7 @@
#endif
if (ft->length != 0) {
- FLAC__stream_encoder_set_total_samples_estimate(encoder->flac, (FLAC__uint64)ft->length);
+ FLAC__stream_encoder_set_total_samples_estimate(encoder->flac, (FLAC__uint64)(ft->length / ft->signal.channels));
encoder->metadata[encoder->num_metadata] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_SEEKTABLE);
if (encoder->metadata[encoder->num_metadata] == NULL) {
--- a/src/soxio.c
+++ b/src/soxio.c
@@ -371,6 +371,13 @@
goto output_error;
}
+ /*
+ * Bit of a hack; doesn't cover the situation where
+ * codec changes audio length (e.g. 8svx, gsm):
+ */
+ if (info)
+ ft->length = ft->length * ft->signal.rate / info->rate * ft->signal.channels / info->channels + .5;
+
return ft;
output_error: