Browse Source

fixed brokend ogg decoding in 0.3.1

git-svn-id: http://zengl.googlecode.com/svn/branches/0.3.x@1912 6573c10b-8653-0410-9706-d32479e959fb
dr.andru 13 years ago
parent
commit
0652d81154
1 changed files with 8 additions and 7 deletions
  1. 8 7
      src/zgl_sound_ogg.pas

+ 8 - 7
src/zgl_sound_ogg.pas

@@ -229,7 +229,11 @@ begin
   if not vorbisInit Then exit;
   if not vorbisInit Then exit;
 
 
   FillChar( _vc, SizeOf( _vc ), 0 );
   FillChar( _vc, SizeOf( _vc ), 0 );
-  if ov_open_callbacks( nil, _vf, Pointer( @PByteArray( Memory.Memory )[ Memory.Position ] ), Memory.Size - Memory.Position, _vc ) >= 0 Then
+  _vc.read  := @ogg_ReadMem;
+  _vc.seek  := @ogg_SeekMem;
+  _vc.close := @ogg_CloseMem;
+  _vc.tell  := @ogg_GetPosMem;
+  if ov_open_callbacks( @Memory.Memory, _vf, Pointer( @PByteArray( Memory.Memory )[ Memory.Position ] ), Memory.Size - Memory.Position, _vc ) >= 0 Then
     begin
     begin
       _vi       := ov_info( _vf, -1 );
       _vi       := ov_info( _vf, -1 );
       Frequency := _vi.rate;
       Frequency := _vi.rate;
@@ -239,12 +243,9 @@ begin
       end;
       end;
 
 
       Size := ov_pcm_total( _vf, -1 ) * 2 * _vi.channels;
       Size := ov_pcm_total( _vf, -1 ) * 2 * _vi.channels;
-      if ov_open_callbacks( nil, _vf, Pointer( @PByteArray( Memory.Memory )[ Memory.Position ] ), Memory.Size - Memory.Position, _vc ) >= 0 Then
-        begin
-          GetMem( Data, Size );
-          decoderRead( _vf, Data, Size, _end );
-          ov_clear( _vf );
-        end;
+      GetMem( Data, Size );
+      decoderRead( _vf, Data, Size, _end );
+      ov_clear( _vf );
     end;
     end;
 end;
 end;