From patchwork Sun Aug 1 01:55:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 29156 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6c0f:0:0:0:0:0 with SMTP id a15csp475830ioh; Sat, 31 Jul 2021 18:55:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGISCGJC15Wcy12MW0/TcOl7ZUYorUEUqGg0gan4FJmCo4DZB3Q2Tirpv3yX2NkPF33k1H X-Received: by 2002:a17:906:76d4:: with SMTP id q20mr9714300ejn.369.1627782942951; Sat, 31 Jul 2021 18:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627782942; cv=none; d=google.com; s=arc-20160816; b=a67iKCXbBFhDj8iFwvBj/mfPTcMj4Sfve3989TCCFiVPVoNbK1Dw6o/l6s9GbS7Gp+ OxyM+pCJi2OfTrOzVgiSHvqzDSuZtuUIjUrKFAhFVsYij34Zma5CXB9GDIOyqmTUp5li /PysR6YpL7NLkfNT02fvaKyruwCEPOL8dOnkCom/YgXbVFJavZkn/uMPf6n3V7ghHGwX mN35Iy2iSS1uUzzr89VBB7R71X5oEqJxyIUS0BfBkUDm7ATDvl7Cl7vUUA0QyJWnttxn RRfQJ5IIkyxL7oUC87A/+bnWa42YJRG6QqBs2X9TtKxE3yLT6xv04f0/JI/9iXxLYdUD v0EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=UHY6mzr39joTXs7W9PRR++xiLrSMQFbZBhliOUVv1RY=; b=TW3xusmTV5sRRuZ7me6SwF4IXE1uocZkQiMCIEZ87E3LuLoyocKxW7nrN65HcmUUX9 v5x1BeRgXMMr3/4FcTN1Fllb1V1RGf9jgV8y+i7WYdfVaDW0jf7/FmKb9yFEWeIHEpuc i5XTBT15qvmyg3NYOOwqyJm2qVbbks7Fhbx6Ea1xAaIPSbteO5HPgHs8VDVi/IR7ZM5x pI49IPPypAGdXIZNjdWgjciOxOnbIW4taWyiDRdjkKnUR8bAeK8idYbL3M1rCPYwTB6F zruqB+EMfAJwWjUOxbAg5R1aMn0jOokqf3VMwpIPFSgFepulUsVo+CSFdfQcRrBLibyE gtEg== 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 l32si6085975ede.260.2021.07.31.18.55.42; Sat, 31 Jul 2021 18:55:42 -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; 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 A227D68A3B8; Sun, 1 Aug 2021 04:55:40 +0300 (EEST) 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 9D24768057F for ; Sun, 1 Aug 2021 04:55:33 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 6EA94E5B71; Sun, 1 Aug 2021 03:55:33 +0200 (CEST) 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 Ut47QZRqp-An; Sun, 1 Aug 2021 03:55:31 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 9EDA4E58D4; Sun, 1 Aug 2021 03:55:31 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sun, 1 Aug 2021 03:55:23 +0200 Message-Id: <20210801015523.18015-1-cus@passwd.hu> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avformat/mxfdec: make MXFMetadataSet part of all metadata sets X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 1qfiK4JDnvx5 The code expects every kind of metadata set to start with the generic metadata set attributes. Signed-off-by: Marton Balint --- libavformat/mxfdec.c | 66 ++++++++++++++------------------------------ 1 file changed, 21 insertions(+), 45 deletions(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index fd22680adb..34cbd2cd77 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -106,17 +106,19 @@ typedef struct MXFPartition { KLVPacket first_essence_klv; } MXFPartition; -typedef struct MXFCryptoContext { +typedef struct MXFMetadataSet { UID uid; MXFPartition *partition; enum MXFMetadataSetType type; +} MXFMetadataSet; + +typedef struct MXFCryptoContext { + MXFMetadataSet meta; UID source_container_ul; } MXFCryptoContext; typedef struct MXFStructuralComponent { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID source_package_ul; UID source_package_uid; UID data_definition_ul; @@ -126,9 +128,7 @@ typedef struct MXFStructuralComponent { } MXFStructuralComponent; typedef struct MXFSequence { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID data_definition_ul; UID *structural_components_refs; int structural_components_count; @@ -137,9 +137,7 @@ typedef struct MXFSequence { } MXFSequence; typedef struct MXFTimecodeComponent { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; int drop_frame; int start_frame; struct AVRational rate; @@ -147,33 +145,25 @@ typedef struct MXFTimecodeComponent { } MXFTimecodeComponent; typedef struct { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID input_segment_ref; } MXFPulldownComponent; typedef struct { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID *structural_components_refs; int structural_components_count; int64_t duration; } MXFEssenceGroup; typedef struct { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; char *name; char *value; } MXFTaggedValue; typedef struct { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; MXFSequence *sequence; /* mandatory, and only one */ UID sequence_ref; int track_id; @@ -190,9 +180,7 @@ typedef struct { } MXFTrack; typedef struct MXFDescriptor { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID essence_container_ul; UID essence_codec_ul; UID codec_ul; @@ -230,9 +218,7 @@ typedef struct MXFDescriptor { } MXFDescriptor; typedef struct MXFIndexTableSegment { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; int edit_unit_byte_count; int index_sid; int body_sid; @@ -246,9 +232,7 @@ typedef struct MXFIndexTableSegment { } MXFIndexTableSegment; typedef struct MXFPackage { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID package_uid; UID package_ul; UID *tracks_refs; @@ -261,21 +245,13 @@ typedef struct MXFPackage { } MXFPackage; typedef struct MXFEssenceContainerData { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; + MXFMetadataSet meta; UID package_uid; UID package_ul; int index_sid; int body_sid; } MXFEssenceContainerData; -typedef struct MXFMetadataSet { - UID uid; - MXFPartition *partition; - enum MXFMetadataSetType type; -} MXFMetadataSet; - /* decoded index table */ typedef struct MXFIndexTable { int index_sid; @@ -2060,7 +2036,7 @@ static MXFTimecodeComponent* mxf_resolve_timecode_component(MXFContext *mxf, UID if (!component) return NULL; - switch (component->type) { + switch (component->meta.type) { case TimecodeComponent: return (MXFTimecodeComponent*)component; case PulldownComponent: /* timcode component may be located on a pulldown component */ @@ -2096,7 +2072,7 @@ static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, MXFDescriptor if (!descriptor) return NULL; - if (descriptor->type == MultipleDescriptor) { + if (descriptor->meta.type == MultipleDescriptor) { for (i = 0; i < descriptor->sub_descriptors_count; i++) { sub_descriptor = mxf_resolve_strong_ref(mxf, &descriptor->sub_descriptors_refs[i], Descriptor); @@ -2108,7 +2084,7 @@ static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, MXFDescriptor return sub_descriptor; } } - } else if (descriptor->type == Descriptor) + } else if (descriptor->meta.type == Descriptor) return descriptor; return NULL; @@ -2148,7 +2124,7 @@ static MXFStructuralComponent* mxf_resolve_sourceclip(MXFContext *mxf, UID *stro component = mxf_resolve_strong_ref(mxf, strong_ref, AnyType); if (!component) return NULL; - switch (component->type) { + switch (component->meta.type) { case SourceClip: return component; case EssenceGroup: @@ -3312,7 +3288,7 @@ static int mxf_handle_missing_index_segment(MXFContext *mxf, AVStream *st) if (!track->index_sid) track->index_sid = track->body_sid; - segment->type = IndexTableSegment; + segment->meta.type = IndexTableSegment; /* stream will be treated as small EditUnitByteCount */ segment->edit_unit_byte_count = edit_unit_byte_count; segment->index_start_position = 0;