[FFmpeg-cvslog] avformat/mxfdec: guess wrapping of tracks by other tracks with the same body sid

Marton Balint git at videolan.org
Sun Apr 28 23:08:32 EEST 2019


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sun Apr  7 02:27:49 2019 +0200| [5b6960f955a8914594182baeb1ab8f523acc5323] | committer: 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: Marton Balint <cus at passwd.hu>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b6960f955a8914594182baeb1ab8f523acc5323
---

 libavformat/mxfdec.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 2c44852062..034025bcaa 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -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;



More information about the ffmpeg-cvslog mailing list