[FFmpeg-devel] [PATCHv2 3/5] avformat/mxfdec: guess wrapping of tracks by other tracks with the same body sid

Tomas Härdin tjoppen at acc.umu.se
Fri Apr 26 13:06:15 EEST 2019


ons 2019-04-24 klockan 22:31 +0200 skrev Marton Balint:
> 
> On Wed, 24 Apr 2019, Tomas Härdin wrote:
> 
> > mån 2019-04-22 klockan 19:15 +0200 skrev Marton Balint:
> > > 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>
> > > 
> > > ---
> > >  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);
> > > +                }
> > > +            }
> > > +        }
> > > +    }
> > 
> > Don't we have mxf_get_wrapping_by_body_sid() for this?
> > 
> 
> That is similar, yes, but in order to find and warn about every mismatch 
> between frame wrapped and clip wrapped as you suggested we cannot use it 
> here directly (mxf_get_wrapping_by_body_sid finds the first stream with a 
> known wrapping and a matching body sid).
> 
> Also we cannot warn in mxf_get_wrapping_by_body_sid because that is called 
> for each partition.

Ah, OK then :)

/Tomas


More information about the ffmpeg-devel mailing list