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;
|
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_package = package;
|
||||||
etrack->source_track = track;
|
etrack->source_track = track;
|
||||||
continue;
|
continue;
|
||||||
|
@ -886,6 +894,7 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux)
|
||||||
GST_ERROR_OBJECT (demux, "Failed to update essence track %u", i);
|
GST_ERROR_OBJECT (demux, "Failed to update essence track %u", i);
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
@ -1987,6 +1996,9 @@ gst_mxf_demux_pull_klv_packet (GstMXFDemux * demux, guint64 offset, MXFUL * key,
|
||||||
guint64 length;
|
guint64 length;
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
gchar str[48];
|
||||||
|
#endif
|
||||||
|
|
||||||
memset (key, 0, sizeof (MXFUL));
|
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);
|
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 */
|
/* Decode BER encoded packet length */
|
||||||
if ((map.data[16] & 0x80) == 0) {
|
if ((map.data[16] & 0x80) == 0) {
|
||||||
length = map.data[16];
|
length = map.data[16];
|
||||||
|
@ -2048,6 +2063,9 @@ gst_mxf_demux_pull_klv_packet (GstMXFDemux * demux, guint64 offset, MXFUL * key,
|
||||||
goto beach;
|
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 */
|
/* Pull the complete KLV packet */
|
||||||
if ((ret = gst_mxf_demux_pull_range (demux, offset + data_offset, length,
|
if ((ret = gst_mxf_demux_pull_range (demux, offset + data_offset, length,
|
||||||
&buffer)) != GST_FLOW_OK)
|
&buffer)) != GST_FLOW_OK)
|
||||||
|
@ -2887,6 +2905,9 @@ gst_mxf_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf)
|
||||||
guint64 offset = 0;
|
guint64 offset = 0;
|
||||||
GstBuffer *buffer = NULL;
|
GstBuffer *buffer = NULL;
|
||||||
gboolean res;
|
gboolean res;
|
||||||
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
gchar str[48];
|
||||||
|
#endif
|
||||||
|
|
||||||
demux = GST_MXF_DEMUX (parent);
|
demux = GST_MXF_DEMUX (parent);
|
||||||
|
|
||||||
|
@ -2981,6 +3002,9 @@ gst_mxf_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf)
|
||||||
|
|
||||||
memcpy (&key, data, 16);
|
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 */
|
/* Decode BER encoded packet length */
|
||||||
if ((data[16] & 0x80) == 0) {
|
if ((data[16] & 0x80) == 0) {
|
||||||
length = data[16];
|
length = data[16];
|
||||||
|
@ -3025,6 +3049,9 @@ gst_mxf_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf)
|
||||||
break;
|
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)
|
if (gst_adapter_available (demux->adapter) < offset + length)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue