[FFmpeg-devel] [PATCH 3/5] avformat/mxfdec: guess wrapping of tracks by other tracks with the same body sid
Tomas Härdin
tjoppen at acc.umu.se
Sun Apr 14 18:58:21 EEST 2019
fre 2019-04-12 klockan 01:09 +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 | 26 ++++++++++++++++----------
> 1 file changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index 18c038c3f6..236294880e 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -2144,6 +2144,16 @@ static int mxf_add_metadata_stream(MXFContext *mxf, MXFTrack *track)
> return 0;
> }
>
> +static MXFWrappingScheme mxf_get_wrapping_by_body_sid(AVFormatContext *s, int body_sid)
> +{
> + for (int i = 0; i < s->nb_streams; i++) {
> + MXFTrack *track = s->streams[i]->priv_data;
> + if (track && track->body_sid == body_sid && track->wrapping != UnknownWrapped)
> + return track->wrapping;
Maybe print a warning? Especially if, god forbid, the file mixes
ClipWrapping and FrameWrapping..
But now I see this function was merely moved further up, so that could
be a separate patch..
> @@ -2553,6 +2563,12 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
> }
> }
>
> + for (int i = 0; i < mxf->fc->nb_streams; i++) {
> + MXFTrack *track = mxf->fc->streams[i]->priv_data;
> + if (track && track->body_sid && track->wrapping == UnknownWrapped)
> + track->wrapping = mxf_get_wrapping_by_body_sid(mxf->fc, track->body_sid);
> + }
Or maybe put a warning here instead. Vendors should fix their dang MXF
muxers..
/Tomas
More information about the ffmpeg-devel
mailing list