summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-12-08 18:35:39 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-12-08 18:35:39 +0000
commit0955d2393468b2a92ef3e1a79f512a19613e3375 (patch)
treec46fcc1d018f4d881ae7f760e35153516918323a
parentd5066b11efa2ea244f0efbc0bc07604af5294b75 (diff)
downloadmpv-0955d2393468b2a92ef3e1a79f512a19613e3375.tar.bz2
mpv-0955d2393468b2a92ef3e1a79f512a19613e3375.tar.xz
vobsub seeking support by Lu Ran
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11590 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--mplayer.c3
-rw-r--r--vobsub.c16
-rw-r--r--vobsub.h1
3 files changed, 19 insertions, 1 deletions
diff --git a/mplayer.c b/mplayer.c
index 6e22bb6792..a90094f600 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -3398,7 +3398,8 @@ if(rel_seek_secs || abs_seek_pos){
/* 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 --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)
{
diff --git a/vobsub.h b/vobsub.h
index e14e4aa935..179791f06f 100644
--- a/vobsub.h
+++ b/vobsub.h
@@ -15,6 +15,7 @@ extern void vobsub_out_output(void *me, const unsigned char *packet, int len, do
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 */