r71699 - in /branches/upstream/libaudio-scan-perl/current: ./ lib/Audio/ src/ t/ t/mp3/
ghedo-guest at users.alioth.debian.org
ghedo-guest at users.alioth.debian.org
Sat Mar 19 12:34:43 UTC 2011
Author: ghedo-guest
Date: Sat Mar 19 12:34:22 2011
New Revision: 71699
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=71699
Log:
[svn-upgrade] new version libaudio-scan-perl (0.86+dfsg)
Added:
branches/upstream/libaudio-scan-perl/current/t/mp3/bad-first-samplerate.mp3 (with props)
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-ext-header-invalid.mp3 (with props)
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-xing-no-lame.mp3 (with props)
Modified:
branches/upstream/libaudio-scan-perl/current/Changes
branches/upstream/libaudio-scan-perl/current/MANIFEST
branches/upstream/libaudio-scan-perl/current/META.yml
branches/upstream/libaudio-scan-perl/current/Makefile.PL
branches/upstream/libaudio-scan-perl/current/lib/Audio/Scan.pm
branches/upstream/libaudio-scan-perl/current/src/id3.c
branches/upstream/libaudio-scan-perl/current/src/mp3.c
branches/upstream/libaudio-scan-perl/current/t/mp3.t
branches/upstream/libaudio-scan-perl/current/t/mp3/v2-v1.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-empty-tcon2.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-etco.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-link-frame.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-mcdi.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon-numeric.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon-rx-cr.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon-text.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-sylt.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.4-corrupt-frame.mp3
branches/upstream/libaudio-scan-perl/current/t/mp3/v2.4-unsync.mp3
Modified: branches/upstream/libaudio-scan-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/Changes?rev=71699&op=diff
==============================================================================
--- branches/upstream/libaudio-scan-perl/current/Changes (original)
+++ branches/upstream/libaudio-scan-perl/current/Changes Sat Mar 19 12:34:22 2011
@@ -1,4 +1,11 @@
Revision history for Audio::Scan
+
+0.86 2011-03-18
+ - MP3: Require first 3 frames to have matching samplerate and channel values.
+ - MP3: Fixed bug where info->{vbr} would not be set if a file had a Xing frame
+ but no LAME data.
+ - MP3: Handle case where ID3 tag indicates an extended header is present but no
+ actual header exists.
0.85 2010-09-08 23:40:00
- Changed audio_md5 to use bytes from middle of file instead of the start,
Modified: branches/upstream/libaudio-scan-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/MANIFEST?rev=71699&op=diff
==============================================================================
--- branches/upstream/libaudio-scan-perl/current/MANIFEST (original)
+++ branches/upstream/libaudio-scan-perl/current/MANIFEST Sat Mar 19 12:34:22 2011
@@ -100,6 +100,7 @@
t/mac/apev2.ape
t/mp3/ape-no-v1.mp3
t/mp3/ape-v1.mp3
+t/mp3/bad-first-samplerate.mp3
t/mp3/bug5686/latin/good.mp3
t/mp3/bug5686/utf/invalid.mp3
t/mp3/gentoo-bug-210564.mp3
@@ -135,6 +136,7 @@
t/mp3/v2.3-encrypted-frame.mp3
t/mp3/v2.3-etco.mp3
t/mp3/v2.3-ext-header.mp3
+t/mp3/v2.3-ext-header-invalid.mp3
t/mp3/v2.3-group-id.mp3
t/mp3/v2.3-invalid-aenc.mp3
t/mp3/v2.3-invalid-encoding.mp3
@@ -157,6 +159,7 @@
t/mp3/v2.3-utf16any.mp3
t/mp3/v2.3-utf16be.mp3
t/mp3/v2.3-utf16le.mp3
+t/mp3/v2.3-xing-no-lame.mp3
t/mp3/v2.3-xsop.mp3
t/mp3/v2.3-zero-frame.mp3
t/mp3/v2.3.mp3
Modified: branches/upstream/libaudio-scan-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/META.yml?rev=71699&op=diff
==============================================================================
--- branches/upstream/libaudio-scan-perl/current/META.yml (original)
+++ branches/upstream/libaudio-scan-perl/current/META.yml Sat Mar 19 12:34:22 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Audio-Scan
-version: 0.85
+version: 0.86
abstract: Fast C metadata and tag reader for all common audio file formats
author:
- Andy Grundman <andy at slimdevices.com>
@@ -10,7 +10,8 @@
ExtUtils::MakeMaker: 0
build_requires:
ExtUtils::MakeMaker: 0
-requires: {}
+requires:
+ Test::Warn: 0
no_index:
directory:
- t
Modified: branches/upstream/libaudio-scan-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/Makefile.PL?rev=71699&op=diff
==============================================================================
--- branches/upstream/libaudio-scan-perl/current/Makefile.PL (original)
+++ branches/upstream/libaudio-scan-perl/current/Makefile.PL Sat Mar 19 12:34:22 2011
@@ -31,7 +31,7 @@
WriteMakefile(
NAME => 'Audio::Scan',
VERSION_FROM => 'lib/Audio/Scan.pm',
- PREREQ_PM => {},
+ PREREQ_PM => { 'Test::Warn' => 0 },
ABSTRACT_FROM => 'lib/Audio/Scan.pm',
AUTHOR => 'Andy Grundman <andy at slimdevices.com>',
INC => join(' ', @INC),
Modified: branches/upstream/libaudio-scan-perl/current/lib/Audio/Scan.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/lib/Audio/Scan.pm?rev=71699&op=diff
==============================================================================
--- branches/upstream/libaudio-scan-perl/current/lib/Audio/Scan.pm (original)
+++ branches/upstream/libaudio-scan-perl/current/lib/Audio/Scan.pm Sat Mar 19 12:34:22 2011
@@ -2,7 +2,7 @@
use strict;
-our $VERSION = '0.85';
+our $VERSION = '0.86';
require XSLoader;
XSLoader::load('Audio::Scan', $VERSION);
Modified: branches/upstream/libaudio-scan-perl/current/src/id3.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/src/id3.c?rev=71699&op=diff
==============================================================================
--- branches/upstream/libaudio-scan-perl/current/src/id3.c (original)
+++ branches/upstream/libaudio-scan-perl/current/src/id3.c Sat Mar 19 12:34:22 2011
@@ -273,12 +273,20 @@
// We don't care about the value of the extended flags or CRC, so just read the size and skip it
ehsize = buffer_get_int(id3->buf);
+
+ // ehsize may be invalid, tested with v2.3-ext-header-invalid.mp3
+ if (ehsize > id3->size_remain - 4) {
+ warn("Error: Invalid ID3 extended header size (%s)\n", id3->file);
+ ret = 0;
+ goto out;
+ }
+
+ DEBUG_TRACE(" Skipping extended header, size %d\n", ehsize);
+
if ( !_check_buf(id3->infile, id3->buf, ehsize, ID3_BLOCK_SIZE) ) {
ret = 0;
goto out;
}
-
- DEBUG_TRACE(" Skipping extended header, size %d\n", ehsize);
buffer_consume(id3->buf, ehsize);
id3->size_remain -= ehsize + 4;
Modified: branches/upstream/libaudio-scan-perl/current/src/mp3.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/src/mp3.c?rev=71699&op=diff
==============================================================================
--- branches/upstream/libaudio-scan-perl/current/src/mp3.c (original)
+++ branches/upstream/libaudio-scan-perl/current/src/mp3.c Sat Mar 19 12:34:22 2011
@@ -212,6 +212,10 @@
if (frame->padding)
frame->frame_size += frame->bytes_per_slot;
+
+ DEBUG_TRACE("Frame @%p: size=%d, %d samples, %dkbps %d/%d\n",
+ bptr, frame->frame_size, frame->samples_per_frame,
+ frame->bitrate_kbps, frame->samplerate, frame->channels);
return 0;
}
@@ -291,7 +295,7 @@
}
}
- //DEBUG_TRACE(" Frame %d: %dkbps\n", frame_count, frame.bitrate_kbps);
+ //DEBUG_TRACE(" Frame %d: %dkbps, %dkHz\n", frame_count, frame.bitrate_kbps, frame.samplerate);
if (frame.frame_size > buffer_len(mp3->buf)) {
// Partial frame in buffer
@@ -507,6 +511,7 @@
DEBUG_TRACE("Found VBRI tag\n");
mp3->xing_frame->vbri_tag = TRUE;
+ mp3->vbr = VBR;
if ( !_check_buf(mp3->infile, mp3->buf, 14, MP3_BLOCK_SIZE) ) {
return 0;
@@ -599,12 +604,12 @@
if ( !buffer_len(mp3->buf) ) {
if (mp3->audio_offset >= mp3->file_size - 4) {
// No audio frames in file
- PerlIO_printf(PerlIO_stderr(), "Unable to find any MP3 frames in file: %s\n", file);
+ warn("Unable to find any MP3 frames in file: %s\n", file);
goto out;
}
if ( !_check_buf(mp3->infile, mp3->buf, 4, MP3_BLOCK_SIZE) ) {
- PerlIO_printf(PerlIO_stderr(), "Unable to find any MP3 frames in file: %s\n", file);
+ warn("Unable to find any MP3 frames in file: %s\n", file);
goto out;
}
}
@@ -620,12 +625,44 @@
}
if ( !_decode_mp3_frame( buffer_ptr(mp3->buf), &frame ) ) {
- // Found a valid frame
- DEBUG_TRACE(" valid frame\n");
-
- found_first_frame = 1;
- }
- else {
+ struct mp3frame frame2, frame3;
+
+ // Need the whole frame to consider it valid
+ if ( _check_buf(mp3->infile, mp3->buf, frame.frame_size, MP3_BLOCK_SIZE)
+
+ // If we have enough data for the start of the next frame then
+ // it must also look valid and be consistent
+ && (
+ !_check_buf(mp3->infile, mp3->buf, frame.frame_size + 4, MP3_BLOCK_SIZE)
+ || (
+ !_decode_mp3_frame( buffer_ptr(mp3->buf) + frame.frame_size, &frame2 )
+ && frame.samplerate == frame2.samplerate
+ && frame.channels == frame2.channels
+ )
+ )
+
+ // If we have enough data for the start of the over-next frame then
+ // it must also look valid and be consistent
+ && (
+ !_check_buf(mp3->infile, mp3->buf, frame.frame_size + frame2.frame_size + 4, MP3_BLOCK_SIZE)
+ || (
+ !_decode_mp3_frame( buffer_ptr(mp3->buf) + frame.frame_size + frame2.frame_size, &frame3 )
+ && frame.samplerate == frame3.samplerate
+ && frame.channels == frame3.channels
+ )
+ )
+ ) {
+ // Found a valid frame
+ DEBUG_TRACE(" valid frame\n");
+
+ found_first_frame = 1;
+ }
+ else {
+ DEBUG_TRACE(" false sync\n");
+ }
+ }
+
+ if (!found_first_frame) {
// Not a valid frame, stray 0xFF
DEBUG_TRACE(" invalid frame\n");
@@ -635,7 +672,7 @@
}
if ( !found_first_frame ) {
- PerlIO_printf(PerlIO_stderr(), "Unable to find any MP3 frames in file (checked 4K): %s\n", file);
+ warn("Unable to find any MP3 frames in file (checked 4K): %s\n", file);
goto out;
}
@@ -809,10 +846,10 @@
my_hv_store( info, "lame_preset", newSVpv( presets_old[mp3->xing_frame->lame_preset], 0 ) );
}
}
-
- if (mp3->vbr == ABR || mp3->vbr == VBR) {
- my_hv_store( info, "vbr", newSViv(1) );
- }
+ }
+
+ if (mp3->vbr == ABR || mp3->vbr == VBR) {
+ my_hv_store( info, "vbr", newSViv(1) );
}
out:
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3.t?rev=71699&op=diff
==============================================================================
--- branches/upstream/libaudio-scan-perl/current/t/mp3.t (original)
+++ branches/upstream/libaudio-scan-perl/current/t/mp3.t Sat Mar 19 12:34:22 2011
@@ -2,7 +2,8 @@
use File::Spec::Functions;
use FindBin ();
-use Test::More tests => 378;
+use Test::More tests => 382;
+use Test::Warn;
use Audio::Scan;
@@ -123,20 +124,14 @@
# File with no audio frames, test is rejected properly
{
- # Hide stderr
- no strict 'subs';
- no warnings;
- open OLD_STDERR, '>&', STDERR;
- close STDERR;
-
- my $s = Audio::Scan->scan_info( _f('v2.3-no-audio-frames.mp3') );
-
- my $info = $s->{info};
-
- is( $info->{bitrate}, undef, 'File with no audio frames ok' );
-
- # Restore stderr
- open STDERR, '>&', OLD_STDERR;
+ my $s;
+ warning_like { $s = Audio::Scan->scan_info( _f('v2.3-no-audio-frames.mp3') ); }
+ [ qr/Unable to find any MP3 frames in file/ ],
+ 'File with no audio frames ok';
+
+ my $info = $s->{info};
+
+ is( $info->{bitrate}, undef, 'File with no audio frames has undef bitrate ok' );
}
# MPEG1 Xing mono file to test xing_offset works properly
@@ -1259,6 +1254,29 @@
is( $tags->{TPE1}, 'Herbert Eimert', 'v2.2 multiple null strings TP1 value ok' );
}
+# Bad first samplerate (stream from Radio Paradise)
+{
+ my $s = Audio::Scan->scan( _f('bad-first-samplerate.mp3') );
+ my $info = $s->{info};
+
+ is( $info->{samplerate}, 44100, 'Bad first samplerate detected as 44100 ok' );
+}
+
+# File with Xing tag but no LAME data, used to not include info->{vbr}
+{
+ my $s = Audio::Scan->scan( _f('v2.3-xing-no-lame.mp3') );
+ my $info = $s->{info};
+
+ is( $info->{vbr}, 1, 'Xing without LAME marked as VBR ok' );
+}
+
+# File with extended header bit set but no extended header
+{
+ warning_like { Audio::Scan->scan( _f('v2.3-ext-header-invalid.mp3') ); }
+ [ qr/Error: Invalid ID3 extended header size/ ],
+ 'v2.3 invalid extended header ok';
+}
+
sub _f {
return catfile( $FindBin::Bin, 'mp3', shift );
}
Added: branches/upstream/libaudio-scan-perl/current/t/mp3/bad-first-samplerate.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/bad-first-samplerate.mp3?rev=71699&op=file
==============================================================================
Binary file - no diff available.
Propchange: branches/upstream/libaudio-scan-perl/current/t/mp3/bad-first-samplerate.mp3
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2-v1.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2-v1.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-empty-tcon2.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-empty-tcon2.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-etco.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-etco.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Added: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-ext-header-invalid.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-ext-header-invalid.mp3?rev=71699&op=file
==============================================================================
Binary file - no diff available.
Propchange: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-ext-header-invalid.mp3
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-link-frame.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-link-frame.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-mcdi.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-mcdi.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon-numeric.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon-numeric.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon-rx-cr.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon-rx-cr.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon-text.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon-text.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-multiple-tcon.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-sylt.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-sylt.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Added: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-xing-no-lame.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-xing-no-lame.mp3?rev=71699&op=file
==============================================================================
Binary file - no diff available.
Propchange: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.3-xing-no-lame.mp3
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.4-corrupt-frame.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.4-corrupt-frame.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
Modified: branches/upstream/libaudio-scan-perl/current/t/mp3/v2.4-unsync.mp3
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libaudio-scan-perl/current/t/mp3/v2.4-unsync.mp3?rev=71699&op=diff
==============================================================================
Binary files - no diff available.
More information about the Pkg-perl-cvs-commits
mailing list