Chapter III  Data Retrieval Structure

III.1  General


This chapter contains the format of data structures  used by the CD   file 
manager to  retrieve  named files  from  a CD-I  disc.   It  contains    a 
specification for the data organization, Disc Label, and directory  record 
structures.

From an access point of view, the disc consists of directly   addressable  
sectors, numbered consecutively  (beginning at  zero). The main    channel 
address of block zero is taken to be exactly 00 minutes 02 seconds and  00 
sector number.  The disc logical format specifies the  contents of   these 
sectors.

Definitions for this chapter:

(1)         The word sector is used to designate a CD-I physical  sector. 
      The data part of a logical sector is referred to as a block.

(2)         Block  addresses are  32-bit integers.   They are   converted 
      into  absolute  disc  addresses   (e.g.,  minutes,  seconds,    and 
      sectors).

(3) BP  indicates Byte Position within a table, starting at 1.

Rules for construction of file names
Any file name length is limited to 28 bytes.
When the CD-I default  character set (ISO 8859-1)  is used the   following 
rules must be followed:

A file  name can  contain any  number of  upper  or lower  case   letters, 
numbers or special characters (as listed below).  While the file name  may 
begin with any of the following characters or digits, the file name   must 
contain at least one letter or number. Within  these limitations, it   can 
contain any combinations of the following:

- upper case letter:A - Z
- lower case letter:a - z
- decimal digits:  0 - 9
- underscore:     ___
- period:         .
- dollar sign:     $

File names may not contain spaces.

Here are some examples of legal names:

raw.data.2        project_review_backup
X6809            $Ship.Dir
.login          12345

Here are some examples of illegal names:

Max*min           (* is not a legal character)
open orders       (Name cannot contain a space)
this.name.obviously.has.more.than.28.characters (too long)


1.1 Application file names


It is recommended  that applications  use module names  that start    with 
"cdi_"  (e.g.  cdi_myprog).   This  will  help  prevent  conflicts    with 
manufacturer dependent or standard CD-RTOS modules.III.2  Disc Label

2.1  General Structure of the Disc Label


There are 2 record types in the CD-I Disc Label:

(1)   File Structure Volume Descriptor Record.  Every CD-I disc  contains 
    at least one File Structure Volume Descriptor record.


(2)         Terminator  Record.   At  least  one  Terminator record    is 
     required on every CD-I  disc.  It is the  last record in  the   Disc 
     Label and signifies the end of the Disc Label.



2.2  Detailed Specification of  the File  Structure   Volume               
Descriptor Record


There can be one  or more File Structure  Volume Descriptor records.    If 
the File  Structure Volume  Descriptor record  for the  player's   default 
character set  (see VII.3.1.4.1.3)  is not  found, then  the  first   File 
Structure Volume Descriptor will be used.

Figure  III.1  illustrates  the  format  of  a  File   Structure    Volume 
Descriptor.


       Figure III.1

________________________________________________________________
_   BP   _ Size in bytes _            Description              _
________________________________________________________________
_     1  _        1      _ Disc Label Record Type              _
_     2  _        5      _ Volume Structure Standard ID        _
_     7  _        1      _ Volume Structure Version number     _
_     8  _        1      _ Volume flags                        _
_     9  _       32      _ System identifier                   _
_    41  _       32      _ Volume identifier                   _
_    73  _       12      _ Reserved                            _
_    85  _        4      _ Volume space size                   _
_    89  _       32      _ Coded Character Set identifier      _
_   121  _        2      _ Reserved                            _
_   123  _        2      _ Number of Volumes in Album          _
_   125  _        2      _ Reserved                            _
_   127  _        2      _ Album Set Sequence number           _
_   129  _        2      _ Reserved                            _
_   131  _        2      _ Logical Block size                  _
_   133  _        4      _ Reserved                            _
_   137  _        4      _ Path Table size                     _
_   141  _        8      _ Reserved                            _
_   149  _        4      _ Address of Path Table               _
_   153  _       38      _ Reserved                            _
_   191  _      128      _ Album identifier                    _
_   319  _      128      _ Publisher identifier                _
_   447  _      128      _ Data Preparer identifier            _
_   575  _      128      _ Application identifier              _
_   703  _       32      _ Copyright file name                 _
_   735  _        5      _ Reserved                            _
_   740  _       32      _ Abstract file name                  _
_   772  _        5      _ Reserved                            _
_   777  _       32      _ Bibliographic file name             _
_   809  _        5      _ Reserved                            _
_   814  _       16      _ Creation date and time              _
_   830  _        1      _ Reserved                            _
_   831  _       16      _ Modification date and time          _
_   847  _        1      _ Reserved                            _
_   848  _       16      _ Expiration date and time            _
_   864  _        1      _ Reserved                            _
_   865  _       16      _ Effective date and time             _
_   881  _        1      _ Reserved                            _
_   882  _        1      _ File Structure Standard Version     _
_        _               _ number                              _
_   883  _        1      _ Reserved                            _
_   884  _      512      _ Application use                     _
_  1396  _      653      _ Reserved                            _
________________________________________________________________
The fields in the  File Structure Volume Descriptor  have the    following 
meaning:

