From patchwork Mon Jan 4 00:28:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 24771 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 2B40844907C for ; Mon, 4 Jan 2021 02:28:58 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 17E5E68A9D5; Mon, 4 Jan 2021 02:28:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B2EF068A990 for ; Mon, 4 Jan 2021 02:28:54 +0200 (EET) Received: by mail-wm1-f48.google.com with SMTP id c133so16828008wme.4 for ; Sun, 03 Jan 2021 16:28:54 -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:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; bh=WEXw+YzM7OPpLDzktcHxjf1K199JsJCFY1OKZAeZjLI=; b=teXkGdcqYDTNJcIYLPB8uh24jaWBHVH7MFgbOuWXXu3cKoaehhP2sqwH42aREwtyoR h6TsecX65HGJsmrvM//+EhbvXnwD1ZHhpoDOJHr1nFOTd6hW6qOODQm1OQf1rWf2HfYV YY7z/Zids+s0DSkwioOmQczwojGlYeJ4eoz5A9gxP9QE47L7Vo9B14II8YdJkuQOxEOt rqB+szmaxpV69yw2GTXECJqcanyh6t10X3ip+Vvil76zaeDA0ygbt/+MowxT8ZTi+vTd tdja7PPFczu9xZ3QTtIbAzD4/avKjwt/33ZrDNjuyiQa32vBg7Kg/J+0jBUH91PmUP3N i93g== 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:in-reply-to :references:reply-to:mime-version:content-transfer-encoding; bh=WEXw+YzM7OPpLDzktcHxjf1K199JsJCFY1OKZAeZjLI=; b=l1t2Jebr9oWPvEMNV4P8FJ4BNxsrXcajf95EHgg+0Ja6DcyA7zGrp+AfNsQLfqk+aP 0sVFIhI/smCeOpSBBTvPIEPoEslQi2BppcbICS4xzXd9/5CnnWlIOKLCxi9eaFx+MXet 00oNBWivq/SflxNphfrOYu+XCg94tINHHL/7c9JlO+S18L+KZBT1+iFToc1mTjHMTmQR D7qQcQvEyO1nLniuRWQail/a2KKljTvmJT+p81VtyHDWdJoWz3HK74zsgXkbFi51R/iH 5RYQLl3lFisTYNfEqmycSX8tI7giUbQLxV74rLOb5uydhBA9CFtPDVAf3GS/uJruLHWO KoFQ== X-Gm-Message-State: AOAM533KfG5acNR3p4LJsLjYdXQ6MS4SKX6khGKTcyZXI0jN8SgbSP5l nkYepbERQ0T6n8UKMDrwU0CKT0bABQM= X-Google-Smtp-Source: ABdhPJxFpWrEJjr0ARaJY91NAwpbH+K6y0DBKEZfis8z+N5EJ2T3WQ/sXUyQmxX588qPtJDIast92w== X-Received: by 2002:a1c:7dd8:: with SMTP id y207mr25138951wmc.181.1609720134040; Sun, 03 Jan 2021 16:28:54 -0800 (PST) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id u26sm30032046wmm.24.2021.01.03.16.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Jan 2021 16:28:53 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 4 Jan 2021 01:28:07 +0100 Message-Id: <20210104002816.2321974-7-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210104002816.2321974-1-andreas.rheinhardt@gmail.com> References: <20210104002816.2321974-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 07/16] avformat/mxf: Deduplicate random_index_pack_key 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Andreas Rheinhardt --- There is also another key that is duplicated: header_open_partition_key and mxf_jp2k_rsiz. But they seem to mean something different which makes me wonder if one of these keys is incorrect; I have therefore refrained from deduplicating them. libavformat/mxf.c | 2 ++ libavformat/mxf.h | 1 + libavformat/mxfdec.c | 3 +-- libavformat/mxfenc.c | 3 +-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/mxf.c b/libavformat/mxf.c index 88f69ebcfb..1901b24c68 100644 --- a/libavformat/mxf.c +++ b/libavformat/mxf.c @@ -24,6 +24,8 @@ const uint8_t ff_mxf_mastering_display_prefix[13] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x0e,0x04,0x20,0x04,0x01,0x01 }; +const uint8_t ff_mxf_random_index_pack_key[16] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00 }; + /* be careful to update references to this array if reordering */ /* local tags are dynamic and must not clash with others in mxfenc.c */ const MXFLocalTagPair ff_mxf_mastering_display_local_tags[4] = { diff --git a/libavformat/mxf.h b/libavformat/mxf.h index 7fa10bcca1..5219abc767 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -84,6 +84,7 @@ typedef struct MXFLocalTagPair { } MXFLocalTagPair; extern const uint8_t ff_mxf_mastering_display_prefix[13]; +extern const uint8_t ff_mxf_random_index_pack_key[16]; extern const MXFLocalTagPair ff_mxf_mastering_display_local_tags[4]; #define FF_MXF_MASTERING_CHROMA_DEN 50000 diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index b563f2abe1..784f43d6d1 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -328,7 +328,6 @@ static const uint8_t mxf_apple_coll_prefix[] = { 0x06,0x0e,0x2b,0x 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 }; static const uint8_t mxf_encrypted_triplet_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 }; static const uint8_t mxf_encrypted_essence_container[] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00 }; -static const uint8_t mxf_random_index_pack_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00 }; static const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00 }; static const uint8_t mxf_avid_project_name[] = { 0xa5,0xfb,0x7b,0x25,0xf6,0x15,0x94,0xb9,0x62,0xfc,0x37,0x17,0x49,0x2d,0x42,0xbf }; static const uint8_t mxf_jp2k_rsiz[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02,0x01,0x00 }; @@ -3264,7 +3263,7 @@ static void mxf_read_random_index_pack(AVFormatContext *s) goto end; avio_seek(s->pb, file_size - length, SEEK_SET); if (klv_read_packet(&klv, s->pb) < 0 || - !IS_KLV_KEY(klv.key, mxf_random_index_pack_key)) + !IS_KLV_KEY(klv.key, ff_mxf_random_index_pack_key)) goto end; if (klv.next_klv != file_size || klv.length <= 4 || (klv.length - 4) % 12) { av_log(s, AV_LOG_WARNING, "Invalid RIP KLV length\n"); diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index d8678c9d25..6c5331ad62 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -271,7 +271,6 @@ static const uint8_t opatom_ul[] = { 0x06,0x0E,0x2B,0x34,0x04, static const uint8_t footer_partition_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x04,0x04,0x00 }; // ClosedComplete static const uint8_t primer_pack_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x05,0x01,0x00 }; static const uint8_t index_table_segment_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x10,0x01,0x00 }; -static const uint8_t random_index_pack_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x11,0x01,0x00 }; static const uint8_t header_open_partition_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x02,0x01,0x00 }; // OpenIncomplete static const uint8_t header_closed_partition_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x02,0x01,0x01,0x02,0x04,0x00 }; // ClosedComplete static const uint8_t klv_fill_key[] = { 0x06,0x0E,0x2B,0x34,0x01,0x01,0x01,0x02,0x03,0x01,0x02,0x10,0x01,0x00,0x00,0x00 }; @@ -2956,7 +2955,7 @@ static void mxf_write_random_index_pack(AVFormatContext *s) uint64_t pos = avio_tell(pb); int i; - avio_write(pb, random_index_pack_key, 16); + avio_write(pb, ff_mxf_random_index_pack_key, 16); klv_encode_ber_length(pb, 28 + 12LL*mxf->body_partitions_count); if (mxf->edit_unit_byte_count && s->oformat != &ff_mxf_opatom_muxer)