summaryrefslogtreecommitdiffstats
path: root/vobsub.c
diff options
context:
space:
mode:
authorulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-05-14 03:43:45 +0000
committerulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-05-14 03:43:45 +0000
commit015ba173a185918183f3c91d9774e8689091142d (patch)
treeb02e978995881ba1a6245834f64153a51c2e3e22 /vobsub.c
parent020fe6ff75cd5b8935e09fcdd7e4ed9f6b3d98d2 (diff)
downloadmpv-015ba173a185918183f3c91d9774e8689091142d.tar.bz2
mpv-015ba173a185918183f3c91d9774e8689091142d.tar.xz
Add detection code for abnormal pts jump when seeking previous.
This patch make the vobsub works more accurately according to the requested pts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26765 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'vobsub.c')
-rw-r--r--vobsub.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/vobsub.c b/vobsub.c
index 8152e6e795..115402d590 100644
--- a/vobsub.c
+++ b/vobsub.c
@@ -1284,6 +1284,20 @@ vobsub_set_from_lang(void *vobhandle, unsigned char * lang)
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;