sd_lavc: compensate for a stupid libavcodec API issue

The libavcodec PGS decoder sets end_display_time to UINT32_MAX, in an
attempt to signal unknown end time (the API does not allow to signal
this properly, and this was a backwards compatible hack).

While we have no issues with the large value, our code wants to
distinguish between known and unknown end time explicitly.
This commit is contained in:
wm4 2014-12-21 23:55:00 +01:00
parent 49d01d81e0
commit 1e3400e353
1 changed files with 4 additions and 1 deletions

View File

@ -210,8 +210,11 @@ static void decode(struct sd *sd, struct demux_packet *packet)
return;
if (pts != MP_NOPTS_VALUE) {
if (sub.end_display_time > sub.start_display_time)
if (sub.end_display_time > sub.start_display_time &&
sub.end_display_time != UINT32_MAX)
{
duration = (sub.end_display_time - sub.start_display_time) / 1000.0;
}
pts += sub.start_display_time / 1000.0;
}
double endpts = MP_NOPTS_VALUE;