Changeset 396

Show
Ignore:
Timestamp:
2004-02-09 22:04:45 (5 years ago)
Author:
conrad
Message:

added query of oggz_io to get input length for seeking
+ fixed 'if (bytes = ERR_BLAH)' typo from friday :)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • liboggz/trunk/doc/Makefile.am

    r346 r396  
    7070        rm -rf $(docdir) 
    7171 
    72 maintainer-clean-local: 
     72clean-local: 
    7373        if test -d liboggz; then rm -rf liboggz; fi 
     74        if test -f doxygen-build.stamp; then rm -f doxygen-build.stamp; fi 
  • liboggz/trunk/src/liboggz/oggz_read.c

    r395 r396  
    206206{ 
    207207  OggzReader * reader = &oggz->x.reader; 
    208   long nread = 0; 
    209208 
    210209  oggz_stream_t * stream; 
     
    456455  } 
    457456 
    458  
    459457  offset_at = oggz_io_tell (oggz); 
    460458 
    461459  oggz->offset = offset_at; 
    462  
    463460 
    464461  ogg_sync_reset (&reader->ogg_sync); 
     
    516513oggz_purge (OGGZ * oggz) 
    517514{ 
    518   long reset_ret; 
    519  
    520515  if (oggz == NULL) return OGGZ_ERR_BAD_OGGZ; 
    521516 
     
    560555        /* schyeah! */ 
    561556      } 
    562       if (bytes = OGGZ_ERR_SYSTEM) { 
     557      if (bytes == OGGZ_ERR_SYSTEM) { 
    563558          /*oggz_set_error (oggz, OGGZ_ERR_SYSTEM);*/ 
    564559          return -1; 
     
    801796  struct stat statbuf; 
    802797  oggz_off_t offset_orig, offset_at, offset_guess; 
    803   oggz_off_t offset_begin, offset_end, offset_next; 
     798  oggz_off_t offset_begin, offset_end = -1, offset_next; 
    804799  ogg_int64_t granule_at; 
    805800  ogg_int64_t unit_at, unit_begin = 0, unit_end = -1; 
     
    828823    } 
    829824 
    830 #if 0 
    831 #ifndef WIN32 
    832     if (S_ISREG(statbuf.st_mode) || S_ISLNK(statbuf.st_mode)) { 
    833       offset_end = statbuf.st_size; 
    834     } else { 
    835       /*oggz_set_error (oggz, OGGZ_ERR_NOSEEK);*/ 
    836       return -1; 
    837     } 
    838 #else 
    839     if (statbuf.st_mode & S_IFREG) { 
    840       offset_end = statbuf.st_size; 
    841     } else { 
    842       /*oggz_set_error (oggz, OGGZ_ERR_NOSEEK);*/ 
    843       return -1; 
    844     } 
    845 #endif 
    846 #else 
    847825    if (oggz_stat_regular (statbuf.st_mode)) { 
    848826      offset_end = statbuf.st_size; 
    849827    } else { 
    850828      /*oggz_set_error (oggz, OGGZ_ERR_NOSEEK);*/ 
    851       return -1; 
    852     } 
    853 #endif 
     829 
     830      /* XXX: should be able to just carry on and guess, as per io */ 
     831      /*return -1;*/ 
     832    } 
    854833  } else { 
    855     if (oggz->io == NULL || oggz->io->seek == NULL) 
     834    oggz_off_t offset_save; 
     835 
     836    if (oggz->io == NULL || oggz->io->seek == NULL) { 
    856837      /* No file, and no io seek method */ 
    857838      return -1; 
     839    } 
     840 
     841    /* Get the offset of the end by querying the io seek method */ 
     842    offset_save = oggz_io_tell (oggz); 
     843    if (oggz_io_seek (oggz, 0, SEEK_END) == -1) { 
     844      return -1; 
     845    } 
     846    offset_end = oggz_io_tell (oggz); 
     847    if (oggz_io_seek (oggz, offset_save, SEEK_SET) == -1) { 
     848      return -1; /* fubar */ 
     849    } 
    858850  } 
    859851 
     
    994986      break; 
    995987    } 
    996  
    997  
    998988  } 
    999989