Commit caa83490 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵
Browse files

gst/mxf/mxfdemux.c: Don't allow negative or zero edit rates to prevent...

gst/mxf/mxfdemux.c: Don't allow negative or zero edit rates to prevent division by zero and we support negative edit ...

Original commit message from CVS:
* gst/mxf/mxfdemux.c:
(gst_mxf_demux_handle_header_metadata_update_streams),
(gst_mxf_demux_pad_next_component):
Don't allow negative or zero edit rates to prevent division
by zero and we support negative edit rates anyway.
parent b5f61341
2009-01-05 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/mxfdemux.c:
(gst_mxf_demux_handle_header_metadata_update_streams),
(gst_mxf_demux_pad_next_component):
Don't allow negative or zero edit rates to prevent division
by zero and we support negative edit rates anyway.
2009-01-05 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> 2009-01-05 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
* ext/x264/gstx264enc.c: (gst_x264_enc_class_init), * ext/x264/gstx264enc.c: (gst_x264_enc_class_init),
......
...@@ -560,11 +560,11 @@ gst_mxf_demux_choose_package (GstMXFDemux * demux) ...@@ -560,11 +560,11 @@ gst_mxf_demux_choose_package (GstMXFDemux * demux)
for (i = 0; i < demux->preface->content_storage->n_packages; i++) { for (i = 0; i < demux->preface->content_storage->n_packages; i++) {
if (demux->preface->content_storage->packages[i] && if (demux->preface->content_storage->packages[i] &&
MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface->content_storage-> MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface->
packages[i])) { content_storage->packages[i])) {
ret = ret =
MXF_METADATA_GENERIC_PACKAGE (demux->preface->content_storage-> MXF_METADATA_GENERIC_PACKAGE (demux->preface->
packages[i]); content_storage->packages[i]);
break; break;
} }
} }
...@@ -701,6 +701,12 @@ gst_mxf_demux_handle_header_metadata_update_streams (GstMXFDemux * demux) ...@@ -701,6 +701,12 @@ gst_mxf_demux_handle_header_metadata_update_streams (GstMXFDemux * demux)
continue; continue;
} }
if (track->edit_rate.n <= 0 || track->edit_rate.d <= 0 ||
source_track->edit_rate.n <= 0 || source_track->edit_rate.d <= 0) {
GST_WARNING_OBJECT (demux, "Track has an invalid edit rate");
continue;
}
if (MXF_IS_METADATA_MATERIAL_PACKAGE (current_package) && !component) { if (MXF_IS_METADATA_MATERIAL_PACKAGE (current_package) && !component) {
GST_WARNING_OBJECT (demux, GST_WARNING_OBJECT (demux,
"Playing material package but found no component for track"); "Playing material package but found no component for track");
...@@ -968,9 +974,11 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) ...@@ -968,9 +974,11 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad)
return GST_FLOW_UNEXPECTED; return GST_FLOW_UNEXPECTED;
} }
GST_DEBUG_OBJECT (demux, "Switching to component %u", pad->current_component);
pad->component = pad->component =
MXF_METADATA_SOURCE_CLIP (sequence->structural_components[pad-> MXF_METADATA_SOURCE_CLIP (sequence->
current_component]); structural_components[pad->current_component]);
if (pad->component == NULL) { if (pad->component == NULL) {
GST_ERROR_OBJECT (demux, "No such structural component"); GST_ERROR_OBJECT (demux, "No such structural component");
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
...@@ -978,8 +986,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) ...@@ -978,8 +986,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad)
if (!pad->component->source_package if (!pad->component->source_package
|| !pad->component->source_package->top_level || !pad->component->source_package->top_level
|| !MXF_METADATA_GENERIC_PACKAGE (pad->component-> || !MXF_METADATA_GENERIC_PACKAGE (pad->component->source_package)->
source_package)->tracks) { tracks) {
GST_ERROR_OBJECT (demux, "Invalid component"); GST_ERROR_OBJECT (demux, "Invalid component");
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
...@@ -1011,6 +1019,11 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) ...@@ -1011,6 +1019,11 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad)
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
if (pad->source_track->edit_rate.n <= 0 ||
pad->source_track->edit_rate.d <= 0) {
GST_ERROR_OBJECT (demux, "Source track has invalid edit rate");
return GST_FLOW_ERROR;
}
pad->current_component_position = 0; pad->current_component_position = 0;
pad->current_component_drop = pad->source_track->origin; pad->current_component_drop = pad->source_track->origin;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment