lavf: move AVStream.pts_buffer to AVStreamInternal

Those are private fields, no reason to have them exposed in a public
header.
This commit is contained in:
Anton Khirnov 2020-10-09 09:22:36 +02:00
parent cea7c19cda
commit 91a98cc4ea
4 changed files with 18 additions and 15 deletions

View File

@ -1084,11 +1084,10 @@ typedef struct AVStream {
*/
struct AVPacketList *last_in_packet_buffer;
AVProbeData probe_data;
#define MAX_REORDER_DELAY 16
int64_t pts_buffer[MAX_REORDER_DELAY+1];
#if LIBAVFORMAT_VERSION_MAJOR < 59
// kept for ABI compatibility only, do not access in any way
int64_t unused5[16+1];
void *unused2;
int unused3;
unsigned int unused4;

View File

@ -308,12 +308,16 @@ struct AVStreamInternal {
*/
int update_initial_durations_done;
#define MAX_REORDER_DELAY 16
/**
* Internal data to generate dts from pts
*/
int64_t pts_reorder_error[MAX_REORDER_DELAY+1];
uint8_t pts_reorder_error_count[MAX_REORDER_DELAY+1];
int64_t pts_buffer[MAX_REORDER_DELAY+1];
/**
* Internal data to analyze DTS and detect faulty mpeg streams
*/

View File

@ -595,13 +595,13 @@ static int compute_muxer_pkt_fields(AVFormatContext *s, AVStream *st, AVPacket *
//calculate dts from pts
if (pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) {
st->pts_buffer[0] = pkt->pts;
for (i = 1; i < delay + 1 && st->pts_buffer[i] == AV_NOPTS_VALUE; i++)
st->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration;
for (i = 0; i<delay && st->pts_buffer[i] > st->pts_buffer[i + 1]; i++)
FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]);
st->internal->pts_buffer[0] = pkt->pts;
for (i = 1; i < delay + 1 && st->internal->pts_buffer[i] == AV_NOPTS_VALUE; i++)
st->internal->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration;
for (i = 0; i<delay && st->internal->pts_buffer[i] > st->internal->pts_buffer[i + 1]; i++)
FFSWAP(int64_t, st->internal->pts_buffer[i], st->internal->pts_buffer[i + 1]);
pkt->dts = st->pts_buffer[0];
pkt->dts = st->internal->pts_buffer[0];
}
if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE &&

View File

@ -1357,12 +1357,12 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
}
if (pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) {
st->pts_buffer[0] = pkt->pts;
for (i = 0; i<delay && st->pts_buffer[i] > st->pts_buffer[i + 1]; i++)
FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]);
st->internal->pts_buffer[0] = pkt->pts;
for (i = 0; i<delay && st->internal->pts_buffer[i] > st->internal->pts_buffer[i + 1]; i++)
FFSWAP(int64_t, st->internal->pts_buffer[i], st->internal->pts_buffer[i + 1]);
if(has_decode_delay_been_guessed(st))
pkt->dts = select_from_pts_buffer(st, st->pts_buffer, pkt->dts);
pkt->dts = select_from_pts_buffer(st, st->internal->pts_buffer, pkt->dts);
}
// We skipped it above so we try here.
if (!onein_oneout)
@ -1886,7 +1886,7 @@ void ff_read_frame_flush(AVFormatContext *s)
st->probe_packets = s->max_probe_packets;
for (j = 0; j < MAX_REORDER_DELAY + 1; j++)
st->pts_buffer[j] = AV_NOPTS_VALUE;
st->internal->pts_buffer[j] = AV_NOPTS_VALUE;
if (s->internal->inject_global_side_data)
st->internal->inject_global_side_data = 1;
@ -2867,7 +2867,7 @@ skip_duration_calc:
st->last_IP_pts = AV_NOPTS_VALUE;
st->internal->last_dts_for_order_check = AV_NOPTS_VALUE;
for (j = 0; j < MAX_REORDER_DELAY + 1; j++)
st->pts_buffer[j] = AV_NOPTS_VALUE;
st->internal->pts_buffer[j] = AV_NOPTS_VALUE;
}
}
@ -4526,7 +4526,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
st->last_IP_pts = AV_NOPTS_VALUE;
st->internal->last_dts_for_order_check = AV_NOPTS_VALUE;
for (i = 0; i < MAX_REORDER_DELAY + 1; i++)
st->pts_buffer[i] = AV_NOPTS_VALUE;
st->internal->pts_buffer[i] = AV_NOPTS_VALUE;
st->sample_aspect_ratio = (AVRational) { 0, 1 };