OSDN Git Service

LinGui: preference improvements
[handbrake-jp/handbrake-jp-git.git] / libhb / dvdnav.c
index 2236f6d..dfe847d 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "dvdnav/dvdnav.h"
 #include "dvdread/ifo_read.h"
+#include "dvdread/ifo_print.h"
 #include "dvdread/nav_read.h"
 
 #define DVD_READ_CACHE 1
@@ -842,6 +843,7 @@ static int hb_dvdnav_start( hb_dvd_t * e, hb_title_t *title, int c )
     }
     d->title = t;
     d->stopped = 0;
+    d->chapter = 0;
     return 1;
 }
 
@@ -1080,8 +1082,16 @@ static int hb_dvdnav_read( hb_dvd_t * e, hb_buffer_t * b )
                     return 0;
                 }
                 c = FindChapterIndex(d->list_chapter, pgcn, pgn);
-                if (c > d->chapter)
+                if (c != d->chapter)
+                {
+                    if (c < d->chapter)
+                    {
+                        // Some titles end with a 'link' back to the beginning so
+                        // a transition to an earlier chapter means we're done.
+                        return 0;
+                    }
                     chapter = d->chapter = c;
+                }
             }
             break;