[DVDnav-discuss] r947 - trunk/libdvdnav/src/searching.c

nicodvb subversion at mplayerhq.hu
Sat Jul 14 13:25:45 CEST 2007


Author: nicodvb
Date: Sat Jul 14 13:25:44 2007
New Revision: 947

Log:
make dvdnav_sector_search() work correctly for blocks in the last vobu; patch by ggurov+abc-bg

Modified:
   trunk/libdvdnav/src/searching.c

Modified: trunk/libdvdnav/src/searching.c
==============================================================================
--- trunk/libdvdnav/src/searching.c	(original)
+++ trunk/libdvdnav/src/searching.c	Sat Jul 14 13:25:44 2007
@@ -78,32 +78,26 @@ static dvdnav_status_t dvdnav_scan_admap
   if(admap) {
     uint32_t address = 0;
     uint32_t vobu_start, next_vobu;
-    int32_t found = 0;
     int admap_entries = (admap->last_byte + 1 - VOBU_ADMAP_SIZE)/VOBU_ADMAP_SIZE;
 
     /* Search through ADMAP for best sector */
     vobu_start = SRI_END_OF_CELL;
     /* FIXME: Implement a faster search algorithm */
-    while((!found) && (address < admap_entries)) {
+    while(address < admap_entries) {
       next_vobu = admap->vobu_start_sectors[address];
 
       /* fprintf(MSG_OUT, "libdvdnav: Found block %u\n", next_vobu); */
 
       if(vobu_start <= seekto_block &&
           next_vobu > seekto_block) {
-        found = 1;
+        break;
       } else {
         vobu_start = next_vobu;
       }
       address ++;
     }
-    if(found) {
       *vobu = vobu_start;
       return DVDNAV_STATUS_OK;
-    } else {
-      fprintf(MSG_OUT, "libdvdnav: Could not locate block\n");
-      return DVDNAV_STATUS_ERR;
-    }
   }
   fprintf(MSG_OUT, "libdvdnav: admap not located\n");
   return DVDNAV_STATUS_ERR;



More information about the DVDnav-discuss mailing list