+sub mp4_format ($){
+ my $encoding = $_[0];
+ return 'AAC' if $encoding eq 'mp4a';
+ return 'ALAC' if $encoding eq 'alac';
+ "MP4-$encoding"
+}
+
+sub mp4info{
+ my $file=$_[0];
+ my %tag = %{get_mp4tag $file};
+ my %info = %{get_mp4info $file};
+ $file = scalar fileparse $file;
+
+ freeze +{
+ format => mp4_format $info{ENCODING},
+ title => $tag{TITLE} || '?',
+ artist => $tag{ARTIST} || '?',
+ year => $tag{YEAR} || '?',
+ album => $tag{ALBUM} || '?',
+ tracknumber => $tag{TRACKNUM} || '?',
+ tracktotal => ($tag{TRKN} ? $tag{TRKN}->[1] : undef) || '?',
+ genre => $tag{GENRE} || '?',
+ file => $file,
+ };
+}
+