OSDN Git Service

Improve loop detection in dvdnav
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 11 Feb 2011 21:38:41 +0000 (21:38 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 11 Feb 2011 21:38:41 +0000 (21:38 +0000)
Loops in titles of only a single chapter were not being detected.
We now also check the cell number for loops.

git-svn-id: svn://localhost/HandBrake/trunk@3796 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/dvd.h
libhb/dvdnav.c

index 95f85b1..919d3ac 100644 (file)
@@ -51,6 +51,7 @@ struct hb_dvdnav_s
     int            title;
     int            title_block_count;
     int            chapter;
+    int            cell;
     hb_list_t    * list_chapter;
     int            stopped;
 };
index 7571b57..1d22cf5 100644 (file)
@@ -1345,6 +1345,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;
+    d->cell = 0;
     return 1;
 }
 
@@ -1471,6 +1472,8 @@ static int hb_dvdnav_seek( hb_dvd_t * e, float f )
                   dvdnav_err_to_string(d->dvdnav) );
         return 0;
     }
+    d->chapter = 0;
+    d->cell = 0;
     return 1;
 }
 
@@ -1610,8 +1613,11 @@ static int hb_dvdnav_read( hb_dvd_t * e, hb_buffer_t * b )
             * and update the decoding/displaying accordingly. 
             */
             {
+                dvdnav_cell_change_event_t * cell_event;
                 int tt = 0, pgcn = 0, pgn = 0, c;
 
+                cell_event = (dvdnav_cell_change_event_t*)b->data;
+
                 dvdnav_current_title_program(d->dvdnav, &tt, &pgcn, &pgn);
                 if (tt != d->title)
                 {
@@ -1629,6 +1635,11 @@ static int hb_dvdnav_read( hb_dvd_t * e, hb_buffer_t * b )
                     }
                     chapter = d->chapter = c;
                 }
+                else if ( cell_event->cellN <= d->cell )
+                {
+                    return 0;
+                }
+                d->cell = cell_event->cellN;
             }
             break;