Steve Russell
2005-Nov-01 12:41 UTC
[Vorbis-dev] predictability of buffer size for decoding
I am wondering if buffer size for my decoding to pcm can be predicted dependably as follows. So far, the one problem I have had is when I have played a file of only about 5k. The buffer was a little less than 10% too small. I "solved" that by padding the result with an extra 20 percent. However, I have been told that I should be able to rely on the value of ov_pcm_total. char* m_pDataVorbis; . . . OggVorbis_File vf; . . . vorbis_info* vi = ov_info(&vf,-1); . . . int pcmTotal = ov_pcm_total(&vf, -1); m_pDataVorbis = new char[pcmTotal * vi->channels * 2]; -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.xiph.org/pipermail/vorbis-dev/attachments/20051101/33d6782e/attachment.html
Michael Smith
2005-Nov-01 13:59 UTC
[Vorbis-dev] predictability of buffer size for decoding
On 11/1/05, Steve Russell <srussell@innernet.net> wrote:> > I am wondering if buffer size for my decoding to pcm can be predicted > dependably as follows. So far, the one problem I have had is when I have > played a file of only about 5k. The buffer was a little less than 10% too > small. I "solved" that by padding the result with an extra 20 percent. > However, I have been told that I should be able to rely on the value of > ov_pcm_total.Yes, ov_pcm_total will return sample-accurate accurate values for a valid ogg stream. It's possible to create files that will confuse it into returning the wrong values, but those would be rare (and invalid), so I wouldn't worry about them. Just check that you don't overrun the buffer you DID allocate. Mike
Steve Russell
2005-Nov-08 10:53 UTC
[Vorbis-dev] predictability of buffer size for decoding
----- Original Message ----- From: "Michael Smith" <msmith@xiph.org> I don't know what might be going wrong. Can you run the vorbisfile_example program on this file on your system (from vorbis/examples/ in the libvorbis source code)? Run like "./vorbisfile_example < input.ogg > output.raw", it should print out some info about the file - including the number of samples according to vorbisfile, and then write that many samples (as 16 bit data) to the output file. This works fine on my system. Mike --------- Shortly after the vorbisfile_example.exe command prompt window opens, I get this: NTDLL! 7c918fea() NTDLL! 7c90104b() fseek(_iobuf * 0x00422a30 __iob, long 0, int 1) line 103 + 9 bytes VORBISFILE_D! 10002937() VORBISFILE_D! 1000141d() VORBISFILE_D! 10001399() VORBISFILE_D! 100028ca() main() line 49 + 21 bytes which leads me to here: if(ov_open(stdin, &vf, NULL, 0) < 0) { Any thought on how to proceed?