Let's say I have an audio file being decoded with ffmpeg. The source format is something like AAC where the audio is split into packets. When seeking to a particular time, it is clear that the time will not fall, most of the time, on the packet border but somewhere within the packet duration. Do I have to seek within packet myself or av_seek_frame does it all by itself and sets up decoding so that the next decoded frame should start at the position I've requested?
If I use the function av_seek_frame with the flag AVSEEK_FLAG_BACKWARD, I assume that the next packet returned by av_read_frame will be the packet containing the time position I am seeking to. Is that right?
If I decode this packet with avcodec_decode_audio4, will the frame returned contain the audio data at the start time of the packet begining or from the time I've passed to av_seek_frame? In the latter case how can I find out the frame/packet timestamp so as to estimate the number of samples to skip in the decoded frame? The PTS after seek is zero and DTS looks useless either.
Is it possible to seek with precision to a particular time using ffmpeg?