summaryrefslogtreecommitdiff
path: root/libavformat/jacosubdec.c
diff options
context:
space:
mode:
authorAdam Sampson <ats@offog.org>2019-02-19 09:20:31 +0000
committerMichael Niedermayer <michael@niedermayer.cc>2019-02-20 21:15:07 +0100
commitbfa33f548db853bb4fef88df93b7c7829fe3d981 (patch)
tree2abc69dcc7d4e8545b708710f84fbb461216153e /libavformat/jacosubdec.c
parent1811b7d1f5330e04a48b1d6425cf1ef6ed776ed1 (diff)
lavf/jacosubdec: compute subtitle duration correctly
When a JACOsub subtitle has two timestamps, they represent its start and end times (http://unicorn.us.com/jacosub/jscripts.html#l_times); the duration is the difference between the two, not the sum of the two. The subtitle end times in the FATE test for this were wrong as a result; fix them too. (This test is based on JACOsub's demo.txt, and the end time computed for the last line using @ now matches what the comments there say it should be.) Also tested in practice using MPV, a LaserDisc, and some authentic 1993 JACOsub files. Signed-off-by: Adam Sampson <ats@offog.org> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/jacosubdec.c')
-rw-r--r--libavformat/jacosubdec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c
index 520c435cc5..f6be5df2d7 100644
--- a/libavformat/jacosubdec.c
+++ b/libavformat/jacosubdec.c
@@ -127,7 +127,7 @@ shift_and_ret:
ts_start = (ts_start + jacosub->shift) * 100 / jacosub->timeres;
ts_end = (ts_end + jacosub->shift) * 100 / jacosub->timeres;
*start = ts_start;
- *duration = ts_start + ts_end;
+ *duration = ts_end - ts_start;
return buf + len;
}