From patchwork Mon Aug 15 23:14:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 37299 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3d0d:b0:8d:a68e:8a0e with SMTP id y13csp1545054pzi; Mon, 15 Aug 2022 16:15:10 -0700 (PDT) X-Google-Smtp-Source: AA6agR6/zyayYdl7AJOrNbuWKazOQ67hUOz2N8va6Q23AVqwZLDK028UhFjXiDfEU7iDAdL2TXM8 X-Received: by 2002:a05:6402:14cf:b0:43c:f7bd:181c with SMTP id f15-20020a05640214cf00b0043cf7bd181cmr16261106edx.163.1660605310568; Mon, 15 Aug 2022 16:15:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605310; cv=none; d=google.com; s=arc-20160816; b=ooxw+up4TaEBHhG4BzCAaOrfnP8vq8zi9B8dFTGW4LePWkm+y0Jt/qnrW71yt2ihxC EqgIZYzWpi2V+2/raMErsvt1/+UdImoNR1TZ3zwNYvUoginJN4ADpbudGQendBbcLSmo k7q3zloMVTZQcub/g/jq30YFEknSDluC+jpZAPJBuP/xz9mZyPB2EFWTF+CyS0cUcCtq A1STMexmOlln7+SNfdHZTPn02WXX5RdKcOYfdHYxKpCD2u+RItXDE07Tvgd9Y/U2iT0l jlzfv47mNAWu7f8qfaY9w4YA5HXGWBX0OlLR6JGgMUxxWCgMM4o/6LDl3QDT1IQT7eUu iNJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=1rnAMrA5v6c1b9n5mr33tqx2HJGwSk1JFVGahii8zhw=; b=RRZn9bEnfvSihdtJKpZ/VJhsYcQiJbKeOE8bcaiDhQkDWj+WHONk44zNn1MzZZwnG/ NAPSU/gBgwkV+cwx2xx6nGnC6s7kUyYzjDq7xVHbASXGlmdFBS7bu0f1yBEWk0r932By EOU2w8eRq6GotiDkjSj/SQUVF0msChJNAU6pfMk5Q30o21yQsd9pKoQEbPCndkmMoFUB zBNfPhBAQTkwyUWoA4erzqrN+IP0NMiYeA+JfgOuO7kBe99wQ23/vxnY2qRP2Ee13yZv ioJBKEQC+JSnYH5G47Z4u0BZ3tw8OgEMnNs4KQ4bv5PCeLgSJcmjrIwJmcT0SPy/xfQc GQJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=UJldGjRd; 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=QUARANTINE 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 ga13-20020a1709070c0d00b006ff49b183e9si8696513ejc.971.2022.08.15.16.15.09; Mon, 15 Aug 2022 16:15:10 -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=20210112 header.b=UJldGjRd; 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=QUARANTINE 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 733D868B8BF; Tue, 16 Aug 2022 02:15:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-vk1-f173.google.com (mail-vk1-f173.google.com [209.85.221.173]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1E2C968AE45 for ; Tue, 16 Aug 2022 02:15:01 +0300 (EEST) Received: by mail-vk1-f173.google.com with SMTP id bq26so4397283vkb.8 for ; Mon, 15 Aug 2022 16:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc; bh=w+Vh1Sn4q1RYgah+yPkIXjDO6IsDzhp1loRykV/nM5U=; b=UJldGjRdE7P+aXjbtjYGCEg949J1OUvygFQw2EEz3z5gZE/JQ+Fo/UR4rZryxLk5XH Jo3Pw0bGSdvc8uGasHbe+70a3EP0qkuWGUBgNLnGdE/B14/G3G0W4RRt4yYllgqsiaee fXveFMKNFLlbs7YXdC0KDd4FT3E6NnksChTTcL4moF7vMmJpxxH1yY/+U/VsAbtSrVpI kK6kpOXjPw4q8izKb+/Ay7T5iSM7WUp937pPL+OqFNl54jJHtY2QeyVTg/laeNRrqTB/ v6CKswbLn+Tv/kIderpamgZA7b4aosnbAhso8UodvPVMr4TSc4xYmjoXjeXXcme9IOLV x/bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc; bh=w+Vh1Sn4q1RYgah+yPkIXjDO6IsDzhp1loRykV/nM5U=; b=sbbzSDq31UJTE7IS3HDlR2OVo85+8ssGtbscVXYaFqZz7U55rFl67KzP/6dtXHrKxN nhu1Afizm/aqsgtlbytPjcnnsHIFWhFwU8Lk9tcsRMzCAryr1vYaAE1SD/LsAlBddv8q 7yMJK2t2NI+SzuITmfoMLwUrvUmZLyzPppCOsoRTwhGv6z/RPLMMcfuXuq6tutokF4Cz THEjGx9m6hVukZq5Fw+xlh1Jdx7YJ4VZahBOMWXz+Nw2jm0OfSWLepi+aTPhPT1bQzwv qYQxaXLum2dl/QMsYU0slQUXHrOcsta3JQOj8b3OerB8ZuZlwq770r0Mx14HREQ6sct1 Gegw== X-Gm-Message-State: ACgBeo19lXHN1sXWbMXH1yN7K6xxqbaD0RX9fwbXrQlmejkZR+/3uWS+ CkR+xAzrvWNA7Xuya4tg/F9/b9tdv3o= X-Received: by 2002:a1f:6e01:0:b0:377:93a7:e5f1 with SMTP id j1-20020a1f6e01000000b0037793a7e5f1mr7512493vkc.12.1660605298215; Mon, 15 Aug 2022 16:14:58 -0700 (PDT) Received: from localhost.localdomain ([191.97.187.183]) by smtp.gmail.com with ESMTPSA id i25-20020ab00d99000000b003842250a024sm5836953uak.10.2022.08.15.16.14.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 16:14:57 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Aug 2022 20:14:42 -0300 Message-Id: <20220815231442.1976-1-jamrial@gmail.com> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/mov: don't read duration from mvhd atom X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: EsCDumtzcyrs This duration is equal to the longest duration in all track's tkhd atoms, which may be comprised of the sum of all edit lists in each track. Empty edit lists in tracks represent start_time, and the actual media duration is stored in the mdhd atom. This change lets the generic demux code derive the longest track duration taken from mdhd atoms, so the correct duration and start_time combination will be reported. Should fix ticket #9775. Signed-off-by: James Almer --- libavformat/mov.c | 4 ---- tests/ref/fate/gaplessenc-itunes-to-ipod-aac | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 6ee6ed0950..fee9c39f39 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1516,10 +1516,6 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) av_log(c->fc, AV_LOG_TRACE, "time scale = %i\n", c->time_scale); c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ - // set the AVFormatContext duration because the duration of individual tracks - // may be inaccurate - if (!c->trex_data) - c->fc->duration = av_rescale(c->duration, AV_TIME_BASE, c->time_scale); avio_rb32(pb); /* preferred scale */ avio_rb16(pb); /* preferred volume */ diff --git a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac index f967ac05bc..1f89e9af85 100644 --- a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac +++ b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac @@ -5,7 +5,7 @@ duration_ts=103326 [/STREAM] [FORMAT] start_time=0.000000 -duration=2.344000 +duration=2.342993 [/FORMAT] packet|pts=-1024|dts=-1024|duration=1024|flags=KD|side_data|