From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 5078F40799 for ; Thu, 29 Feb 2024 22:12:03 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2E4B168D20F; Fri, 1 Mar 2024 00:12:01 +0200 (EET) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E51D868D0B7 for ; Fri, 1 Mar 2024 00:11:54 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id BEA76EA01D for ; Thu, 29 Feb 2024 23:11:54 +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 a-bX8oJtCXaE for ; Thu, 29 Feb 2024 23:11:51 +0100 (CET) Received: from iq (iq [217.27.212.140]) by iq.passwd.hu (Postfix) with ESMTPS id 3AE9EE9F49 for ; Thu, 29 Feb 2024 23:11:51 +0100 (CET) Date: Thu, 29 Feb 2024 23:11:51 +0100 (CET) From: Marton Balint To: FFmpeg development discussions and patches In-Reply-To: <20240219234240.21622-1-cus@passwd.hu> Message-ID: <2b4572d8-46c2-6a1c-6cfb-df2c92646138@passwd.hu> References: <20240219234240.21622-1-cus@passwd.hu> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH 1/2] avformat/mxfdec: remove resolve_strong_ref usage with AnyType 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Tue, 20 Feb 2024, Marton Balint wrote: > UUIDs do not have to be unique if their type sets them apart, so avoid using > AnyType, since we are only interested in specific types. Ping for the series, will apply in 1-2 days. Regards, Marton > > Signed-off-by: Marton Balint > --- > libavformat/mxf.h | 3 +-- > libavformat/mxfdec.c | 54 ++++++++++++++++---------------------------- > 2 files changed, 20 insertions(+), 37 deletions(-) > > diff --git a/libavformat/mxf.h b/libavformat/mxf.h > index 7dd1681e60..e16843214c 100644 > --- a/libavformat/mxf.h > +++ b/libavformat/mxf.h > @@ -30,8 +30,7 @@ > typedef AVUUID UID; > > enum MXFMetadataSetType { > - AnyType, > - MaterialPackage, > + MaterialPackage = 1, > SourcePackage, > SourceClip, > TimecodeComponent, > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c > index 446bcf3276..b7b9207a5b 100644 > --- a/libavformat/mxfdec.c > +++ b/libavformat/mxfdec.c > @@ -1582,7 +1582,7 @@ static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMe > return NULL; > for (i = mxf->metadata_sets_count - 1; i >= 0; i--) { > if (!memcmp(*strong_ref, mxf->metadata_sets[i]->uid, 16) && > - (type == AnyType || mxf->metadata_sets[i]->type == type)) { > + (mxf->metadata_sets[i]->type == type)) { > return mxf->metadata_sets[i]; > } > } > @@ -2221,22 +2221,17 @@ static int mxf_add_timecode_metadata(AVDictionary **pm, const char *key, AVTimec > > static MXFTimecodeComponent* mxf_resolve_timecode_component(MXFContext *mxf, UID *strong_ref) > { > - MXFStructuralComponent *component = NULL; > - MXFPulldownComponent *pulldown = NULL; > + MXFTimecodeComponent *timecode; > + MXFPulldownComponent *pulldown; > > - component = mxf_resolve_strong_ref(mxf, strong_ref, AnyType); > - if (!component) > - return NULL; > + timecode = mxf_resolve_strong_ref(mxf, strong_ref, TimecodeComponent); > + if (timecode) > + return timecode; > > - switch (component->meta.type) { > - case TimecodeComponent: > - return (MXFTimecodeComponent*)component; > - case PulldownComponent: /* timcode component may be located on a pulldown component */ > - pulldown = (MXFPulldownComponent*)component; > + pulldown = mxf_resolve_strong_ref(mxf, strong_ref, PulldownComponent); > + if (pulldown) > return mxf_resolve_strong_ref(mxf, &pulldown->input_segment_ref, TimecodeComponent); > - default: > - break; > - } > + > return NULL; > } > > @@ -2280,14 +2275,20 @@ static MXFDescriptor* mxf_resolve_descriptor(MXFContext *mxf, UID *strong_ref, i > return NULL; > } > > -static MXFStructuralComponent* mxf_resolve_essence_group_choice(MXFContext *mxf, MXFEssenceGroup *essence_group) > +static MXFStructuralComponent* mxf_resolve_sourceclip(MXFContext *mxf, UID *strong_ref) > { > MXFStructuralComponent *component = NULL; > MXFPackage *package = NULL; > MXFDescriptor *descriptor = NULL; > + MXFEssenceGroup *essence_group; > int i; > > - if (!essence_group || !essence_group->structural_components_count) > + component = mxf_resolve_strong_ref(mxf, strong_ref, SourceClip); > + if (component) > + return component; > + > + essence_group = mxf_resolve_strong_ref(mxf, strong_ref, EssenceGroup); > + if (!essence_group) > return NULL; > > /* essence groups contains multiple representations of the same media, > @@ -2304,24 +2305,7 @@ static MXFStructuralComponent* mxf_resolve_essence_group_choice(MXFContext *mxf, > if (descriptor) > return component; > } > - return NULL; > -} > - > -static MXFStructuralComponent* mxf_resolve_sourceclip(MXFContext *mxf, UID *strong_ref) > -{ > - MXFStructuralComponent *component = NULL; > > - component = mxf_resolve_strong_ref(mxf, strong_ref, AnyType); > - if (!component) > - return NULL; > - switch (component->meta.type) { > - case SourceClip: > - return component; > - case EssenceGroup: > - return mxf_resolve_essence_group_choice(mxf, (MXFEssenceGroup*) component); > - default: > - break; > - } > return NULL; > } > > @@ -3243,7 +3227,7 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = { > { { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x04,0x04,0x00 }, mxf_read_partition_pack }, > { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x2f,0x00 }, mxf_read_preface_metadata }, > { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x30,0x00 }, mxf_read_identification_metadata }, > - { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x18,0x00 }, mxf_read_content_storage, 0, AnyType }, > + { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x18,0x00 }, mxf_read_content_storage }, > { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x37,0x00 }, mxf_read_package, sizeof(MXFPackage), SourcePackage }, > { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x36,0x00 }, mxf_read_package, sizeof(MXFPackage), MaterialPackage }, > { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x0f,0x00 }, mxf_read_sequence, sizeof(MXFSequence), Sequence }, > @@ -3272,7 +3256,7 @@ static const MXFMetadataReadTableEntry mxf_metadata_read_table[] = { > { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x04,0x01,0x02,0x02,0x00,0x00 }, mxf_read_cryptographic_context, sizeof(MXFCryptoContext), CryptoContext }, > { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x10,0x01,0x00 }, mxf_read_index_table_segment, sizeof(MXFIndexTableSegment), IndexTableSegment }, > { { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x01,0x01,0x01,0x01,0x23,0x00 }, mxf_read_essence_container_data, sizeof(MXFEssenceContainerData), EssenceContainerData }, > - { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, NULL, 0, AnyType }, > + { { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, NULL }, > }; > > static int mxf_metadataset_init(MXFMetadataSet *ctx, enum MXFMetadataSetType type, MXFPartition *partition) > -- > 2.35.3 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".