From patchwork Thu Aug 25 15:58:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 292 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp978184vsd; Thu, 25 Aug 2016 08:59:00 -0700 (PDT) X-Received: by 10.194.0.211 with SMTP id 19mr8952774wjg.124.1472140740047; Thu, 25 Aug 2016 08:59:00 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p71si32286174wmb.47.2016.08.25.08.58.58; Thu, 25 Aug 2016 08:59:00 -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; 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 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 44624689B40; Thu, 25 Aug 2016 18:58:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4D8E1689B22 for ; Thu, 25 Aug 2016 18:58:40 +0300 (EEST) Received: by mail-wm0-f67.google.com with SMTP id i138so7989852wmf.3 for ; Thu, 25 Aug 2016 08:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=1MR8GQRsRfbZ4sFVxPiy1DT7qfmrUGshKsFwbyetud8=; b=JtkmD93aCE124uWH55D4ocXLkWWMOr+6lwZRI4VKaUsHirCGDo6eYUUdcZfRuFwRpZ HCp3OjIp+F59dvIrMA0oGwr4DA/fWz2OLZeAKi3WOCHN3g/cNrmO5NiEeKCyRUXwwGzm pMe0qe345/K8QpZE/k4ptOWNsauS9r+YDM/5VUPPIeVhaVYEnVHa5hpZMSaMJgdjW44Z +IOeZp7AaLICHUoz4FOCwVdbY9jxUbOCXd5gi5xusV6bj+JtlL4muyK6/3TtXEINILEV XKYSNOevi8RLPsmGRlhkD7a31Q52xCRyzYu23lylo3kpg9Soihv8LTHlYKSPlrlxAa2z +j2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=1MR8GQRsRfbZ4sFVxPiy1DT7qfmrUGshKsFwbyetud8=; b=CrpDp6JaLPEXISWI2fGaXMZcC+CkTPu/N2De1ZJinbncfvY9jh6Ao2PK5n/frnwbdL mi+/7+KX1jb3aTpo8p+6x6srW5Cfb7sQn83NhUASFEjgbMmoxQq4P4k/bhPfRnmqI1cf rUardXKY5v0KT0P1GnhquqcU++1pXPz/XBcpmFH0nciGblnYEwiC+VMfwz63X4HTWM14 QC7JMvJ30tj4UGYVWwEh/y0t2YOoVkB0f7OA+fYESWSfqzgxZEnlsf9aWC1d+hfbxzxe U/ZZGj7zXp4Ns/b7dAqUMgBL/stAcfuGTOfuQ6c0o+Lz9H5x+5cyAAE8UhRBlNPAVkHP GLdg== X-Gm-Message-State: AEkoouuNs/LdnIGp+uLvDW0k6Mp0kIibgOnBRsA+/p7fGztr+pA7d9bmvnoz1uLKHoQ/hA== X-Received: by 10.194.23.39 with SMTP id j7mr8000081wjf.4.1472140722659; Thu, 25 Aug 2016 08:58:42 -0700 (PDT) Received: from vimeo-vm.localdomain ([62.208.37.196]) by smtp.gmail.com with ESMTPSA id ly9sm15729494wjb.44.2016.08.25.08.58.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Aug 2016 08:58:42 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Thu, 25 Aug 2016 16:58:14 +0100 Message-Id: <1472140695-10290-1-git-send-email-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 1.8.3.1 Subject: [FFmpeg-devel] [PATCH 1/2 v2] mov: Remove ancient heuristic hack 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: derek.buitenhuis@gmail.com MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" This breaks files with legitimate single-entry edit lists, and the hack, introduced in f03a081df09f9c4798a17d7e24446ed47924b11b, has no link to any known sample in its commit message. Signed-off-by: Derek Buitenhuis --- libavformat/isom.h | 1 - libavformat/mov.c | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/libavformat/isom.h b/libavformat/isom.h index df6c15a..2246fed 100644 --- a/libavformat/isom.h +++ b/libavformat/isom.h @@ -155,7 +155,6 @@ typedef struct MOVStreamContext { MOVDref *drefs; int dref_id; int timecode_track; - int wrong_dts; ///< dts are wrong due to huge ctts offset (iMovie files) int width; ///< tkhd width int height; ///< tkhd height int dts_shift; ///< dts shift when ctts is negative diff --git a/libavformat/mov.c b/libavformat/mov.c index 1bc3800..54c63ad 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2802,12 +2802,8 @@ static void mov_build_index(MOVContext *mov, AVStream *st) sc->time_offset = start_time - empty_duration; current_dts = -sc->time_offset; if (sc->ctts_count>0 && sc->stts_count>0 && - sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) { - /* more than 16 frames delay, dts are likely wrong - this happens with files created by iMovie */ - sc->wrong_dts = 1; + sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) st->codecpar->video_delay = 1; - } } if (!unsupported && st->codecpar->codec_id == AV_CODEC_ID_AAC && start_time > 0) @@ -5352,8 +5348,6 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) sc->ctts_index++; sc->ctts_sample = 0; } - if (sc->wrong_dts) - pkt->dts = AV_NOPTS_VALUE; } else { int64_t next_dts = (sc->current_sample < st->nb_index_entries) ? st->index_entries[sc->current_sample].timestamp : st->duration;