[Speex-dev] How do I seek back to the beginning of a speex file?

Conrad Parker conrad at metadecks.org
Sun Feb 3 20:32:20 PST 2008

On 27/01/2008, Vince Tagle <vtagle at 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?


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 +

The location of the extra_headers field is shown here:




More information about the Speex-dev mailing list