*/
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.
*/
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;
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;
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 {
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;
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);
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) {
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;