Subject: | Picture $type incorrectly defaults to 3 for valid input 0 - "Other" |
Hi,
I'm working on a patch for flac2mp3 that will allow copying embedded
picture data in the source flac files to the mp3 destination files. I
discovered that it is not possible to use all 21 defined picture types
(i.e. 0..20) with Audio-FLAC-Header. There is a bug in Header.pm, sub
picture: When input value is 0 ('Other') it incorrrectly defaults to 3
('Cover (front)'). This bug is corrected by the patch here:
--- H:/test/flac2mp3-0.3.0rc1/Header_v1.9.pm Thu Jan 24 10:23:19 2008
+++ H:/test/flac2mp3-0.3.0rc1/Header_v1.9_bugfixed.pm Thu Jan 24
15:53:15 2008
@@ -164,7 +164,8 @@
sub picture {
my $self = shift;
- my $type = shift || 3; # front cover
+ my $type;
+ $type = 3 unless defined ($type = shift); # defaults to front cover
# if the picture block exists, return it's content
return $self->{'picture'}->{$type} if exists($self->{'picture'}->{$type});
(Not that I think it matters in this specific case, but I'm using
ActivePerl 5.8.8 Build 822 on an MSWin32-x86-multi-thread system.)
Many thanks for an otherwise beautiful script!
/Carl Aslund
Subject: | Patch_Header_v1.9_to_v1.9bugfixed.diff.txt |
--- H:/test/flac2mp3-0.3.0rc1/Header_v1.9.pm Thu Jan 24 10:23:19 2008
+++ H:/test/flac2mp3-0.3.0rc1/Header_v1.9_bugfixed.pm Thu Jan 24 15:53:15 2008
@@ -164,7 +164,8 @@
sub picture {
my $self = shift;
- my $type = shift || 3; # front cover
+ my $type;
+ $type = 3 unless defined ($type = shift); # defaults to front cover
# if the picture block exists, return it's content
return $self->{'picture'}->{$type} if exists($self->{'picture'}->{$type});