diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-12-05 12:26:02 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-12-05 12:26:02 +0000 |
commit | 6f15343df11bdd3b39ede05158f0f8e7f1fdca62 (patch) | |
tree | 4313ba8b4dd6ef739352f156cee1552f75b1a116 | |
parent | 278604dfa1d8f2a3b57ef8fb89d32a7abe1a0be4 (diff) | |
download | gst-plugins-bad-6f15343df11bdd3b39ede05158f0f8e7f1fdca62.tar.gz gst-plugins-bad-6f15343df11bdd3b39ede05158f0f8e7f1fdca62.tar.bz2 gst-plugins-bad-6f15343df11bdd3b39ede05158f0f8e7f1fdca62.zip |
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.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | gst/mxf/mxfdemux.c | 93 | ||||
-rw-r--r-- | gst/mxf/mxfdemux.h | 1 | ||||
-rw-r--r-- | gst/mxf/mxfparse.c | 46 | ||||
-rw-r--r-- | gst/mxf/mxfparse.h | 4 | ||||
-rw-r--r-- | gst/mxf/mxftypes.h | 7 |
6 files changed, 126 insertions, 39 deletions
@@ -1,5 +1,19 @@ 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: (gst_mxf_demux_handle_header_metadata_resolve_references): Generalize some lines of codes that are more or less the same diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 1ea447e0..b8418fa2 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -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 @@ -786,38 +795,6 @@ gst_mxf_demux_handle_metadata_structural_component (GstMXFDemux * demux, } 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) { @@ -883,6 +860,41 @@ gst_mxf_demux_handle_metadata_multiple_descriptor (GstMXFDemux * demux, } 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 diff --git a/gst/mxf/mxfdemux.h b/gst/mxf/mxfdemux.h index a00eb94b..26a02d28 100644 --- a/gst/mxf/mxfdemux.h +++ b/gst/mxf/mxfdemux.h @@ -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; diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c index 53726b6b..212c6942 100644 --- a/gst/mxf/mxfparse.c +++ b/gst/mxf/mxfparse.c @@ -2838,6 +2838,52 @@ void mxf_metadata_rgba_picture_essence_descriptor_reset } 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, guint16 tag_size) diff --git a/gst/mxf/mxfparse.h b/gst/mxf/mxfparse.h index bb4e8580..6ea0ddd9 100644 --- a/gst/mxf/mxfparse.h +++ b/gst/mxf/mxfparse.h @@ -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); diff --git a/gst/mxf/mxftypes.h b/gst/mxf/mxftypes.h index 4b2a6e7e..aaa3ec5c 100644 --- a/gst/mxf/mxftypes.h +++ b/gst/mxf/mxftypes.h @@ -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; |