avformat/mxfdec: remove resolve_strong_ref usage with AnyType
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. Signed-off-by: Marton Balint <cus@passwd.hu> (cherry picked from commit aa299faa9ad2b01010acc4641b1f215d60a1336b)
This commit is contained in:
parent
fafdcb2a35
commit
d3145298c0
@ -30,8 +30,7 @@
|
|||||||
typedef AVUUID UID;
|
typedef AVUUID UID;
|
||||||
|
|
||||||
enum MXFMetadataSetType {
|
enum MXFMetadataSetType {
|
||||||
AnyType,
|
MaterialPackage = 1,
|
||||||
MaterialPackage,
|
|
||||||
SourcePackage,
|
SourcePackage,
|
||||||
SourceClip,
|
SourceClip,
|
||||||
TimecodeComponent,
|
TimecodeComponent,
|
||||||
|
@ -1582,7 +1582,7 @@ static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMe
|
|||||||
return NULL;
|
return NULL;
|
||||||
for (i = mxf->metadata_sets_count - 1; i >= 0; i--) {
|
for (i = mxf->metadata_sets_count - 1; i >= 0; i--) {
|
||||||
if (!memcmp(*strong_ref, mxf->metadata_sets[i]->uid, 16) &&
|
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];
|
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)
|
static MXFTimecodeComponent* mxf_resolve_timecode_component(MXFContext *mxf, UID *strong_ref)
|
||||||
{
|
{
|
||||||
MXFStructuralComponent *component = NULL;
|
MXFTimecodeComponent *timecode;
|
||||||
MXFPulldownComponent *pulldown = NULL;
|
MXFPulldownComponent *pulldown;
|
||||||
|
|
||||||
component = mxf_resolve_strong_ref(mxf, strong_ref, AnyType);
|
timecode = mxf_resolve_strong_ref(mxf, strong_ref, TimecodeComponent);
|
||||||
if (!component)
|
if (timecode)
|
||||||
return NULL;
|
return timecode;
|
||||||
|
|
||||||
switch (component->meta.type) {
|
pulldown = mxf_resolve_strong_ref(mxf, strong_ref, PulldownComponent);
|
||||||
case TimecodeComponent:
|
if (pulldown)
|
||||||
return (MXFTimecodeComponent*)component;
|
|
||||||
case PulldownComponent: /* timcode component may be located on a pulldown component */
|
|
||||||
pulldown = (MXFPulldownComponent*)component;
|
|
||||||
return mxf_resolve_strong_ref(mxf, &pulldown->input_segment_ref, TimecodeComponent);
|
return mxf_resolve_strong_ref(mxf, &pulldown->input_segment_ref, TimecodeComponent);
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2280,14 +2275,20 @@ static MXFDescriptor* mxf_resolve_descriptor(MXFContext *mxf, UID *strong_ref, i
|
|||||||
return NULL;
|
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;
|
MXFStructuralComponent *component = NULL;
|
||||||
MXFPackage *package = NULL;
|
MXFPackage *package = NULL;
|
||||||
MXFDescriptor *descriptor = NULL;
|
MXFDescriptor *descriptor = NULL;
|
||||||
|
MXFEssenceGroup *essence_group;
|
||||||
int i;
|
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;
|
return NULL;
|
||||||
|
|
||||||
/* essence groups contains multiple representations of the same media,
|
/* essence groups contains multiple representations of the same media,
|
||||||
@ -2304,24 +2305,7 @@ static MXFStructuralComponent* mxf_resolve_essence_group_choice(MXFContext *mxf,
|
|||||||
if (descriptor)
|
if (descriptor)
|
||||||
return component;
|
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;
|
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,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,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,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,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,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 },
|
{ { 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,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,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 },
|
{ { 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)
|
static int mxf_metadataset_init(MXFMetadataSet *ctx, enum MXFMetadataSetType type, MXFPartition *partition)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user