From patchwork Wed Jan 18 10:38:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Bouron X-Patchwork-Id: 2246 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp957859vsb; Wed, 18 Jan 2017 02:45:53 -0800 (PST) X-Received: by 10.223.178.243 with SMTP id g106mr2716423wrd.32.1484736353613; Wed, 18 Jan 2017 02:45:53 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id x197si9488998wmf.0.2017.01.18.02.45.52; Wed, 18 Jan 2017 02:45:53 -0800 (PST) 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 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 CEBCF68A2B8; Wed, 18 Jan 2017 12:45:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f43.google.com (mail-wm0-f43.google.com [74.125.82.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6CE5268A27D for ; Wed, 18 Jan 2017 12:45:33 +0200 (EET) Received: by mail-wm0-f43.google.com with SMTP id r126so239570730wmr.0 for ; Wed, 18 Jan 2017 02:45:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=quoBpT93IAQXGHuSbF0wyh+DCaqroQLpWKska1JmdHU=; b=N3ulLKIH/hrKzyv3gNVkWAXKDOzVBlYXk/6w0yJ5EaPPVpfOGFAGP3w54Pq1lyCt/J sLNFJj+kfHIopOGrksS4IR0tgyGenbOfwAb0jCutWPhdQE8P6g3z0KIo0nt4aU/l/U+z CxDbhYzobVGYGBHtBNgheGxP0aEEZwP3dePrOnIKeyrI/SFKtSVTCoweK6mmNV1FQ+/M nehPuXL24xkamM5fVjHx6Ca0OibUKSRpXdyW50K0cVzo9/oSATNjI/+Y2i0VAn5QB5Q8 mkUuxyKdPPp3P//GpcVz36pg/yPVDCbtQnnwKLpUFrDiAmpTi6yrjQcW9rPEDS6zZQro Lhrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=quoBpT93IAQXGHuSbF0wyh+DCaqroQLpWKska1JmdHU=; b=GYgDVD33HCYPCbt8dzBlt07zhWjaJJyOxtz2YN17kluAy+kaen2e2KnLQaN2kBq/cE QAzoTf8zpR/W/SJLuZSDfPTG7KKWvzd4RWksKYuG9H6Bwoh+jLl+jMp91+VE2B6aU07o NnKsJdTHGZwRNIGnmnuvhitLG8F6L0+qlpiFRqNS9PH24P9L7IFW9pY16/V34PMw4JQH TGVL02EhHc7rvM2+xc+WRa5L0VlSNXvQr38xacT57UHUwOnJa03BbjcPvUAIXlnbE7lD iXr50CGabIUD/VnSXfA7ESEqL01gNNNmWDJbcpzNtjcvLaw5JgA+7B/6R+EYJo3dv1tV A+Ng== X-Gm-Message-State: AIkVDXItcGIx9BuBv8GHefM96aG5ADKlzomvrwpvkwlTaZ/UVNQfKntuGZw8Nv5+wH1h4Q== X-Received: by 10.28.31.84 with SMTP id f81mr20956766wmf.94.1484735928327; Wed, 18 Jan 2017 02:38:48 -0800 (PST) Received: from localhost.localdomain (AMontsouris-653-1-242-82.w92-128.abo.wanadoo.fr. [92.128.113.82]) by smtp.gmail.com with ESMTPSA id u81sm3925150wmu.10.2017.01.18.02.38.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jan 2017 02:38:47 -0800 (PST) From: Matthieu Bouron To: ffmpeg-devel@ffmpeg.org Date: Wed, 18 Jan 2017 11:38:41 +0100 Message-Id: <20170118103841.13283-1-matthieu.bouron@gmail.com> X-Mailer: git-send-email 2.11.0 Subject: [FFmpeg-devel] [PATCH] lavf/mov: ignore edit list with duration equals to 0 for covers art 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: Matthieu Bouron MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Discards edit list with duration equals to 0 for video streams with only one frame and avoid discarding covers art muxed as a single frame video stream. --- Hello, The following patch discards single edit list with duration equals to 0 for video streams with only one frame which prevents discarding covers art muxed as a single frame video stream. The patch can be extended to make it always discards single edit list with duration equals to 0 (even if the video streams has more than one sample). What do you think ? Matthieu --- libavformat/mov.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index d1b929174d..88ffd0e5f2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2988,6 +2988,17 @@ static void mov_fix_index(MOVContext *mov, AVStream *st) if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) { return; } + + // Discard edit list with duration equals to 0 for video streams with only + // one frame and avoid discarding covers art muxed as a single frame video + // stream + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && + msc->chunk_count == 1 && + msc->elst_count == 1 && + msc->elst_data[0].duration == 0) { + return; + } + // Clean AVStream from traces of old index st->index_entries = NULL; st->index_entries_allocated_size = 0;