Re: Skipping of sample in ogg writing
Conrad Parker <[email protected]>
| Newsgroups | gmane.comp.multimedia.ogg.vorbis.devel,gmane.comp.multimedia.ogg.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Charan, there was no reply to this email. Do you still see this behaviour from your program, or is it fixed now? Conrad. On 12 December 2009 13:09, charan <[email protected]> wrote: > Hi All, > I m having a strange problem with the Ogg-Vorbis writting code. The code > I m using to write is skipping some samples at the end of the file. For > example I m converting the 10000 sample .wav file ( 441000 sample rate , > 16 bit depth , stereo ) to ogg format. But while reading the ogg file I > only find 5824 samples in the ogg file. Can any one suggest what could > be wrong in the code. Is there anything like bug in ogg itself or am I > missing something critical step. > > Here is the code for writing the ogg file. > > //============================================================================== > > bool write (const int** samplesToWrite, int numSamples) > { > if (numSamples > 0) > { > float** const vorbisBuffer = vorbis_analysis_buffer (&vd, > numSamples); > for (int i = numChannels; --i >= 0;) > > { > > float* const dst = vorbisBuffer[i]; > > const int* const src = samplesToWrite [i]; > > if (src != 0 && dst != 0) > > { > > for (int j = 0; j < numSamples; ++j) > > dst[j] = (float) src[j]; > > } > > } > > } > > > vorbis_analysis_wrote (&vd, numSamples); > > > > while (vorbis_analysis_blockout (&vd, &vb) == 1) > > { > > vorbis_analysis (&vb, 0); > > vorbis_bitrate_addblock (&vb); > > > > while (vorbis_bitrate_flushpacket (&vd, &op)) > > { > > ogg_stream_packetin (&os, &op); > > > > for (;;) > > { > > if (ogg_stream_pageout (&os, &og) == 0) > > break; > > > > mywrite (og.header, og.header_len); > > mywrite (og.body, og.body_len); > > if (ogg_page_eos (&og)) > > break; > > } > > } > > } > > return true; > > } > > //============================================================================== > > > Thanks and Regards, > Charan D'Souza > > _______________________________________________ > Vorbis-dev mailing list > [email protected] > http://lists.xiph.org/mailman/listinfo/vorbis-dev > >