MD On Disc Data Structures

MD On Disc Data Structures

The details of the MiniDisc's data structures have been rather hard to find. The best source to date (unless you're a Rainbow Book licensee) is Jan Maes' book ``The MiniDisc'', on which the pseudo C structures below are based. Anyone having more detailed information concerning the structures below are encouraged to contact us.

Pre-recorded Disc TOC (Total: 2352 bytes)

struct pre_recorded_disc_toc {
	char  sync[12];
	short cluster_address;
	char  sector_address;
	char  mode;
	struct {
	      Disk type
	      First/last track number
	      Lead-out start address
	      Used sector indication
	      Pointers for track numbers
	      Start/end of tracks
	      Track mode	- copy inhibit (SCMS)
				- audio/other
				- stereo/monaural audio
				- emphasis off/on (50/15 microseconds)
	      Pointers for track name table
	      Disc name (ascii)
	      Track name (ascii)
	      Pointers for date and time table
	      Disc record date and time
	      Track record date and time
	      Pointers for track ISRC table
	      Bar code (UPC/EAN code)
	      ISRC code (DIN code)
	} toc_body;  /* 2336 bytes, size of members unknown */
};

Recordable Disc TOC (read only) (Total: 2352 bytes)

struct recordable_disc_toc {
	char  sync[12];
	short cluster_address;
	char  sector_address;
	char  mode;
	struct {
	      Disc type
	      Laser recording power
	      Lead-out start address
	      Used sectors indication
	      Power calibration area start address
	      UTOC start address
	      Recording user area start address
	} toc_body;  /* 2336 bytes, size of members unknown */
};

Recordable Disc U-TOC (re-writeable) (Total: 2352 bytes)

struct recordable_disc_u_toc {
	char  sync[12];
	short cluster_address;
	char  sector_address;
	char  mode;
	struct {
	      First/last track number
	      Used sectors indication
	      Disc-ID (optional)
	      Pointer for defective area start address (optional)
	      Pointer for empty position on parts table
	      Pointer for the rest of recording area start address
	      Pointers for start address
	      Start/end address
	      Link positions of start/end address
	      Track		- copy inhibit (SCMS)
				- audio/other
				- stereo/monaural audio
				- emphasis off/on (50/15 microseconds)
	      Pointers for empty position on name table
	      Pointers for track name table
	      Disc or track name (ascii)
	      Link positions on previous item
	      Pointers for date and time table
	      Disc recording date and time
	      Power calibration area
	      Reserved area
	} u_toc_body; /* 2336 bytes, size of members unknown */

};

Audio Data Sector (Total: 2352 bytes)

struct sector {
	char  sync[12];
	short cluster_address;
	char  sector_address;
	char  mode;
	char  zeros[4];
	char  audio_data[2332];
};
In the Audio Data Sector, the audio_data array holds 5 1/2 sound groups. A sound group is 424 bytes long and consists of 212 bytes for the left channel followed by 212 bytes for the right channel. These 212 bytes correspond to 11.6ms of audio, or 512 16 bit samples of PCM data.

A Single Channel of a Sound Group (Total: 212 bytes)

struct sound_group_single_channel {
	struct sound_parameter_bytes {
		char block_size_mode;
		char sub_information_amount;
		char word_length[?];
		char scale_factor[?];
	} SPB_copy_1;

	char audio_spectrum_bytes[?];

	struct sound_parameter_bytes SPB_copy_2;
};

Speculation of Data Structure Details

Below, I speculate what the unknown data structure members may look like. The main problem so far with this analysis is that the structures don't look like they'll fit in a 2352 byte block. Perhaps the UTOC is two or more blocks?

A Disc Address (3 bytes)

typedef struct {
	short cluster;
	char  sector_and_soundgroup;
} disc_address;

Recordable Disc U-TOC (re-writeable) (Total: 2352 bytes)

struct recordable_disc_u_toc {
	char  sync[12];
	short cluster_address;
	char  sector_address;
	char  mode;
	struct {
	      char first_track_number, last_track_number

#	      define Num_Tracks (last_track_number-first_track_number+1) /* Max: 256 */

		?      Used sectors indication
		?      Disc-ID (optional)
		?      Pointer for defective area start address (optional)
	       char segment_count /* Pointer for empty position on parts table */
		?      Pointer for the rest of recording area start address


	      /* The following array maps "user" track numbers into an index in
		 the segment table for the first segment of a track. */

	      char segment_table_indexes[Num_Tracks];

	      struct audio_segment {
	          disc_address start, end;
		  char link_position;	/* segment position within track, 0, 1, 2, ... etc */
		  char segment_flags;
			/* segment flags has bits for:
	      			- copy inhibit (SCMS)
				- audio/other
				- stereo/monaural audio
				- emphasis off/on (50/15 microseconds) */
	      } segment_table[segment_count]; /* max 256 */

		?      Pointers for empty position on name table
		?      Pointers for track name table
		?      Disc or track name (ascii)
		?      Link positions on previous item
		?      Pointers for date and time table
		?      Disc recording date and time
		?      Power calibration area
		?      Reserved area
	} u_toc_body; /* 2336 bytes, size of members unknown */

};

Return to the MiniDisc Community Page.