[vlc-commits] When the current title fail, try the next one

Jean-Baptiste Kempf git at videolan.org
Wed Apr 9 15:39:48 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Wed Apr  9 15:17:33 2014 +0200| [76c0e0f70f3871ad31a9cd18fe1ce9fc5c8145ab] | committer: Jean-Baptiste Kempf

When the current title fail, try the next one

Arccos FTW
Ref #6649

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

 modules/access/dvdread.c |   22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c
index db37a12..bab7217 100644
--- a/modules/access/dvdread.c
+++ b/modules/access/dvdread.c
@@ -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 );
     }
 
     /*



More information about the vlc-commits mailing list