FFmpeg
|
#include <stdint.h>
#include "libavutil/avassert.h"
#include "libavutil/mathematics.h"
#include "libavutil/timestamp.h"
#include "libavcodec/avcodec.h"
#include "avformat.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"
Go to the source code of this file.
Functions | |
void | avpriv_update_cur_dts (AVFormatContext *s, AVStream *ref_st, int64_t timestamp) |
Update cur_dts of all streams based on the given timestamp and AVStream. More... | |
void | ff_reduce_index (AVFormatContext *s, int stream_index) |
Ensure the index uses less memory than the maximum specified in AVFormatContext.max_index_size by discarding entries if it grows too large. More... | |
int | ff_add_index_entry (AVIndexEntry **index_entries, int *nb_index_entries, unsigned int *index_entries_allocated_size, int64_t pos, int64_t timestamp, int size, int distance, int flags) |
Internal version of av_add_index_entry. More... | |
int | av_add_index_entry (AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags) |
Add an index entry into a sorted list. More... | |
int | ff_index_search_timestamp (const AVIndexEntry *entries, int nb_entries, int64_t wanted_timestamp, int flags) |
Internal version of av_index_search_timestamp. More... | |
void | ff_configure_buffers_for_index (AVFormatContext *s, int64_t time_tolerance) |
int | av_index_search_timestamp (AVStream *st, int64_t wanted_timestamp, int flags) |
Get the index for a specific timestamp. More... | |
int | avformat_index_get_entries_count (const AVStream *st) |
Get the index entry count for the given AVStream. More... | |
const AVIndexEntry * | avformat_index_get_entry (AVStream *st, int idx) |
Get the AVIndexEntry corresponding to the given index. More... | |
const AVIndexEntry * | avformat_index_get_entry_from_timestamp (AVStream *st, int64_t wanted_timestamp, int flags) |
Get the AVIndexEntry corresponding to the given timestamp. More... | |
static int64_t | read_timestamp (AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit, int64_t(*read_timestamp)(struct AVFormatContext *, int, int64_t *, int64_t)) |
int | ff_seek_frame_binary (AVFormatContext *s, int stream_index, int64_t target_ts, int flags) |
Perform a binary search using av_index_search_timestamp() and AVInputFormat.read_timestamp(). More... | |
int | ff_find_last_ts (AVFormatContext *s, int stream_index, int64_t *ts, int64_t *pos, int64_t(*read_timestamp_func)(struct AVFormatContext *, int, int64_t *, int64_t)) |
int64_t | ff_gen_search (AVFormatContext *s, int stream_index, int64_t target_ts, int64_t pos_min, int64_t pos_max, int64_t pos_limit, int64_t ts_min, int64_t ts_max, int flags, int64_t *ts_ret, int64_t(*read_timestamp_func)(struct AVFormatContext *, int, int64_t *, int64_t)) |
Perform a binary search using read_timestamp(). More... | |
static int | seek_frame_byte (AVFormatContext *s, int stream_index, int64_t pos, int flags) |
static int | seek_frame_generic (AVFormatContext *s, int stream_index, int64_t timestamp, int flags) |
static int | seek_frame_internal (AVFormatContext *s, int stream_index, int64_t timestamp, int flags) |
int | av_seek_frame (AVFormatContext *s, int stream_index, int64_t timestamp, int flags) |
Seek to the keyframe at timestamp. More... | |
int | avformat_seek_file (AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) |
Seek to timestamp ts. More... | |
void | ff_read_frame_flush (AVFormatContext *s) |
Flush the frame reader. More... | |
int | avformat_flush (AVFormatContext *s) |
Discard all internally buffered data. More... | |
void | ff_rescale_interval (AVRational tb_in, AVRational tb_out, int64_t *min_ts, int64_t *ts, int64_t *max_ts) |
Rescales a timestamp and the endpoints of an interval to which the temstamp belongs, from a timebase tb_in to a timebase tb_out . More... | |
void avpriv_update_cur_dts | ( | AVFormatContext * | s, |
AVStream * | ref_st, | ||
int64_t | timestamp | ||
) |
Update cur_dts of all streams based on the given timestamp and AVStream.
Stream ref_st unchanged, others set cur_dts in their native time base. Only needed for timestamp wrapping or if (dts not set and pts!=dts).
timestamp | new dts expressed in time_base of param ref_st |
ref_st | reference stream giving time_base of param timestamp |
Definition at line 35 of file seek.c.
Referenced by aa_read_header(), aa_read_seek(), ff_seek_frame_binary(), idcin_read_seek(), mp3_seek(), mpc8_read_seek(), mxf_read_seek(), read_seek(), seek_frame_generic(), and vpk_read_seek().
void ff_reduce_index | ( | AVFormatContext * | s, |
int | stream_index | ||
) |
Ensure the index uses less memory than the maximum specified in AVFormatContext.max_index_size by discarding entries if it grows too large.
Definition at line 48 of file seek.c.
Referenced by av_read_frame(), mpegps_read_pes_header(), mpegts_get_dts(), and read_frame_internal().
int ff_add_index_entry | ( | AVIndexEntry ** | index_entries, |
int * | nb_index_entries, | ||
unsigned int * | index_entries_allocated_size, | ||
int64_t | pos, | ||
int64_t | timestamp, | ||
int | size, | ||
int | distance, | ||
int | flags | ||
) |
Internal version of av_add_index_entry.
Definition at line 62 of file seek.c.
Referenced by av_add_index_entry(), read_header(), and scan_file().
int ff_index_search_timestamp | ( | const AVIndexEntry * | entries, |
int | nb_entries, | ||
int64_t | wanted_timestamp, | ||
int | flags | ||
) |
Internal version of av_index_search_timestamp.
Definition at line 130 of file seek.c.
Referenced by av_index_search_timestamp(), avformat_index_get_entry_from_timestamp(), ff_add_index_entry(), mxf_read_seek(), and read_seek().
void ff_configure_buffers_for_index | ( | AVFormatContext * | s, |
int64_t | time_tolerance | ||
) |
Definition at line 173 of file seek.c.
Referenced by mov_read_header().
|
static |
Definition at line 279 of file seek.c.
Referenced by ff_find_last_ts(), and ff_gen_search().
int ff_seek_frame_binary | ( | AVFormatContext * | s, |
int | stream_index, | ||
int64_t | target_ts, | ||
int | flags | ||
) |
Perform a binary search using av_index_search_timestamp() and AVInputFormat.read_timestamp().
target_ts | target timestamp in the time base of the given stream |
stream_index | stream number |
Definition at line 288 of file seek.c.
Referenced by asf_read_seek(), ogg_read_seek(), rm_read_seek(), and seek_frame_internal().
int ff_find_last_ts | ( | AVFormatContext * | s, |
int | stream_index, | ||
int64_t * | ts, | ||
int64_t * | pos, | ||
int64_t(*)(struct AVFormatContext *, int, int64_t *, int64_t) | read_timestamp_func | ||
) |
Definition at line 358 of file seek.c.
Referenced by ff_gen_search(), and find_duration().
int64_t ff_gen_search | ( | AVFormatContext * | s, |
int | stream_index, | ||
int64_t | target_ts, | ||
int64_t | pos_min, | ||
int64_t | pos_max, | ||
int64_t | pos_limit, | ||
int64_t | ts_min, | ||
int64_t | ts_max, | ||
int | flags, | ||
int64_t * | ts_ret, | ||
int64_t(*)(struct AVFormatContext *, int, int64_t *, int64_t) | read_timestamp | ||
) |
Perform a binary search using read_timestamp().
target_ts | target timestamp in the time base of the given stream |
stream_index | stream number |
Definition at line 396 of file seek.c.
Referenced by ff_seek_frame_binary(), and read_seek().
|
static |
Definition at line 503 of file seek.c.
Referenced by seek_frame_internal().
|
static |
Definition at line 524 of file seek.c.
Referenced by seek_frame_internal().
|
static |
Definition at line 595 of file seek.c.
Referenced by av_seek_frame().
void ff_read_frame_flush | ( | AVFormatContext * | s | ) |
Flush the frame reader.
Definition at line 720 of file seek.c.
Referenced by asf_read_pts(), avformat_flush(), avformat_seek_file(), dash_seek(), ff_seek_frame_binary(), hls_read_seek(), mpegts_get_dts(), seek_frame_generic(), and seek_frame_internal().
void ff_rescale_interval | ( | AVRational | tb_in, |
AVRational | tb_out, | ||
int64_t * | min_ts, | ||
int64_t * | ts, | ||
int64_t * | max_ts | ||
) |
Rescales a timestamp and the endpoints of an interval to which the temstamp belongs, from a timebase tb_in
to a timebase tb_out
.
The upper (lower) bound of the output interval is rounded up (down) such that the output interval always falls within the intput interval. The timestamp is rounded to the nearest integer and halfway cases away from zero, and can therefore fall outside of the output interval.
Useful to simplify the rescaling of the arguments of AVInputFormat::read_seek2()
[in] | tb_in | Timebase of the input min_ts , ts and max_ts |
[in] | tb_out | Timebase of the ouput min_ts , ts and max_ts |
[in,out] | min_ts | Lower bound of the interval |
[in,out] | ts | Timestamp |
[in,out] | max_ts | Upper bound of the interval |
Definition at line 763 of file seek.c.
Referenced by imf_seek(), main(), real_seek(), and try_seek().