I'm working on an application where I need to record the current playing position and return to it later. and I need this to be done the most efficient way, so I used ov_raw_tell() and ov_raw_seek() because the documentation says they are the best when speed is a concern. but the problem is that sometimes ov_raw_tell returns the same value before and after calling ov_read; here's an example: prevPos = ov_raw_tell(&vf); const long ret = ov_read(&vf, temp_buffer, 4096, 0, bytesPerSample, 1, ¤t_section); currentPos = ov_raw_tell(&vf); now, if I check, I'll find that prevPos == currentPos, how could this be true?? I tried the other seeking methods, which are time and pcm, and none of the did the same, prevPos is never equal to currentPos. so how can I solve this? thanks for your time and effort. ____________________________________________________ Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs
On 8/16/05, Diaa Sami <diaasami@yahoo.com> wrote:> I'm working on an application where I need to record > the current playing position and return to it later. > and I need this to be done the most efficient way, so > I used ov_raw_tell() and ov_raw_seek() because the > documentation says they are the best when speed is a > concern. > but the problem is that sometimes ov_raw_tell returns > the same value before and after calling ov_read; > here's an example: > > prevPos = ov_raw_tell(&vf); > const long ret = ov_read(&vf, temp_buffer, 4096, 0, > bytesPerSample, 1, ¤t_section); > currentPos = ov_raw_tell(&vf);Internally, libogg and libvorbis (used by vorbisfile) do some buffering. So a read can sometimes be satisfied entirely from those buffers - and in that case, the vorbisfile stream cursor doesn't need to move. It only gets updated when vorbisfile actually needs to read fresh data from the underlying data source (file or otherwise). As the comment on ov_raw_tell() says: " Note that seek followed by tell will likely not give the set offset due to caching" - if you need accurate seeking, you can't use the raw functions. How serious a concern is performance? The time-based seeking functions (or the pcm offset ones) are accurate and generally not _that_ slow. Mike