Disc Label  Record  Type:   This  field  always  indicates  one  of    the 
following:

 -    the Standard File Structure Volume Descriptor record with the  byte 
    set to 1,
  -   the Coded Character  Set File Structure Volume  Descriptor   record 
    with the byte set to 2.
    All other values for this byte are reserved.

The standard File Structure Volume Descriptor specifies a file   structure 
with all character strings  recorded using the ISO  646 (IRV)    character 
set.

A Coded  Character  Set File  Structure  Volume Descriptor  is  used    to 
describe a file  structure which  uses a character  set other  than    the 
standard ISO 646 character set for the following descriptor fields:

(1) In the File Structure Volume Descriptor

    - System identifier          - Application identifier
    - Volume identifier          - Data Preparer identifier
    - Album identifier           - Copyright file name
    - Publisher identifier       - Abstract file name

(2) File names in each directory record of the file structure.

(3) Directory file names in each Path Table Entry of the file structure.

  A Coded Character Set file structure describes the same file system  as 
  the standard file structure,  but the character strings  in the   above 
  descriptor  fields  are  encoded  in  an  alternative  character    set 
  identified by the Coded Character Set identifier.

  Shifted JIS Kanji is specified by a Disc  Label Record Type of two,   a 
  Volume flag of  one, and  the ISO 2022  escape sequence  for   standard 
  Kanji.








Volume Structure Standard ID:  This name field represents the standard  to 
which the disc file  structure conforms.  CD-I discs  contain the   string 
"CD-I" followed immediately with a space character.

Volume Structure Version number:  The number in this field represents  the 
version number of the standard to which the  disc conforms.  The   current 
version is one.

Volume flags:  The bits of this field are  numbered from 0 to 7   starting 
with the least significant bit.  They specify the characteristics of   the 
volume as outlined below in Figure III.2.


Figure III.2

________________________________________________________________
_ Bit Position _              Characteristic                   _
________________________________________________________________
_      0       _ A value of zero indicates the coded character _
_              _ set identifier field specifies only an escape _
_              _ sequence registered according to ISO 2375.  A _
_              _ value of one indicates the Coded Character Set_
_              _ identifier field specifies an escape sequence _
_              _ not registered according to ISO 2375.         _
_              _                                               _
_    1 - 7     _ All bits are 0 (reserved for future standard- _
_              _ ization).                                     _
________________________________________________________________


System identifier:  This field identifies the operating system which   may 
use any fields described as reserved for the system. All CD-I discs   must 
contain the string "CD-RTOS" padded on the right with space characters.

Volume identifier:  This field contains the logical name of the CD-I  disc 
padded on the right with space characters.

Volume space size in blocks:  This field represents the total size of  the 
usable portion of the disc in blocks (e.g., the highest addressable  block 
to the operating system is the value of this field minus 1).






Coded Character Set identifier:  This field specifies one escape  sequence 
according to the International  Register of Coded Character  Sets to    be 
used with escape sequence  standards for recording.  The  ESC   character, 
which is the  first character  of all sequences,  shall be  omitted   when 
recording this field.

Number of Volumes in Album:  The total number  of discs in the album    to 
which this disc belongs is written in this field.

Album Set Sequence number:  This number specifies the  relative   sequence 
number of this disc in the album to which it belongs. The first album   in 
the sequence will be the number 1.

