diff options
-rw-r--r-- | gst/mxf/mxfdemux.c | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index afd541a2..eac597f7 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -609,11 +609,11 @@ gst_mxf_demux_choose_package (GstMXFDemux * demux) for (i = 0; i < demux->preface->content_storage->n_packages; i++) { if (demux->preface->content_storage->packages[i] && - MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface-> - content_storage->packages[i])) { + MXF_IS_METADATA_MATERIAL_PACKAGE (demux->preface->content_storage-> + packages[i])) { ret = - MXF_METADATA_GENERIC_PACKAGE (demux->preface-> - content_storage->packages[i]); + MXF_METADATA_GENERIC_PACKAGE (demux->preface->content_storage-> + packages[i]); break; } } @@ -1257,8 +1257,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) pad->current_component_index); pad->current_component = - MXF_METADATA_SOURCE_CLIP (sequence-> - structural_components[pad->current_component_index]); + MXF_METADATA_SOURCE_CLIP (sequence->structural_components[pad-> + current_component_index]); if (pad->current_component == NULL) { GST_ERROR_OBJECT (demux, "No such structural component"); return GST_FLOW_ERROR; @@ -1266,8 +1266,8 @@ gst_mxf_demux_pad_next_component (GstMXFDemux * demux, GstMXFDemuxPad * pad) if (!pad->current_component->source_package || !pad->current_component->source_package->top_level - || !MXF_METADATA_GENERIC_PACKAGE (pad-> - current_component->source_package)->tracks) { + || !MXF_METADATA_GENERIC_PACKAGE (pad->current_component-> + source_package)->tracks) { GST_ERROR_OBJECT (demux, "Invalid component"); return GST_FLOW_ERROR; } @@ -1492,6 +1492,7 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, for (i = 0; i < demux->src->len; i++) { GstMXFDemuxPad *pad = g_ptr_array_index (demux->src, i); + guint j; if (pad->current_essence_track != etrack) continue; @@ -1506,6 +1507,19 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, continue; } + for (j = 0; j < demux->src->len; j++) { + GstMXFDemuxPad *opad = g_ptr_array_index (demux->src, j); + + if (!opad->eos && opad->last_stop < pad->last_stop && + pad->last_stop - opad->last_stop > 500 * GST_MSECOND) { + break; + } + } + if (j != demux->src->len) { + GST_DEBUG_OBJECT (demux, "Pad is too far ahead of time"); + continue; + } + /* Create another subbuffer to have writable metadata */ outbuf = gst_buffer_create_sub (inbuf, 0, GST_BUFFER_SIZE (inbuf)); @@ -1582,7 +1596,6 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, } if (ret == GST_FLOW_UNEXPECTED) { - gboolean eos = TRUE; GST_DEBUG_OBJECT (demux, "EOS for track"); pad->eos = TRUE; @@ -1591,15 +1604,15 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, for (i = 0; i < demux->src->len; i++) { GstMXFDemuxPad *opad = g_ptr_array_index (demux->src, i); - eos &= opad->eos; + if (!opad->eos) { + ret = GST_FLOW_OK; + break; + } } - if (eos) { + if (ret == GST_FLOW_UNEXPECTED) { GST_DEBUG_OBJECT (demux, "All tracks are EOS"); - ret = GST_FLOW_UNEXPECTED; break; - } else { - ret = GST_FLOW_OK; } } |