Tamás Zahola
2016-Jan-13 09:33 UTC
[flac-dev] FLAC__stream_decoder_seek_absolute calling write callback
Hello, The API documentation [1] `FLAC__stream_decoder_seek_absolute` says: "Flush the input and seek to an absolute sample. Decoding will resume at the given sample. Note that because of this, the next write callback may contain a partial block." I expected that subsequent `process_single` calls would return data starting exactly from the sample I've seeked to. To my surprise hovewer it seems that `seek_absolute` implicitly processes the frame which contains the requested sample (the write callback receives only the tail of the frame from the given sample). Since the documentation haven't mentioned seek_absolute triggering the write callback, my question would be whether this behaviour is guaranteed or not? Is seek_absolute guaranteed to implicitly process the frame containing the requested sample? (in other worfs: a process_single call after a successful seek_absolute call always processes the frame _after_ the one contaning the requested sample) Best regards, Tamas Zahola <tzahola at gmail.com> [1] https://xiph.org/flac/api/group__flac__stream__decoder.html#ga6a2eb6072b9fafefc3f80f1959805ccb
Erik de Castro Lopo
2016-Jan-19 18:58 UTC
[flac-dev] FLAC__stream_decoder_seek_absolute calling write callback
Tam?s Zahola wrote:> Hello, > > The API documentation [1] `FLAC__stream_decoder_seek_absolute` says: > > "Flush the input and seek to an absolute sample. Decoding will resume > at the given sample. Note that because of this, the next write > callback may contain a partial block." > > I expected that subsequent `process_single` calls would return data > starting exactly from the sample I've seeked to. To my surprise > hovewer it seems that `seek_absolute` implicitly processes the frame > which contains the requested sample (the write callback receives only > the tail of the frame from the given sample). > > Since the documentation haven't mentioned seek_absolute triggering the > write callback, my question would be whether this behaviour is > guaranteed or not? Is seek_absolute guaranteed to implicitly process > the frame containing the requested sample? (in other worfs: a > process_single call after a successful seek_absolute call always > processes the frame _after_ the one contaning the requested sample)Hi, Sorry for the tardy response to this. I've now read your email a number of times and I'm still not sure what needs to be done. Maybe it would help if you could explain the following: * What is actually happening. * What you expect to happen and how that differs from what is happening. * Propose a fix. Once thing that may actually help is a small chunk of code demonstrating the problem. Cheers, Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/