[FFmpeg-devel] [PATCH] avformat: add some documentation about seeking

Michael Niedermayer michaelni at gmx.at
Wed May 14 06:12:28 CEST 2014


On Tue, May 13, 2014 at 06:20:26PM -0700, Aman Gupta wrote:
> Signed-off-by: Aman Gupta <ffmpeg at tmm1.net>
> ---
>  libavformat/avformat.h | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index 7d2db6a..f4b6ba0 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -169,6 +169,27 @@
>   * longer needed.
>   *
>   * @section lavf_decoding_seek Seeking
> + * @{
> + * Instead of reading each frame successively with av_read_frame(), you may seek
> + * around the stream with av_seek_frame() and read frames at specific locations.
> + * By default, seeking will jump forward to the closest keyframe near the given
> + * timestamp in the given stream. Use AVSEEK_FLAG_ANY to seek to non-keyframes,
> + * or AVSEEK_FLAG_BACKWARD to jump backwards in the stream.
> + *
> + * Here's a simple example that quickly processes all keyframes by seeking over
> + * intermediate frames:
> + * @code
> + * while (av_read_frame(ic, &pkt) == 0) {

larger or equal to 0 is better, all errors should be negative
everything else shouldnt be an error


> + *     if (pkt.flags & AV_PKT_FLAG_KEY)
> + *         process(pkt);
> + *
> + *     // seek forward to the next keyframe in this stream
> + *     av_seek_frame(ic, pkt.stream_index, pkt.dts, 0);

wont that seek to the same frame again ?

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140514/8f3abcd6/attachment.asc>


More information about the ffmpeg-devel mailing list