cdframe(4)
cdframe - structure of a frame of audio data on Compact Disc (CD)
As shipped in IRIX 6.5.30. Unchanged since IRIX 6.5.
NAME cdframe - structure of a frame of audio data on Compact Disc (CD) SYNOPSIS #include <cdaudio.h> DESCRIPTION Audio on Compact Discs (CD) is blocked into frames. The CD has 75 frames each second. One frame of data contains both audio and non-audio data (known as subcodes). These frames are frequently referred to as subcode-frames because it takes one complete frame to assemble all the bits of a chunk of subcode. A program reading a CD in audio mode must read a minimum of one CD frame. This is enforced by the function CDreadda(3) in libcdaudio. The cdframe structure, describing the content of a frame of CD data, is defined in <cdaudio.h> as follows: typedef struct cdframe { char audio[CDDA_DATASIZE]; struct subcodeQ subcode; } CDFRAME; Audio Data Audio samples in the audio array are linearly encoded in a 16-bit 2's complement format. Encoding is carried out either without pre-emphasis or with a first order 50/15 Ms pre-emphasis. The data stream contains two interleaved channels, usually used as the left and right channels of a stereo pair. The sample representing the left channel is first, followed by the sample representing the right channel. The sampling frequency is 44.1 kHz and both channels are sampled simultaneously during recording. The least significant byte of each 16-bit value is first. The bytes need to be swapped in order to match the native byte ordering of the IRIS Indigo and Personal IRIS 4D/35 and their audio hardware. So each 4-byte chunk of the data array represents a pair of samples (1 left plus 1 right) as follows. Byte 0 is the least significant byte of the left channel sample; byte 1 is the most significant byte of the left channel sample. Byte 2 is the least significant byte of the simultaneous right channel sample; byte 3 is the most significant byte of the simultaneous right channel sample. CDDA_DATASIZE is 2352 bytes. Subcodes The subcodeQ structure contains information from the Q subcode fields recorded on the CD. CD's also have subcode fields P and R through W. P subcodes provide a simple track separator intended for use by low cost players. They have no useful purpose when the player is able to read and process the Q subcodes. Subcodes R through W are not yet fully defined and some CD-ROM drives do not read them. The subcodeQ structure is defined in cdaudio.h as follows: typedef struct subcodeQ { unchar control; unchar type; union { struct { struct cdpackedbcd { unchar dhi:4, dlo:4; } track; struct cdpackedbcd index; /* aka point during trk 0 */ struct cdtimecode { unchar mhi:4, mlo:4; unchar shi:4, slo:4; unchar fhi:4, flo:4; } ptime; struct cdtimecode atime; unchar fill[6]; } mode1; struct { unchar catalognumber[13]; struct cdpackedbcd aframe; } mode2; struct { struct cdident { unchar country[2]; unchar owner[3]; unchar year[2]; unchar serial[5]; } ident; struct cdpackedbcd aframe; unchar fill; } mode3; } data; } CDSUBCODEQ; The control field contains 4 flag bits in its least significant nibble to define the kind of information in a track (program item). 0 0 X 0 - 2 audio channels without pre-emphasis 0 0 X 1 - 2 audio channels with pre-emphasis of 50/15 Ms 0 X 0 X - copy prohibited 0 X 1 X - copy permitted The bits of the control field can only change during an actual pause (index.dhi, index.dlo == 00) of at least 2 s or during the lead-in area. Notes 1. - The four bits of the control field should be copied to the control field of the channel status of the digital audio interface for domestic use. Notes 2. - For non-audio applications of the compact disc the following control codes have been defined: 0 1 X 0 - digital data 1 X X X - broadcasting use All other combinations will be defined later on. The type field contains 4 address-bits in its least significant nibble that identify the type of the data field which is a union of three possible types. 0001 - mode 1 0010 - mode 2 0011 - mode 3 Mode 1 Q Data Mode 1 data contains track numbering and time code information. All numbers are encoded as BCD digits. track is the number of the current track. It is two BCD digits packed into a single byte. The most significant digit, d1, is in the most significant nibble. Audio program tracks are numbered from 01 - 99. Track number 00 is the lead-in track. Track number AA (each BCD digit has the bit-pattern 1010) is the lead-out track. Tracks may be subdivided into sections; each section has a unique index number. index is the index number of the current subdivision within the track. Its representation is identical with track. Regular subdivisions are numbered from 01 - 99. The first subdivision within a track must be numbered 01. The index number increases in increments of 1. Index number 00 indicates a pause and coincides with actual pauses (gaps between tracks) in the audio program. During index number 00, track is the number of the track that follows the pause. The first audio track is preceded by a pause encoding of 2 s to 3 s. During the lead-out track the subdivision number is 01. During the lead-in track a table of contents is recorded in the mode 1 subcodes. During this time, the index number field, now known as Point, records a track number. The atime field (see below) gives the starting position of the track given by point. Several special track numbers are also valid at this time. If point = A0 the minutes field of atime contains the track number of the first track on the disk. The seconds and frame fields are zero. If point = A1 the minutes field of atime contains the track number of the last track on the disk. The seconds and frame fields are zero. If point = A2 atime contains the starting point of the lead-out track. In normal use (i.e. except during lead-in) ptime is the time into the current program (track). atime is the time from the start of the disc. In the cdtimecode structure, mhi and mlo are the current minute, shi and slo are the current second and fhi and flo are the current frame. Frame numbers run from 00 to 74. Mode 2 Q Data Mode 2 data contains the catalogue number of the disc. catalognumber is expressed in 13 BCD digits according to the UPC/EAN code. The catalogue number does not change on a disk. If no catalogue number is recorded these BCD digits are all zero. aframe contains the continuation of the absolute frame numbering from mode 1. This allows an uninterrupted flow of frame numbers. It contains two packed BCD digits. Mode 3 Q Data Mode 3 data is used to give a unique identification to an audio track. This is done by means of the International Standard Recording Code (ISO 3901). ident is the ISRC and it consists of several fields. country and owner are encoded in a six-bit format using the 6 least significant digits of each byte according to the following table: Octal ASCII Octal ASCII Octal ASCII ______________ _______________ ______________ 000 0 023 C 037 O 001 1 024 D 040 P 002 2 025 E 041 Q 003 3 026 F 042 R 004 4 027 G 043 S 005 5 030 H 044 T 006 6 031 I 045 U 007 7 032 J 046 V 010 8 033 K 047 W 011 9 034 L 050 X 021 A 035 M 051 Y 022 B 036 N 052 Z year and serial are BCD digits in the least significant nibbles of each byte. aframe contains the continuation of the absolute frame numbering from mode 1. This allows an uninterrupted flow of frame numbers. It contains two packed BCD digits. SEE ALSO cdintro(3dm) Compact Disc Digital Audio System. The International Electro-Technical Commission (IEC). Bureau Central de la Commission Electrotechnique Internationale, 3 rue de Varembe, Geneve, Suisse