mxfdemux: Handle empty tracks

This can happen when tracks aren't fully/properly detected due to new descriptors

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3899>
This commit is contained in:
Edward Hervey 2023-02-06 17:57:32 +01:00
parent 206ed12368
commit 2d5b71d6e3

View file

@ -814,13 +814,8 @@ gst_mxf_demux_update_essence_tracks (GstMXFDemux * demux)
gboolean new = FALSE; gboolean new = FALSE;
if (!package->parent.tracks[j] if (!package->parent.tracks[j]
|| !MXF_IS_METADATA_TIMELINE_TRACK (package->parent.tracks[j])) { || !MXF_IS_METADATA_TIMELINE_TRACK (package->parent.tracks[j]))
GST_DEBUG_OBJECT (demux,
"Skipping non-timeline track (id:%d number:0x%08x)",
package->parent.tracks[j]->track_id,
package->parent.tracks[j]->track_number);
continue; continue;
}
track = MXF_METADATA_TIMELINE_TRACK (package->parent.tracks[j]); track = MXF_METADATA_TIMELINE_TRACK (package->parent.tracks[j]);
if ((track->parent.type & 0xf0) != 0x30) { if ((track->parent.type & 0xf0) != 0x30) {
@ -1174,16 +1169,21 @@ gst_mxf_demux_show_topology (GstMXFDemux * demux)
for (tmp = file_packages; tmp; tmp = tmp->next) { for (tmp = file_packages; tmp; tmp = tmp->next) {
MXFMetadataMaterialPackage *pack = (MXFMetadataMaterialPackage *) tmp->data; MXFMetadataMaterialPackage *pack = (MXFMetadataMaterialPackage *) tmp->data;
MXFMetadataSourcePackage *src = (MXFMetadataSourcePackage *) pack; MXFMetadataSourcePackage *src = (MXFMetadataSourcePackage *) pack;
#ifndef GST_DISABLE_GST_DEBUG
MXFMetadataEssenceContainerData *econt = MXFMetadataEssenceContainerData *econt =
essence_container_for_source_package (storage, src); essence_container_for_source_package (storage, src);
GST_DEBUG_OBJECT (demux, GST_DEBUG_OBJECT (demux,
" Package (body_sid:%d index_sid:%d top_level:%d) with %d tracks , UID:%s", " Package (body_sid:%d index_sid:%d top_level:%d) with %d tracks , UID:%s",
econt->body_sid, econt->index_sid, src->top_level, pack->n_tracks, econt ? econt->body_sid : 0, econt ? econt->index_sid : 0,
mxf_umid_to_string (&pack->package_uid, str)); src->top_level, pack->n_tracks, mxf_umid_to_string (&pack->package_uid,
str));
#endif
GST_DEBUG_OBJECT (demux, " Package descriptor : %s", GST_DEBUG_OBJECT (demux, " Package descriptor : %s",
g_type_name (G_OBJECT_TYPE (src->descriptor))); g_type_name (G_OBJECT_TYPE (src->descriptor)));
for (i = 0; i < pack->n_tracks; i++) { for (i = 0; i < pack->n_tracks; i++) {
MXFMetadataTrack *track = pack->tracks[i]; MXFMetadataTrack *track = pack->tracks[i];
if (!track)
continue;
MXFMetadataSequence *sequence = track->sequence; MXFMetadataSequence *sequence = track->sequence;
guint di, si; guint di, si;
if (MXF_IS_METADATA_TIMELINE_TRACK (track)) { if (MXF_IS_METADATA_TIMELINE_TRACK (track)) {