{Real file} unit fmt_Real; {$include compilers.inc} interface uses wat_api; function ReadReal(var Info:tSongInfo):boolean; cdecl; implementation uses windows,common,io,tags,srv_format; const blk_RMF = $464D522E; // '.RMF' blkPROP = $504F5250; // 'PROP' blkCONT = $544E4F43; // 'CONT' - content blkMDPR = $5250444D; // 'MDPR' blkDATA = $41544144; // 'DATA' blkINDX = $58444E49; // 'INDX' blkRMMD = $444D4D52; // 'RMMD' - comment block blkRMJD = $444A4D52; // 'RMJD' blkRMJE = $454A4D52; // 'RMJE' type tChunk = packed record ID:dword; len:dword; //with Chunk; end; type pPROP = ^tPROP; tPROP = packed record w1 :word; l1,l2 :dword; l3,l4 :dword; un1 :dword; // or 2+2 filetotal :dword; // msec l5 :dword; InfoDataSize:dword; Infosize :dword; w2 :word; // always 2 ? w :word; // chunks+1? end; procedure SkipStr(var p:PAnsiChar;alen:integer); var llen:integer; begin if alen=2 then llen:=(ord(p[0]) shl 8)+ord(p[1]) else llen:=ord(p[0]); inc(p,alen); // if llen>0 then inc(p,llen); end; function ReadStr(var p:PAnsiChar;alen:integer):PAnsiChar; var llen:integer; begin if alen=2 then llen:=(ord(p[0]) shl 8)+ord(p[1]) else llen:=ord(p[0]); inc(p,alen); if llen>0 then begin mGetMem(result,llen+1); move(p^,result^,llen); result[llen]:=#0; inc(p,llen); end else result:=nil; end; function GetWord(var p:PAnsiChar):word; begin result:=(ord(p[0]) shl 8)+ord(p[1]); inc(p,2); end; function GetLong(var p:PAnsiChar):dword; begin result:=(ord(p[0]) shl 24)+(ord(p[1]) shl 16)+(ord(p[2]) shl 8)+ord(p[3]); inc(p,4); end; function ReadReal(var Info:tSongInfo):boolean; cdecl; var f:THANDLE; chunk:tChunk; p,buf:PAnsiChar; ls:PAnsiChar; ver:integer; fsize:cardinal; begin result:=false; f:=Reset(Info.mfile); if f=THANDLE(INVALID_HANDLE_VALUE) then exit; fsize:=FileSize(f); while FilePos(f)SizeOf(chunk) then // channels-1: ofs=$0A break; Skip(f,chunk.len-SizeOf(chunk)); end; end; ReadID3v1(f,Info); CloseHandle(f); result:=true; end; var LocalFormatLinkRM, LocalFormatLinkRA, LocalFormatLinkRAM:twFormat; procedure InitLink; begin LocalFormatLinkRM.Next:=FormatLink; LocalFormatLinkRM.This.proc :=@ReadReal; LocalFormatLinkRM.This.ext :='RM'; LocalFormatLinkRM.This.flags:=WAT_OPT_VIDEO; FormatLink:=@LocalFormatLinkRM; LocalFormatLinkRA.Next:=FormatLink; LocalFormatLinkRA.This.proc :=@ReadReal; LocalFormatLinkRA.This.ext :='RA'; LocalFormatLinkRA.This.flags:=WAT_OPT_VIDEO; FormatLink:=@LocalFormatLinkRA; LocalFormatLinkRAM.Next:=FormatLink; LocalFormatLinkRAM.This.proc :=@ReadReal; LocalFormatLinkRAM.This.ext :='RAM'; LocalFormatLinkRAM.This.flags:=WAT_OPT_VIDEO; FormatLink:=@LocalFormatLinkRAM; end; initialization InitLink; end.