PageRenderTime 40ms CodeModel.GetById 30ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/SDL/CD.pm

http://github.com/PerlGameDev/SDL
Perl | 46 lines | 36 code | 9 blank | 1 comment | 0 complexity | e78d9d76b5eee290c0d4d975808ef8a3 MD5 | raw file
 1package SDL::CD;
 2use strict;
 3use warnings;
 4use vars qw(@ISA @EXPORT @EXPORT_OK);
 5require Exporter;
 6require DynaLoader;
 7use SDL::Constants ':SDL::CDROM';
 8our @ISA = qw(Exporter DynaLoader);
 9
10use SDL::Internal::Loader;
11internal_load_dlls(__PACKAGE__);
12
13our $VERSION = 2.548;
14
15bootstrap SDL::CD;
16
17use base 'Exporter';
18our @EXPORT      = @{ $SDL::Constants::EXPORT_TAGS{'SDL::CDROM'} };
19our %EXPORT_TAGS = (
20	all        => \@EXPORT,
21	format     => $SDL::Constants::EXPORT_TAGS{'SDL::CDROM/default'},
22	status     => $SDL::Constants::EXPORT_TAGS{'SDL::CDROM/status'},
23	track_type => $SDL::Constants::EXPORT_TAGS{'SDL::CDROM/track_type'}
24);
25
26# Conversion functions from frames to Minute/Second/Frames and vice versa
27sub FRAMES_TO_MSF {
28	my $frames = shift;
29	my $F      = $frames % CD_FPS;
30	$frames /= CD_FPS;
31	my $S = $frames % 60;
32	$frames /= 60;
33	my $M = $frames;
34
35	return ( $M, $S, $F );
36}
37
38sub MSF_TO_FRAMES {
39	my $M = shift;
40	my $S = shift;
41	my $F = shift;
42
43	return ( $M * 60 * CD_FPS + $S * CD_FPS + $F );
44}
45
461;