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
@ -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>
|
2008-12-07 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||||
|
|
||||||
* gst/mxf/mxfmpeg.c: (mxf_mpeg_es_create_caps):
|
* gst/mxf/mxfmpeg.c: (mxf_mpeg_es_create_caps):
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
/* TODO:
|
/* TODO:
|
||||||
* - Handle CDCI essence
|
* - Handle CDCI essence
|
||||||
* - Correctly transform for the GStreamer strides
|
* - 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
|
#ifdef HAVE_CONFIG_H
|
||||||
@ -40,6 +42,12 @@
|
|||||||
GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
|
GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
|
||||||
#define GST_CAT_DEFAULT mxf_debug
|
#define GST_CAT_DEFAULT mxf_debug
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
guint32 image_start_offset;
|
||||||
|
guint32 image_end_offset;
|
||||||
|
} MXFUPMappingData;
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
mxf_is_up_essence_track (const MXFMetadataTrack * track)
|
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,
|
MXFMetadataTrack * track, MXFMetadataStructuralComponent * component,
|
||||||
gpointer mapping_data, GstBuffer ** outbuf)
|
gpointer mapping_data, GstBuffer ** outbuf)
|
||||||
{
|
{
|
||||||
*outbuf = buffer;
|
MXFUPMappingData *data = mapping_data;
|
||||||
|
|
||||||
/* SMPTE 384M 7.1 */
|
/* SMPTE 384M 7.1 */
|
||||||
if (key->u[12] != 0x15 || (key->u[14] != 0x01 && key->u[14] != 0x02
|
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;
|
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;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +185,17 @@ mxf_up_rgba_create_caps (MXFMetadataGenericPackage * package,
|
|||||||
return NULL;
|
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;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user