From patchwork Sat Feb 17 21:45:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 7631 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp2206058jai; Sat, 17 Feb 2018 13:46:33 -0800 (PST) X-Google-Smtp-Source: AH8x226SdoE/dnKPzh6V5qoh0V4C4LZ+G9rIuM0T/nVNuzxtxN/oPefVrgmDHXENw3F+jKtNn19b X-Received: by 10.28.58.208 with SMTP id h199mr8362802wma.79.1518903993291; Sat, 17 Feb 2018 13:46:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518903993; cv=none; d=google.com; s=arc-20160816; b=zzcGBsnq4e54mzODcNsQ2Io53ViQ1WoRZLJ40FmnKmsX36vBMldfsJQXTnL95SNK3r eoDlkyvTk7kEcovNjV2allRV9ZWQNNHheD8ZEecWf2kNGVCubv15qBbBCrnzdRmIPWHt gM6PD43M8Sjefe/b7qvJ5MSDAGgzPQgOQJt6GaFaMXX+gOUb5JernBKXdMkNmX9UGlZ7 6wZxnQoPozo30c/YkC3kndT3Q0bSYc1lk+989F4ESbepbyVXArrKYnYxqn6BhuodbkZB yn8wtGbf50YcCzYbPYttWlbvXNI7KUFsGKQwSWKrmeb3Oi1wu1kXfF5zYfdd1eF4k/Ee xseA== 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:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=2w32mJ4xNt+XMUxlQgoNIalVZKnCSezxbPK/taVgklw=; b=CYzP7GiPaA4mMFPYZmx+g9EAY8+m7NfSuQRWOc+j0GB33pLx0vYlmfPkie/O8H2oBC cARMDCJ9IuYseCKH9O6r6GBaxEmQ16Cu+LLBsc6/jVrObcxW8W0KDiFYZc2eTklzlX2I mZj1Wy3pNCfMjFeHuRfUjUpkBNdQtNzxfdT/BfHBb5cMUacRMCX1jK6PA3d/BnNNVLXb m7g8hCxHvCLIqdOG5KeJeVzWHnh9Su2AvVNVjfG/+oXSMkaVzW5/znbHN2KXE29va0L9 uHg7Bcb1dhRMQh7cN4VW0hxch9GOXBP2c2hQSl8bmelK+a/vsorlGcAOW+QI2pEKZcUR O6nA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b4si6900191wrf.69.2018.02.17.13.46.32; Sat, 17 Feb 2018 13:46:33 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0D5B768A043; Sat, 17 Feb 2018 23:45:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 52188689EEF for ; Sat, 17 Feb 2018 23:45:51 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 6649AE1943; Sat, 17 Feb 2018 22:45:51 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18wUTho1Lp_G; Sat, 17 Feb 2018 22:45:50 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 995D0E1643; Sat, 17 Feb 2018 22:45:50 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 17 Feb 2018 22:45:34 +0100 Message-Id: <20180217214538.24255-6-cus@passwd.hu> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180217214538.24255-1-cus@passwd.hu> References: <20180217214538.24255-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 06/10] avformat/mxfdec: fix sorting of index segments 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: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes ticket #5320. Signed-off-by: Marton Balint --- libavformat/mxfdec.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 4f30877f6d..7abb047117 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -1309,9 +1309,15 @@ static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segment * We want the smallest values for the keys than what we currently have, unless this is the first such entry this time around. * If we come across an entry with the same IndexStartPosition but larger IndexDuration, then we'll prefer it over the one we currently have. */ - if ((i == 0 || s->body_sid > last_body_sid || s->index_sid > last_index_sid || s->index_start_position > last_index_start) && - (best == -1 || s->body_sid < best_body_sid || s->index_sid < best_index_sid || s->index_start_position < best_index_start || - (s->index_start_position == best_index_start && s->index_duration > best_index_duration))) { + if ((i == 0 || + s->body_sid > last_body_sid || + s->body_sid == last_body_sid && s->index_sid > last_index_sid || + s->body_sid == last_body_sid && s->index_sid == last_index_sid && s->index_start_position > last_index_start) && + (best == -1 || + s->body_sid < best_body_sid || + s->body_sid == best_body_sid && s->index_sid < best_index_sid || + s->body_sid == best_body_sid && s->index_sid == best_index_sid && s->index_start_position < best_index_start || + s->body_sid == best_body_sid && s->index_sid == best_index_sid && s->index_start_position == best_index_start && s->index_duration > best_index_duration)) { best = j; best_body_sid = s->body_sid; best_index_sid = s->index_sid;