summaryrefslogtreecommitdiffstats
path: root/sub/sd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-21 23:55:00 +0100
committerwm4 <wm4@nowhere>2014-12-21 23:58:09 +0100
commit1e3400e353d7aea5243f074f45741eb1cee9b1ad (patch)
tree78f29e000a08a8d04687ec66ce20149183edc40a /sub/sd_lavc.c
parent49d01d81e0d6c15c9a73fb8420eaabbad78dc56e (diff)
downloadmpv-1e3400e353d7aea5243f074f45741eb1cee9b1ad.tar.bz2
mpv-1e3400e353d7aea5243f074f45741eb1cee9b1ad.tar.xz
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.
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r--sub/sd_lavc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 5e0398d41c..3628607eed 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -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;