FFmpeg
|
#include <stdint.h>
#include "libavutil/rational.h"
#include "libavcodec/packet.h"
#include "avformat.h"
Go to the source code of this file.
Data Structures | |
struct | FFInputFormat |
struct | FFStreamInfo |
Macros | |
#define | FF_INFMT_FLAG_INIT_CLEANUP (1 << 0) |
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_header() failure. More... | |
#define | MAX_STD_TIMEBASES (30*12+30+3+6) |
#define | FFERROR_REDO FFERRTAG('R','E','D','O') |
Returned by demuxers to indicate that data was consumed but discarded (ignored streams or junk data). More... | |
#define | RELATIVE_TS_BASE (INT64_MAX - (1LL << 48)) |
Functions | |
static const FFInputFormat * | ffifmt (const AVInputFormat *fmt) |
static av_always_inline int | is_relative (int64_t ts) |
int64_t | ff_wrap_timestamp (const AVStream *st, int64_t timestamp) |
Wrap a given time stamp, if there is an indication for an overflow. More... | |
int | ff_read_packet (AVFormatContext *s, AVPacket *pkt) |
Read a transport packet from a media file. More... | |
void | ff_read_frame_flush (AVFormatContext *s) |
Flush the frame reader. More... | |
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 FFInputFormat.read_timestamp(). 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. More... | |
int | ff_find_last_ts (AVFormatContext *s, int stream_index, int64_t *ts, int64_t *pos, int64_t(*read_timestamp)(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)(struct AVFormatContext *, int, int64_t *, int64_t)) |
Perform a binary search using read_timestamp(). 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... | |
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... | |
void | ff_configure_buffers_for_index (AVFormatContext *s, int64_t time_tolerance) |
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_rfps_add_frame (AVFormatContext *ic, AVStream *st, int64_t dts) |
add frame for rfps calculation. More... | |
void | ff_rfps_calculate (AVFormatContext *ic) |
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_stream_set_need_parsing (AVStream *st, enum AVStreamParseType type) |
AVChapter * | avpriv_new_chapter (AVFormatContext *s, int64_t id, AVRational time_base, int64_t start, int64_t end, const char *title) |
Add a new chapter. More... | |
int | ff_add_attached_pic (AVFormatContext *s, AVStream *st, AVIOContext *pb, AVBufferRef **buf, int size) |
Add an attached pic to an AVStream. More... | |
int | ff_add_param_change (AVPacket *pkt, int32_t channels, uint64_t channel_layout, int32_t sample_rate, int32_t width, int32_t height) |
Add side data to a packet for changing parameters to the given values. More... | |
int | ff_generate_avci_extradata (AVStream *st) |
Generate standard extradata for AVC-Intra based on width/height and field order. More... | |
int | ff_get_extradata (void *logctx, AVCodecParameters *par, AVIOContext *pb, int size) |
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and fill it from pb. More... | |
int | ff_find_stream_index (const AVFormatContext *s, int id) |
Find stream index based on format-specific stream ID. More... | |
int | ff_buffer_packet (AVFormatContext *s, AVPacket *pkt) |
#define FF_INFMT_FLAG_INIT_CLEANUP (1 << 0) |
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_header() failure.
|
inlinestatic |
Definition at line 133 of file demux.h.
Referenced by av_probe_input_format3(), av_read_pause(), av_read_play(), av_seek_frame(), avdevice_list_devices(), avformat_close_input(), avformat_open_input(), avformat_seek_file(), ff_alloc_input_device_context(), ff_img_read_header(), ff_img_read_packet(), ff_raw_audio_read_header(), ff_raw_subtitle_read_header(), ff_raw_video_read_header(), ff_read_packet(), ff_seek_frame_binary(), g726_read_header(), pcm_read_header(), probe(), raw_data_read_header(), rawvideo_read_header(), seek_frame_generic(), and seek_frame_internal().
|
static |
Definition at line 175 of file demux.h.
Referenced by av_read_frame(), compute_pkt_fields(), ff_add_index_entry(), ff_rfps_add_frame(), read_frame_internal(), update_initial_timestamps(), and update_timestamps().
Wrap a given time stamp, if there is an indication for an overflow.
st | stream |
timestamp | the time stamp to wrap |
Definition at line 66 of file demux.c.
Referenced by av_add_index_entry(), and read_timestamp().
int ff_read_packet | ( | AVFormatContext * | s, |
AVPacket * | pkt | ||
) |
Read a transport packet from a media file.
s | media file handle |
pkt | is filled |
Definition at line 615 of file demux.c.
Referenced by asfrtp_parse_packet(), estimate_timings_from_pts(), get_subtitle_pkt(), read_frame_internal(), read_gab2_sub(), and seek_subtitle().
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(), dvdvideo_subdemux_flush(), ff_seek_frame_binary(), hls_read_seek(), mpegts_get_dts(), seek_frame_generic(), and seek_frame_internal().
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 FFInputFormat.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().
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().
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 | ||
) |
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().
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().
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().
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().
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_rfps_add_frame | ( | AVFormatContext * | ic, |
AVStream * | st, | ||
int64_t | dts | ||
) |
add frame for rfps calculation.
dts | timestamp of the i-th frame |
Definition at line 2270 of file demux.c.
Referenced by avformat_find_stream_info(), and mov_build_index().
void ff_rfps_calculate | ( | AVFormatContext * | ic | ) |
Definition at line 2331 of file demux.c.
Referenced by avformat_find_stream_info(), and mov_read_header().
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 FFInputFormat::read_seek2()
[in] | tb_in | Timebase of the input min_ts , ts and max_ts |
[in] | tb_out | Timebase of the output 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().
void avpriv_stream_set_need_parsing | ( | AVStream * | st, |
enum AVStreamParseType | type | ||
) |
Definition at line 37 of file demux_utils.c.
Referenced by v4l2_read_header().
AVChapter* avpriv_new_chapter | ( | AVFormatContext * | s, |
int64_t | id, | ||
AVRational | time_base, | ||
int64_t | start, | ||
int64_t | end, | ||
const char * | title | ||
) |
Add a new chapter.
s | media file handle |
id | unique ID for this chapter |
start | chapter start time in time_base units |
end | chapter end time in time_base units |
title | chapter title |
Definition at line 42 of file demux_utils.c.
Referenced by aa_read_header(), asf_read_marker(), concat_parse_script(), decode_info_header(), dvdvideo_chapters_setup_preindex(), dvdvideo_chapters_setup_simple(), ff_id3v2_parse_chapters(), flac_read_header(), mov_metadata_hmmt(), mov_read_chapters(), mov_read_chpl(), ogm_chapter(), read_chapter(), and read_header().
int ff_add_attached_pic | ( | AVFormatContext * | s, |
AVStream * | st, | ||
AVIOContext * | pb, | ||
AVBufferRef ** | buf, | ||
int | size | ||
) |
Add an attached pic to an AVStream.
st | if set, the stream to add the attached pic to; if unset, a new stream will be added to s. |
pb | AVIOContext to read data from if buf is unset. |
buf | if set, it contains the data and size information to be used for the attached pic; if unset, data is read from pb. |
size | the size of the data to read if buf is unset. |
Definition at line 116 of file demux_utils.c.
Referenced by ape_tag_read_field(), asf_read_picture(), ff_flac_parse_picture(), ff_id3v2_parse_apic(), get_attachment(), mov_read_chapters(), and mov_read_covr().
int ff_add_param_change | ( | AVPacket * | pkt, |
int32_t | channels, | ||
uint64_t | channel_layout, | ||
int32_t | sample_rate, | ||
int32_t | width, | ||
int32_t | height | ||
) |
Add side data to a packet for changing parameters to the given values.
Parameters set to 0 aren't included in the change.
Definition at line 151 of file demux_utils.c.
Referenced by flv_read_packet(), load_ipmovie_packet(), and swf_read_packet().
Generate standard extradata for AVC-Intra based on width/height and field order.
Definition at line 200 of file demux_utils.c.
Referenced by mov_read_trak(), and mxf_parse_structural_metadata().
int ff_get_extradata | ( | void * | logctx, |
AVCodecParameters * | par, | ||
AVIOContext * | pb, | ||
int | size | ||
) |
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and fill it from pb.
size | size of extradata |
Definition at line 335 of file demux_utils.c.
Referenced by aax_read_header(), acm_read_header(), adx_read_header(), aiff_read_header(), aix_read_header(), apc_read_header(), ape_tag_read_field(), avi_read_header(), bfi_read_header(), bonk_read_header(), decode_stream_header(), ff_get_wav_header(), ff_mp4_read_dec_config_descr(), flv_get_extradata(), get_codec_data(), idcin_read_header(), mov_parse_stsd_data(), mov_read_dfla(), mov_read_dvc1(), mov_read_glbl(), mov_read_strf(), mov_read_wave(), mpc8_read_header(), mpc_read_header(), osq_read_header(), parse_chunk(), parse_video_info(), read_header(), read_kuki_chunk(), rka_read_header(), rl2_read_header(), rm_read_extradata(), rsd_read_header(), vc1t_read_header(), wady_read_header(), wsvqa_read_header(), and yop_read_header().
int ff_find_stream_index | ( | const AVFormatContext * | s, |
int | id | ||
) |
Find stream index based on format-specific stream ID.
Definition at line 351 of file demux_utils.c.
Referenced by get_sindex(), parse_chunks(), pmt_cb(), and scte_data_cb().
int ff_buffer_packet | ( | AVFormatContext * | s, |
AVPacket * | pkt | ||
) |
Definition at line 608 of file demux.c.
Referenced by mov_read_packet().