avformat/mxfdec: make MXFMetadataSet part of all metadata sets

The code expects every kind of metadata set to start with the generic metadata
set attributes.

Signed-off-by: Marton Balint <cus@passwd.hu>
pull/364/head
Marton Balint 4 years ago
parent 5fdb5ed613
commit 188e17ac85
  1. 66
      libavformat/mxfdec.c

@ -106,17 +106,19 @@ typedef struct MXFPartition {
KLVPacket first_essence_klv; KLVPacket first_essence_klv;
} MXFPartition; } MXFPartition;
typedef struct MXFCryptoContext { typedef struct MXFMetadataSet {
UID uid; UID uid;
MXFPartition *partition; MXFPartition *partition;
enum MXFMetadataSetType type; enum MXFMetadataSetType type;
} MXFMetadataSet;
typedef struct MXFCryptoContext {
MXFMetadataSet meta;
UID source_container_ul; UID source_container_ul;
} MXFCryptoContext; } MXFCryptoContext;
typedef struct MXFStructuralComponent { typedef struct MXFStructuralComponent {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
UID source_package_ul; UID source_package_ul;
UID source_package_uid; UID source_package_uid;
UID data_definition_ul; UID data_definition_ul;
@ -126,9 +128,7 @@ typedef struct MXFStructuralComponent {
} MXFStructuralComponent; } MXFStructuralComponent;
typedef struct MXFSequence { typedef struct MXFSequence {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
UID data_definition_ul; UID data_definition_ul;
UID *structural_components_refs; UID *structural_components_refs;
int structural_components_count; int structural_components_count;
@ -137,9 +137,7 @@ typedef struct MXFSequence {
} MXFSequence; } MXFSequence;
typedef struct MXFTimecodeComponent { typedef struct MXFTimecodeComponent {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
int drop_frame; int drop_frame;
int start_frame; int start_frame;
struct AVRational rate; struct AVRational rate;
@ -147,33 +145,25 @@ typedef struct MXFTimecodeComponent {
} MXFTimecodeComponent; } MXFTimecodeComponent;
typedef struct { typedef struct {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
UID input_segment_ref; UID input_segment_ref;
} MXFPulldownComponent; } MXFPulldownComponent;
typedef struct { typedef struct {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
UID *structural_components_refs; UID *structural_components_refs;
int structural_components_count; int structural_components_count;
int64_t duration; int64_t duration;
} MXFEssenceGroup; } MXFEssenceGroup;
typedef struct { typedef struct {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
char *name; char *name;
char *value; char *value;
} MXFTaggedValue; } MXFTaggedValue;
typedef struct { typedef struct {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
MXFSequence *sequence; /* mandatory, and only one */ MXFSequence *sequence; /* mandatory, and only one */
UID sequence_ref; UID sequence_ref;
int track_id; int track_id;
@ -190,9 +180,7 @@ typedef struct {
} MXFTrack; } MXFTrack;
typedef struct MXFDescriptor { typedef struct MXFDescriptor {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
UID essence_container_ul; UID essence_container_ul;
UID essence_codec_ul; UID essence_codec_ul;
UID codec_ul; UID codec_ul;
@ -230,9 +218,7 @@ typedef struct MXFDescriptor {
} MXFDescriptor; } MXFDescriptor;
typedef struct MXFIndexTableSegment { typedef struct MXFIndexTableSegment {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
int edit_unit_byte_count; int edit_unit_byte_count;
int index_sid; int index_sid;
int body_sid; int body_sid;
@ -246,9 +232,7 @@ typedef struct MXFIndexTableSegment {
} MXFIndexTableSegment; } MXFIndexTableSegment;
typedef struct MXFPackage { typedef struct MXFPackage {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
UID package_uid; UID package_uid;
UID package_ul; UID package_ul;
UID *tracks_refs; UID *tracks_refs;
@ -261,21 +245,13 @@ typedef struct MXFPackage {
} MXFPackage; } MXFPackage;
typedef struct MXFEssenceContainerData { typedef struct MXFEssenceContainerData {
UID uid; MXFMetadataSet meta;
MXFPartition *partition;
enum MXFMetadataSetType type;
UID package_uid; UID package_uid;
UID package_ul; UID package_ul;
int index_sid; int index_sid;
int body_sid; int body_sid;
} MXFEssenceContainerData; } MXFEssenceContainerData;
typedef struct MXFMetadataSet {
UID uid;
MXFPartition *partition;
enum MXFMetadataSetType type;
} MXFMetadataSet;
/* decoded index table */ /* decoded index table */
typedef struct MXFIndexTable { typedef struct MXFIndexTable {
int index_sid; int index_sid;
@ -2060,7 +2036,7 @@ static MXFTimecodeComponent* mxf_resolve_timecode_component(MXFContext *mxf, UID
if (!component) if (!component)
return NULL; return NULL;
switch (component->type) { switch (component->meta.type) {
case TimecodeComponent: case TimecodeComponent:
return (MXFTimecodeComponent*)component; return (MXFTimecodeComponent*)component;
case PulldownComponent: /* timcode component may be located on a pulldown 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) if (!descriptor)
return NULL; return NULL;
if (descriptor->type == MultipleDescriptor) { if (descriptor->meta.type == MultipleDescriptor) {
for (i = 0; i < descriptor->sub_descriptors_count; i++) { for (i = 0; i < descriptor->sub_descriptors_count; i++) {
sub_descriptor = mxf_resolve_strong_ref(mxf, &descriptor->sub_descriptors_refs[i], Descriptor); 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; return sub_descriptor;
} }
} }
} else if (descriptor->type == Descriptor) } else if (descriptor->meta.type == Descriptor)
return descriptor; return descriptor;
return NULL; return NULL;
@ -2148,7 +2124,7 @@ static MXFStructuralComponent* mxf_resolve_sourceclip(MXFContext *mxf, UID *stro
component = mxf_resolve_strong_ref(mxf, strong_ref, AnyType); component = mxf_resolve_strong_ref(mxf, strong_ref, AnyType);
if (!component) if (!component)
return NULL; return NULL;
switch (component->type) { switch (component->meta.type) {
case SourceClip: case SourceClip:
return component; return component;
case EssenceGroup: case EssenceGroup:
@ -3312,7 +3288,7 @@ static int mxf_handle_missing_index_segment(MXFContext *mxf, AVStream *st)
if (!track->index_sid) if (!track->index_sid)
track->index_sid = track->body_sid; track->index_sid = track->body_sid;
segment->type = IndexTableSegment; segment->meta.type = IndexTableSegment;
/* stream will be treated as small EditUnitByteCount */ /* stream will be treated as small EditUnitByteCount */
segment->edit_unit_byte_count = edit_unit_byte_count; segment->edit_unit_byte_count = edit_unit_byte_count;
segment->index_start_position = 0; segment->index_start_position = 0;

Loading…
Cancel
Save