| @@ -8780,6 +8780,8 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) · 8779 unmodified lines |
| 8780 | 8780 | AVIndexEntry *sample = NULL; |
| 8781 | 8781 | int64_t best_dts = INT64_MAX; |
| 8782 | 8782 | int i; |
| 8783 | + MOVContext *mov = s->priv_data; |
| 8784 | + int no_interleave = !mov->interleaved_read || !(s->pb->seekable & AVIO_SEEKABLE_NORMAL); |
| 8783 | 8785 | for (i = 0; i < s->nb_streams; i++) { |
| 8784 | 8786 | AVStream *avst = s->streams[i]; |
| 8785 | 8787 | FFStream *const avsti = ffstream(avst); |
| @@ -8788,7 +8790,7 @@ static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st) · 2 unmodified lines |
| 8788 | 8790 | AVIndexEntry *current_sample = &avsti->index_entries[msc->current_sample]; |
| 8789 | 8791 | int64_t dts = av_rescale(current_sample->timestamp, AV_TIME_BASE, msc->time_scale); |
| 8790 | 8792 | av_log(s, AV_LOG_TRACE, "stream %d, sample %d, dts %"PRId64"\n", i, msc->current_sample, dts); |
| 8791 | | − if (!sample || (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL) && current_sample->pos < sample->pos) || |
| 8793 | + if (!sample || (no_interleave && current_sample->pos < sample->pos) || |
| 8792 | 8794 | ((s->pb->seekable & AVIO_SEEKABLE_NORMAL) && |
| 8793 | 8795 | ((msc->pb != s->pb && dts < best_dts) || (msc->pb == s->pb && dts != AV_NOPTS_VALUE && |
| 8794 | 8796 | ((FFABS(best_dts - dts) <= AV_TIME_BASE && current_sample->pos < sample->pos) || |
| @@ -9282,6 +9284,7 @@ static const AVOption mov_options[] = { · 487 unmodified lines |
| 9282 | 9284 | { "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), AV_OPT_TYPE_BOOL, |
| 9283 | 9285 | {.i64 = 0}, 0, 1, FLAGS }, |
| 9284 | 9286 | { "max_stts_delta", "treat offsets above this value as invalid", OFFSET(max_stts_delta), AV_OPT_TYPE_INT, {.i64 = UINT_MAX-48000*10 }, 0, UINT_MAX, .flags = AV_OPT_FLAG_DECODING_PARAM }, |
| 9287 | + { "interleaved_read", "Interleave packets from multiple tracks at demuxer level", OFFSET(interleaved_read), AV_OPT_TYPE_BOOL, {.i64 = 1 }, 0, 1, .flags = AV_OPT_FLAG_DECODING_PARAM }, |
| 9285 | 9288 | |
| 9286 | 9289 | { NULL }, |
| 9287 | 9290 | }; |