[vlc-commits] demux: subtitle: fix seek with single sub

Francois Cartegnie git at videolan.org
Mon Feb 19 17:15:52 CET 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 19 17:15:00 2018 +0100| [5e78630c67b50d12367990645ba3603e2168445d] | committer: Francois Cartegnie

demux: subtitle: fix seek with single sub

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e78630c67b50d12367990645ba3603e2168445d
---

 modules/demux/subtitle.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/modules/demux/subtitle.c b/modules/demux/subtitle.c
index 7ef52f3939..5b8493692d 100644
--- a/modules/demux/subtitle.c
+++ b/modules/demux/subtitle.c
@@ -784,17 +784,15 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 
         case DEMUX_SET_TIME:
             i64 = va_arg( args, int64_t );
-            for( size_t i = 0; i + 1< p_sys->subtitles.i_count; i++ )
+            p_sys->b_first_time = true;
+            p_sys->i_next_demux_date = i64;
+            for( size_t i = 0; i < p_sys->subtitles.i_count; i++ )
             {
-                if( p_sys->subtitles.p_array[i + 1].i_start >= i64 )
-                {
-                    p_sys->subtitles.i_current = i;
-                    p_sys->i_next_demux_date = i64;
-                    p_sys->b_first_time = true;
-                    return VLC_SUCCESS;
-                }
+                if( p_sys->subtitles.p_array[i].i_start > i64 )
+                    break;
+                p_sys->subtitles.i_current = i;
             }
-            break;
+            return VLC_SUCCESS;
 
         case DEMUX_GET_POSITION:
             pf = va_arg( args, double * );



More information about the vlc-commits mailing list