解封装(八):av_seek_frame改变播放进度函数
作者:互联网
av_seek_frame
函数原型:
/**
- Seek to the keyframe at timestamp.
- ‘timestamp’ in ‘stream_index’.
- @param s media file handle
- @param stream_index If stream_index is (-1), a default
- stream is selected, and timestamp is automatically converted
- from AV_TIME_BASE units to the stream specific time_base.
- @param timestamp Timestamp in AVStream.time_base units
- or, if no stream is specified, in AV_TIME_BASE units.
- @param flags flags which select direction and seeking mode
- @return >= 0 on success
*/
int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int flags); //-1 default
分析:上面函数的第一个参数是我们封装格式的上下文,第二个参数是对应的我们的索引。就是移动到这个帧的位置。第三个参数是时间戳,移动到哪个时间位置。第四个参数是标识位,标识移动的方法。
#define AVSEEK_FLAG_BACKWARD -1 //<seek backward
#define AVSEEK_FLAG_BYTE 2 //<seeking base on position in bytes
如下图
标签:index,stream,int,timestamp,frame,param,av,seek 来源: https://blog.csdn.net/weixin_43907175/article/details/122013045