comparison libmpdemux/demux_mkv.c @ 19430:de5065d3ce74

Fix seeking in matroska files when timecodes do not start from zero.
author eugeni
date Fri, 18 Aug 2006 12:20:43 +0000
parents 4e68a3881201
children c8daf3471201
comparison
equal deleted inserted replaced
19429:3fb0eb698ce8 19430:de5065d3ce74
3604 /* let's find the entry in the indexes with the smallest */ 3604 /* let's find the entry in the indexes with the smallest */
3605 /* difference to the wanted timecode. */ 3605 /* difference to the wanted timecode. */
3606 for (i=0; i < mkv_d->num_indexes; i++) 3606 for (i=0; i < mkv_d->num_indexes; i++)
3607 if (mkv_d->indexes[i].tnum == demuxer->video->id) 3607 if (mkv_d->indexes[i].tnum == demuxer->video->id)
3608 { 3608 {
3609 diff = target_timecode - (int64_t) mkv_d->indexes[i].timecode; 3609 diff = target_timecode + mkv_d->first_tc - (int64_t) mkv_d->indexes[i].timecode;
3610 3610
3611 if ((flags & 1 || target_timecode <= mkv_d->last_pts*1000) 3611 if ((flags & 1 || target_timecode <= mkv_d->last_pts*1000)
3612 && diff >= 0 && diff < min_diff) 3612 && diff >= 0 && diff < min_diff)
3613 { 3613 {
3614 min_diff = diff; 3614 min_diff = diff;