Logical Block size:  This field contains the size  of a block (in   bytes) 
as seen by the  file system.  For CD-I  discs, the block  size is   always 
2048 bytes.

Path Table size:  This  field contains the size  in bytes of  the   system 
Path Table.

Address of Path  Table:  The  block address of  the first  block of    the 
system Path Table is kept in this field.

Album identifier:  This field  contains the name of  the album to    which 
this disc belongs and is padded on the right with space characters.

Publisher identifier:  This field  is used to identify  the publisher   of 
the disc (i.e., who specified the contents of the disc) and is padded   on 
the right with space characters.

Data Preparer  identifier:   This field  identifies  the author  of    the 
contents of the disc and is padded on the right with space characters.

Application identifier:  This specifies the path name of the   application 
program to  execute  when the  disc  is first  mounted.  Section   VII.1.2 
outlines how this name is used in the startup sequence.

Copyright file name:  This  field contains the name  of a real-time   file 
that may be used  to produce a copyright  message when a  disc is    first 
mounted.  Any desired  information may  be recorded in  the file.     This 
field is padded on the right with space characters.

Abstract file name:  This  field contains the name  of a real-time    file 
that may be used to produce an abstract statement about the disc when   it 
is first mounted.  Any desired information may be  recorded in the   file. 
This field is padded on the right with space characters.

Bibliographic file name: This field contains the name of a real-time  file 
that may be used  to contain bibliographic information  about the    disc. 
Any desired information  may be  recorded in this  file.  This  field   is 
padded on the right with space characters.

Creation date and time:  This contains the date  and time that the    CD-I 
disc was originally  mastered.  The  format of a  16-byte date  and   time 
field is recorded as  a string of numerals  "YYYYMMDDHHMMSStt" where    tt 
means hundredths of a  second.  For example, 6:51  a.m. on September    6, 
1954 would be recorded as "1954090606510000".  No consideration  is   made 
for time zones.  If a date is not used, it contains "0" characters.

Modification date and time:  Recorded in this field are the date and  time 
that the disc was last changed (e.g., re-mastered).  The date is  recorded 
in the same format as the creation date and time.

Expiration date and time:   If the data on  a disc is  valid only for    a 
limited time, this field  indicates the time at  which the disc    becomes 
obsolete.  The date is recorded in the same  format as the creation   date 
and time.

Effective date and time:   If the data on  a disc is  not valid until    a 
specific time, this field  indicates the time at  which the disc   becomes 
useful.  The date is recorded in the same format as the creation date  and 
time.

File Structure Standard Version number:  This number is used to   indicate 
the revision number of the file structure standard to which the  directory 
search files conform.  It is set to one.

Figure III.3  is  an  example  of  a  standard  File  Structure     Volume 
Descriptor.


Figure III.3
________________________________________________________________
_   BP   _     Contents     _            Description           _
________________________________________________________________
_    1   _          1       _ Disc Label Record Type - standard_
_        _                  _ FSVD                             _
_    2   _     "CD-I"       _ Volume Structure Standard ID     _
_    7   _          1       _ Volume Structure Version number  _
_    8   _          0       _ Volume flags - standard file     _
_        _                  _ structure                        _
_    9   _    "CD-RTOS"     _ System identifer                 _
_   41   _     "Games"      _ Volume identifier                _
_   73   _          0       _ Reserved                         _
_   85   _     200000       _ Volume space size - 200,000      _
_        _                  _ blocks used on this volume       _
_   89   _          0       _ Coded Character Set identifier - _
_        _                  _ must be zero if standard FS      _
_  121   _          0       _ Reserved                         _
_  123   _          1       _ Number of Volumes in Album       _
_  125   _          0       _ Reserved                         _
_  127   _          1       _ Album Set Sequence number        _
_  129   _          0       _ Reserved                         _
_  131   _       2048       _ Logical Block size               _
_  133   _          0       _ Reserved                         _
_  137   _       2358       _ Path Table size                  _
_  141   _          0       _ Reserved                         _
_  149   _         19       _ Address of Path Table            _
_  153   _          0       _ Reserved                         _
_  191   _     "Games"      _ Album identifier                 _
_  319   _  "RG Software"   _ Publisher identifier             _
_  447   _  "Larry Hobbs"   _ Data Preparer identifier         _
_  575   _      "Menu"      _ Application identifier           _
_  703   _  "Copyrightfile" _ Copyright file name              _
_  735   _          0       _ Reserved                         _
_  740   _  "Abstractfile"  _ Abstract file name               _
_  772   _          0       _ Reserved                         _
_  777   _  "Bibliofile"    _ Bibliographic file name          _
_  809   _          0       _ Reserved                         _
_  814   _"1957100207340000"_ Creation date and time           _
_  830   _          0       _ Reserved                         _
_  831   _"0000000000000000"_ Modification date and time - not _
_        _                  _ used if zero                     _
_  847   _          0       _ Reserved                         _
_  848   _"0000000000000000"_ Expiration date and time - not   _
_        _                  _ used if zero                     _
_  864   _          0       _ Reserved                         _
_  865   _"0000000000000000"_ Effective date and time - not    _
_        _                  _ used if zero                     _
_  881   _          0       _ Reserved                         _
_  882   _          1       _ File Structure Standard Version  _
_        _                  _ number                           _
_  883   _          0       _ Reserved                         _
________________________________________________________________




















