From bfa33f548db853bb4fef88df93b7c7829fe3d981 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Tue, 19 Feb 2019 09:20:31 +0000 Subject: 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 Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer --- libavformat/jacosubdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavformat/jacosubdec.c') 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; } -- cgit v1.2.3