Vince Tagle
2008-Jan-26 16:46 UTC
[Speex-dev] How do I seek back to the beginning of a speex file?
Okay, I feel really stupid here but I've been unable to figure out how to easily seek within a speex file so that playback starts from the beginning. I've scoured the mailing lists for solutions and the best that I could come up with was to see what libvorbis was doing when it performed a seek inside of an ogg stream but it looked rather complicated for what I want to do. Does anyone happen to have any sample code that I could look at? Vince Tagle <vtagle@gmail.com>
Conrad Parker
2008-Feb-03 20:32 UTC
[Speex-dev] How do I seek back to the beginning of a speex file?
On 27/01/2008, Vince Tagle <vtagle@gmail.com> wrote:> Okay, I feel really stupid here but I've been unable to figure out > how to easily seek within a speex file so that playback starts from > the beginning. I've scoured the mailing lists for solutions and the > best that I could come up with was to see what libvorbis was doing > when it performed a seek inside of an ogg stream but it looked rather > complicated for what I want to do. Does anyone happen to have any > sample code that I could look at?Hi, you just need to seek to the beginning of the file and skip over the header packets at the start of the file. Usually there are 2 header packets. There is a field in the first header which tells you if there are more. That field is called extra_headers. The total number of headers in a speex file is (2 + extra_headers). The location of the extra_headers field is shown here: http://wiki.xiph.org/index.php/OggSpeex cheers, Conrad.