This page is intentionally left blank





















This page is intentionally left blank

2.3  Detailed Specification of Terminator Record


The last record  in the  Disc Label must  be a  Terminator record.    This 
record determines  the  end  of  the  Disc Label.   The  format  of    the 
Terminator record is indicated in Figure III.6.


Figure III.6

________________________________________________________________
_   BP   _ Size in bytes _            Description              _
________________________________________________________________
_    1   _        1      _ Disc Label Record Type              _
_    2   _        5      _ Volume Structure Standard ID        _
_    7   _        1      _ Volume Structure Version number     _
_    8   _     2041      _ Reserved                            _
________________________________________________________________


The fields in the record have the following meaning.

Disc Label Record  Type:  The  value of 255  in this  field signifies    a 
Terminator record.

Volume Structure Standard ID:  This name field represents the standard  to 
which the disc file  structure conforms.  CD-I discs  contain the   string 
"CD-I", padded on the right with space characters.

Volume Structure Version number:  The number in this field represents  the 
version number of the standard to which the  disc conforms.  The   current 
version is one.

Figure III.7 is an example of a Terminator record.














Figure III.7

________________________________________________________________
_   BP   _ Contents _               Description                _
________________________________________________________________
_    1   _   255    _ Disc Label Record Type                   _
_    2   _  "CD-I"  _ Volume Structure Standard ID             _
_    7   _     1    _ Volume Structure Version number          _
_    8   _     0    _ Reserved                                 _

________________________________________________________________2.4   
Location of Disc Label


The Disc Label is located starting at block 16 of track 1 on a CD-I disc.


2.5  Sector Subheader Format of Disc Label


All sectors in the disc label have the  subheader format which is    given 
below.

(1) The File number byte is zero
(2) The Channel number bits are set to zero
(3)   The EOR and data bits in the  submode byte are set to one and   the 
    rest are zero. Additionally the EOF bit in  the submode byte of   the 
    last sector of the Disc Label is set to one.
(4) The Coding Information byte is zero.




2.6  Location of Data Track and Music Tracks


CD-I data and programs (i.e. ADPCM sound, video data, text data,  computer 
programs, and binary  data) are  contained in blocks  after the    message 
sectors which follow the  Disc Label.  If no  CD-DA tracks (i.e.,    music 
tracks) are on a  CD-I disc, then it  is recommended that  the CD-I   data 
including the Disc  Label and  any application software  as well  as   the 
message sectors are contained on one track.

The Disc Label must always be in track 1.

It should be noted that accessing of CD-DA  data can be done within _    1 
second whilst accessing CD-I data can be done within the sector required.

III.3  Disc Directory



3.1  General


On a CD-I disc there must be at least one file, organized as a  directory, 
called the Root Directory.  The Root Directory may be located anywhere  on 
a disc.  Its  position is  defined by an  entry in  the Path  Table.    It 
contains names and characteristics of files and optional    subdirectories 
on the disc.

3.2  Directory Structure


A directory is a file of variable length directory records.  Each   record 
is a  file  descriptor  used  to  store  common  format  and     attribute 
information needed to access a file on the disc.

