mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
lavf: move AVStream.{pts_wrap_*,update_initial_durations_done} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public header.
This commit is contained in:
parent
36d7c1dee8
commit
323c9a8c52
@ -1162,28 +1162,6 @@ typedef struct AVStream {
|
||||
*/
|
||||
int64_t mux_ts_offset;
|
||||
|
||||
/**
|
||||
* Internal data to check for wrapping of the time stamp
|
||||
*/
|
||||
int64_t pts_wrap_reference;
|
||||
|
||||
/**
|
||||
* Options for behavior, when a wrap is detected.
|
||||
*
|
||||
* Defined by AV_PTS_WRAP_ values.
|
||||
*
|
||||
* If correction is enabled, there are two possibilities:
|
||||
* If the first time stamp is near the wrap point, the wrap offset
|
||||
* will be subtracted, which will create negative time stamps.
|
||||
* Otherwise the offset will be added.
|
||||
*/
|
||||
int pts_wrap_behavior;
|
||||
|
||||
/**
|
||||
* Internal data to prevent doing update_initial_durations() twice
|
||||
*/
|
||||
int update_initial_durations_done;
|
||||
|
||||
/**
|
||||
* An opaque field for libavformat internal usage.
|
||||
* Must not be accessed in any way by callers.
|
||||
|
@ -225,6 +225,28 @@ struct AVStreamInternal {
|
||||
|
||||
} *info;
|
||||
|
||||
/**
|
||||
* Internal data to check for wrapping of the time stamp
|
||||
*/
|
||||
int64_t pts_wrap_reference;
|
||||
|
||||
/**
|
||||
* Options for behavior, when a wrap is detected.
|
||||
*
|
||||
* Defined by AV_PTS_WRAP_ values.
|
||||
*
|
||||
* If correction is enabled, there are two possibilities:
|
||||
* If the first time stamp is near the wrap point, the wrap offset
|
||||
* will be subtracted, which will create negative time stamps.
|
||||
* Otherwise the offset will be added.
|
||||
*/
|
||||
int pts_wrap_behavior;
|
||||
|
||||
/**
|
||||
* Internal data to prevent doing update_initial_durations() twice
|
||||
*/
|
||||
int update_initial_durations_done;
|
||||
|
||||
/**
|
||||
* Internal data to generate dts from pts
|
||||
*/
|
||||
|
@ -1325,8 +1325,8 @@ skip:
|
||||
int64_t pcr = f->last_pcr / 300;
|
||||
pcr_found = 1;
|
||||
if (st) {
|
||||
pes->st->pts_wrap_reference = st->pts_wrap_reference;
|
||||
pes->st->pts_wrap_behavior = st->pts_wrap_behavior;
|
||||
pes->st->internal->pts_wrap_reference = st->internal->pts_wrap_reference;
|
||||
pes->st->internal->pts_wrap_behavior = st->internal->pts_wrap_behavior;
|
||||
}
|
||||
if (pes->dts == AV_NOPTS_VALUE || pes->dts < pcr) {
|
||||
pes->pts = pes->dts = pcr;
|
||||
|
@ -101,13 +101,13 @@ static int is_relative(int64_t ts) {
|
||||
*/
|
||||
static int64_t wrap_timestamp(const AVStream *st, int64_t timestamp)
|
||||
{
|
||||
if (st->pts_wrap_behavior != AV_PTS_WRAP_IGNORE &&
|
||||
st->pts_wrap_reference != AV_NOPTS_VALUE && timestamp != AV_NOPTS_VALUE) {
|
||||
if (st->pts_wrap_behavior == AV_PTS_WRAP_ADD_OFFSET &&
|
||||
timestamp < st->pts_wrap_reference)
|
||||
if (st->internal->pts_wrap_behavior != AV_PTS_WRAP_IGNORE &&
|
||||
st->internal->pts_wrap_reference != AV_NOPTS_VALUE && timestamp != AV_NOPTS_VALUE) {
|
||||
if (st->internal->pts_wrap_behavior == AV_PTS_WRAP_ADD_OFFSET &&
|
||||
timestamp < st->internal->pts_wrap_reference)
|
||||
return timestamp + (1ULL << st->pts_wrap_bits);
|
||||
else if (st->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET &&
|
||||
timestamp >= st->pts_wrap_reference)
|
||||
else if (st->internal->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET &&
|
||||
timestamp >= st->internal->pts_wrap_reference)
|
||||
return timestamp - (1ULL << st->pts_wrap_bits);
|
||||
}
|
||||
return timestamp;
|
||||
@ -732,7 +732,7 @@ static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_in
|
||||
|
||||
if (ref == AV_NOPTS_VALUE)
|
||||
ref = pkt->pts;
|
||||
if (st->pts_wrap_reference != AV_NOPTS_VALUE || st->pts_wrap_bits >= 63 || ref == AV_NOPTS_VALUE || !s->correct_ts_overflow)
|
||||
if (st->internal->pts_wrap_reference != AV_NOPTS_VALUE || st->pts_wrap_bits >= 63 || ref == AV_NOPTS_VALUE || !s->correct_ts_overflow)
|
||||
return 0;
|
||||
ref &= (1LL << st->pts_wrap_bits)-1;
|
||||
|
||||
@ -747,17 +747,17 @@ static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_in
|
||||
|
||||
if (!first_program) {
|
||||
int default_stream_index = av_find_default_stream_index(s);
|
||||
if (s->streams[default_stream_index]->pts_wrap_reference == AV_NOPTS_VALUE) {
|
||||
if (s->streams[default_stream_index]->internal->pts_wrap_reference == AV_NOPTS_VALUE) {
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
if (av_find_program_from_stream(s, NULL, i))
|
||||
continue;
|
||||
s->streams[i]->pts_wrap_reference = pts_wrap_reference;
|
||||
s->streams[i]->pts_wrap_behavior = pts_wrap_behavior;
|
||||
s->streams[i]->internal->pts_wrap_reference = pts_wrap_reference;
|
||||
s->streams[i]->internal->pts_wrap_behavior = pts_wrap_behavior;
|
||||
}
|
||||
}
|
||||
else {
|
||||
st->pts_wrap_reference = s->streams[default_stream_index]->pts_wrap_reference;
|
||||
st->pts_wrap_behavior = s->streams[default_stream_index]->pts_wrap_behavior;
|
||||
st->internal->pts_wrap_reference = s->streams[default_stream_index]->internal->pts_wrap_reference;
|
||||
st->internal->pts_wrap_behavior = s->streams[default_stream_index]->internal->pts_wrap_behavior;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -776,8 +776,8 @@ static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_in
|
||||
while (program) {
|
||||
if (program->pts_wrap_reference != pts_wrap_reference) {
|
||||
for (i = 0; i<program->nb_stream_indexes; i++) {
|
||||
s->streams[program->stream_index[i]]->pts_wrap_reference = pts_wrap_reference;
|
||||
s->streams[program->stream_index[i]]->pts_wrap_behavior = pts_wrap_behavior;
|
||||
s->streams[program->stream_index[i]]->internal->pts_wrap_reference = pts_wrap_reference;
|
||||
s->streams[program->stream_index[i]]->internal->pts_wrap_behavior = pts_wrap_behavior;
|
||||
}
|
||||
|
||||
program->pts_wrap_reference = pts_wrap_reference;
|
||||
@ -859,7 +859,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
|
||||
st = s->streams[pkt->stream_index];
|
||||
|
||||
if (update_wrap_reference(s, st, pkt->stream_index, pkt) && st->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET) {
|
||||
if (update_wrap_reference(s, st, pkt->stream_index, pkt) && st->internal->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET) {
|
||||
// correct first time stamps to negative values
|
||||
if (!is_relative(st->first_dts))
|
||||
st->first_dts = wrap_timestamp(st, st->first_dts);
|
||||
@ -1147,9 +1147,9 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st,
|
||||
int64_t cur_dts = RELATIVE_TS_BASE;
|
||||
|
||||
if (st->first_dts != AV_NOPTS_VALUE) {
|
||||
if (st->update_initial_durations_done)
|
||||
if (st->internal->update_initial_durations_done)
|
||||
return;
|
||||
st->update_initial_durations_done = 1;
|
||||
st->internal->update_initial_durations_done = 1;
|
||||
cur_dts = st->first_dts;
|
||||
for (; pktl; pktl = get_next_pkt(s, st, pktl)) {
|
||||
if (pktl->pkt.stream_index == stream_index) {
|
||||
@ -4520,8 +4520,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
st->duration = AV_NOPTS_VALUE;
|
||||
st->first_dts = AV_NOPTS_VALUE;
|
||||
st->probe_packets = s->max_probe_packets;
|
||||
st->pts_wrap_reference = AV_NOPTS_VALUE;
|
||||
st->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;
|
||||
st->internal->pts_wrap_reference = AV_NOPTS_VALUE;
|
||||
st->internal->pts_wrap_behavior = AV_PTS_WRAP_IGNORE;
|
||||
|
||||
st->last_IP_pts = AV_NOPTS_VALUE;
|
||||
st->internal->last_dts_for_order_check = AV_NOPTS_VALUE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user