From patchwork Thu Jun 18 00:47:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: rcombs X-Patchwork-Id: 20446 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 A708944AC29 for ; Thu, 18 Jun 2020 03:48:08 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8D2A068B4A2; Thu, 18 Jun 2020 03:48:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from so254-54.mailgun.net (so254-54.mailgun.net [198.61.254.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AB7ED68B31C for ; Thu, 18 Jun 2020 03:48:01 +0300 (EEST) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=rcombs.me; q=dns/txt; s=mx; t=1592441285; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-Id: Date: Subject: To: From: Sender; bh=XJKTbcLZME+ncyakzF4KMgOAgJL/WgSGl09HXvYlKGg=; b=uLaFXMqk6HsMc+OI50tpg7aPDMqNvbqsB1qOz6V/MhnUh8Kk1BadWivVlZLHaJcICcFZeM2M 5Ik/uenimw6io0T6XMAphrFF+fco00m9Od1GTpMsejUxnaeFU9X1jmiHm8P6/ay+iTuR7dtF FZlHWJBoes9Zi9WOEzLQypX6Umw= X-Mailgun-Sending-Ip: 198.61.254.54 X-Mailgun-Sid: WyJiZDU1MSIsICJmZm1wZWctZGV2ZWxAZmZtcGVnLm9yZyIsICJiMGJhIl0= Received: from rcombs-mbp.localdomain ( [24.14.135.13]) by smtp-out-n07.prod.us-east-1.postgun.com with SMTP id 5eeab9b3bfb34e631c32347a (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 18 Jun 2020 00:47:47 GMT From: rcombs To: ffmpeg-devel@ffmpeg.org Date: Wed, 17 Jun 2020 19:47:43 -0500 Message-Id: <20200618004743.95896-5-rcombs@rcombs.me> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200618004743.95896-1-rcombs@rcombs.me> References: <20200618004743.95896-1-rcombs@rcombs.me> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/5] lavf/webvttdec: ignore unrecognized blocks 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The WebVTT spec expects this behavior and it fixes some files --- libavformat/webvttdec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/webvttdec.c b/libavformat/webvttdec.c index 38c281fe00..2e832b86eb 100644 --- a/libavformat/webvttdec.c +++ b/libavformat/webvttdec.c @@ -78,7 +78,7 @@ static int webvtt_read_header(AVFormatContext *s) int i; int64_t pos; AVPacket *sub; - const char *p, *identifier, *settings; + const char *p, *identifier, *settings, *arrow; int identifier_len, settings_len; int64_t ts_start, ts_end; @@ -120,12 +120,13 @@ static int webvtt_read_header(AVFormatContext *s) p++; } + if (!(arrow = strstr(p, "-->"))) + continue; + /* cue timestamps */ if ((ts_start = read_ts(p)) == AV_NOPTS_VALUE) break; - if (!(p = strstr(p, "-->"))) - break; - p += 2; + p = arrow + 2; do p++; while (*p == ' ' || *p == '\t'); if ((ts_end = read_ts(p)) == AV_NOPTS_VALUE) break;