gst/mxf/: Implement parsing of the generic data essence descriptor.

Original commit message from CVS:
* gst/mxf/mxfdemux.c: (gst_mxf_demux_reset_metadata),
(gst_mxf_demux_handle_metadata_generic_data_essence_descriptor),
(gst_mxf_demux_handle_header_metadata_resolve_references),
(gst_mxf_demux_handle_metadata):
* gst/mxf/mxfdemux.h:
* gst/mxf/mxfparse.c:
(mxf_metadata_generic_data_essence_descriptor_handle_tag),
(mxf_metadata_generic_data_essence_descriptor_reset):
* gst/mxf/mxfparse.h:
* gst/mxf/mxftypes.h:
Implement parsing of the generic data essence descriptor.
This commit is contained in:
Sebastian Dröge 2008-12-05 12:26:02 +00:00
parent 278604dfa1
commit 6f15343df1
6 changed files with 126 additions and 39 deletions

View file

@ -1,3 +1,17 @@
2008-12-05 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/mxfdemux.c: (gst_mxf_demux_reset_metadata),
(gst_mxf_demux_handle_metadata_generic_data_essence_descriptor),
(gst_mxf_demux_handle_header_metadata_resolve_references),
(gst_mxf_demux_handle_metadata):
* gst/mxf/mxfdemux.h:
* gst/mxf/mxfparse.c:
(mxf_metadata_generic_data_essence_descriptor_handle_tag),
(mxf_metadata_generic_data_essence_descriptor_reset):
* gst/mxf/mxfparse.h:
* gst/mxf/mxftypes.h:
Implement parsing of the generic data essence descriptor.
2008-12-05 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/mxfdemux.c:

View file

