# HG changeset patch # User ulion # Date 1210736625 0 # Node ID 99458e732ebdee81493c5be96ee5abae1a8c0602 # Parent 401426ba1ecf7ebaa0e186769740ccc862ec4bdf Add detection code for abnormal pts jump when seeking previous. This patch make the vobsub works more accurately according to the requested pts. diff -r 401426ba1ecf -r 99458e732ebd vobsub.c --- a/vobsub.c Wed May 14 03:37:03 2008 +0000 +++ b/vobsub.c Wed May 14 03:43:45 2008 +0000 @@ -1284,6 +1284,20 @@ static void vobsub_queue_reseek(packet_queue_t *queue, unsigned int pts100) { int reseek_count = 0; unsigned int lastpts = 0; + + if (queue->current_index > 0 + && (queue->packets[queue->current_index].pts100 == UINT_MAX + || queue->packets[queue->current_index].pts100 > pts100)) { + // possible pts seek previous, try to check it. + int i = 1; + while (queue->current_index >= i + && queue->packets[queue->current_index-i].pts100 == UINT_MAX) + ++i; + if (queue->current_index >= i + && queue->packets[queue->current_index-i].pts100 > pts100) + // pts seek previous confirmed, reseek from beginning + queue->current_index = 0; + } while (queue->current_index < queue->packets_size && queue->packets[queue->current_index].pts100 <= pts100) { lastpts = queue->packets[queue->current_index].pts100;