blob: 73d58b68ff210aa6e52b0a3c22d792b55fa3a96c (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
{OFR file}
unit fmt_OFR;
{$include compilers.inc}
interface
uses wat_api;
function ReadOFR(var Info:tSongInfo):boolean; cdecl;
implementation
uses windows,common,io,tags,srv_format;
type
tMain = packed record
ID :dword; // 'OFR '
Size :dword; //15
SamplesLo :dword;
SamplesHi :word;
SampleType :byte;
ChannelsMap:byte;
Samplerate :dword;
Encoder :word;
Compression:byte;
end;
function ReadOFR(var Info:tSongInfo):boolean; cdecl;
var
f:THANDLE;
Hdr:tMain;
Samples:int64;
begin
result:=false;
f:=Reset(Info.mfile);
if f=THANDLE(INVALID_HANDLE_VALUE) then
exit;
ReadID3v2(f,Info);
BlockRead(f,Hdr,SizeOf(Hdr));
Samples:=Hdr.SamplesLo+Hdr.SamplesHi*$10000;
Info.channels:=Hdr.ChannelsMap+1;
Info.khz :=Hdr.Samplerate div 1000;
Info.total :=(Samples div Info.channels)*Info.khz;
ReadAPEv2(f,Info);
ReadID3v1(f,Info);
CloseHandle(f);
result:=true;
end;
var
LocalFormatLinkOFR,
LocalFormatLinkOFS:twFormat;
procedure InitLink;
begin
LocalFormatLinkOFR.Next:=FormatLink;
LocalFormatLinkOFR.This.proc :=@ReadOFR;
LocalFormatLinkOFR.This.ext :='OFR';
LocalFormatLinkOFR.This.flags:=0;
FormatLink:=@LocalFormatLinkOFR;
LocalFormatLinkOFS.Next:=FormatLink;
LocalFormatLinkOFS.This.proc :=@ReadOFR;
LocalFormatLinkOFS.This.ext :='OFS';
LocalFormatLinkOFS.This.flags:=0;
FormatLink:=@LocalFormatLinkOFS;
end;
initialization
InitLink;
end.
|