@ -294,6 +294,15 @@ gst_mxf_demux_reset_metadata (GstMXFDemux * demux)
demux->multiple_descriptor = NULL;
}
if (demux->generic_data_essence_descriptor) {
for (i = 0; i < demux->generic_data_essence_descriptor->len; i++)
mxf_metadata_generic_data_essence_descriptor_reset (&g_array_index
(demux->generic_data_essence_descriptor,
MXFMetadataGenericDataEssenceDescriptor, i));
g_array_free (demux->generic_data_essence_descriptor, TRUE);
demux->generic_data_essence_descriptor = NULL;
}
if (demux->generic_picture_essence_descriptor) {
for (i = 0; i < demux->generic_picture_essence_descriptor->len; i++)
mxf_metadata_generic_picture_essence_descriptor_reset (&g_array_index
@ -785,38 +794,6 @@ gst_mxf_demux_handle_metadata_structural_component (GstMXFDemux * demux,
return GST_FLOW_OK;
}
static GstFlowReturn
gst_mxf_demux_handle_metadata_generic_descriptor (GstMXFDemux * demux,
const MXFUL * key, guint16 type, GstBuffer * buffer)
{
MXFMetadataGenericDescriptor descriptor;
memset (&descriptor, 0, sizeof (descriptor));
GST_DEBUG_OBJECT (demux,
"Handling metadata generic descriptor of size %u"
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
GST_BUFFER_SIZE (buffer), demux->offset, type);
if (!mxf_metadata_descriptor_parse (key,
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
(MXFMetadataDescriptorHandleTag)
mxf_metadata_generic_descriptor_handle_tag,
(MXFMetadataDescriptorReset) mxf_metadata_generic_descriptor_reset)) {
GST_ERROR_OBJECT (demux, "Parsing metadata generic descriptor failed");
return GST_FLOW_ERROR;
}
if (!demux->generic_descriptor)
demux->generic_descriptor =
g_array_new (FALSE, FALSE, sizeof (MXFMetadataGenericDescriptor));
g_array_append_val (demux->generic_descriptor, descriptor);
return GST_FLOW_OK;
}
static GstFlowReturn
gst_mxf_demux_handle_metadata_file_descriptor (GstMXFDemux * demux,
const MXFUL * key, guint16 type, GstBuffer * buffer)
@ -882,6 +859,41 @@ gst_mxf_demux_handle_metadata_multiple_descriptor (GstMXFDemux * demux,
return GST_FLOW_OK;
}
static GstFlowReturn
gst_mxf_demux_handle_metadata_generic_data_essence_descriptor (GstMXFDemux *
demux, const MXFUL * key, guint16 type, GstBuffer * buffer)
{
MXFMetadataGenericDataEssenceDescriptor descriptor;
memset (&descriptor, 0, sizeof (descriptor));
GST_DEBUG_OBJECT (demux,
"Handling metadata generic data essence descriptor of size %u"
" at offset %" G_GUINT64_FORMAT " with type 0x%04d",
GST_BUFFER_SIZE (buffer), demux->offset, type);
if (!mxf_metadata_descriptor_parse (key,
(MXFMetadataGenericDescriptor *) & descriptor, &demux->primer,
type, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer),
(MXFMetadataDescriptorHandleTag)
mxf_metadata_generic_data_essence_descriptor_handle_tag,
(MXFMetadataDescriptorReset)
mxf_metadata_generic_data_essence_descriptor_reset)) {
GST_ERROR_OBJECT (demux,
"Parsing metadata generic data essence descriptor failed");
return GST_FLOW_ERROR;
}
if (!demux->generic_data_essence_descriptor)
demux->generic_data_essence_descriptor =
g_array_new (FALSE, FALSE,
sizeof (MXFMetadataGenericDataEssenceDescriptor));
g_array_append_val (demux->generic_data_essence_descriptor, descriptor);
return GST_FLOW_OK;
}
static GstFlowReturn
gst_mxf_demux_handle_metadata_generic_picture_essence_descriptor (GstMXFDemux *
demux, const MXFUL * key, guint16 type, GstBuffer * buffer)
@ -1179,6 +1191,8 @@ gst_mxf_demux_handle_header_metadata_resolve_references (GstMXFDemux * demux)
FILL_DESCRIPTOR_ARRAY (demux->generic_descriptor,
MXFMetadataGenericDescriptor);
FILL_DESCRIPTOR_ARRAY (demux->file_descriptor, MXFMetadataFileDescriptor);
FILL_DESCRIPTOR_ARRAY (demux->generic_data_essence_descriptor,
MXFMetadataGenericDataEssenceDescriptor);
FILL_DESCRIPTOR_ARRAY (demux->generic_picture_essence_descriptor,
MXFMetadataGenericPictureEssenceDescriptor);
FILL_DESCRIPTOR_ARRAY (demux->cdci_picture_essence_descriptor,
@ -1309,8 +1323,9 @@ gst_mxf_demux_handle_header_metadata_resolve_references (GstMXFDemux * demux)
MXFMetadataEssenceContainerData, i);
for (j = 0; j < demux->content_storage.n_essence_container_data; j++) {
if (mxf_ul_is_equal (&demux->content_storage.
essence_container_data_uids[j], &data->instance_uid)) {
if (mxf_ul_is_equal (&demux->
content_storage.essence_container_data_uids[j],
&data->instance_uid)) {
demux->content_storage.essence_container_data[j] = data;
break;
}
@ -2018,16 +2033,16 @@ gst_mxf_demux_handle_metadata (GstMXFDemux * demux, const MXFUL * key,
gst_mxf_demux_handle_metadata_structural_component (demux,
key, type, buffer);
break;
case MXF_METADATA_GENERIC_DATA_ESSENCE_DESCRIPTOR:
ret =
gst_mxf_demux_handle_metadata_generic_descriptor (demux,
key, type, buffer);
break;
case MXF_METADATA_FILE_DESCRIPTOR:
ret =
gst_mxf_demux_handle_metadata_file_descriptor (demux,
key, type, buffer);
break;
case MXF_METADATA_GENERIC_DATA_ESSENCE_DESCRIPTOR:
ret =
gst_mxf_demux_handle_metadata_generic_data_essence_descriptor
(demux, key, type, buffer);
break;
case MXF_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR:
ret =
gst_mxf_demux_handle_metadata_generic_picture_essence_descriptor

View file

@ -91,6 +91,7 @@ struct _GstMXFDemux
GArray *file_descriptor;
GArray *generic_sound_essence_descriptor;
GArray *generic_picture_essence_descriptor;
GArray *generic_data_essence_descriptor;
GArray *cdci_picture_essence_descriptor;
GArray *rgba_picture_essence_descriptor;
GArray *mpeg_video_descriptor;

View file

@ -2837,6 +2837,52 @@ void mxf_metadata_rgba_picture_essence_descriptor_reset
descriptor->alpha_max_ref = 255;
}
gboolean
mxf_metadata_generic_data_essence_descriptor_handle_tag
(MXFMetadataGenericDescriptor * d, const MXFPrimerPack * primer,
guint16 tag, const guint8 * tag_data, guint16 tag_size)
{
MXFMetadataGenericDataEssenceDescriptor *descriptor =
(MXFMetadataGenericDataEssenceDescriptor *) d;
gboolean ret = FALSE;
gchar str[48];
switch (tag) {
case 0x3e01:
if (tag_size != 16)
goto error;
memcpy (&descriptor->data_essence_compression, tag_data, 16);
GST_DEBUG (" data essence compression = %s",
mxf_ul_to_string (&descriptor->data_essence_compression, str));
ret = TRUE;
break;
default:
ret =
mxf_metadata_file_descriptor_handle_tag (d, primer, tag, tag_data,
tag_size);
break;
}
return ret;
error:
GST_ERROR ("Invalid generic data essence descriptor tag 0x%04x of size %u",
tag, tag_size);
return TRUE;
}
void mxf_metadata_generic_data_essence_descriptor_reset
(MXFMetadataGenericDataEssenceDescriptor * descriptor)
{
g_return_if_fail (descriptor != NULL);
mxf_metadata_file_descriptor_reset ((MXFMetadataFileDescriptor *) descriptor);
MXF_METADATA_DESCRIPTOR_CLEAR (descriptor,
MXFMetadataGenericDataEssenceDescriptor, MXFMetadataFileDescriptor);
}
gboolean
mxf_metadata_multiple_descriptor_handle_tag (MXFMetadataGenericDescriptor * d,
const MXFPrimerPack * primer, guint16 tag, const guint8 * tag_data,

View file

@ -151,6 +151,10 @@ gboolean mxf_metadata_rgba_picture_essence_descriptor_handle_tag (MXFMetadataGen
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
void mxf_metadata_rgba_picture_essence_descriptor_reset (MXFMetadataRGBAPictureEssenceDescriptor *descriptor);
gboolean mxf_metadata_generic_data_essence_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
void mxf_metadata_generic_data_essence_descriptor_reset (MXFMetadataGenericDataEssenceDescriptor *descriptor);
gboolean mxf_metadata_multiple_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
void mxf_metadata_multiple_descriptor_reset (MXFMetadataMultipleDescriptor *descriptor);

View file

@ -195,6 +195,7 @@ typedef struct _MXFMetadataGenericPictureEssenceDescriptor MXFMetadataGenericPic
typedef struct _MXFMetadataCDCIPictureEssenceDescriptor MXFMetadataCDCIPictureEssenceDescriptor;
typedef struct _MXFMetadataRGBAPictureEssenceDescriptor MXFMetadataRGBAPictureEssenceDescriptor;
typedef struct _MXFMetadataGenericSoundEssenceDescriptor MXFMetadataGenericSoundEssenceDescriptor;
typedef struct _MXFMetadataGenericDataEssenceDescriptor MXFMetadataGenericDataEssenceDescriptor;
typedef struct _MXFMetadataMultipleDescriptor MXFMetadataMultipleDescriptor;
typedef struct _MXFMetadataLocator MXFMetadataLocator;
@ -498,6 +499,12 @@ struct _MXFMetadataGenericSoundEssenceDescriptor {
MXFUL sound_essence_compression;
};
struct _MXFMetadataGenericDataEssenceDescriptor {
MXFMetadataFileDescriptor parent;
MXFUL data_essence_compression;
};
struct _MXFMetadataMultipleDescriptor {
MXFMetadataFileDescriptor parent;