File: decoder.t

package info (click to toggle)
libaudio-flac-decoder-perl 0.3%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 364 kB
  • sloc: ansic: 481; perl: 58; sh: 51; makefile: 3
file content (43 lines) | stat: -rw-r--r-- 856 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/perl -w

use Test;

BEGIN { plan tests => 15 };

use Audio::FLAC::Decoder;
use Fcntl qw(:seek);

ok(1);

ok(my $flac = Audio::FLAC::Decoder->open("t/test.flac"));
my $buffer;
ok($flac->sysread($buffer));
ok($flac->bits_per_sample == 16);
ok($flac->channels == 1);
ok($flac->sample_rate == 8000);

#ok($flac->raw_total);
#ok($flac->pcm_total);
#ok($flac->time_total);

ok($flac->raw_tell(), 10800);

#ok($flac->time_tell);

ok($flac->raw_seek(0, SEEK_SET), 0);
ok($flac->raw_seek(32768, SEEK_SET), 0);
ok($flac->raw_tell(), 32768);

# seek 5 seconds in.
# Windows seems to be off by 1 byte. Why?
if ($^O !~ /win32/i) {
	ok($flac->time_seek(4), 10800);

	# XXX - should check time_tell
	ok($flac->raw_tell(), 142501);
}

# test opening from a glob
ok(open FH, "t/test.flac" or die $!);
ok($flac = Audio::FLAC::Decoder->open(\*FH));
ok(close(FH));