summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-05-19 20:16:22 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-05-21 18:53:42 +0200
commit1f359c85599b58ffed58e61e543f2acb0a3d6295 (patch)
tree3d671c209ba5c325e167ec25256f70ed2d4aeb01 /ffmpeg.c
parent7f7080dc73df87c9aa5b96faf99567277fc6c6eb (diff)
ffmpeg: use av_stream_get_end_pts()
Simplifies code and should correct timing values when -*sync drop is used Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index eafcf0ff48..5299f0ef0f 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -658,12 +658,8 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost)
pkt->dts = max;
}
}
- ost->last_mux_dts_plus_duration =
ost->last_mux_dts = pkt->dts;
- if (ost->last_mux_dts_plus_duration != AV_NOPTS_VALUE)
- ost->last_mux_dts_plus_duration += pkt->duration;
-
ost->data_size += pkt->size;
ost->packets_written++;
@@ -1107,7 +1103,7 @@ static void do_video_stats(OutputStream *ost, int frame_size)
fprintf(vstats_file,"f_size= %6d ", frame_size);
/* compute pts value */
- ti1 = ost->last_mux_dts_plus_duration * av_q2d(ost->st->time_base);
+ ti1 = av_stream_get_end_pts(ost->st) * av_q2d(ost->st->time_base);
if (ti1 < 0.01)
ti1 = 0.01;
@@ -1419,8 +1415,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
vid = 1;
}
/* compute min output value */
- if (ost->last_mux_dts_plus_duration != AV_NOPTS_VALUE)
- pts = FFMAX(pts, av_rescale_q(ost->last_mux_dts_plus_duration,
+ if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE)
+ pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st),
ost->st->time_base, AV_TIME_BASE_Q));
}