Logo Search packages:      
Sourcecode: vcdimager version File versions

uint32_t vcdinfo_get_entry_sect_count ( const vcdinfo_obj_t *  obj,
unsigned int  entry_num 

Return number of sector units in of an entry. 0 is returned if entry_num is invalid.

Return number of sector units in of an entry. 0 is returned if entry_num is out of range. The first entry number is 0.

Definition at line 629 of file info.c.

References vcdinf_get_num_entries(), vcdinfo_get_entry_lsn(), vcdinfo_get_entry_sect_count(), vcdinfo_get_track(), vcdinfo_get_track_lsn(), VCDINFO_INVALID_TRACK, and VCDINFO_NULL_LSN.

Referenced by vcdinfo_get_entry_sect_count().

  const EntriesVcd_t *entries = &obj->entries;
  const unsigned int entry_count = vcdinf_get_num_entries(entries);
  if (entry_num > entry_count) 
    return 0;
  else {
    const lsn_t this_lsn = vcdinfo_get_entry_lsn(obj, entry_num);
    lsn_t next_lsn;
    if (entry_num < entry_count-1) {
      track_t track=vcdinfo_get_track(obj, entry_num);
      track_t next_track=vcdinfo_get_track(obj, entry_num+1);
      next_lsn = vcdinfo_get_entry_lsn(obj, entry_num+1);
      /* If we've changed tracks, don't include pregap sector between 
      if (track != next_track) next_lsn -= CDIO_PREGAP_SECTORS;
    } else {
      /* entry_num == entry_count -1. Or the last entry.
         This is really really ugly. There's probably a better
         way to do it. 
         Below we get the track of the current entry and then the LBA of the
         beginning of the following (leadout?) track.

         Wait! It's uglier than that! Since VCD's can be created
         *without* a pregap to the leadout track, we try not to use
         that if we can get the entry from the ISO 9660 filesystem.
      track_t track = vcdinfo_get_track(obj, entry_num);
      if (track != VCDINFO_INVALID_TRACK) {
        iso9660_stat_t *statbuf;
        const lsn_t lsn = vcdinfo_get_track_lsn(obj, track);

        /* Try to get the sector count from the ISO 9660 filesystem */
        statbuf = iso9660_find_fs_lsn(obj->img, lsn);
        if (NULL != statbuf) {
          next_lsn = lsn + statbuf->secsize;
        } else {
          /* Failed on ISO 9660 filesystem. Use next track or
             LEADOUT track.  */
          next_lsn = vcdinfo_get_track_lsn(obj, track+1);
        if (next_lsn == VCDINFO_NULL_LSN)
          return 0;
      } else {
        /* Something went wrong. Set up size to zero. */
        return 0;
    return (next_lsn - this_lsn);

Generated by  Doxygen 1.6.0   Back to index