Audio-Scan

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

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-zero-length-txxx.mp3
t/mp3/v2.3.mp3
t/mp3/v2.4-ape-invalid-key.mp3
t/mp3/v2.4-ape.mp3
t/mp3/v2.4-apic-jpg.mp3
t/mp3/v2.4-apic-multiple.mp3
t/mp3/v2.4-apic-png.mp3
t/mp3/v2.4-apic-unsync.mp3
t/mp3/v2.4-compressed-frame.mp3
t/mp3/v2.4-corrupt-frame.mp3
t/mp3/v2.4-empty-text.mp3
t/mp3/v2.4-encrypted-frame.mp3
t/mp3/v2.4-ext-header-invalid-too-short.mp3
t/mp3/v2.4-ext-header-invalid.mp3
t/mp3/v2.4-ext-header.mp3
t/mp3/v2.4-geob-multiple.mp3
t/mp3/v2.4-geob.mp3

t/mp3.t  view on Meta::CPAN


    my $s = Audio::Scan->scan( _f('v2.4-apic-jpg.mp3') );

    my $tags = $s->{tags};

    is( length( $tags->{APIC}->[3] ), 2103, 'ID3v2.4 APIC JPEG picture with AUDIO_SCAN_NO_ARTWORK=0 ok' );
}

# ID3v2.4 with PNG APIC
{
    my $s = Audio::Scan->scan( _f('v2.4-apic-png.mp3') );

    my $tags = $s->{tags};

    is( ref $tags->{APIC}, 'ARRAY', 'ID3v2.4 APIC PNG frame is array' );
    is( $tags->{APIC}->[0], 'image/png', 'ID3v2.4 APIC PNG mime type ok' );
    is( $tags->{APIC}->[1], 3, 'ID3v2.4 APIC PNG picture type ok' );
    is( $tags->{APIC}->[2], 'This is the front cover description', 'ID3v2.4 APIC PNG description ok' );
    is( length( $tags->{APIC}->[3] ), 58618, 'ID3v2.4 APIC PNG picture length ok' );
    is( unpack( 'H*', substr( $tags->{APIC}->[3], 0, 4 ) ), '89504e47', 'ID3v2.4 APIC PNG picture data ok ');
}

# ID3v2.4 with multiple APIC
{
    my $s = Audio::Scan->scan( _f('v2.4-apic-multiple.mp3') );

    my $tags = $s->{tags};

    my $png = $tags->{APIC}->[0];
    my $jpg = $tags->{APIC}->[1];

    is( ref $png, 'ARRAY', 'ID3v2.4 APIC PNG frame is array' );
    is( $png->[0], 'image/png', 'ID3v2.4 APIC PNG mime type ok' );
    is( $png->[1], 3, 'ID3v2.4 APIC PNG picture type ok' );
    is( $png->[2], 'This is the front cover description', 'ID3v2.4 APIC PNG description ok' );
    is( length( $png->[3] ), 58618, 'ID3v2.4 APIC PNG picture length ok' );
    is( unpack( 'H*', substr( $png->[3], 0, 4 ) ), '89504e47', 'ID3v2.4 APIC PNG picture data ok ');

    is( ref $jpg, 'ARRAY', 'ID3v2.4 APIC JPEG frame is array' );
    is( $jpg->[0], 'image/jpeg', 'ID3v2.4 APIC JPEG mime type ok' );
    is( $jpg->[1], 4, 'ID3v2.4 APIC JPEG picture type ok' );
    is( $jpg->[2], 'This is the back cover description', 'ID3v2.4 APIC JPEG description ok' );
    is( length( $jpg->[3] ), 2103, 'ID3v2.4 APIC JPEG picture length ok' );
    is( unpack( 'H*', substr( $jpg->[3], 0, 4 ) ), 'ffd8ffe0', 'ID3v2.4 APIC JPEG picture data ok ');
}

# ID3v2.4 with GEOB

t/opus.t  view on Meta::CPAN

    is($info->{input_samplerate}, 44100, 'Input Sample Rate ok');
    is($info->{song_length_ms}, 100, 'Song length ok');
    is($info->{audio_offset}, 204698, 'Audio offset ok');
    is($info->{audio_size}, 908, 'Audio size ok');
    is($info->{audio_md5}, 'c050e1584b6284c230708b8b0fb2f31e', 'Audio MD5 ok');

    my $tags = $s->{tags};
    is($tags->{ALLPICTURES}[0]{image_data}, 152291, 'Image size ok');
    is($tags->{ALLPICTURES}[0]{width}, 500, 'Image width ok');
    is($tags->{ALLPICTURES}[0]{height}, 500, 'Image height ok');
    is($tags->{ALLPICTURES}[0]{mime_type}, 'image/png', 'Image type ok');
}

{
    my $offset = Audio::Scan->find_frame( _f('3min_noise.opus'), 0 );

    is( $offset, 841, 'Find frame in first page ok' );
}

{
    for ( my $ms = 68000; $ms <= 70000; $ms += 100 ) {



( run in 1.590 second using v1.01-cache-2.11-cpan-788537b7465 )