Directory files are used extensively by the compact disc file   management 
system to locate other files on a CD-I  disc.  They may also be   accessed 
by application programs to determine a disc's contents.  The first  record 
in any  directory describes  the directory  itself.  The  directory   name 
stored in the first directory record is a  null byte.  The second   record 
describes  the  directory's  parent  directory  file,  except  when    the 
directory is the Root  Directory, in which case  the second record  is   a 
copy of the  Root Directory  record.  The directory  name stored  in   the 
second directory record is a byte which contains the value 1.

Every directory record must  end in the sector  in which it  begins.   Any 
unused bytes at the end of a sector  of directory records must be set   to 
null.  Each  directory record  describes one  file, as  shown  in   Figure 
III.8.


Figure III.8

________________________________________________________________
_   BP   _ Size in bytes _           Description               _
________________________________________________________________
_    1   _       1       _ Record length                       _
_    2   _       1       _ Extended Attribute record length    _
_    3   _       4       _ Reserved                            _
_    7   _       4       _ File beginning LBN                  _
_   11   _       4       _ Reserved                            _
_   15   _       4       _ File size                           _
_   19   _       6       _ Creation date                       _
_   25   _       1       _ Reserved                            _
_   26   _       1       _ File flags                          _
_   27   _       2       _ Interleave                          _
_   29   _       2       _ Reserved                            _
_   31   _       2       _ Album Set Sequence number           _
_   33   _       1       _ File name size                      _
_   34   _      (n)      _ File name                           _
_  34+n  _       4       _ Owner ID                            _
_  38+n  _       2       _ Attributes                          _
_  40+n  _       2       _ Reserved                            _
_  42+n  _       1       _ File number                         _
_  43+n  _       1       _ Reserved                            _
_        _               _                                     _
_        _     43+n      _ Total                               _
________________________________________________________________
LBN =Logical Block Number

The fields in a directory record have the meaning given below.

Record length:  This is the size in bytes of this directory record.

Extended Attribute record length:   This is the number  of blocks at   the 
beginning of the file reserved for extended attribute  information.    The 
format of the extended  attribute record is not  defined and is   reserved 
for application use.

File beginning LBN: This is the logical block  number of the first   block 
of the file.

File size:  This is the size of the file in bytes (By convention the  size 
of Form 2 sectors is considered as 2048 bytes by the system).


Creation date:  This is the date and time  on which the file was   created 
or last modified.  The field contains six bytes representing six  unsigned 
numerical values in binary notation according to the following format.

        ________________________________________________
        _   BP   _          Description                _
        ________________________________________________
        _    1   _ Number of years since 1900          _
        _    2   _ Month of the year from 1 to 12      _
        _    3   _ Day of the month from 1 to 31       _
        _    4   _ Hour of the day from 0 to 23        _
        _    5   _ Minute of the hour from 0 to 59     _
        _    6   _ Second of the minute from 0 to 59   _
        ________________________________________________

File flags:  This field is bit encoded.  Bit  zero, when set to one,   has 
the following meaning:
_________
_  bit  _
________________________________________________________________
_   0   _ The file is hidden and does not usually appear in    _
_       _ directory listings.                                  _
________________________________________________________________
Bits 1 to 7 are reserved.

Interleave:  This contains two unsigned 8-bit integers indicating how  the 
file is interleaved.  The numbers represent a ratio between sectors   that 
belong to the file and those that do  not. As an example, an    interleave 
value of 1:3 would represent a file sector map as follows.

*  -  -  -  *  -  -  -  *    ...

(* means a sector is part of the file and - means it is unrelated to   the 
file.)

For non-interleaved files both bytes must be set to zero.

Album Set Sequence number:   The Album Set Sequence  number of the    disc 
which contains this file is recorded in this field.  If the file   resides 
on this disc this field is zero.  The use and definition of the Album  Set 
Sequence number is the responsibility of the content provider.



File name size:  This field is used to record the number of characters  in 
the file name field.   If the length of  the file name  is even, a    null 
padding byte is inserted  on the end of  the name to  make the owner    ID 
field begin on an even offset.  The padding  byte is not included in   the 
file name size field.

File name:  This field contains the name of  the file described by    this 
directory record.

