Simplifies code and should correct timing values when -*sync drop is used
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
... | ... |
@@ -658,12 +658,8 @@ static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) |
658 | 658 |
pkt->dts = max; |
659 | 659 |
} |
660 | 660 |
} |
661 |
- ost->last_mux_dts_plus_duration = |
|
662 | 661 |
ost->last_mux_dts = pkt->dts; |
663 | 662 |
|
664 |
- if (ost->last_mux_dts_plus_duration != AV_NOPTS_VALUE) |
|
665 |
- ost->last_mux_dts_plus_duration += pkt->duration; |
|
666 |
- |
|
667 | 663 |
ost->data_size += pkt->size; |
668 | 664 |
ost->packets_written++; |
669 | 665 |
|
... | ... |
@@ -1107,7 +1103,7 @@ static void do_video_stats(OutputStream *ost, int frame_size) |
1107 | 1107 |
|
1108 | 1108 |
fprintf(vstats_file,"f_size= %6d ", frame_size); |
1109 | 1109 |
/* compute pts value */ |
1110 |
- ti1 = ost->last_mux_dts_plus_duration * av_q2d(ost->st->time_base); |
|
1110 |
+ ti1 = av_stream_get_end_pts(ost->st) * av_q2d(ost->st->time_base); |
|
1111 | 1111 |
if (ti1 < 0.01) |
1112 | 1112 |
ti1 = 0.01; |
1113 | 1113 |
|
... | ... |
@@ -1419,8 +1415,8 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti |
1419 | 1419 |
vid = 1; |
1420 | 1420 |
} |
1421 | 1421 |
/* compute min output value */ |
1422 |
- if (ost->last_mux_dts_plus_duration != AV_NOPTS_VALUE) |
|
1423 |
- pts = FFMAX(pts, av_rescale_q(ost->last_mux_dts_plus_duration, |
|
1422 |
+ if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) |
|
1423 |
+ pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), |
|
1424 | 1424 |
ost->st->time_base, AV_TIME_BASE_Q)); |
1425 | 1425 |
} |
1426 | 1426 |
|
... | ... |
@@ -378,7 +378,6 @@ typedef struct OutputStream { |
378 | 378 |
int64_t first_pts; |
379 | 379 |
/* dts of the last packet sent to the muxer */ |
380 | 380 |
int64_t last_mux_dts; |
381 |
- int64_t last_mux_dts_plus_duration; |
|
382 | 381 |
AVBitStreamFilterContext *bitstream_filters; |
383 | 382 |
AVCodec *enc; |
384 | 383 |
int64_t max_frames; |
... | ... |
@@ -1152,7 +1152,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e |
1152 | 1152 |
input_streams[source_index]->st->discard = AVDISCARD_NONE; |
1153 | 1153 |
} |
1154 | 1154 |
ost->last_mux_dts = AV_NOPTS_VALUE; |
1155 |
- ost->last_mux_dts_plus_duration = AV_NOPTS_VALUE; |
|
1156 | 1155 |
|
1157 | 1156 |
return ost; |
1158 | 1157 |
} |