summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-11-25 10:26:11 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-11-25 10:26:11 +0000
commit4f365b391e9ab1582c2374889f4255da61f8d330 (patch)
treebf19e9e86e06297722d7fe31fe4d3497e671ab71 /gst
parentfb8d2b901ddf2d03f4263f9e69b673ef1c89e353 (diff)
downloadgst-plugins-bad-4f365b391e9ab1582c2374889f4255da61f8d330.tar.gz
gst-plugins-bad-4f365b391e9ab1582c2374889f4255da61f8d330.tar.bz2
gst-plugins-bad-4f365b391e9ab1582c2374889f4255da61f8d330.zip
gst/mxf/: Add initial parsing of RGBA descriptors.
Original commit message from CVS: * gst/mxf/mxfdemux.c: (gst_mxf_demux_reset_metadata), (gst_mxf_demux_handle_metadata_generic_descriptor), (gst_mxf_demux_handle_metadata_file_descriptor), (gst_mxf_demux_handle_metadata_multiple_descriptor), (gst_mxf_demux_handle_metadata_generic_picture_essence_descriptor), (gst_mxf_demux_handle_metadata_cdci_picture_essence_descriptor), (gst_mxf_demux_handle_metadata_rgba_picture_essence_descriptor), (gst_mxf_demux_handle_metadata_mpeg_video_descriptor), (gst_mxf_demux_handle_metadata_generic_sound_essence_descriptor), (gst_mxf_demux_handle_metadata_wave_audio_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_rgba_picture_essence_descriptor_handle_tag), (mxf_metadata_rgba_picture_essence_descriptor_reset): * gst/mxf/mxfparse.h: * gst/mxf/mxftypes.h: Add initial parsing of RGBA descriptors. Don't initialize descriptor GArray with zeroes.
Diffstat (limited to 'gst')
-rw-r--r--gst/mxf/mxfdemux.c78
-rw-r--r--gst/mxf/mxfdemux.h1
-rw-r--r--gst/mxf/mxfparse.c73
-rw-r--r--gst/mxf/mxfparse.h4
-rw-r--r--gst/mxf/mxftypes.h13
5 files changed, 158 insertions, 11 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c
index bb272121..d02e5ade 100644
--- a/gst/mxf/mxfdemux.c
+++ b/gst/mxf/mxfdemux.c
@@ -289,6 +289,15 @@ gst_mxf_demux_reset_metadata (GstMXFDemux * demux)
demux->cdci_picture_essence_descriptor = NULL;
}
+ if (demux->rgba_picture_essence_descriptor) {
+ for (i = 0; i < demux->rgba_picture_essence_descriptor->len; i++)
+ mxf_metadata_rgba_picture_essence_descriptor_reset (&g_array_index
+ (demux->rgba_picture_essence_descriptor,
+ MXFMetadataRGBAPictureEssenceDescriptor, i));
+ g_array_free (demux->rgba_picture_essence_descriptor, TRUE);
+ demux->rgba_picture_essence_descriptor = NULL;
+ }
+
if (demux->mpeg_video_descriptor) {
for (i = 0; i < demux->mpeg_video_descriptor->len; i++)
mxf_metadata_mpeg_video_descriptor_reset (&g_array_index
@@ -722,7 +731,7 @@ gst_mxf_demux_handle_metadata_generic_descriptor (GstMXFDemux * demux,
if (!demux->generic_descriptor)
demux->generic_descriptor =
- g_array_new (FALSE, TRUE, sizeof (MXFMetadataGenericDescriptor));
+ g_array_new (FALSE, FALSE, sizeof (MXFMetadataGenericDescriptor));
g_array_append_val (demux->generic_descriptor, descriptor);
@@ -754,7 +763,7 @@ gst_mxf_demux_handle_metadata_file_descriptor (GstMXFDemux * demux,
if (!demux->file_descriptor)
demux->file_descriptor =
- g_array_new (FALSE, TRUE, sizeof (MXFMetadataFileDescriptor));
+ g_array_new (FALSE, FALSE, sizeof (MXFMetadataFileDescriptor));
g_array_append_val (demux->file_descriptor, descriptor);
@@ -787,7 +796,7 @@ gst_mxf_demux_handle_metadata_multiple_descriptor (GstMXFDemux * demux,
if (!demux->multiple_descriptor)
demux->multiple_descriptor =
- g_array_new (FALSE, TRUE, sizeof (MXFMetadataMultipleDescriptor));
+ g_array_new (FALSE, FALSE, sizeof (MXFMetadataMultipleDescriptor));
g_array_append_val (demux->multiple_descriptor, descriptor);
@@ -821,7 +830,7 @@ gst_mxf_demux_handle_metadata_generic_picture_essence_descriptor (GstMXFDemux *
if (!demux->generic_picture_essence_descriptor)
demux->generic_picture_essence_descriptor =
- g_array_new (FALSE, TRUE,
+ g_array_new (FALSE, FALSE,
sizeof (MXFMetadataGenericPictureEssenceDescriptor));
g_array_append_val (demux->generic_picture_essence_descriptor, descriptor);
@@ -856,7 +865,7 @@ gst_mxf_demux_handle_metadata_cdci_picture_essence_descriptor (GstMXFDemux *
if (!demux->cdci_picture_essence_descriptor)
demux->cdci_picture_essence_descriptor =
- g_array_new (FALSE, TRUE,
+ g_array_new (FALSE, FALSE,
sizeof (MXFMetadataCDCIPictureEssenceDescriptor));
g_array_append_val (demux->cdci_picture_essence_descriptor, descriptor);
@@ -865,6 +874,41 @@ gst_mxf_demux_handle_metadata_cdci_picture_essence_descriptor (GstMXFDemux *
}
static GstFlowReturn
+gst_mxf_demux_handle_metadata_rgba_picture_essence_descriptor (GstMXFDemux *
+ demux, const MXFUL * key, guint16 type, GstBuffer * buffer)
+{
+ MXFMetadataRGBAPictureEssenceDescriptor descriptor;
+
+ memset (&descriptor, 0, sizeof (descriptor));
+
+ GST_DEBUG_OBJECT (demux,
+ "Handling metadata RGBA picture 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_rgba_picture_essence_descriptor_handle_tag,
+ (MXFMetadataDescriptorReset)
+ mxf_metadata_rgba_picture_essence_descriptor_reset)) {
+ GST_ERROR_OBJECT (demux,
+ "Parsing metadata RGBA picture essence descriptor failed");
+ return GST_FLOW_ERROR;
+ }
+
+ if (!demux->rgba_picture_essence_descriptor)
+ demux->rgba_picture_essence_descriptor =
+ g_array_new (FALSE, FALSE,
+ sizeof (MXFMetadataRGBAPictureEssenceDescriptor));
+
+ g_array_append_val (demux->rgba_picture_essence_descriptor, descriptor);
+
+ return GST_FLOW_OK;
+}
+
+static GstFlowReturn
gst_mxf_demux_handle_metadata_mpeg_video_descriptor (GstMXFDemux * demux,
const MXFUL * key, guint16 type, GstBuffer * buffer)
{
@@ -890,7 +934,7 @@ gst_mxf_demux_handle_metadata_mpeg_video_descriptor (GstMXFDemux * demux,
if (!demux->mpeg_video_descriptor)
demux->mpeg_video_descriptor =
- g_array_new (FALSE, TRUE, sizeof (MXFMetadataMPEGVideoDescriptor));
+ g_array_new (FALSE, FALSE, sizeof (MXFMetadataMPEGVideoDescriptor));
g_array_append_val (demux->mpeg_video_descriptor, descriptor);
@@ -924,7 +968,7 @@ gst_mxf_demux_handle_metadata_generic_sound_essence_descriptor (GstMXFDemux *
if (!demux->generic_sound_essence_descriptor)
demux->generic_sound_essence_descriptor =
- g_array_new (FALSE, TRUE,
+ g_array_new (FALSE, FALSE,
sizeof (MXFMetadataGenericSoundEssenceDescriptor));
g_array_append_val (demux->generic_sound_essence_descriptor, descriptor);
@@ -959,7 +1003,7 @@ gst_mxf_demux_handle_metadata_wave_audio_essence_descriptor (GstMXFDemux *
if (!demux->wave_audio_essence_descriptor)
demux->wave_audio_essence_descriptor =
- g_array_new (FALSE, TRUE,
+ g_array_new (FALSE, FALSE,
sizeof (MXFMetadataWaveAudioEssenceDescriptor));
g_array_append_val (demux->wave_audio_essence_descriptor, descriptor);
@@ -1033,6 +1077,13 @@ gst_mxf_demux_handle_header_metadata_resolve_references (GstMXFDemux * demux)
MXFMetadataCDCIPictureEssenceDescriptor, i));
}
}
+ if (demux->rgba_picture_essence_descriptor) {
+ for (i = 0; i < demux->rgba_picture_essence_descriptor->len; i++) {
+ g_ptr_array_add (demux->descriptor,
+ &g_array_index (demux->rgba_picture_essence_descriptor,
+ MXFMetadataRGBAPictureEssenceDescriptor, i));
+ }
+ }
if (demux->mpeg_video_descriptor) {
for (i = 0; i < demux->mpeg_video_descriptor->len; i++) {
g_ptr_array_add (demux->descriptor,
@@ -1173,8 +1224,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;
}
@@ -1827,7 +1879,6 @@ 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_RGBA_PICTURE_ESSENCE_DESCRIPTOR:
case MXF_METADATA_GENERIC_DATA_ESSENCE_DESCRIPTOR:
ret =
gst_mxf_demux_handle_metadata_generic_descriptor (demux,
@@ -1848,6 +1899,11 @@ gst_mxf_demux_handle_metadata (GstMXFDemux * demux, const MXFUL * key,
gst_mxf_demux_handle_metadata_cdci_picture_essence_descriptor (demux,
key, type, buffer);
break;
+ case MXF_METADATA_RGBA_PICTURE_ESSENCE_DESCRIPTOR:
+ ret =
+ gst_mxf_demux_handle_metadata_rgba_picture_essence_descriptor (demux,
+ key, type, buffer);
+ break;
case MXF_METADATA_MPEG_VIDEO_DESCRIPTOR:
ret =
gst_mxf_demux_handle_metadata_mpeg_video_descriptor (demux,
diff --git a/gst/mxf/mxfdemux.h b/gst/mxf/mxfdemux.h
index b49d919c..0452f808 100644
--- a/gst/mxf/mxfdemux.h
+++ b/gst/mxf/mxfdemux.h
@@ -88,6 +88,7 @@ struct _GstMXFDemux
GArray *generic_sound_essence_descriptor;
GArray *generic_picture_essence_descriptor;
GArray *cdci_picture_essence_descriptor;
+ GArray *rgba_picture_essence_descriptor;
GArray *mpeg_video_descriptor;
GArray *wave_audio_essence_descriptor;
GArray *multiple_descriptor;
diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c
index 41ba4d5d..0f5323e7 100644
--- a/gst/mxf/mxfparse.c
+++ b/gst/mxf/mxfparse.c
@@ -2389,6 +2389,79 @@ void mxf_metadata_cdci_picture_essence_descriptor_reset
}
gboolean
+ mxf_metadata_rgba_picture_essence_descriptor_handle_tag
+ (MXFMetadataGenericDescriptor * d, const MXFPrimerPack * primer,
+ guint16 tag, const guint8 * tag_data, guint16 tag_size)
+{
+ MXFMetadataRGBAPictureEssenceDescriptor *descriptor =
+ (MXFMetadataRGBAPictureEssenceDescriptor *) d;
+ gboolean ret = FALSE;
+
+ switch (tag) {
+ case 0x3406:
+ if (tag_size != 4)
+ goto error;
+ descriptor->component_max_ref = GST_READ_UINT32_BE (tag_data);
+ GST_DEBUG (" component max ref = %u", descriptor->component_max_ref);
+ break;
+ case 0x3407:
+ if (tag_size != 4)
+ goto error;
+ descriptor->component_min_ref = GST_READ_UINT32_BE (tag_data);
+ GST_DEBUG (" component min ref = %u", descriptor->component_min_ref);
+ break;
+ case 0x3408:
+ if (tag_size != 4)
+ goto error;
+ descriptor->alpha_max_ref = GST_READ_UINT32_BE (tag_data);
+ GST_DEBUG (" alpha max ref = %u", descriptor->alpha_max_ref);
+ break;
+ case 0x3409:
+ if (tag_size != 4)
+ goto error;
+ descriptor->alpha_min_ref = GST_READ_UINT32_BE (tag_data);
+ GST_DEBUG (" alpha min ref = %u", descriptor->alpha_min_ref);
+ break;
+ case 0x3405:
+ if (tag_size != 1)
+ goto error;
+ descriptor->scanning_direction = GST_READ_UINT8 (tag_data);
+ GST_DEBUG (" scanning direction = %u", descriptor->scanning_direction);
+ break;
+ case 0x3401:
+ case 0x3403:
+ case 0x3404:
+ /* TODO: handle this */
+ GST_WARNING (" tag 0x%04x not implemented yet", tag);
+ break;
+ default:
+ ret =
+ mxf_metadata_generic_picture_essence_descriptor_handle_tag (d, primer,
+ tag, tag_data, tag_size);
+ break;
+ }
+
+ return ret;
+
+error:
+ GST_ERROR ("Invalid RGBA picture essence descriptor tag 0x%04x of size %u",
+ tag, tag_size);
+
+ return TRUE;
+}
+
+void mxf_metadata_rgba_picture_essence_descriptor_reset
+ (MXFMetadataRGBAPictureEssenceDescriptor * descriptor)
+{
+ g_return_if_fail (descriptor != NULL);
+
+ mxf_metadata_generic_picture_essence_descriptor_reset (
+ (MXFMetadataGenericPictureEssenceDescriptor *) descriptor);
+
+ memset (descriptor, 0, sizeof (MXFMetadataRGBAPictureEssenceDescriptor));
+}
+
+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 790bc396..8a6b3437 100644
--- a/gst/mxf/mxfparse.h
+++ b/gst/mxf/mxfparse.h
@@ -131,6 +131,10 @@ gboolean mxf_metadata_cdci_picture_essence_descriptor_handle_tag (MXFMetadataGen
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
void mxf_metadata_cdci_picture_essence_descriptor_reset (MXFMetadataCDCIPictureEssenceDescriptor *descriptor);
+gboolean mxf_metadata_rgba_picture_essence_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
+ 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_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 c253f2c7..6fd15fae 100644
--- a/gst/mxf/mxftypes.h
+++ b/gst/mxf/mxftypes.h
@@ -149,6 +149,7 @@ typedef struct _MXFMetadataGenericDescriptor MXFMetadataGenericDescriptor;
typedef struct _MXFMetadataFileDescriptor MXFMetadataFileDescriptor;
typedef struct _MXFMetadataGenericPictureEssenceDescriptor MXFMetadataGenericPictureEssenceDescriptor;
typedef struct _MXFMetadataCDCIPictureEssenceDescriptor MXFMetadataCDCIPictureEssenceDescriptor;
+typedef struct _MXFMetadataRGBAPictureEssenceDescriptor MXFMetadataRGBAPictureEssenceDescriptor;
typedef struct _MXFMetadataGenericSoundEssenceDescriptor MXFMetadataGenericSoundEssenceDescriptor;
typedef struct _MXFMetadataMultipleDescriptor MXFMetadataMultipleDescriptor;
typedef struct _MXFMetadataLocator MXFMetadataLocator;
@@ -422,6 +423,18 @@ struct _MXFMetadataCDCIPictureEssenceDescriptor {
guint32 color_range;
};
+struct _MXFMetadataRGBAPictureEssenceDescriptor {
+ MXFMetadataGenericPictureEssenceDescriptor parent;
+
+ guint32 component_max_ref;
+ guint32 component_min_ref;
+ guint32 alpha_max_ref;
+ guint32 alpha_min_ref;
+ guint8 scanning_direction;
+
+ /* TODO: pixel layout, palette & palette layout */
+};
+
struct _MXFMetadataGenericSoundEssenceDescriptor {
MXFMetadataFileDescriptor parent;