Owner ID:  This  field contains  the user identification  number of    the 
creator of this  file.  The  owner's group ID  is contained  in the   most 
significant two bytes and the owner's user ID  is contained in the   least 
significant two bytes.

Attributes:  This field contains the file attributes and permissions,  bit 
encoded.  It indicates how the file is accessed  and who (owner ID)    may 
access it.  If the owner bit is set to one then a user with the same  user 
ID as the owner ID of this file may access the file.  If the group bit  is 
set to one then any user with the  same group ID as the owner's group   ID 
may access the file.  If the world bit  is set to one then any user    may 
access the file.  There is also a bit which if set to one indicates if   a 
file is a CD-DA file.  The format of the attributes is outlined in  Figure 
III.9. If the directory bit is set to one then this file is a directory.

Figure III.9

                ______________________________
                _ Bit Number _   Contents    _
                ______________________________
                _     0      _ Owner read    _
                _     1      _ Reserved      _
                _     2      _ Owner execute _
                _     3      _ Reserved      _
                _     4      _ Group read    _
                _     5      _ Reserved      _
                _     6      _ Group execute _
                _     7      _ Reserved      _
                _     8      _ World read    _
                _     9      _ Reserved      _
                _    10      _ World execute _
                _  11-13     _ Reserved      _
                _    14      _ CD-DA file    _
                _    15      _ Directory     _
                ______________________________


File number:  This  number is  recorded as the  file identifier  in    the 
subheader of each sector belonging to an interleaved file. It is used   to 
select sectors that belong to the file.

Figure III.10 is an example of a directory record.


Figure III.10

_________________________________________________________________
_  BP  _   Contents       _           Description               _
_________________________________________________________________
_   1  _       48         _ Record length                       _
_   2  _        0         _ Extended Attribute record length    _
_   3  _        0         _ Reserved - must be zero             _
_   7  _       29         _ File beginning LBN                  _
_  11  _        0         _ Reserved - must be zero             _
_  15  _     1000000      _ File size in bytes                  _
_  19  _$39 08 18 0A 20 03_ Creation date (24 August 1957,      _
_      _                  _ 10:32:03)                           _
_  25  _         0        _ Reserved                            _
_  26  _         0        _ File flags - not hidden             _
_  27  _      0204        _ Interleave (2:4)                    _
_  29  _         0        _ Reserved                            _
_  31  _         0        _ Album Set Sequence number           _
_  33  _         5        _ File name size                      _
_  34  _    "GAMES"       _ File name                           _
_  39  _    $000A0005     _ Owner ID - group = 10, user = 5     _
_  43  _     $0055        _ Attribute - read and execute for    _
_      _                  _ owner and group                     _
_  45  _         0        _ Reserved                            _
_  47  _         2        _ File number                         _
_  48  _         0        _ Reserved                            _
_________________________________________________________________

                                                                    3.3   
Directory Search Method


As part of the CD-I mastering process, a  Path Table index is created   to 
describe the entire directory structure on disc.  This index is   recorded 
in the disc Root  Directory as a normal  CD-I file.  The  Path Table    is 
loaded into memory when a disc is mounted or first accessed.  It   permits 
any file on disc to be opened using only one seek.

The Path Table is organized as a breadth first traversal (see Fig.  III.12 
and III.13) of the disc directory structure.  When  a file is opened   the 
Path Table is sequentially searched (in RAM) to locate the directory  that 
contains the record describing  the file.  This search  yields the   block 
number of the beginning of the directory file.   A seek is then made    to 
this block and records are searched sequentially until the record for  the 
requested file is found or it is determined that the file does not exist.

The Path Table contains one variable length entry for each directory   and 
subdirectory on a  disc.  Each  entry is organized  as shown  in    Figure 
III.11.

Figure III.11

     ____________________________________________________
     _   BP   _ Size in bytes _      Description        _
     ____________________________________________________
     _    1   _      1        _ Name size               _
     _    2   _      1        _ Extended Attribute      _
     _        _               _ record length           _
     _    3   _      4        _ Directory block address _
     _    7   _      2        _ Parent Directory number _
     _    9   _      n        _ Directory file name     _
     ____________________________________________________

The fields have the following meaning:

