[FFmpeg-devel] [PATCH] avformat: add some documentation about seeking
Aman Gupta
ffmpeg at tmm1.net
Wed May 14 03:20:26 CEST 2014
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) {
+ * 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);
+ * }
+ * @endcode
+ *
+ * If you're decoding incoming packets with avcodec_decode_*, make sure to flush
+ * your decoder's buffers after each seek with avcodec_flush_buffers().
* @}
*
* @defgroup lavf_encoding Muxing
--
1.9.1
More information about the ffmpeg-devel
mailing list