# HG changeset patch # User alex # Date 1070908539 0 # Node ID 5cff0d11b47b8dbc1ba8d76827323a3da941634b # Parent bd910f698b8d8dc9820358ad0554d73bd65cc8a6 vobsub seeking support by Lu Ran diff -r bd910f698b8d -r 5cff0d11b47b mplayer.c --- a/mplayer.c Mon Dec 08 17:40:41 2003 +0000 +++ b/mplayer.c Mon Dec 08 18:35:39 2003 +0000 @@ -3398,7 +3398,8 @@ /* FIXME there should be real seeking for vobsub */ if(sh_video) sh_video->pts=d_video->pts; if (vo_vobsub) - vobsub_reset(vo_vobsub); + //vobsub_reset(vo_vobsub); + vobsub_seek(vo_vobsub,sh_video->pts); #if 0 if(sh_video && d_video->packs == 0) ds_fill_buffer(d_video); diff -r bd910f698b8d -r 5cff0d11b47b vobsub.c --- a/vobsub.c Mon Dec 08 17:40:41 2003 +0000 +++ b/vobsub.c Mon Dec 08 18:35:39 2003 +0000 @@ -1267,6 +1267,22 @@ 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) { diff -r bd910f698b8d -r 5cff0d11b47b vobsub.h --- a/vobsub.h Mon Dec 08 17:40:41 2003 +0000 +++ b/vobsub.h Mon Dec 08 18:35:39 2003 +0000 @@ -15,6 +15,7 @@ extern void vobsub_out_close(void *me); extern int vobsub_set_from_lang(void *vobhandle, unsigned char * lang); extern unsigned int vobsub_get_forced_subs_flag(void const * const vobhandle); +extern void vobsub_seek(void * vobhandle, float pts); #endif /* MPLAYER_VOBSUB_H */