From patchwork Sat Feb 17 21:45:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 7630 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.150.1 with SMTP id c1csp2205837jai; Sat, 17 Feb 2018 13:46:09 -0800 (PST) X-Google-Smtp-Source: AH8x225AQrVZFIFO4nF3uRquHMocaOnBx7vnrz2J+Rm1HO+ivX/0wwcVnqB12ewZpWAAwWVNziZe X-Received: by 10.28.154.67 with SMTP id c64mr8368760wme.125.1518903969294; Sat, 17 Feb 2018 13:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518903969; cv=none; d=google.com; s=arc-20160816; b=Veo3T8WlhVcG56VW7gift9CrU+E4CsqahHswk+7ZDunej5Dr92QmcGD1Rw1xFl1fFh akeECG5ZR/OmGI38pIovjQ8dOQkXB+L76GHy5k1pfe7IYfUBruvCGNNbmccWh0J3KOGy FpNRMnNefDwUFRMsS+uOrMQ+HYv9wQwSPqJ45Tc96edePhWqX/E3uaAAJNiJtfkJkUvp DC1mqAUgc7Q2w959R/oph/9+cPT8zBoPJjnAAuV2L1I0BioO1+aBo5zEeE3bmmNcOkgJ 88ZTyvOTGSJNZ/YwK4PMMF/qPOqT0QZGSGa+gOWIWsL6BUX9X6b9QLhnhEbA6UVL7Cx+ ivyg== 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=HARS/MaVlOD96UjmJOiOOIuWTFnAmYz/yAvtHjyj9qg=; b=WG7znri6fuRhjTUZEiE8cRuIbtu912fVD0bCRlVQ9JUb3z5XQ7NNQ0OTMbkTWzvSGA u/20P/0qmuO83xsjsGCYk+hQ3xBAtEs1Khwb/ePSgkYVfA5RNZIqaTfaGv40HvvjSpRo 0N2OZ+LNDJhx4vKXW1MP+zvQ9Rzc4e86YQG92EiSlDx7uHFiiGL9ruyJ/rf3bXoPHUbv S5cCV5WVWbpHxSCpE2xIGPhfQep8WTRAHMnZM6SedwiqCSGdTdo3XJa47B4WnjewGD1/ XHPDrx0c0E93onjDLA8ooxNgrJx9Y04uTqy0Nf7ZMPHThkFvJn2Jo+jxHBOHeSuVpUkv HaJw== 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 z4si561970wrh.1.2018.02.17.13.46.08; Sat, 17 Feb 2018 13:46:09 -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 6E383689D80; Sat, 17 Feb 2018 23:45:53 +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 D78E2689C61 for ; Sat, 17 Feb 2018 23:45:46 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id E62E2E1949; Sat, 17 Feb 2018 22:45:46 +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 aKm821bGNAxN; Sat, 17 Feb 2018 22:45:46 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 323D2E194E; Sat, 17 Feb 2018 22:45:46 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 17 Feb 2018 22:45:31 +0100 Message-Id: <20180217214538.24255-3-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 03/10] avformat/mxfdec: use the first system item if available for calculating essence_offset 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" Also add an additional system item key. Fixes parsing of ffmpeg-bugs/trac/ticket2817/warehouse.mxf Signed-off-by: Marton Balint --- libavformat/mxfdec.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 95767ccba4..43a0220c87 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -289,7 +289,8 @@ static const uint8_t mxf_header_partition_pack_key[] = { 0x06,0x0e,0x2b,0x static const uint8_t mxf_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 }; static const uint8_t mxf_avid_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0e,0x04,0x03,0x01 }; static const uint8_t mxf_canopus_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x0a,0x0e,0x0f,0x03,0x01 }; -static const uint8_t mxf_system_item_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x03,0x01,0x04 }; +static const uint8_t mxf_system_item_key_cp[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x03,0x01,0x04 }; +static const uint8_t mxf_system_item_key_gc[] = { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 }; static const uint8_t mxf_klv_key[] = { 0x06,0x0e,0x2b,0x34 }; /* complete keys to match */ static const uint8_t mxf_crypto_source_container_ul[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 }; @@ -2861,7 +2862,8 @@ static int mxf_read_header(AVFormatContext *s) if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || IS_KLV_KEY(klv.key, mxf_essence_element_key) || IS_KLV_KEY(klv.key, mxf_avid_essence_element_key) || - IS_KLV_KEY(klv.key, mxf_system_item_key)) { + IS_KLV_KEY(klv.key, mxf_system_item_key_cp) || + IS_KLV_KEY(klv.key, mxf_system_item_key_gc)) { if (!mxf->current_partition) { av_log(mxf->fc, AV_LOG_ERROR, "found essence prior to first PartitionPack\n"); @@ -2888,7 +2890,10 @@ static int mxf_read_header(AVFormatContext *s) mxf->current_partition->essence_length = klv.length; } else { /* NOTE: op1a_essence_offset may be less than to klv.offset (C0023S01.mxf) */ - mxf->current_partition->essence_offset = op1a_essence_offset; + if (IS_KLV_KEY(klv.key, mxf_system_item_key_cp) || IS_KLV_KEY(klv.key, mxf_system_item_key_gc)) + mxf->current_partition->essence_offset = klv.offset; + else + mxf->current_partition->essence_offset = op1a_essence_offset; } }