Mercurial > libavformat.hg
comparison mov.c @ 2083:2c3887f02739 libavformat
fix ctts index computation when seeking, check must be done against next ctts sample, thanks to Uoti
author | bcoudurier |
---|---|
date | Sat, 12 May 2007 22:02:27 +0000 |
parents | dc74a26ea890 |
children | f5671ebda7cd |
comparison
equal
deleted
inserted
replaced
2082:676463c51735 | 2083:2c3887f02739 |
---|---|
1523 dprintf(st->codec, "stream %d, found sample %d\n", st->index, sc->current_sample); | 1523 dprintf(st->codec, "stream %d, found sample %d\n", st->index, sc->current_sample); |
1524 /* adjust ctts index */ | 1524 /* adjust ctts index */ |
1525 if (sc->ctts_data) { | 1525 if (sc->ctts_data) { |
1526 time_sample = 0; | 1526 time_sample = 0; |
1527 for (i = 0; i < sc->ctts_count; i++) { | 1527 for (i = 0; i < sc->ctts_count; i++) { |
1528 time_sample += sc->ctts_data[i].count; | 1528 int next = time_sample + sc->ctts_data[i].count; |
1529 if (time_sample >= sc->current_sample) { | 1529 if (next > sc->current_sample) { |
1530 sc->sample_to_ctime_index = i; | 1530 sc->sample_to_ctime_index = i; |
1531 sc->sample_to_ctime_sample = time_sample - sc->current_sample; | 1531 sc->sample_to_ctime_sample = sc->current_sample - time_sample; |
1532 break; | 1532 break; |
1533 } | 1533 } |
1534 time_sample = next; | |
1534 } | 1535 } |
1535 } | 1536 } |
1536 return sample; | 1537 return sample; |
1537 } | 1538 } |
1538 | 1539 |