From 3c3dff6869a3f3ffdf327e004977fa39594dd2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 7 Feb 2009 10:13:54 +0100 Subject: mxfdemux: Make essence track creation a bit more robust against broken files Some files contain multiple tracks with the same track number but different track id inside the same source package. This is invalid and we simply ignore the second and following of such traacks now instead of overwriting the information of the first one. --- gst/mxf/mxfdemux.c | 19 +++++++++++++++++-- gst/mxf/mxfdemux.h | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'gst/mxf') diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index db5b6209..32978dd2 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -725,6 +725,14 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux) if (tmp->track_number == track->parent.track_number && tmp->body_sid == edata->body_sid) { + if (tmp->track_id != track->parent.track_id || + !mxf_umid_is_equal (&tmp->source_package_uid, + &package->parent.package_uid)) { + GST_ERROR_OBJECT (demux, "There already exists a different track " + "with this track number and body sid but a different source " + "or source track id -- ignoring"); + continue; + } etrack = tmp; break; } @@ -737,6 +745,8 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux) memset (&tmp, 0, sizeof (tmp)); tmp.body_sid = edata->body_sid; tmp.track_number = track->parent.track_number; + tmp.track_id = track->parent.track_id; + memcpy (&tmp.source_package_uid, &package->parent.package_uid, 32); if (!demux->essence_tracks) demux->essence_tracks = @@ -756,6 +766,11 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux) goto next; } + if (track->parent.n_descriptor == 0) { + GST_WARNING_OBJECT (demux, "Source track has no descriptors"); + goto next; + } + if (track->parent.sequence->duration > etrack->duration) etrack->duration = track->parent.sequence->duration; @@ -773,7 +788,7 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux) gchar *name; GST_WARNING_OBJECT (demux, - "No essence element handler for track found"); + "No essence element handler for track %u found", i); mxf_ul_to_string (&track->parent.descriptor[0]->essence_container, essence_container); @@ -840,7 +855,7 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux) &g_array_index (demux->essence_tracks, GstMXFDemuxEssenceTrack, i); if (!etrack->source_package || !etrack->source_track || !etrack->caps) { - GST_ERROR_OBJECT (demux, "Failed to update essence track"); + GST_ERROR_OBJECT (demux, "Failed to update essence track %u", i); return GST_FLOW_ERROR; } } diff --git a/gst/mxf/mxfdemux.h b/gst/mxf/mxfdemux.h index 23d63c36..db1b4390 100644 --- a/gst/mxf/mxfdemux.h +++ b/gst/mxf/mxfdemux.h @@ -68,6 +68,9 @@ typedef struct guint32 body_sid; guint32 track_number; + guint32 track_id; + MXFUMID source_package_uid; + gint64 position; gint64 duration; -- cgit v1.2.1