STR (Streaming Data): Difference between revisions
| Revision as of 02:22, 23 October 2026 RemmyLee (Hardware and system software pages from the Sony manuals) | Revision as of 02:27, 23 October 2026 RemmyLee (File format pages from the Sony File Formats manual) | ||
| Line 1: | Line 1: | ||
| + | --- | ||
| + | title: STR (Streaming Data) | ||
| + | type: format | ||
| + | summary: CD-ROM data format for streaming movies and other time-series data. | ||
| + | category: File formats | ||
| + | info: Extension = .STR | ||
| + | info: Sector size = 2048 bytes (2336 bytes with audio) | ||
| + | --- | ||
| + | |||
| + | ## Overview | ||
| + | |||
| + | Streaming is the reading and processing of successive data from a CD-ROM. STR is the CD-ROM data format defined for streaming on the PlayStation.[^ff13] | ||
| + | |||
| + | Streaming is used for animation and audio. It also serves other time-series data that changes continuously.[^ff13] | ||
| + | |||
| + | The streaming library is used separately from the other CD-ROM functions.[^ff13] | ||
| + | |||
| + | The bitstream for movie playback comes through streaming. The bitstream does not hold the image size, so the STR header holds the data needed for playback.[^ff13] | ||
| + | |||
| + | ## Streaming Data | ||
| + | |||
| + | Streaming data in an STR file is a continuous array of frame data elements.[^ff13] | ||
| + | |||
| + | The contents of a frame depend on the data. In an animation, one frame can hold one still image of the sequence.[^ff13] | ||
| + | |||
| + | The STR format does not set the data type of a frame.[^ff13] | ||
| + | |||
| + | Each frame has its own length and type. One STR file can mix frames of several types and sizes.[^ff13] | ||
| + | |||
| + | ## Frame Data | ||
| + | |||
| + | Frame data is divided into 2048-byte sectors. These match the CD-ROM data sectors.[^ff13] | ||
| + | |||
| + | Each sector starts with a 32-byte header. 2016 bytes of data follow.[^ff13] | ||
| + | |||
| + | Each frame begins on a sector boundary. The last sector of a frame is padded with dummy data to the 2048-byte boundary.[^ff13][^ff14] | ||
| + | |||
| + | ## Sector Header | ||
| + | |||
| + | The sector header is divided into the following fields:[^ff14][^ff15] | ||
| + | |||
| + | Table: 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 | | ||
| + | |||
| + | All fields are little endian.[^ff15] | ||
| + | |||
| + | An StTYPE with the MSB set is a system-defined format. With the MSB clear it is a user-defined format, and the other 15 bits are free.[^ff14] | ||
| + | |||
| + | The streaming library uses StSECTOR_OFFSET, StSECTOR_SIZE and StFRAME_NO to read frame data in order without missing sectors.[^ff14] | ||
| + | |||
| + | ## User-defined Frame Data | ||
| + | |||
| + | User-defined data streams with the MSB of StTYPE set to 0.[^ff15] | ||
| + | |||
| + | A run of streaming data with the same attributes throughout can use one header frame for the whole run. This reduces the total amount of data.[^ff15] | ||
| + | |||
| + | The manual gives an example of streaming data with a header frame.[^ff15] | ||
| + | |||
| + | The example is as follows: | ||
| + | |||
| + | |||
| + | Table: Streaming data with header frame | ||
| + | |||
| + | | Frame | StTYPE | | ||
| + | | --- | --- | | ||
| + | | Header | 0x0003 | | ||
| + | | Frame0 | 0x0002 | | ||
| + | | Frame1 | 0x0002 | | ||
| + | | Frame3 | 0x0002 | | ||
| + | |||
| + | In this example the LSB of StTYPE marks the header frame.[^ff15] | ||
| + | |||
| + | The application can read StTYPE in each frame. The meaning of the frame data can then change with the type of frame.[^ff15] | ||
| + | |||
| + | A header frame can hold CLUT data that is not saved in each frame. It can also hold a table of jumps to frames.[^ff15] | ||
| + | |||
| + | ## MDEC Animation | ||
| + | |||
| + | MDEC animation is a system-defined format with StTYPE 0x8001.[^ff16] | ||
| + | |||
| + | Its sector header has the following fields: | ||
| + | |||
| + | |||
| + | Table: 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 | | ||
| + | |||
| + | The channel number is 0 for ordinary streaming.[^ff16] | ||
| + | |||
| + | The frame data of an MDEC animation is [BS](/formats/bs/) data. | ||
| + | |||
| + | ## Streaming Data with Audio | ||
| + | |||
| + | The PlayStation plays back ADPCM audio data as specified in the CD-ROM XA standard. Sony calls this XA-ADPCM audio.[^ff16] | ||
| + | |||
| + | XA-ADPCM audio goes from the CD-ROM decoder to the SPU without using main memory. Streaming reads data into main memory, so it cannot play XA-ADPCM audio.[^ff16] | ||
| + | |||
| + | Audio sectors are interleaved with data sectors on the disc. Streaming data with audio places the streaming data in the gaps between the audio sectors.[^ff16][^ff17] | ||
| + | |||
| + | The manual's example uses streaming data at 30 fps (5 sectors per frame). The audio is 37.8 kHz stereo at double speed.[^ff17] | ||
| + | |||
| + | ### Sector Size | ||
| + | |||
| + | A sector of ordinary streaming data is 2048 bytes. A sector of streaming data with audio is 2336 bytes.[^ff18] | ||
| + | |||
| + | A data sector has the following parts: | ||
| + | |||
| + | |||
| + | Table: 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 following parts:[^ff18] | ||
| + | |||
| + | Table: XA-ADPCM audio sector for streaming data with audio | ||
| + | |||
| + | | Part | Size | | ||
| + | | --- | --- | | ||
| + | | Subheader | 8 bytes | | ||
| + | | XA-ADPCM audio | 2324 bytes | | ||
| + | | Dummy data | 4 bytes | | ||
| + | |||
| + | The CD-ROM XA standard sets the size of the subheader. The subheader holds flags that tell data sectors from audio sectors.[^ff18] | ||
| + | |||
| + | The dummy data makes an audio sector the same size as a data sector.[^ff18] | ||
| + | |||
| + | The sector header and data areas are the same as in ordinary streaming data.[^ff18] | ||
| + | |||
| + | ## References | ||
| + | |||
| + | [^ff13]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-3, Figure 1. | ||
| + | [^ff14]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-4, Figures 2 and 3. | ||
| + | [^ff15]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-5, Figure 4. | ||
| + | [^ff16]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-6, Figure 5. | ||
| + | [^ff17]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-7, Figure 7. | ||
| + | [^ff18]: Sony Computer Entertainment Inc. File Formats. November 1998. Page 1-8, Figures 8 and 9. | ||