1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/mxfdec: fix sorting of index segments

Fixes ticket #5320.

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint 2018-02-07 00:20:01 +01:00
parent 9492bb58ee
commit c46e430c5b

View File

@ -1309,9 +1309,15 @@ static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segment
* We want the smallest values for the keys than what we currently have, unless this is the first such entry this time around.
* If we come across an entry with the same IndexStartPosition but larger IndexDuration, then we'll prefer it over the one we currently have.
*/
if ((i == 0 || s->body_sid > last_body_sid || s->index_sid > last_index_sid || s->index_start_position > last_index_start) &&
(best == -1 || s->body_sid < best_body_sid || s->index_sid < best_index_sid || s->index_start_position < best_index_start ||
(s->index_start_position == best_index_start && s->index_duration > best_index_duration))) {
if ((i == 0 ||
s->body_sid > last_body_sid ||
s->body_sid == last_body_sid && s->index_sid > last_index_sid ||
s->body_sid == last_body_sid && s->index_sid == last_index_sid && s->index_start_position > last_index_start) &&
(best == -1 ||
s->body_sid < best_body_sid ||
s->body_sid == best_body_sid && s->index_sid < best_index_sid ||
s->body_sid == best_body_sid && s->index_sid == best_index_sid && s->index_start_position < best_index_start ||
s->body_sid == best_body_sid && s->index_sid == best_index_sid && s->index_start_position == best_index_start && s->index_duration > best_index_duration)) {
best = j;
best_body_sid = s->body_sid;
best_index_sid = s->index_sid;