gst/mxf/: "Generation UID" and "This Generation UID" are different so handle them different. Also both are not part o...

Original commit message from CVS:
* gst/mxf/Makefile.am:
* gst/mxf/mxfdemux.c:
* gst/mxf/mxfmetadata.c: (mxf_metadata_handle_tag),
(mxf_metadata_preface_handle_tag),
(mxf_metadata_identification_handle_tag),
(mxf_metadata_content_storage_handle_tag),
(mxf_metadata_essence_container_data_handle_tag),
(mxf_metadata_generic_package_handle_tag),
(mxf_metadata_track_handle_tag),
(mxf_metadata_sequence_handle_tag),
(mxf_metadata_structural_component_handle_tag),
(mxf_metadata_generic_descriptor_handle_tag),
(mxf_metadata_locator_handle_tag),
(mxf_metadata_locator_class_init):
* gst/mxf/mxfmetadata.h:
"Generation UID" and "This Generation UID" are different so handle
them different. Also both are not part of every metadata type.
This commit is contained in:
Sebastian Dröge 2009-01-05 13:41:07 +00:00
parent 9ebb543b50
commit 7dad262671
5 changed files with 153 additions and 21 deletions

View file

@ -1,3 +1,23 @@
2009-01-05 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/Makefile.am:
* gst/mxf/mxfdemux.c:
* gst/mxf/mxfmetadata.c: (mxf_metadata_handle_tag),
(mxf_metadata_preface_handle_tag),
(mxf_metadata_identification_handle_tag),
(mxf_metadata_content_storage_handle_tag),
(mxf_metadata_essence_container_data_handle_tag),
(mxf_metadata_generic_package_handle_tag),
(mxf_metadata_track_handle_tag),
(mxf_metadata_sequence_handle_tag),
(mxf_metadata_structural_component_handle_tag),
(mxf_metadata_generic_descriptor_handle_tag),
(mxf_metadata_locator_handle_tag),
(mxf_metadata_locator_class_init):
* gst/mxf/mxfmetadata.h:
"Generation UID" and "This Generation UID" are different so handle
them different. Also both are not part of every metadata type.
2009-01-05 Sebastian Dröge <sebastian.droege@collabora.co.uk>
Patch by: Sascha Hauer <s dot hauer at pengutronix dot de>

View file

@ -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

View file

@ -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;
}

View file

@ -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,

View file

@ -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 {