summaryrefslogtreecommitdiffstats
path: root/vobsub.c
diff options
context:
space:
mode:
authorulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-20 15:43:10 +0000
committerulion <ulion@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-20 15:43:10 +0000
commit5d2de57e5bcef12cc7d570c9d83d27cebd94f812 (patch)
tree0cfe9b6da94488606e4146d3b2b85512164b836a /vobsub.c
parentb060a1c6443d47a4b592508b6651ec8589eaf511 (diff)
downloadmpv-5d2de57e5bcef12cc7d570c9d83d27cebd94f812.tar.bz2
mpv-5d2de57e5bcef12cc7d570c9d83d27cebd94f812.tar.xz
Fix vobsub_seek use same reseek method as vobsub_get_packet did.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25819 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'vobsub.c')
-rw-r--r--vobsub.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/vobsub.c b/vobsub.c
index c3230ff25b..82ce4f0a1f 100644
--- a/vobsub.c
+++ b/vobsub.c
@@ -1279,14 +1279,9 @@ vobsub_set_from_lang(void *vobhandle, unsigned char * lang)
mp_msg(MSGT_VOBSUB, MSGL_WARN, "No matching VOBSUB language found!\n");
return -1;
}
-
-int
-vobsub_get_packet(void *vobhandle, float pts,void** data, int* timestamp) {
- vobsub_t *vob = (vobsub_t *)vobhandle;
- unsigned int pts100 = 90000 * pts;
- if (vob->spu_streams && 0 <= vobsub_id && (unsigned) vobsub_id < vob->spu_streams_size) {
- packet_queue_t *queue = vob->spu_streams + vobsub_id;
+/// make sure we seek to the first packet of packets having same pts values.
+static void vobsub_queue_reseek(packet_queue_t *queue, unsigned int pts100) {
int reseek_count = 0;
unsigned int lastpts = 0;
while (queue->current_index < queue->packets_size
@@ -1300,6 +1295,16 @@ vobsub_get_packet(void *vobhandle, float pts,void** data, int* timestamp) {
queue->packets[queue->current_index-1].pts100 != lastpts)
break;
}
+}
+
+int
+vobsub_get_packet(void *vobhandle, float pts,void** data, int* timestamp) {
+ vobsub_t *vob = (vobsub_t *)vobhandle;
+ unsigned int pts100 = 90000 * pts;
+ if (vob->spu_streams && 0 <= vobsub_id && (unsigned) vobsub_id < vob->spu_streams_size) {
+ packet_queue_t *queue = vob->spu_streams + vobsub_id;
+
+ vobsub_queue_reseek(queue, pts100);
while (queue->current_index < queue->packets_size) {
packet_t *pkt = queue->packets + queue->current_index;
@@ -1346,11 +1351,7 @@ void vobsub_seek(void * vobhandle, float pts)
return;
queue = vob->spu_streams + vobsub_id;
queue->current_index = 0;
- while (queue->current_index < queue->packets_size
- && (queue->packets + queue->current_index)->pts100 < seek_pts100)
- ++queue->current_index;
- if (queue->current_index > 0)
- --queue->current_index;
+ vobsub_queue_reseek(queue, seek_pts100);
}
}