psx.wiki

STR (Streaming Data)

CD-ROM data format for streaming movies and other time-series data.

STR (Streaming Data)
Extension.STR
Sector size2048 bytes (2336 bytes with audio)

Overview

Streaming refers to the successive reading and processing of data from a CD-ROM, and STR is the CD-ROM data format defined for streaming on the PlayStation. Streaming is generally used to play back animation or audio data. However, it can serve any time-series data that changes continuously. The streaming library is used separately from the other CD-ROM functions.1

The bitstream used for movie playback is obtained through streaming. Because the bitstream does not include the image size or other supplemental information, the STR format defines the information required for playback in its header.1

Streaming Data

Streaming data in an STR file is a continuous array of frame data elements. The contents of a frame depend on the data being streamed. In an animation each frame can contain one of the still images of the sequence, and in an animation of 3D modeling data each frame can contain one unit of the modeling data.1

The STR format does not specify the type of data in a frame, so it can be defined freely as needed. The length and type are set independently for each frame. Frames of various types and sizes can therefore be mixed in one STR file.1

Frame Data

Frame data in an STR file is divided into 2048-byte sectors that correspond to CD-ROM data sectors. Each sector starts with a 32-byte header that describes the sector data, and 2016 bytes of data follow it. Each frame must begin on a sector boundary, so the last sector of a frame is padded with dummy data to the 2048-byte boundary.12

Sector Header

The sector header at the start of each sector is divided into the following fields. All fields are little endian.23

Table 1: STR sector header
Field Size Contents
StSTATUS 2 bytes STR format identifier and version
StTYPE 2 bytes Data type of the frame
StSECTOR_OFFSET 2 bytes Sector number in the frame
StSECTOR_SIZE 2 bytes Number of sectors in the frame
StFRAME_NO 4 bytes Frame number of the streaming data, starting from 1
StFRAME_SIZE 4 bytes Frame size in long words
StUSER 16 bytes User-defined area

If the MSB of StTYPE is 1, the data type is a system-defined format. If the MSB is 0, it is a user-defined format and the other 15 bits can be set as desired, which allows other frame formats to be carried in the STR format.2

StSECTOR_OFFSET, StSECTOR_SIZE and StFRAME_NO ensure that the streaming library reads the frame data consecutively without missing any sectors.2

User-defined Frame Data

User-defined data is streamed by setting the MSB of StTYPE to 0. If the whole run of streaming data uses the same attribute values, one header frame can serve the entire run instead of a header in each frame. This reduces the total amount of data. In the manual's example the LSB of StTYPE distinguishes the header frame from the other frames:3

Table 2: Streaming data with header frame
Frame StTYPE
Header 0x0003
Frame0 0x0002
Frame1 0x0002
Frame3 0x0002

The application can read the StTYPE field of each frame as it is read from the CD-ROM. The interpretation of the frame data can therefore change with the type of frame. A header frame can hold, for example, CLUT data that is not saved in each frame or a table of jumps to certain frames.3

MDEC Animation

MDEC animation is a system-defined format with StTYPE 0x8001. Its StTYPE also carries a channel number for multi-channel streaming, which is 0 for ordinary streaming. The frame data is BS data, and the sector header has the following fields:4

Table 3: MDEC animation sector header
Field Size Contents
StSTATUS 2 bytes Status
StTYPE 2 bytes Data type, with a channel number for multi-channel streaming
StSECTOR_OFFSET 2 bytes Sector number in the frame
StSECTOR_SIZE 2 bytes Number of sectors in the frame
StFRAME_NO 4 bytes Frame number of the streaming data, starting from 1
StFRAME_SIZE 4 bytes Frame size in long words
StMOVIE_WIDTH 2 bytes Width
StMOVIE_HEIGHT 2 bytes Height
StMOVIE_HEADM 4 bytes Reserved for system
StMOVIE_HEADV 4 bytes Reserved for system

Streaming Data with Audio

The PlayStation plays back ADPCM audio data as specified in the CD-ROM XA standard, which Sony calls XA-ADPCM audio. XA-ADPCM audio is sent directly from the CD-ROM decoder to the SPU without using main memory. Streaming reads CD-ROM data into main memory, and it consequently cannot be used to play back XA-ADPCM audio.4

To play XA-ADPCM audio, the audio sectors must be interleaved with gaps on the CD-ROM. Streaming data with audio places ordinary streaming data in these gap sectors. The manual's example uses streaming data at 30 fps (5 sectors per frame) with 37.8 kHz stereo audio at double speed.45

Sector Size

The sector size is 2048 bytes for ordinary streaming data but 2336 bytes for streaming data with audio. A data sector adds an 8-byte subheader before the sector header and 280 bytes of dummy data after the data. The sector header and data areas are otherwise identical to those of ordinary streaming data.6

Table 4: Data sector in streaming data with audio
Part Size
Subheader 8 bytes
Sector header 32 bytes
Data 2016 bytes
Dummy data 280 bytes

The audio sectors have the same 2336-byte size:6

Table 5: XA-ADPCM audio sector for streaming data with audio
Part Size
Subheader 8 bytes
XA-ADPCM audio 2324 bytes
Dummy data 4 bytes

The size of the subheader is specified by the CD-ROM XA standard, and the subheader holds the flags that distinguish data sectors from audio sectors. The dummy data at the end of each sector makes the audio sectors the same size as the data sectors.6

References


  1. ^ a b c d e Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-3, Figure 1.

  2. ^ a b c d Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-4, Figures 2 and 3.

  3. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-5, Figure 4.

  4. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-6, Figure 5.

  5. ^ Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-7, Figure 7.

  6. ^ a b c Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-8, Figures 8 and 9.

Categories: File formats