Hi, I have this code to decode ogg data:<div><br></div><div><div> unsigned long PSS_OggStream::DecodeOggVorbis(OggVorbis_File *psOggVorbisFile, char *pDecodeBuffer, unsigned long ulBufferSize, unsigned long ulChannels)</div>
<div> {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> int current_section;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> long lDecodeSize;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> unsigned long ulSamples;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> short *pSamples;</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span> unsigned long ulBytesDone = 0;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> while (true)</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> {</div><div>#ifdef WIN32</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>lDecodeSize = ov_read(psOggVorbisFile, pDecodeBuffer + ulBytesDone, ulBufferSize - ulBytesDone, 0, 2, 1, &current_section);</div>
<div>#elif MACOSX // El cuarto parametro es lo del big endian de los cojones</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>lDecodeSize = ov_read(psOggVorbisFile, pDecodeBuffer + ulBytesDone, ulBufferSize - ulBytesDone, 1, 2, 1, &current_section);</div>
<div>#endif</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> if (lDecodeSize > 0)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> ulBytesDone += lDecodeSize;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span> if (ulBytesDone >= ulBufferSize)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> break;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> }</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> else</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> break;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> }</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> }</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span> return ulBytesDone;</div>
<div> }</div></div><div><br></div><div>This works fine on Windows, but on MacOSX, after ov_read call, pDecodeBuffer is full of 128, -128, 0... I mean, non sense data.</div><div><br></div><div>Any idea???</div><div><br></div>
<div>Thanks!</div>