Name size:  The length  of the directory file  name string in  this   path 
table entry.

Extended Attribute record  length: This  is the length  of the    Extended 
Attribute record.

Directory block address:  This field contains the beginning logical  block 
number (LBN) of the directory file on disc.

Parent Directory number:  This is the number (relative  to the   beginning 
of the Path Table) of this directory's parent.

Directory file name:  This  variable length field is  used to store    the 
actual text representing the name of the directory.  If the length of  the 
file name is odd, a null padding byte  is added to make the size of    the 
Path Table record even.   The padding byte is  not included in  the   name 
size field.

If there is more than one directory on  the disc, the first entry of   the 
Path Table describes the Root Directory with a parent directory of 1   and 
directory file name = 0.

Figure III.12 depicts an example directory structure and the contents   of 
the Path  Table that  would be  used to  describe  it to  the CD-I    File 
Manager.


Figure III.12

                  Root Directory
                         _
 ________________________________________________
 _             _                                _
CMDS         ATLAS                            USERS
               _                                _
       __________________          __________________________
       _       _        _          _         _      _       _
      USA    JAPAN    EUROPE    SORENSEN  GREWELL  NICK  DOGGETT
                        _
                   ___________
                   _         _
                 MAPS      TOURS


The Path  Table used  to describe  the above  directory  structure   would 
contain the entries given in Figure III.13.


Figure III.13

  _____________________________________________________________
  _Relative_Directory_ Extended At- _ Parent  _Name_Directory _
  _Position_  Block  _tribute Record_Directory_Size_File Name _
  _        _ Address _    Length    _ Number  _    _          _
  _____________________________________________________________
  _    1   _  XXXXXX _      0       _    1    _  1 _ 0 (Root) _
  _    2   _  XXXXXX _      0       _    1    _  5 _"ATLAS"   _
  _    3   _  XXXXXX _      0       _    1    _  4 _"CMDS"    _
  _    4   _  XXXXXX _      0       _    1    _  5 _"USERS"   _
  _    5   _  XXXXXX _      0       _    2    _  6 _"EUROPE"  _
  _    6   _  XXXXXX _      0       _    2    _  5 _"JAPAN"   _
  _    7   _  XXXXXX _      0       _    2    _  3 _"USA"     _
  _    8   _  XXXXXX _      0       _    4    _  7 _"DOGGETT" _
  _    9   _  XXXXXX _      0       _    4    _  7 _"GREWELL" _
  _   10   _  XXXXXX _      0       _    4    _  4 _"NICK"    _
  _   11   _  XXXXXX _      0       _    4    _  8 _"SORENSEN"_
  _   12   _  XXXXXX _      0       _    5    _  4 _"MAPS"    _
  _   13   _  XXXXXX _      0       _    5    _  5 _"TOURS"   _
  _____________________________________________________________

As illustrated above, directory files on the same  level (e.g., with   the 
same Parent Directory) are placed in the Path  Table in binary   ascending 
order of the file name.

3.4  Sector Subheader Format

All sectors in the directory and the path table have the subheader  format 
which is given below.

1.The File number byte is zero
2.The Channel number bits are set to zero
3.    The data bit in the submode byte  is set to one and the rest    are 
    zero.

    Additionally the EOR and  the EOF bits in  the submode byte  of   the 
last sector of the Directory and the Path Table are set to one.

4.The Coding Information byte is zero.

III.4  Files

4.1  General


A CD-I  file  is composed  of  a set  of  (logically)  contiguous   blocks 
identified by a unique  name in a directory.   These blocks are   numbered 
starting at zero, which  is the number of  the first block  of the   file. 
Files are made up of blocks of either 2048 or 2324 bytes (or both).   They 
can contain any combination of audio, video, or computer data.

Random access to  files at  the byte level  is available  through   system 
calls provided by the Compact Disc File manager.

An attribute bit in the directory record of  a file may be set to one   to 
indicate the file is an audio track, recorded in CD-DA format.  This  type 
of file  can  only be  played  through a  CD-DA  decoder  in the     Audio 
Processing Unit  (see  IV 5.2).   The  CD-DA data  in  the  file is    not 
otherwise accessible by application programs.



























4.2  Standard Files


