[DVDnav-discuss] r949 - trunk/libdvdnav2/src/searching.c

nicodvb subversion at mplayerhq.hu
Sat Jul 14 13:28:46 CEST 2007


Author: nicodvb
Date: Sat Jul 14 13:28:46 2007
New Revision: 949

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

Modified:
   trunk/libdvdnav2/src/searching.c

Modified: trunk/libdvdnav2/src/searching.c
==============================================================================
--- trunk/libdvdnav2/src/searching.c	(original)
+++ trunk/libdvdnav2/src/searching.c	Sat Jul 14 13:28:46 2007
@@ -65,32 +65,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