diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-12-06 10:06:02 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-12-06 10:10:05 +0100 |
commit | 347823179051e0343d0a9f508c5d5c2e4e1f45a4 (patch) | |
tree | 0ddf5db3e2b8957b636fc7d3d1bccd99e3a36671 | |
parent | 76ca3c77d78c236cba3e29de72430af506630264 (diff) | |
download | gstreamer-plugins-bad-347823179051e0343d0a9f508c5d5c2e4e1f45a4.tar.gz |
mxfdemux: Don't allow any wrapping other than frame wrapping
Bad things will happen otherwise, like reading a complete,
multiple GB large video track into a single buffer.
Conflicts:
gst/mxf/mxfdemux.c
-rw-r--r-- | gst/mxf/mxfdemux.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 4db5ca441..c16c514eb 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -855,6 +855,14 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux) caps = NULL; } + + if (etrack->handler + && etrack->handler->get_track_wrapping (track) != + MXF_ESSENCE_WRAPPING_FRAME_WRAPPING) { + GST_ERROR_OBJECT (demux, "Only frame wrapping currently supported"); + return GST_FLOW_ERROR; + } + etrack->source_package = package; etrack->source_track = track; continue; @@ -886,6 +894,7 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux) GST_ERROR_OBJECT (demux, "Failed to update essence track %u", i); return GST_FLOW_ERROR; } + } return GST_FLOW_OK; @@ -1987,6 +1996,9 @@ gst_mxf_demux_pull_klv_packet (GstMXFDemux * demux, guint64 offset, MXFUL * key, guint64 length; GstFlowReturn ret = GST_FLOW_OK; GstMapInfo map; +#ifndef GST_DISABLE_GST_DEBUG + gchar str[48]; +#endif memset (key, 0, sizeof (MXFUL)); @@ -1999,6 +2011,9 @@ gst_mxf_demux_pull_klv_packet (GstMXFDemux * demux, guint64 offset, MXFUL * key, memcpy (key, map.data, 16); + GST_DEBUG_OBJECT (demux, "Got KLV packet with key %s", mxf_ul_to_string (key, + str)); + /* Decode BER encoded packet length */ if ((map.data[16] & 0x80) == 0) { length = map.data[16]; @@ -2048,6 +2063,9 @@ gst_mxf_demux_pull_klv_packet (GstMXFDemux * demux, guint64 offset, MXFUL * key, goto beach; } + GST_DEBUG_OBJECT (demux, "KLV packet with key %s has length %u", + mxf_ul_to_string (key, str), length); + /* Pull the complete KLV packet */ if ((ret = gst_mxf_demux_pull_range (demux, offset + data_offset, length, &buffer)) != GST_FLOW_OK) @@ -2887,6 +2905,9 @@ gst_mxf_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf) guint64 offset = 0; GstBuffer *buffer = NULL; gboolean res; +#ifndef GST_DISABLE_GST_DEBUG + gchar str[48]; +#endif demux = GST_MXF_DEMUX (parent); @@ -2981,6 +3002,9 @@ gst_mxf_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf) memcpy (&key, data, 16); + GST_DEBUG_OBJECT (demux, "Got KLV packet with key %s", + mxf_ul_to_string (&key, str)); + /* Decode BER encoded packet length */ if ((data[16] & 0x80) == 0) { length = data[16]; @@ -3025,6 +3049,9 @@ gst_mxf_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf) break; } + GST_DEBUG_OBJECT (demux, "KLV packet with key %s has length %u", + mxf_ul_to_string (&key, str), length); + if (gst_adapter_available (demux->adapter) < offset + length) break; |