From abcc8554971b964ee697a158043afe213798af71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 7 Dec 2008 17:16:29 +0000 Subject: gst/mxf/: Add initial support for uncompressed video essence (SMPTE S384M). Original commit message from CVS: * gst/mxf/Makefile.am: * gst/mxf/mxfdemux.c: (gst_mxf_demux_handle_header_metadata_update_streams): * gst/mxf/mxftypes.h: * gst/mxf/mxfup.c: (mxf_is_up_essence_track), (mxf_up_handle_essence_element), (mxf_up_rgba_create_caps), (mxf_up_create_caps): * gst/mxf/mxfup.h: Add initial support for uncompressed video essence (SMPTE S384M). * gst/mxf/mxfparse.c: (mxf_metadata_rgba_picture_essence_descriptor_handle_tag), (mxf_metadata_rgba_picture_essence_descriptor_reset): Fix parsing of the RGBA descriptor and add support for parsing the pixel layout. --- gst/mxf/mxfparse.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'gst/mxf/mxfparse.c') diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c index 212c6942..e2ff891e 100644 --- a/gst/mxf/mxfparse.c +++ b/gst/mxf/mxfparse.c @@ -2774,36 +2774,70 @@ gboolean goto error; descriptor->component_max_ref = GST_READ_UINT32_BE (tag_data); GST_DEBUG (" component max ref = %u", descriptor->component_max_ref); + ret = TRUE; 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); + ret = TRUE; 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); + ret = TRUE; 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); + ret = TRUE; 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); + ret = TRUE; break; - case 0x3401: + case 0x3401:{ + guint i, len; + + if (tag_size % 2 != 0) + goto error; + + i = 0; + while (tag_data[i] != 0 && tag_data[i + 1] != 0 && i + 2 <= tag_size) + i += 2; + len = i / 2; + + descriptor->n_pixel_layout = len; + GST_DEBUG (" number of pixel layouts = %u", len); + if (len == 0) + return TRUE; + + descriptor->pixel_layout = g_malloc0 (2 * len); + + for (i = 0; i < len; i++) { + descriptor->pixel_layout[2 * i] = tag_data[2 * i]; + descriptor->pixel_layout[2 * i + 1] = tag_data[2 * i + 1]; + GST_DEBUG (" pixel layout %u = %c : %u", i, + (gchar) descriptor->pixel_layout[2 * i], + descriptor->pixel_layout[2 * i + 1]); + } + + ret = TRUE; + break; + } case 0x3403: case 0x3404: /* TODO: handle this */ GST_WARNING (" tag 0x%04x not implemented yet", tag); + ret = TRUE; break; default: ret = @@ -2829,6 +2863,8 @@ void mxf_metadata_rgba_picture_essence_descriptor_reset mxf_metadata_generic_picture_essence_descriptor_reset ( (MXFMetadataGenericPictureEssenceDescriptor *) descriptor); + g_free (descriptor->pixel_layout); + MXF_METADATA_DESCRIPTOR_CLEAR (descriptor, MXFMetadataRGBAPictureEssenceDescriptor, MXFMetadataGenericPictureEssenceDescriptor); -- cgit v1.2.1