[asterisk-dev] f->offset - How should it be used ?

Jacob Tinning tinning at sifira.dk
Thu Apr 20 06:51:00 MST 2006


On Thu, 20 Apr 2006, Kevin P. Fleming wrote:

> > I don't quite undestand. If I want to read a frame and whatever gave me
> > the frame, has placed something ahead of the actual data, I thought I
> > should start from f->data + f->offset and read f->datalen bytes.

> In any case: f->offset tells you how many bytes of space have been
> allocated to the frame _before_ the point that f->data points to.
>   If the frame was created to hold a 20ms sample of ulaw data, with
> the standard AST_FRIENDLY_OFFSET, then the _true_ data buffer will be 160 +
> AST_FRIENDLY_OFFSET bytes, f->data will point to the beginning of that
> buffer + AST_FRIENDLY_OFFSET, f->datalen will be 160 and f->offset will
> be AST_FRIENDLY_OFFSET.

Aha. Now I get it - Thank you.

Mvh. Jacob
-- 



More information about the asterisk-dev mailing list