[FFmpeg-cvslog] avformat/mxfdec: always use a stream which matches the first index table when seeking

Marton Balint git at videolan.org
Thu Mar 1 23:31:53 EET 2018


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sat Feb 17 19:31:33 2018 +0100| [f50741147ccac999a8a3e8a15244cbe525537622] | committer: Marton Balint

avformat/mxfdec: always use a stream which matches the first index table when seeking

Obviously this is still not perfect, but better then it was. Using the first
index table and mxf->current_edit_unit is still hardcoded in many places, so
this change has hopefully the less chance of breaking anything that works
now.

Signed-off-by: Marton Balint <cus at passwd.hu>

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

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

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 21fd2a876b..e0a4b5bd11 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -3451,6 +3451,20 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti
         mxf->current_edit_unit = sample_time;
     } else {
         t = &mxf->index_tables[0];
+        if (t->index_sid != source_track->index_sid) {
+            /* If the first index table does not belong to the stream, then find a stream which does belong to the index table */
+            for (i = 0; i < s->nb_streams; i++) {
+                MXFTrack *new_source_track = s->streams[i]->priv_data;
+                if (new_source_track && new_source_track->index_sid == t->index_sid) {
+                    sample_time = av_rescale_q(sample_time, new_source_track->edit_rate, source_track->edit_rate);
+                    source_track = new_source_track;
+                    st = s->streams[i];
+                    break;
+                }
+            }
+            if (i == s->nb_streams)
+                return AVERROR_INVALIDDATA;
+        }
 
         /* clamp above zero, else ff_index_search_timestamp() returns negative
          * this also means we allow seeking before the start */



More information about the ffmpeg-cvslog mailing list