Subject: | write() in Audio::FLAC version 0.7 results in corrupt FLAC file |
Calling the write() method on a newly created Audio::FLAC object results in a modified FLAC file that no longer passes flac --test. I am running on a Debian Linux x86 system, using Perl 5.8.2 and Audio::FLAC version 0.7. I've put together a simple program that illustrates the problem. It is included in the session log below, which shows the steps I performed that exhibited the problem. Please let me know if there is anything else I can do to help identify/resolve the problem.
[mike@rocky:/tmp/bug]
$ uname -a
Linux rocky 2.4.22 #1 Sun Sep 28 00:43:53 CDT 2003 i686 GNU/Linux
[mike@rocky:/tmp/bug]
$ perl -v
This is perl, v5.8.2 built for i386-linux-thread-multi
Copyright 1987-2003, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
[mike@rocky:/tmp/bug]
$ cat test.pl
#!/usr/bin/perl -w
use Audio::FLAC 0.7;
my $flac = Audio::FLAC->new("song.flac");
if (0 == $flac->write()) {
print "Write returned without error\n";
}
[mike@rocky:/tmp/bug]
$ metaflac --list song.flac
METADATA block #0
type: 0 (STREAMINFO)
is last: false
length: 34
minumum blocksize: 4608 samples
maximum blocksize: 4608 samples
minimum framesize: 14 bytes
maximum framesize: 15636 bytes
sample_rate: 44100 Hz
channels: 2
bits-per-sample: 16
total samples: 10120068
MD5 signature: 1027dc990e213bdb4e15f317ec6b561a
METADATA block #1
type: 3 (SEEKTABLE)
is last: false
length: 396
seek points: 22
point 0: sample_number=0, stream_offset=0, frame_samples=4608
point 1: sample_number=456192, stream_offset=1256444, frame_samples=4608
point 2: sample_number=916992, stream_offset=2562730, frame_samples=4608
point 3: sample_number=1377792, stream_offset=3878343, frame_samples=4608
point 4: sample_number=1838592, stream_offset=5227466, frame_samples=4608
point 5: sample_number=2299392, stream_offset=6567698, frame_samples=4608
point 6: sample_number=2755584, stream_offset=7882880, frame_samples=4608
point 7: sample_number=3216384, stream_offset=9237400, frame_samples=4608
point 8: sample_number=3677184, stream_offset=10603759, frame_samples=4608
point 9: sample_number=4137984, stream_offset=11978105, frame_samples=4608
point 10: sample_number=4598784, stream_offset=13320356, frame_samples=4608
point 11: sample_number=5059584, stream_offset=14650826, frame_samples=4608
point 12: sample_number=5515776, stream_offset=15991933, frame_samples=4608
point 13: sample_number=5976576, stream_offset=17367158, frame_samples=4608
point 14: sample_number=6437376, stream_offset=18733490, frame_samples=4608
point 15: sample_number=6898176, stream_offset=20088650, frame_samples=4608
point 16: sample_number=7358976, stream_offset=21438699, frame_samples=4608
point 17: sample_number=7819776, stream_offset=22829601, frame_samples=4608
point 18: sample_number=8275968, stream_offset=24194473, frame_samples=4608
point 19: sample_number=8736768, stream_offset=25587334, frame_samples=4608
point 20: sample_number=9197568, stream_offset=26989606, frame_samples=4608
point 21: sample_number=9658368, stream_offset=28397296, frame_samples=4608
METADATA block #2
type: 4 (VORBIS_COMMENT)
is last: false
length: 341
vendor string: reference libFLAC 1.1.0 20030126
comments: 11
comment[0]: artist=Train
comment[1]: title=She's on Fire
comment[2]: album=Drops of Jupiter
comment[3]: date=2001
comment[4]: tracknumber=1
comment[5]: genre=Alternative
comment[6]: comment=EAC secure mode / FLAC 1.1.0 @ q6
comment[7]: REPLAYGAIN_TRACK_PEAK=0.98873901
comment[8]: REPLAYGAIN_TRACK_GAIN=-8.39 dB
comment[9]: REPLAYGAIN_ALBUM_PEAK=1.00000000
comment[10]: REPLAYGAIN_ALBUM_GAIN=-8.17 dB
METADATA block #3
type: 1 (PADDING)
is last: true
length: 3956
[mike@rocky:/tmp/bug]
$ flac --test song.flac
flac 1.1.0, Copyright (C) 2000,2001,2002,2003 Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions. Type `flac' for details.
song.flac: ok
[mike@rocky:/tmp/bug]
$ perl ./test.pl
Write returned without error
[mike@rocky:/tmp/bug]
$ flac --test song.flac
flac 1.1.0, Copyright (C) 2000,2001,2002,2003 Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions. Type `flac' for details.
song.flac: *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
song.flac: *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
song.flac: ERROR while decoding metadata
state = 4:FLAC__STREAM_DECODER_END_OF_STREAM