Commit 5b6960f9 authored by Marton Balint's avatar Marton Balint

avformat/mxfdec: guess wrapping of tracks by other tracks with the same body sid

This affects the following samples:

samples/ffmpeg-bugs/roundup/issue1775/av_seek_frame_failure.mxf
samples/ffmpeg-bugs/trac/ticket1957/16ch.mxf
samples/ffmpeg-bugs/trac/ticket5016/r0.mxf
samples/ffmpeg-bugs/trac/ticket5016/r1.mxf
samples/ffmpeg-bugs/trac/ticket5316/hq.MXF
samples/ffmpeg-bugs/trac/ticket5316/hqx.MXF

Some AVPacket->pos values are changed because for frame wrapped tracks we point
to the KLV offset and not the data.
Signed-off-by: 's avatarMarton Balint <cus@passwd.hu>
parent a5136426
......@@ -2553,6 +2553,24 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
}
}
for (int i = 0; i < mxf->fc->nb_streams; i++) {
MXFTrack *track1 = mxf->fc->streams[i]->priv_data;
if (track1 && track1->body_sid) {
for (int j = i + 1; j < mxf->fc->nb_streams; j++) {
MXFTrack *track2 = mxf->fc->streams[j]->priv_data;
if (track2 && track1->body_sid == track2->body_sid && track1->wrapping != track2->wrapping) {
if (track1->wrapping == UnknownWrapped)
track1->wrapping = track2->wrapping;
else if (track2->wrapping == UnknownWrapped)
track2->wrapping = track1->wrapping;
else
av_log(mxf->fc, AV_LOG_ERROR, "stream %d and stream %d have the same BodySID (%d) "
"with different wrapping\n", i, j, track1->body_sid);
}
}
}
}
ret = 0;
fail_and_free:
return ret;
......
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