Stream Protocols
The Stream Protocol Control Block (SPCB) defines key parameters that control
the behavior of a data stream. The application can query, install, or deinstall
a specific SPCB from a stream handler. SPCB information is installed in
the SPI.INI file by means of a resource file. (See Installing
a Stream Handler for a description of how to install stream protocol.)
Each stream handler supports one or more stream protocols. Each SPCB is
uniquely identified by the value of the stream data type (SPCB key). One
field in the SPCB key allows the stream handler to have multiple SPCBs installed
for the same data type. This field can be used by an application to specify
which SPCB, for any data type, it wants to use. Each application in the
system could define multiple SPCBs for the same data type (see the ulType
field in the SPCBKEY data structure). The application can modify a stream
protocol by installing a new SPCB and deinstalling the old SPCB.
The parameters in the SPCB are:
Fields
SPCB
Length
Length of SPCB structure. Provided for future
expansion of the SPCB.
SPCB Key
Data
stream type and internal key. The internal key is used to differentiate
between multiple SPCB's of the same data stream type.
- Data Type - The data type of the stream (for example,
waveform or MIDI).
- Data Subtype - The subtype of the stream (for example,
16-bit stereo PCM).
- Internal Key - Used to differentiate between multiple
SPCB's of the same data type and subtype.
Data
Flag
Attributes of the data type. (that is, specifies
whether data or time cuepoints are supported by this data type).
- SPCBDATA_CUETIME - This data type can support time
cuepoint events.
- SPCBDATA_CUEDATA - This data type can support data
cuepoint events.
- SPCBDATA_NOSEEK - Seeking cannot be done on this
data type.
Number of Records
Maximum number of records per buffer. (This is only
valid for split streams).
Data Block Size
Size
of a block. A block is an atomic piece of data. For example, for digital
audio data type PCM 16-bit stereo at a 44.1 kHz sampling rate, the block
size would be 4 bytes.
Data Buffer Size
Size
of buffer to be used while streaming. Maximum buffer size is 64KB.
Min
Number of Buffers
Minimum number of buffers needed
to maintain a constant data stream.
Max Number of
Buffers
Maximum number of buffers needed (ideal
number). For normal streams, this means the number of buffers that will
be allocated for the stream. For user provided buffer streaming, this means
the number of buffers that the Sync/Stream Manager can queue up for a consumer.
This can be used by a source stream handler that gives the same set of buffers
to the Sync/Stream Manager repeatedly. If the number of buffers is set to
the number of buffers in the set minus one, the source stream handler will
be able to detect when the target has consumed a buffer and it can be reused.
Assuming that the set of buffers is an ordered set and each buffer is used
in the same order each time.
Source Start Number
Number of EMPTY buffers required to start the source
stream handler. The value should be at least as big as the maximum number
of buffers that would be requested by the source stream handler.
Target
Start Number
Number of FULL buffers required to
start the target stream handler. The value should be at least as big as
the maximum number of buffers that would be requested by the target stream
handler. Usually, a target will require at least two buffers at the start
of the stream.
Buffer Flag