index 8962f5046fe7efcbbd17aaefaad982917c0e56f9..a2787be1a540abd3a6e8a02df71ff481d00af781 100644 (file)
{$IF DEFINED(WINDOWS)}
{$IFDEF VORBIS_WINDOZE_STATIC}
{$IF DEFINED(WINDOWS)}
{$IFDEF VORBIS_WINDOZE_STATIC}
- {$LINKLIB libvorbis.a}
{$LINKLIB libvorbisfile.a}
{$LINKLIB libvorbisfile.a}
+ {$LINKLIB libvorbis.a}
{$ELSE}
{$DEFINE OGG_DYNAMIC}
const vorbislib = 'libvorbis-0.dll';
{$ELSE}
{$DEFINE OGG_DYNAMIC}
const vorbislib = 'libvorbis-0.dll';
implementation
implementation
+//k8: sighs. you HAVE to have a 16-byte aligned buffer, otherwise
+// 32-bit SSE2-enabled builds *WILL* fail.
+// it means that you *CANNOT* simply use a passed pointer.
+// therefore this fuckery with internal buffer (because
+// i am not sure that FPC will align stack variables
+// correctly).
function ov_read_ext(var vf: OggVorbis_File; buffer: pointer; length: cint; bigendianp: cbool; word: cint; sgned: cbool): clong;
var
ofs: cint;
Num: cint;
Res: cint;
function ov_read_ext(var vf: OggVorbis_File; buffer: pointer; length: cint; bigendianp: cbool; word: cint; sgned: cbool): clong;
var
ofs: cint;
Num: cint;
Res: cint;
+ buf: array[0..3000] of Byte;
+ rd: cint;
+ bptr: ^Byte;
begin
// check blocksize here!
{if length mod 4 <> 0 then
begin
// check blocksize here!
{if length mod 4 <> 0 then
ofs := 0;
num := length;
ofs := 0;
num := length;
+ bptr := @buf;
+ while ((PtrUInt(bptr) and $0f) <> 0) do Inc(bptr);
+
while num > 0 do
begin
while num > 0 do
begin
- res := ov_read(vf, buffer + ofs, num, bigendianp, word, sgned, nil);
+ rd := num;
+ if (rd > 2048) then rd := 2048;
+ res := ov_read(vf, bptr, rd, bigendianp, word, sgned, nil);
+ //res := ov_read(vf, buffer + ofs, num, bigendianp, word, sgned, nil);
if res < 0 then
Exit(res);
if res = 0 then
Break;
if res < 0 then
Exit(res);
if res = 0 then
Break;
- ofs := ofs + res;
- num := num - res;
+ //ofs := ofs + res;
+ //num := num - res;
+ Move(bptr^, buffer^, res);
+ buffer := buffer+res;
+ ofs := ofs+res;
+ num := num-res;
end;
Result := ofs;
end;
Result := ofs;