mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
mxfdemux: Handle sub-descriptor in generic descriptors
Specificied in S377-1 (2019) B.2 Generic Descriptor This is one of the ways to store more "sub descriptors" for a single track Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3899>
This commit is contained in:
parent
56a50c3008
commit
206ed12368
5 changed files with 72 additions and 4 deletions
|
@ -1201,9 +1201,21 @@ gst_mxf_demux_show_topology (GstMXFDemux * demux)
|
||||||
}
|
}
|
||||||
for (di = 0; di < track->n_descriptor; di++) {
|
for (di = 0; di < track->n_descriptor; di++) {
|
||||||
MXFMetadataFileDescriptor *desc = track->descriptor[di];
|
MXFMetadataFileDescriptor *desc = track->descriptor[di];
|
||||||
|
MXFMetadataGenericDescriptor *generic =
|
||||||
|
(MXFMetadataGenericDescriptor *) desc;
|
||||||
|
guint subdi;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (demux, " Descriptor %s %s",
|
GST_DEBUG_OBJECT (demux, " Descriptor %s %s",
|
||||||
g_type_name (G_OBJECT_TYPE (desc)),
|
g_type_name (G_OBJECT_TYPE (desc)),
|
||||||
mxf_ul_to_string (&desc->essence_container, str));
|
mxf_ul_to_string (&desc->essence_container, str));
|
||||||
|
for (subdi = 0; subdi < generic->n_sub_descriptors; subdi++) {
|
||||||
|
MXFMetadataGenericDescriptor *subdesc =
|
||||||
|
generic->sub_descriptors[subdi];
|
||||||
|
if (subdesc) {
|
||||||
|
GST_DEBUG_OBJECT (demux, " Sub-Descriptor %s",
|
||||||
|
g_type_name (G_OBJECT_TYPE (subdesc)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (demux,
|
GST_DEBUG_OBJECT (demux,
|
||||||
" Sequence duration:%" G_GINT64_FORMAT
|
" Sequence duration:%" G_GINT64_FORMAT
|
||||||
|
|
|
@ -3912,6 +3912,11 @@ mxf_metadata_generic_descriptor_finalize (GObject * object)
|
||||||
g_free (self->locators);
|
g_free (self->locators);
|
||||||
self->locators = NULL;
|
self->locators = NULL;
|
||||||
|
|
||||||
|
g_free (self->sub_descriptors_uids);
|
||||||
|
self->sub_descriptors_uids = NULL;
|
||||||
|
g_free (self->sub_descriptors);
|
||||||
|
self->sub_descriptors = NULL;
|
||||||
|
|
||||||
G_OBJECT_CLASS (mxf_metadata_generic_descriptor_parent_class)->finalize
|
G_OBJECT_CLASS (mxf_metadata_generic_descriptor_parent_class)->finalize
|
||||||
(object);
|
(object);
|
||||||
}
|
}
|
||||||
|
@ -3946,12 +3951,32 @@ mxf_metadata_generic_descriptor_handle_tag (MXFMetadataBase * metadata,
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
{
|
||||||
|
MXFUL *tag_ul = mxf_primer_tag_to_ul (primer, tag);
|
||||||
|
if (tag_ul && mxf_ul_is_equal (tag_ul, MXF_UL (SUB_DESCRIPTORS_ARRAY))) {
|
||||||
|
if (!mxf_uuid_array_parse (&self->sub_descriptors_uids,
|
||||||
|
&self->n_sub_descriptors, tag_data, tag_size))
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
GST_DEBUG (" number of sub_descriptors = %u", self->n_sub_descriptors);
|
||||||
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
for (i = 0; i < self->n_sub_descriptors; i++) {
|
||||||
|
GST_DEBUG (" sub descriptor %u = %s", i,
|
||||||
|
mxf_uuid_to_string (&self->sub_descriptors_uids[i], str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
ret =
|
ret =
|
||||||
MXF_METADATA_BASE_CLASS
|
MXF_METADATA_BASE_CLASS
|
||||||
(mxf_metadata_generic_descriptor_parent_class)->handle_tag (metadata,
|
(mxf_metadata_generic_descriptor_parent_class)->handle_tag
|
||||||
primer, tag, tag_data, tag_size);
|
(metadata, primer, tag, tag_data, tag_size);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -4000,6 +4025,29 @@ mxf_metadata_generic_descriptor_resolve (MXFMetadataBase * m,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* this memory reuse is done in the same way as for locators, but the reason
|
||||||
|
* isn't 100% clear. This might not be needed anymore */
|
||||||
|
if (self->sub_descriptors)
|
||||||
|
memset (self->sub_descriptors, 0,
|
||||||
|
sizeof (gpointer) * self->n_sub_descriptors);
|
||||||
|
else
|
||||||
|
self->sub_descriptors =
|
||||||
|
g_new0 (MXFMetadataGenericDescriptor *, self->n_sub_descriptors);
|
||||||
|
for (i = 0; i < self->n_sub_descriptors; i++) {
|
||||||
|
current = g_hash_table_lookup (metadata, &self->sub_descriptors_uids[i]);
|
||||||
|
if (current && MXF_IS_METADATA_GENERIC_DESCRIPTOR (current)) {
|
||||||
|
if (mxf_metadata_base_resolve (current, metadata)) {
|
||||||
|
self->sub_descriptors[i] = MXF_METADATA_GENERIC_DESCRIPTOR (current);
|
||||||
|
} else {
|
||||||
|
GST_WARNING ("Couldn't resolve sub_descriptor %s",
|
||||||
|
mxf_uuid_to_string (&self->sub_descriptors_uids[i], str));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GST_WARNING ("Sub_Descriptor %s not found",
|
||||||
|
mxf_uuid_to_string (&self->sub_descriptors_uids[i], str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
MXF_METADATA_BASE_CLASS
|
MXF_METADATA_BASE_CLASS
|
||||||
(mxf_metadata_generic_descriptor_parent_class)->resolve (m, metadata);
|
(mxf_metadata_generic_descriptor_parent_class)->resolve (m, metadata);
|
||||||
|
|
|
@ -625,6 +625,10 @@ struct _MXFMetadataGenericDescriptor {
|
||||||
guint32 n_locators;
|
guint32 n_locators;
|
||||||
MXFUUID *locators_uids;
|
MXFUUID *locators_uids;
|
||||||
MXFMetadataLocator **locators;
|
MXFMetadataLocator **locators;
|
||||||
|
|
||||||
|
MXFUUID *sub_descriptors_uids;
|
||||||
|
guint32 n_sub_descriptors;
|
||||||
|
MXFMetadataGenericDescriptor **sub_descriptors;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _MXFMetadataFileDescriptor {
|
struct _MXFMetadataFileDescriptor {
|
||||||
|
|
|
@ -275,6 +275,9 @@ const MXFUL _mxf_ul_table[] = {
|
||||||
/* LOCATORS */
|
/* LOCATORS */
|
||||||
{{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
|
{{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x02,
|
||||||
0x06, 0x01, 0x01, 0x04, 0x06, 0x03, 0x00, 0x00}},
|
0x06, 0x01, 0x01, 0x04, 0x06, 0x03, 0x00, 0x00}},
|
||||||
|
/* SUB_DESCRIPTORS_ARRAY */
|
||||||
|
{{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x09,
|
||||||
|
0x06, 0x01, 0x01, 0x04, 0x06, 0x10, 0x00, 0x00}},
|
||||||
/* File descriptor */
|
/* File descriptor */
|
||||||
/* LINKED_TRACK_ID */
|
/* LINKED_TRACK_ID */
|
||||||
{{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
|
{{0x06, 0x0E, 0x2B, 0x34, 0x01, 0x01, 0x01, 0x05,
|
||||||
|
|
|
@ -106,6 +106,7 @@ typedef enum {
|
||||||
MXF_UL_DM_SEGMENT_TRACK_IDS,
|
MXF_UL_DM_SEGMENT_TRACK_IDS,
|
||||||
MXF_UL_DM_FRAMEWORK,
|
MXF_UL_DM_FRAMEWORK,
|
||||||
MXF_UL_LOCATORS,
|
MXF_UL_LOCATORS,
|
||||||
|
MXF_UL_SUB_DESCRIPTORS_ARRAY,
|
||||||
MXF_UL_LINKED_TRACK_ID,
|
MXF_UL_LINKED_TRACK_ID,
|
||||||
MXF_UL_SAMPLE_RATE,
|
MXF_UL_SAMPLE_RATE,
|
||||||
MXF_UL_CONTAINER_DURATION,
|
MXF_UL_CONTAINER_DURATION,
|
||||||
|
|
Loading…
Reference in a new issue