Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Marton Balint <cus@passwd.hu>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 1/2] avformat/mxfdec: remove resolve_strong_ref usage with AnyType
Date: Thu, 29 Feb 2024 23:11:51 +0100 (CET)
Message-ID: <2b4572d8-46c2-6a1c-6cfb-df2c92646138@passwd.hu> (raw)
In-Reply-To: <20240219234240.21622-1-cus@passwd.hu>



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 <cus@passwd.hu>
> ---
> 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".

      parent reply	other threads:[~2024-02-29 22:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 23:42 Marton Balint
2024-02-19 23:42 ` [FFmpeg-devel] [PATCH 2/2] avformat/mxfdec: track metadata sets by their type Marton Balint
2024-02-29 22:11 ` Marton Balint [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2b4572d8-46c2-6a1c-6cfb-df2c92646138@passwd.hu \
    --to=cus@passwd.hu \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git