|
|
|
@@ -42,7 +42,7 @@ |
|
|
|
typedef struct SegmentListEntry { |
|
|
|
int index; |
|
|
|
double start_time, end_time; |
|
|
|
int64_t start_pts, start_dts; |
|
|
|
int64_t start_pts; |
|
|
|
char filename[1024]; |
|
|
|
struct SegmentListEntry *next; |
|
|
|
} SegmentListEntry; |
|
|
|
@@ -664,8 +664,6 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) |
|
|
|
seg->cur_entry.index = seg->segment_idx; |
|
|
|
seg->cur_entry.start_time = (double)pkt->pts * av_q2d(st->time_base); |
|
|
|
seg->cur_entry.start_pts = av_rescale_q(pkt->pts, st->time_base, AV_TIME_BASE_Q); |
|
|
|
seg->cur_entry.start_dts = pkt->dts != AV_NOPTS_VALUE ? |
|
|
|
av_rescale_q(pkt->dts, st->time_base, AV_TIME_BASE_Q) : seg->cur_entry.start_pts; |
|
|
|
} else if (pkt->pts != AV_NOPTS_VALUE) { |
|
|
|
seg->cur_entry.end_time = |
|
|
|
FFMAX(seg->cur_entry.end_time, (double)(pkt->pts + pkt->duration) * av_q2d(st->time_base)); |
|
|
|
@@ -679,18 +677,17 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) |
|
|
|
} |
|
|
|
|
|
|
|
if (seg->reset_timestamps) { |
|
|
|
av_log(s, AV_LOG_DEBUG, "stream:%d start_pts_time:%s pts:%s pts_time:%s start_dts_time:%s dts:%s dts_time:%s", |
|
|
|
av_log(s, AV_LOG_DEBUG, "stream:%d start_pts_time:%s pts:%s pts_time:%s dts:%s dts_time:%s", |
|
|
|
pkt->stream_index, |
|
|
|
av_ts2timestr(seg->cur_entry.start_pts, &AV_TIME_BASE_Q), |
|
|
|
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), |
|
|
|
av_ts2timestr(seg->cur_entry.start_dts, &AV_TIME_BASE_Q), |
|
|
|
av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base)); |
|
|
|
|
|
|
|
/* compute new timestamps */ |
|
|
|
if (pkt->pts != AV_NOPTS_VALUE) |
|
|
|
pkt->pts -= av_rescale_q(seg->cur_entry.start_pts, AV_TIME_BASE_Q, st->time_base); |
|
|
|
if (pkt->dts != AV_NOPTS_VALUE) |
|
|
|
pkt->dts -= av_rescale_q(seg->cur_entry.start_dts, AV_TIME_BASE_Q, st->time_base); |
|
|
|
pkt->dts -= av_rescale_q(seg->cur_entry.start_pts, AV_TIME_BASE_Q, st->time_base); |
|
|
|
|
|
|
|
av_log(s, AV_LOG_DEBUG, " -> pts:%s pts_time:%s dts:%s dts_time:%s\n", |
|
|
|
av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), |
|
|
|
|