From 0955d2393468b2a92ef3e1a79f512a19613e3375 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 8 Dec 2003 18:35:39 +0000 Subject: vobsub seeking support by Lu Ran git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11590 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vobsub.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'vobsub.c') diff --git a/vobsub.c b/vobsub.c index c2b313ca0b..2e2874242b 100644 --- a/vobsub.c +++ b/vobsub.c @@ -1267,6 +1267,22 @@ vobsub_get_next_packet(void *vobhandle, void** data, int* timestamp) return -1; } +void vobsub_seek(void * vobhandle, float pts) +{ + vobsub_t * vob = (vobsub_t *)vobhandle; + packet_queue_t * queue; + int seek_pts100 = (int)pts * 90000; + + if (vob->spu_streams && 0 <= vobsub_id && (unsigned) vobsub_id < vob->spu_streams_size) { + queue = vob->spu_streams + vobsub_id; + queue->current_index = 0; + while ((queue->packets + queue->current_index)->pts100 < seek_pts100) + ++queue->current_index; + if (queue->current_index > 0); + --queue->current_index; + } +} + void vobsub_reset(void *vobhandle) { -- cgit v1.2.3