[FFmpeg-devel] [PATCH 3/5] avformat/mxfdec: guess wrapping of tracks by other tracks with the same body sid
Marton Balint
cus at passwd.hu
Fri Apr 12 02:09:18 EEST 2019
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;
+ }
+ return UnknownWrapped;
+}
+
static int mxf_parse_structural_metadata(MXFContext *mxf)
{
MXFPackage *material_package = NULL;
@@ -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);
+ }
+
ret = 0;
fail_and_free:
return ret;
@@ -2913,16 +2929,6 @@ static int mxf_parse_handle_partition_or_eof(MXFContext *mxf)
return mxf->parsing_backward ? mxf_seek_to_previous_partition(mxf) : 1;
}
-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;
- }
- return UnknownWrapped;
-}
-
/**
* Figures out the proper offset and length of the essence container in each partition
*/
--
2.16.4
More information about the ffmpeg-devel
mailing list