diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-10-09 09:22:36 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-10-28 14:59:28 +0100 |
commit | cea7c19cda0ea1630ae1de8c102ab14231b9db10 (patch) | |
tree | 9e703af026f15d976d79a0811566043ccb95ec9f /libavformat/utils.c | |
parent | 7e87288f73242dac6344e65f892569102893fac0 (diff) | |
download | ffmpeg-cea7c19cda0ea1630ae1de8c102ab14231b9db10.tar.gz |
lavf: move AVStream.*index_entries* to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header. Since there are some (semi-)public fields located after these,
even though this section is supposed to be private, keep some dummy
padding there until the next major bump to preserve ABI compatibility.
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 683134d84a..6ffc19517f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1914,11 +1914,11 @@ void ff_reduce_index(AVFormatContext *s, int stream_index) AVStream *st = s->streams[stream_index]; unsigned int max_entries = s->max_index_size / sizeof(AVIndexEntry); - if ((unsigned) st->nb_index_entries >= max_entries) { + if ((unsigned) st->internal->nb_index_entries >= max_entries) { int i; - for (i = 0; 2 * i < st->nb_index_entries; i++) - st->index_entries[i] = st->index_entries[2 * i]; - st->nb_index_entries = i; + for (i = 0; 2 * i < st->internal->nb_index_entries; i++) + st->internal->index_entries[i] = st->internal->index_entries[2 * i]; + st->internal->nb_index_entries = i; } } @@ -1985,8 +1985,8 @@ int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags) { timestamp = wrap_timestamp(st, timestamp); - return ff_add_index_entry(&st->index_entries, &st->nb_index_entries, - &st->index_entries_allocated_size, pos, + return ff_add_index_entry(&st->internal->index_entries, &st->internal->nb_index_entries, + &st->internal->index_entries_allocated_size, pos, timestamp, size, distance, flags); } @@ -2062,13 +2062,13 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance) if (ist1 == ist2) continue; - for (i1 = i2 = 0; i1 < st1->nb_index_entries; i1++) { - AVIndexEntry *e1 = &st1->index_entries[i1]; + for (i1 = i2 = 0; i1 < st1->internal->nb_index_entries; i1++) { + AVIndexEntry *e1 = &st1->internal->index_entries[i1]; int64_t e1_pts = av_rescale_q(e1->timestamp, st1->time_base, AV_TIME_BASE_Q); skip = FFMAX(skip, e1->size); - for (; i2 < st2->nb_index_entries; i2++) { - AVIndexEntry *e2 = &st2->index_entries[i2]; + for (; i2 < st2->internal->nb_index_entries; i2++) { + AVIndexEntry *e2 = &st2->internal->index_entries[i2]; int64_t e2_pts = av_rescale_q(e2->timestamp, st2->time_base, AV_TIME_BASE_Q); if (e2_pts < e1_pts || e2_pts - (uint64_t)e1_pts < time_tolerance) continue; @@ -2100,7 +2100,7 @@ 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) { - return ff_index_search_timestamp(st->index_entries, st->nb_index_entries, + return ff_index_search_timestamp(st->internal->index_entries, st->internal->nb_index_entries, wanted_timestamp, flags); } @@ -2133,7 +2133,7 @@ int ff_seek_frame_binary(AVFormatContext *s, int stream_index, pos_limit = -1; // GCC falsely says it may be uninitialized. st = s->streams[stream_index]; - if (st->index_entries) { + if (st->internal->index_entries) { AVIndexEntry *e; /* FIXME: Whole function must be checked for non-keyframe entries in @@ -2141,7 +2141,7 @@ int ff_seek_frame_binary(AVFormatContext *s, int stream_index, index = av_index_search_timestamp(st, target_ts, flags | AVSEEK_FLAG_BACKWARD); index = FFMAX(index, 0); - e = &st->index_entries[index]; + e = &st->internal->index_entries[index]; if (e->timestamp <= target_ts || e->pos == e->min_distance) { pos_min = e->pos; @@ -2154,9 +2154,9 @@ int ff_seek_frame_binary(AVFormatContext *s, int stream_index, index = av_index_search_timestamp(st, target_ts, flags & ~AVSEEK_FLAG_BACKWARD); - av_assert0(index < st->nb_index_entries); + av_assert0(index < st->internal->nb_index_entries); if (index >= 0) { - e = &st->index_entries[index]; + e = &st->internal->index_entries[index]; av_assert1(e->timestamp >= target_ts); pos_max = e->pos; ts_max = e->timestamp; @@ -2357,17 +2357,17 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index, index = av_index_search_timestamp(st, timestamp, flags); - if (index < 0 && st->nb_index_entries && - timestamp < st->index_entries[0].timestamp) + if (index < 0 && st->internal->nb_index_entries && + timestamp < st->internal->index_entries[0].timestamp) return -1; - if (index < 0 || index == st->nb_index_entries - 1) { + if (index < 0 || index == st->internal->nb_index_entries - 1) { AVPacket pkt; int nonkey = 0; - if (st->nb_index_entries) { - av_assert0(st->index_entries); - ie = &st->index_entries[st->nb_index_entries - 1]; + if (st->internal->nb_index_entries) { + av_assert0(st->internal->index_entries); + ie = &st->internal->index_entries[st->internal->nb_index_entries - 1]; if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; ff_update_cur_dts(s, st, ie->timestamp); @@ -2404,7 +2404,7 @@ static int seek_frame_generic(AVFormatContext *s, int stream_index, if (s->iformat->read_seek) if (s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0) return 0; - ie = &st->index_entries[index]; + ie = &st->internal->index_entries[index]; if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; ff_update_cur_dts(s, st, ie->timestamp); @@ -4342,6 +4342,7 @@ static void free_stream(AVStream **pst) avcodec_free_context(&st->internal->avctx); av_bsf_free(&st->internal->bsfc); av_freep(&st->internal->priv_pts); + av_freep(&st->internal->index_entries); av_bsf_free(&st->internal->extract_extradata.bsf); av_packet_free(&st->internal->extract_extradata.pkt); @@ -4354,7 +4355,6 @@ static void free_stream(AVStream **pst) av_dict_free(&st->metadata); avcodec_parameters_free(&st->codecpar); av_freep(&st->probe_data.buf); - av_freep(&st->index_entries); #if FF_API_LAVF_AVCTX FF_DISABLE_DEPRECATION_WARNINGS avcodec_free_context(&st->codec); |