By convention, every CD-I disc contains a small  number of files in    its 
Root Directory.  The names  and contents of recommended  files appear   in 
Figure III.14.


Figure III.14

________________________________________________________________
_    Name      _                  Contents                     _
________________________________________________________________
_              _                                               _
_  "path_tbl"  _ This file is used to record an image of the   _
_              _ Path Table index as specified in III.3.3.     _
_              _                                               _
_   "album"    _ A catalogue of related CD-I discs is recorded _
_              _ in this file.  The information in this file   _
_              _ may be used by an application to instruct a   _
_              _ user to locate and mount a particular disc in _
_              _ a multi-album set.                            _
_              _                                               _
_   "author"   _ This file is used to identify the CD-I content_
_              _ developer i.e. data preparer. Any desired     _
_              _ information may be recorded in the file.      _
_              _                                               _
_"manufacturer"_ This file is used to identify the manufacturer_
_              _ of the CD-I disc.  Any desired information may_
_              _ be recorded in the file.                      _
________________________________________________________________

















4.3  Real-time Files


A real-time file is  a file containing real-time  records.  A    real-time 
record is a logical record in a CD-I file containing audio, video,  and/or 
computer data that must be retrieved from a  CD-I disc at a precise   rate 
in order to produce  an aesthetic sound or  image.  In particular,   audio 
data within a real-time record, whether from disc or RAM, must arrive   at 
the audio processor  in exact  intervals in order  to be  perceived as   a 
realistic sound. For  example, the  audio blocks in  a real-time    record 
should be considered a clock upon whose timing  the other elements in    a 
real-time record must be synchronized.

Individual blocks  of real-time  records can  contain audio,  video,    or 
ordinary computer data, but these different types of data cannot be  mixed 
within a single block.  The Compact Disc File Manager (see VII.2.2)   does 
not restrict the order of audio, video, or  data blocks.  This order    is 
determined according  to the  requirements of  the application.   When   a 
real-time record is read, blocks are grouped together or directly   routed 
to the appropriate hardware (e.g., audio data).

Data blocks that contain computer data are always read into memory to   be 
processed by an application program.

The last physical sector belonging to a real-time record is identified  by 
having an EOR bit set to one in its sector subheader submode byte.



















4.4  Interleaving Data and Files



4.4.1  General


The audio blocks in a real-time file from a CD-I disc must arrive to   the 
audio processor at a  very precise rate.  The  rotational latency of    CD 
drives makes it impossible  to achieve the required  data rate by   simply 
reading an  audio  block, pausing  for  a predetermined  time,  and   then 
reading the  next  block.   Instead,  audio  blocks must  be    physically 
interspaced  at  intervals  which   depend  on  the  quality   of    sound 
reproduction.

The blocks between consecutive audio blocks can be  used in a variety   of 
ways.  Video (i.e., stills) or text data does not necessarily have such  a 
critical timing and can  be placed within the  gaps.  Also, a  number   of 
mutually exclusive audio channels can be interleaved within  a   real-time 
record to  provide  different  sound  tracks,  for example,  each  in    a 
different language.

It is  also  possible to  physically  interleave files  (see    III.4.4.2) 
according to a fixed repeating pattern.

Any combination  of  these  techniques  may  be used  depending  on    the 
requirements of an application.  Information recorded in the subheader  of 
each block is used to determine which blocks are to be played.   Directory 
files must not be interleaved.


4.4.2  File Number


The file number is used to identify all sectors that belong to one   file. 
A given file may be physically interleaved with other files on the   disc. 
All sectors of a  logical file have the  same value in  the file    number 
byte. The file number can be used to  select sectors that belong to    the 
same logical file and to reject any others.  The file number with a   byte 
value of 0 is only used for a  file that will be read consecutively.    No 
interleaving is possible with file 0. Files 1 to 255 (see Figure   III-15) 
may be read consecutively or may be interleaved with other files.






             Figure III.15 

       _______________________________________
                 _ Byte Value  _      File Number      _
                 _______________________________________
                 _ 0000 0000   _ 0 (consecutive sector _
                 _             _    reading only)      _
                 _ 0000 0001   _ 1                     _
                 _ 0000 0010   _ 2                     _
                 _     :       _ :                     _
                 _ 1111 1111   _ 255                   _
                 _______________________________________

