From patchwork Tue Feb 12 23:13:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Sampson X-Patchwork-Id: 12054 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2125C448ECF for ; Wed, 13 Feb 2019 01:14:18 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0393D68A10A; Wed, 13 Feb 2019 01:14:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from b-painless.mh.aa.net.uk (b-painless.mh.aa.net.uk [81.187.30.52]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 73DF6689A2A for ; Wed, 13 Feb 2019 01:14:12 +0200 (EET) Received: from cartman.offog.org ([2001:8b0:83b:b53f::a]) by b-painless.mh.aa.net.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gthFj-0000mU-V7 for ffmpeg-devel@ffmpeg.org; Tue, 12 Feb 2019 23:14:12 +0000 Received: from ats by cartman.offog.org with local (Exim 4.92) (envelope-from ) id 1gthFY-0002om-Tk; Tue, 12 Feb 2019 23:14:00 +0000 From: Adam Sampson To: ffmpeg-devel@ffmpeg.org Date: Tue, 12 Feb 2019 23:13:20 +0000 Message-Id: <20190212231319.10526-1-ats@offog.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] lavf/jacosubdec: compute subtitle duration correctly X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Adam Sampson Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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. Tested using MPV, a LaserDisc, and some authentic 1993 JACOsub files. --- libavformat/jacosubdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; }