summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-12-07 18:39:41 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-12-07 18:39:41 +0000
commitf6e81c84e91d9019bf08dfc37c07c988cd976693 (patch)
tree44b2fd1beaedc702bad08f0a86ab8252e95677ee
parent8932df4eef2b5bfadfd4d0fc60eed393d29fb09e (diff)
downloadgst-plugins-bad-f6e81c84e91d9019bf08dfc37c07c988cd976693.tar.gz
gst-plugins-bad-f6e81c84e91d9019bf08dfc37c07c988cd976693.tar.bz2
gst-plugins-bad-f6e81c84e91d9019bf08dfc37c07c988cd976693.zip
gst/mxf/mxfup.c: Handle the image start and end offsets, otherwise we output too large image buffers.
Original commit message from CVS: * gst/mxf/mxfup.c: (mxf_up_handle_essence_element), (mxf_up_rgba_create_caps): Handle the image start and end offsets, otherwise we output too large image buffers.
-rw-r--r--ChangeLog7
-rw-r--r--gst/mxf/mxfup.c41
2 files changed, 47 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b0b20a81..b719d201 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2008-12-07 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ * gst/mxf/mxfup.c: (mxf_up_handle_essence_element),
+ (mxf_up_rgba_create_caps):
+ Handle the image start and end offsets, otherwise we output
+ too large image buffers.
+
+2008-12-07 Sebastian Dröge <sebastian.droege@collabora.co.uk>
+
* gst/mxf/mxfmpeg.c: (mxf_mpeg_es_create_caps):
Set codec name tags for the MPEG audio essence.
diff --git a/gst/mxf/mxfup.c b/gst/mxf/mxfup.c
index 2d401755..77adcc03 100644
--- a/gst/mxf/mxfup.c
+++ b/gst/mxf/mxfup.c
@@ -24,6 +24,8 @@
/* TODO:
* - Handle CDCI essence
* - Correctly transform for the GStreamer strides
+ * - Handle all the dimensions and other properties in the picture
+ * essence descriptors correctly according to S377M Annex E
*/
#ifdef HAVE_CONFIG_H
@@ -40,6 +42,12 @@
GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
#define GST_CAT_DEFAULT mxf_debug
+typedef struct
+{
+ guint32 image_start_offset;
+ guint32 image_end_offset;
+} MXFUPMappingData;
+
gboolean
mxf_is_up_essence_track (const MXFMetadataTrack * track)
{
@@ -68,7 +76,7 @@ mxf_up_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
MXFMetadataTrack * track, MXFMetadataStructuralComponent * component,
gpointer mapping_data, GstBuffer ** outbuf)
{
- *outbuf = buffer;
+ MXFUPMappingData *data = mapping_data;
/* SMPTE 384M 7.1 */
if (key->u[12] != 0x15 || (key->u[14] != 0x01 && key->u[14] != 0x02
@@ -77,6 +85,26 @@ mxf_up_handle_essence_element (const MXFUL * key, GstBuffer * buffer,
return GST_FLOW_ERROR;
}
+ if (!data || (data->image_start_offset == 0 && data->image_end_offset == 0)) {
+ *outbuf = buffer;
+ } else {
+ if (data->image_start_offset + data->image_end_offset
+ > GST_BUFFER_SIZE (buffer)) {
+ gst_buffer_unref (buffer);
+ GST_ERROR ("Invalid buffer size");
+ return GST_FLOW_ERROR;
+ } else {
+ *outbuf =
+ gst_buffer_create_sub (buffer, data->image_start_offset,
+ GST_BUFFER_SIZE (buffer) - data->image_end_offset -
+ data->image_start_offset);
+ gst_buffer_copy_metadata (*outbuf, buffer,
+ GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS |
+ GST_BUFFER_COPY_CAPS);
+ gst_buffer_unref (buffer);
+ }
+ }
+
return GST_FLOW_OK;
}
@@ -157,6 +185,17 @@ mxf_up_rgba_create_caps (MXFMetadataGenericPackage * package,
return NULL;
}
+ if (caps) {
+ MXFUPMappingData *data = g_new0 (MXFUPMappingData, 1);
+
+ data->image_start_offset =
+ ((MXFMetadataGenericPictureEssenceDescriptor *) d)->image_start_offset;
+ data->image_end_offset =
+ ((MXFMetadataGenericPictureEssenceDescriptor *) d)->image_end_offset;
+
+ *mapping_data = data;
+ }
+
return caps;
}