From patchwork Tue Sep 26 02:01:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodger Combs X-Patchwork-Id: 5281 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.36.26 with SMTP id f26csp3285975jaa; Mon, 25 Sep 2017 19:01:40 -0700 (PDT) X-Received: by 10.223.165.29 with SMTP id i29mr5442225wrb.163.1506391300378; Mon, 25 Sep 2017 19:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506391300; cv=none; d=google.com; s=arc-20160816; b=qgAqmTVxhdqEedx7g9r8AQnzhr2mH6kR8AuLchGQrwrlIuYE3Eeb6moqFPQwkBCMp8 eMBvnA4LWAg6kdFoqFDcC5nVID6b5Vf89Qpxnl1AH7cB2oYlsL/DckIxgywNLiWRUM9E Dn2b+6qhvq21ePGHjs6D8BiwfJ4nT+OlRnTcJe0CFtO2Sgrf9jIGb59nU5oQZnWm4jLn Vz6N0dtiFGNsxqroDkhhx714N0arzVyYVPO0G4nxssLySA0xXFZZ6LDbYy5vaRAJTIxr S5V7olOIMCqtiyqDz3EKqu04r3a2rh+rRWXSGvR+LBYK52tQmTwlcMvT5IbeoT4z9Hgl 9paA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=1FPmhaTcIvl81HnE2Czah6zcvA6jLsaNunX9MdFJlXE=; b=Z7jbcD2VXU3wXq7cOQsy5mMH8H/5L8IA0Kj+YBrT1FT5JMhUMpw0qjGtBmy5ga38tf GsY1sB7TAp85YUjCSvkEzC5PnN/ChXhQ1u5OEzt/W9r/1sp1ly0GPzQKNUN6ISP2pl1A jzk22LIVZ6B3x2mrvRSVUjlAcCsLu9xzlVmhP004ReVu2xuXhoL7SBYasQYp/QY4juQo 6zXy9xmVzZY8Hs7ndoUIIH30MyYaPdw0Jt7ux+Lc6n2tjCmeVrZ2DYewi4KCbsD8YNTb FpUS7IGN+xH2DK4uD7b813KS24hdU1soRlCT6uAYKqF7bvHgiRWkIWcGFN7RZtLEmx31 2l4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=u+yH3wEb; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a13si6233077wrg.175.2017.09.25.19.01.39; Mon, 25 Sep 2017 19:01:40 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=u+yH3wEb; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 60696689B69; Tue, 26 Sep 2017 05:01:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f48.google.com (mail-it0-f48.google.com [209.85.214.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BC3DB6899ED for ; Tue, 26 Sep 2017 05:01:20 +0300 (EEST) Received: by mail-it0-f48.google.com with SMTP id g18so1217755itg.5 for ; Mon, 25 Sep 2017 19:01:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=DhwM6c5igvl0MK7eX2bmrQEIsMRJLFwshLuwsGSCj5U=; b=u+yH3wEbFK3yJCFJVbptV/wHADZkS6IYDFxsriR+l5V+gG9KIZRwkpUjeIdRtOZTF6 BrYg/g7Ehb7j5WP76XyApGcHzM8aI/zev/ZcMY6MrQgkV8AFHhdKRnJ7X/+SUvPx6FGY JwQuWeDMf2GGb1rhQBCjQTSVNSWMuKmT1NeMjx8qmN+lMloAwZCUWLanuPu7f38YQFTY e7AbuhcRaBNYK41iZCSCVelr18cpplMfcJDDOoI3VhL7QjyTFn1zcfMtO87XyXYuFQEw cAVO9YRpkpm4j3/l1WXy1zDlBXSiTdr4KXi9vxv77LDIYJshSQAYuuZyKqQPNmB30lex ijnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=DhwM6c5igvl0MK7eX2bmrQEIsMRJLFwshLuwsGSCj5U=; b=mpcEFoqiAdJbpFOoZrolRkavZjmywAesPay1CSUdlmQaIDv0X5A+a2HIvMvyO8xJfj 1gMNM4Nddr+t+Izc4WDQkOWqVCJv/Xj94d+CTUprg5vm63Qirr2YG9xMxXc5ptUgK0Vg ju4rvmChGD9huE/E33bT6et/z1VFI5MrEHPZl78sgY8Fl+MbaVYQCeO44id7lPBZlBhi 35qNSCsBzi/GGBfzx++EmZcqNXAQE0W7oqE7YQ7aUws0zRk4lCXZ7krAwn1v0FUfUmdm l1yGj9tZmRm2qD9rael8k4LjWUH2zn0l8Z1dO40B+oyy6DS95OPyREDZja4s1KBkw+h9 796Q== X-Gm-Message-State: AHPjjUjOFMjSQTmABYbH/wHYwaYH63u1iCRpkRAEmihRde/+xfL1LZ7m HEWEpz49TpFrA2vBdz9uSDEAF19Z X-Google-Smtp-Source: AOwi7QCfnrvpALNtjL8TU/dWb8TkDrQ/rQKHH+vbIBOj8NBRA8hVD7rBU0wvLHMyXxhMDrHacCvQzA== X-Received: by 10.36.101.12 with SMTP id u12mr3261777itb.135.1506391291097; Mon, 25 Sep 2017 19:01:31 -0700 (PDT) Received: from Rodgers-MacBook-Pro.local.net (c-73-75-100-12.hsd1.il.comcast.net. [73.75.100.12]) by smtp.gmail.com with ESMTPSA id f14sm451711itc.13.2017.09.25.19.01.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 25 Sep 2017 19:01:30 -0700 (PDT) From: Rodger Combs To: ffmpeg-devel@ffmpeg.org Date: Mon, 25 Sep 2017 21:01:28 -0500 Message-Id: <20170926020128.55003-1-rodger.combs@gmail.com> X-Mailer: git-send-email 2.14.1 Subject: [FFmpeg-devel] [PATCH] lavf/movdec: flag chapter streams as such, even when not reading them 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This allows the use of the `ignore_chapters` option to avoid performing extra seeks at startup without producing "subtitle" chapter streams. --- libavformat/mov.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 2519707345..5b40408d62 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5780,6 +5780,7 @@ static void mov_read_chapters(AVFormatContext *s) int64_t cur_pos; int i, j; int chapter_track; + int read_contents = (s->pb->seekable & AVIO_SEEKABLE_NORMAL) && !mov->ignore_chapters; for (j = 0; j < mov->nb_chapter_tracks; j++) { chapter_track = mov->chapter_tracks[j]; @@ -5799,7 +5800,7 @@ static void mov_read_chapters(AVFormatContext *s) if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { st->disposition |= AV_DISPOSITION_ATTACHED_PIC | AV_DISPOSITION_TIMED_THUMBNAILS; - if (st->nb_index_entries) { + if (st->nb_index_entries && read_contents) { // Retrieve the first frame, if possible AVPacket pkt; AVIndexEntry *sample = &st->index_entries[0]; @@ -5819,6 +5820,10 @@ static void mov_read_chapters(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_DATA; st->codecpar->codec_id = AV_CODEC_ID_BIN_DATA; st->discard = AVDISCARD_ALL; + + if (!read_contents) + continue; + for (i = 0; i < st->nb_index_entries; i++) { AVIndexEntry *sample = &st->index_entries[i]; int64_t end = i+1 < st->nb_index_entries ? st->index_entries[i+1].timestamp : st->duration; @@ -5869,7 +5874,8 @@ static void mov_read_chapters(AVFormatContext *s) } } finish: - avio_seek(sc->pb, cur_pos, SEEK_SET); + if (read_contents) + avio_seek(sc->pb, cur_pos, SEEK_SET); } } @@ -6206,9 +6212,11 @@ static int mov_read_header(AVFormatContext *s) } av_log(mov->fc, AV_LOG_TRACE, "on_parse_exit_offset=%"PRId64"\n", avio_tell(pb)); + + if (mov->nb_chapter_tracks > 0) + mov_read_chapters(s); + if (pb->seekable & AVIO_SEEKABLE_NORMAL) { - if (mov->nb_chapter_tracks > 0 && !mov->ignore_chapters) - mov_read_chapters(s); for (i = 0; i < s->nb_streams; i++) if (s->streams[i]->codecpar->codec_tag == AV_RL32("tmcd")) { mov_read_timecode_track(s, s->streams[i]);