diff options
Diffstat (limited to 'gst/mxf')
-rw-r--r-- | gst/mxf/Makefile.am | 6 | ||||
-rw-r--r-- | gst/mxf/mxfdemux.c | 18 | ||||
-rw-r--r-- | gst/mxf/mxfmetadata.c | 109 | ||||
-rw-r--r-- | gst/mxf/mxfmetadata.h | 21 |
4 files changed, 133 insertions, 21 deletions
diff --git a/gst/mxf/Makefile.am b/gst/mxf/Makefile.am index 397d41a0..1a061387 100644 --- a/gst/mxf/Makefile.am +++ b/gst/mxf/Makefile.am @@ -12,7 +12,8 @@ libgstmxf_la_SOURCES = \ mxfd10.c \ mxfup.c \ mxfvc3.c \ - mxfmetadata.c + mxfmetadata.c \ + mxfdms1.c libgstmxf_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) libgstmxf_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \ @@ -31,5 +32,6 @@ noinst_HEADERS = \ mxfup.h \ mxfvc3.h \ mxftypes.h \ - mxfmetadata.h + mxfmetadata.h \ + mxfdms1.h diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 6aa18428..2ddc9d3e 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -35,8 +35,6 @@ * - Differentiate UL and UUIDs, the former can define an object system * (i.e. mxf_ul_is_a() and friends could be implemented), see SMPTE S336M. * The latter are just 16 byte unique identifiers - * - Differentiate between "Generation UID" and "This Generation UID" and move - * them from MXFMetadataBase to MXFMetadata*. * - Check everything for correctness vs. SMPTE S336M, some things can probably * be generalized/simplified * - Seeking support: IndexTableSegments and skip-to-position seeks, needs correct @@ -560,11 +558,11 @@ gst_mxf_demux_choose_package (GstMXFDemux * demux) for (i = 0; i < demux->preface->content_storage->n_packages; i++) { if (demux->preface->content_storage->packages[i] && - MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface-> - content_storage->packages[i])) { + MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface->content_storage-> + packages[i])) { ret = - MXF_METADATA_GENERIC_PACKAGE (demux->preface-> - content_storage->packages[i]); + MXF_METADATA_GENERIC_PACKAGE (demux->preface->content_storage-> + packages[i]); break; } } @@ -977,8 +975,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) GST_DEBUG_OBJECT (demux, "Switching to component %u", pad->current_component); pad->component = - MXF_METADATA_SOURCE_CLIP (sequence-> - structural_components[pad->current_component]); + MXF_METADATA_SOURCE_CLIP (sequence->structural_components[pad-> + current_component]); if (pad->component == NULL) { GST_ERROR_OBJECT (demux, "No such structural component"); return GST_FLOW_ERROR; @@ -986,8 +984,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) if (!pad->component->source_package || !pad->component->source_package->top_level - || !MXF_METADATA_GENERIC_PACKAGE (pad->component->source_package)-> - tracks) { + || !MXF_METADATA_GENERIC_PACKAGE (pad->component-> + source_package)->tracks) { GST_ERROR_OBJECT (demux, "Invalid component"); return GST_FLOW_ERROR; } diff --git a/gst/mxf/mxfmetadata.c b/gst/mxf/mxfmetadata.c index ade8f056..02f301a6 100644 --- a/gst/mxf/mxfmetadata.c +++ b/gst/mxf/mxfmetadata.c @@ -151,14 +151,6 @@ mxf_metadata_handle_tag (MXFMetadataBase * metadata, MXFPrimerPack * primer, GST_DEBUG (" instance uid = %s", mxf_ul_to_string (&self->parent.instance_uid, str)); break; - case 0x0102: - case 0x3c09: - if (tag_size != 16) - goto error; - memcpy (&self->parent.generation_uid, tag_data, 16); - GST_DEBUG (" generation uid = %s", - mxf_ul_to_string (&self->parent.generation_uid, str)); - break; default: ret = MXF_METADATA_BASE_CLASS (mxf_metadata_parent_class)->handle_tag @@ -335,6 +327,13 @@ mxf_metadata_preface_handle_tag (MXFMetadataBase * metadata, gboolean ret = TRUE; switch (tag) { + case 0x0102: + if (tag_size != 16) + goto error; + memcpy (&self->generation_uid, tag_data, 16); + GST_DEBUG (" generation uid = %s", + mxf_ul_to_string (&self->generation_uid, str)); + break; case 0x3b02: if (!mxf_timestamp_parse (&self->last_modified_date, tag_data, tag_size)) goto error; @@ -574,6 +573,13 @@ mxf_metadata_identification_handle_tag (MXFMetadataBase * metadata, #endif switch (tag) { + case 0x3c09: + if (tag_size != 16) + goto error; + memcpy (&self->this_generation_uid, tag_data, 16); + GST_DEBUG (" this generation uid = %s", + mxf_ul_to_string (&self->this_generation_uid, str)); + break; case 0x3c01: self->company_name = mxf_utf16_to_utf8 (tag_data, tag_size); GST_DEBUG (" company name = %s", GST_STR_NULL (self->company_name)); @@ -695,6 +701,13 @@ mxf_metadata_content_storage_handle_tag (MXFMetadataBase * metadata, #endif switch (tag) { + case 0x0102: + if (tag_size != 16) + goto error; + memcpy (&self->generation_uid, tag_data, 16); + GST_DEBUG (" generation uid = %s", + mxf_ul_to_string (&self->generation_uid, str)); + break; case 0x1901:{ guint32 len; guint i; @@ -854,6 +867,13 @@ mxf_metadata_essence_container_data_handle_tag (MXFMetadataBase * metadata, #endif switch (tag) { + case 0x0102: + if (tag_size != 16) + goto error; + memcpy (&self->generation_uid, tag_data, 16); + GST_DEBUG (" generation uid = %s", + mxf_ul_to_string (&self->generation_uid, str)); + break; case 0x2701: if (tag_size != 32) goto error; @@ -976,6 +996,13 @@ mxf_metadata_generic_package_handle_tag (MXFMetadataBase * metadata, #endif switch (tag) { + case 0x0102: + if (tag_size != 16) + goto error; + memcpy (&self->generation_uid, tag_data, 16); + GST_DEBUG (" generation uid = %s", + mxf_ul_to_string (&self->generation_uid, str)); + break; case 0x4401: if (tag_size != 32) goto error; @@ -1374,6 +1401,13 @@ mxf_metadata_track_handle_tag (MXFMetadataBase * metadata, #endif switch (tag) { + case 0x0102: + if (tag_size != 16) + goto error; + memcpy (&self->generation_uid, tag_data, 16); + GST_DEBUG (" generation uid = %s", + mxf_ul_to_string (&self->generation_uid, str)); + break; case 0x4801: if (tag_size != 4) goto error; @@ -1668,6 +1702,13 @@ mxf_metadata_sequence_handle_tag (MXFMetadataBase * metadata, #endif switch (tag) { + case 0x0102: + if (tag_size != 16) + goto error; + memcpy (&self->generation_uid, tag_data, 16); + GST_DEBUG (" generation uid = %s", + mxf_ul_to_string (&self->generation_uid, str)); + break; case 0x0201: if (tag_size != 16) goto error; @@ -1796,6 +1837,13 @@ mxf_metadata_structural_component_handle_tag (MXFMetadataBase * metadata, #endif switch (tag) { + case 0x0102: + if (tag_size != 16) + goto error; + memcpy (&self->generation_uid, tag_data, 16); + GST_DEBUG (" generation uid = %s", + mxf_ul_to_string (&self->generation_uid, str)); + break; case 0x0201: if (tag_size != 16) goto error; @@ -2270,6 +2318,13 @@ mxf_metadata_generic_descriptor_handle_tag (MXFMetadataBase * metadata, #endif switch (tag) { + case 0x0102: + if (tag_size != 16) + goto error; + memcpy (&self->generation_uid, tag_data, 16); + GST_DEBUG (" generation uid = %s", + mxf_ul_to_string (&self->generation_uid, str)); + break; case 0x2f01:{ guint32 len; guint i; @@ -3276,6 +3331,41 @@ mxf_metadata_multiple_descriptor_class_init (MXFMetadataMultipleDescriptorClass G_DEFINE_ABSTRACT_TYPE (MXFMetadataLocator, mxf_metadata_locator, MXF_TYPE_METADATA); +static gboolean +mxf_metadata_locator_handle_tag (MXFMetadataBase * metadata, + MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data, + guint tag_size) +{ + MXFMetadataLocator *self = MXF_METADATA_LOCATOR (metadata); + gboolean ret = TRUE; +#ifndef GST_DISABLE_GST_DEBUG + gchar str[48]; +#endif + + switch (tag) { + case 0x0102: + if (tag_size != 16) + goto error; + memcpy (&self->generation_uid, tag_data, 16); + GST_DEBUG (" generation uid = %s", + mxf_ul_to_string (&self->generation_uid, str)); + break; + default: + ret = + MXF_METADATA_BASE_CLASS + (mxf_metadata_locator_parent_class)->handle_tag (metadata, + primer, tag, tag_data, tag_size); + break; + } + + return ret; + +error: + GST_ERROR ("Invalid locator local tag 0x%04x of size %u", tag, tag_size); + + return FALSE; +} + static void mxf_metadata_locator_init (MXFMetadataLocator * self) { @@ -3284,6 +3374,9 @@ mxf_metadata_locator_init (MXFMetadataLocator * self) static void mxf_metadata_locator_class_init (MXFMetadataLocatorClass * klass) { + MXFMetadataBaseClass *metadata_base_class = (MXFMetadataBaseClass *) klass; + + metadata_base_class->handle_tag = mxf_metadata_locator_handle_tag; } G_DEFINE_TYPE (MXFMetadataTextLocator, mxf_metadata_text_locator, diff --git a/gst/mxf/mxfmetadata.h b/gst/mxf/mxfmetadata.h index f0797572..e5c455e8 100644 --- a/gst/mxf/mxfmetadata.h +++ b/gst/mxf/mxfmetadata.h @@ -343,7 +343,6 @@ struct _MXFMetadataBase { GstMiniObject parent; MXFUL instance_uid; - MXFUL generation_uid; MXFMetadataBaseResolveState resolved; @@ -366,6 +365,8 @@ struct _MXFMetadata { struct _MXFMetadataPreface { MXFMetadata parent; + MXFUL generation_uid; + MXFTimestamp last_modified_date; guint16 version; @@ -393,6 +394,8 @@ struct _MXFMetadataPreface { struct _MXFMetadataIdentification { MXFMetadata parent; + MXFUL this_generation_uid; + gchar *company_name; gchar *product_name; @@ -412,6 +415,8 @@ struct _MXFMetadataIdentification { struct _MXFMetadataContentStorage { MXFMetadata parent; + MXFUL generation_uid; + guint32 n_packages; MXFUL *packages_uids; MXFMetadataGenericPackage **packages; @@ -424,6 +429,8 @@ struct _MXFMetadataContentStorage { struct _MXFMetadataEssenceContainerData { MXFMetadata parent; + MXFUL generation_uid; + MXFUMID linked_package_uid; MXFMetadataSourcePackage *linked_package; @@ -434,6 +441,8 @@ struct _MXFMetadataEssenceContainerData { struct _MXFMetadataGenericPackage { MXFMetadata parent; + MXFUL generation_uid; + MXFUMID package_uid; gchar *name; @@ -477,6 +486,8 @@ typedef enum { struct _MXFMetadataTrack { MXFMetadata parent; + MXFUL generation_uid; + guint32 track_id; guint32 track_number; @@ -508,6 +519,8 @@ struct _MXFMetadataEventTrack { struct _MXFMetadataSequence { MXFMetadata parent; + MXFUL generation_uid; + MXFUL data_definition; gint64 duration; @@ -520,6 +533,8 @@ struct _MXFMetadataSequence { struct _MXFMetadataStructuralComponent { MXFMetadata parent; + MXFUL generation_uid; + MXFUL data_definition; gint64 duration; }; @@ -565,6 +580,8 @@ struct _MXFMetadataDMSegment { struct _MXFMetadataGenericDescriptor { MXFMetadata parent; + MXFUL generation_uid; + guint32 n_locators; MXFUL *locators_uids; MXFMetadataLocator **locators; @@ -681,6 +698,8 @@ struct _MXFMetadataMultipleDescriptor { struct _MXFMetadataLocator { MXFMetadata parent; + + MXFUL generation_uid; }; struct _MXFMetadataNetworkLocator { |