summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 987c4a8)
raw | patch | inline | side by side (parent: 987c4a8)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 20 Sep 2019 03:26:25 +0000 (06:26 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Fri, 20 Sep 2019 03:26:49 +0000 (06:26 +0300) |
src/lib/vorbis/vorbis.pas | patch | blob | history |
index a4a21b5dc86e5b195f987a55a8340d3298895f40..81b026f7c348420a27b2fb08ee333deda42fd505 100644 (file)
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;
+ buf: array[0..3000] of Byte;
+ rd: cint;
+ bptr: ^Byte;
begin
// check blocksize here!
{if length mod 4 <> 0 then
ofs := 0;
num := length;
+ bptr := @buf;
+ while ((LongWord(bptr) and $0f) <> 0) do Inc(bptr);
+
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;
- 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;