]> git.sesse.net Git - vlc/commitdiff
When the current title fail, try the next one
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 9 Apr 2014 13:17:33 +0000 (15:17 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 9 Apr 2014 13:39:15 +0000 (15:39 +0200)
Arccos FTW
Ref #6649

modules/access/dvdread.c

index db37a12d3bf5a25b0a5b9cf6873bee55445b575b..bab72177f63f6c636dbd93125ceb69ee28022c76 100644 (file)
@@ -475,12 +475,15 @@ static int Demux( demux_t *p_demux )
         /* End of title */
         if( p_sys->i_cur_cell >= p_sys->p_cur_pgc->nr_of_cells )
         {
-            if( p_sys->i_title + 1 >= p_sys->i_titles )
+            int k = p_sys->i_title;
+
+            /* Looking for a not broken title */
+            while( k < p_sys->i_titles && DvdReadSetArea( p_demux, ++k, 0, -1 ) != VLC_SUCCESS )
             {
-                return 0; /* EOF */
+                msg_Err(p_demux, "Failed next title, trying another: %i", k );
+                if( k >= p_sys->i_titles )
+                    return 0; // EOF
             }
-
-            DvdReadSetArea( p_demux, p_sys->i_title + 1, 0, -1 );
         }
 
         if( p_sys->i_pack_len >= 1024 )
@@ -500,12 +503,15 @@ static int Demux( demux_t *p_demux )
 
     if( p_sys->i_cur_cell >= p_sys->p_cur_pgc->nr_of_cells )
     {
-        if( p_sys->i_title + 1 >= p_sys->i_titles )
+        int k = p_sys->i_title;
+
+        /* Looking for a not broken title */
+        while( k < p_sys->i_titles && DvdReadSetArea( p_demux, ++k, 0, -1 ) != VLC_SUCCESS )
         {
-            return 0; /* EOF */
+            msg_Err(p_demux, "Failed next title, trying another: %i", k );
+            if( k >= p_sys->i_titles )
+                return 0; // EOF
         }
-
-        DvdReadSetArea( p_demux, p_sys->i_title + 1, 0, -1 );
     }
 
     /*