mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
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.
This commit is contained in:
parent
8932df4eef
commit
f6e81c84e9
2 changed files with 47 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
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):
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue