<div dir="ltr"><div class="gmail_quote">
<div lang="EN-US" vlink="purple" link="blue">
<div>
<p>I&#39;m doing some work where narrowband speex audio capture is happening and being written to file in the ogg container format. Later retrieval for reading will occur too.</p>
<p>&nbsp;</p>
<p>I&#39;ve been using liboggz to do the file reading and writing and have obviously come across some things I don&#39;t seem to follow or have just got wrong.</p>
<p>&nbsp;</p>
<p>I can happily generate an ogg file using liboggz with some test data.</p>
<p>I write the headers then pump a couple of 600 byte test data packets into it and liboggz does the magic of breaking the 600 byte packet into 3 page segments. Then I write an eos page to finish up.</p>
<p>&nbsp;</p>
<p>I can then read this file back and rewrite it to another file and get exactly the same result – which is great (result is test_with_data.ogg file attached).</p>
<p>&nbsp;</p>
<p>I then attempted to read back a sample spx file I obtained from the web (attached female_scrub.spx) file.</p>
<p>I can read it back happily but I end up with a resultant file twice the size as the read_packet callback gets called on each page segment being read, and I am writing each of these back to the resultant file with a write feed and they all end up on their own page (no matter how I set the flush flags).</p>

<p>&nbsp;</p>
<p>The part I don't understand is why the read_packet callback only gets invoked on my test file when the full 600 bytes have been read, noting that it is written to file as 3 segments on the page (lengths, FF, FF and 5A I think it was). But when the sample spx file gets read, the read_packet callback gets called for each segment, which by the way are all of size 20 bytes, and returns only 20 bytes at a time.</p>

<p>&nbsp;</p>
<p>Ideas?</p>
<p>&nbsp;</p>
<p>Please forgive any obvious stupidity as I am a rank amateur with all this stuff ;-)</p>
<p>&nbsp;</p>
<p>Thanks,</p>
<p>Warwick Baker.</p></div></div></div><br></div>