mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
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
This commit is contained in:
parent
76ca3c77d7
commit
3478231790
1 changed files with 27 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue